query('SELECT topic_id FROM mst_topic WHERE topic=\''.$str_subject.'\' AND topic_type=\''.$str_subject_type.'\''); if ($_q->num_rows > 0) { $_d = $_q->fetch_row(); // return the subject/topic ID return $_d[0]; } return false; } // start the output buffer ob_start(); /* main content */ // biblio topic save proccess if (isset($_POST['save']) AND (isset($_POST['topicID']) OR trim($_POST['search_str']))) { $subject = trim($dbs->escape_string(strip_tags($_POST['search_str']))); // create new sql op object $sql_op = new simbio_dbop($dbs); // check if biblioID POST var exists if (isset($_POST['biblioID']) AND !empty($_POST['biblioID'])) { $data['biblio_id'] = (integer)$_POST['biblioID']; // check if the topic select list is empty or not if (!empty($_POST['topicID'])) { $data['topic_id'] = $_POST['topicID']; } else if ($subject AND empty($_POST['topicID'])) { // check subject $subject_id = checkSubject($subject, $_POST['type']); if ($subject_id !== false) { $data['topic_id'] = $subject_id; } else { // adding new topic $topic_data['topic'] = $subject; $topic_data['topic_type'] = $_POST['type']; $topic_data['input_date'] = date('Y-m-d'); $topic_data['last_update'] = date('Y-m-d'); // insert new topic to topic master table $sql_op->insert('mst_topic', $topic_data); // put last inserted ID $data['topic_id'] = $sql_op->insert_id; } } $data['level'] = intval($_POST['level']); if ($sql_op->insert('biblio_topic', $data)) { echo ''; } else { utility::jsAlert(__('Subject FAILED to Add. Please Contact System Administrator')."\n".$sql_op->error); } } else { if (!empty($_POST['topicID'])) { // add to current session $_SESSION['biblioTopic'][$_POST['topicID']] = array($_POST['topicID'], intval($_POST['level'])); } else if ($subject AND empty($_POST['topicID'])) { // check subject $subject_id = checkSubject($subject); if ($subject_id !== false) { $last_id = $subject_id; } else { // adding new topic $topic_data['topic'] = $subject; $topic_data['topic_type'] = $_POST['type']; $topic_data['input_date'] = date('Y-m-d'); $topic_data['last_update'] = date('Y-m-d'); // insert new topic to topic master table $sql_op->insert('mst_topic', $topic_data); $last_id = $sql_op->insert_id; } $_SESSION['biblioTopic'][$last_id] = array($last_id, intval($_POST['level'])); } echo ''; } } ?>

:
'; } ?>