echo '<script type="text/javascript">parent.ucsUpload(\'' . MWB . 'bibliography/ucs_upload.php\', \'itemID[]=' . $updateRecordID . '\', false);</script>'; } // write log utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'bibliography', $_SESSION['realname'] . ' update bibliographic data (' . $data['title'] . ') with biblio_id (' . $updateRecordID . ')'); // close window OR redirect main page if ($in_pop_up) { $itemCollID = (int) $_POST['itemCollID']; echo '<script type="text/javascript">top.$(\'#mainContent\').simbioAJAX(parent.jQuery.ajaxHistory[0].url, {method: \'post\', addData: \'' . ($itemCollID ? 'itemID=' . $itemCollID . '&detail=true' : '') . '\'});</script>'; echo '<script type="text/javascript">top.closeHTMLpop();</script>'; } else { echo '<script type="text/javascript">top.$(\'#mainContent\').simbioAJAX(parent.jQuery.ajaxHistory[0].url);</script>'; } // update index // delete from index first $sql_op->delete('search_biblio', "biblio_id={$updateRecordID}"); $indexer->makeIndex($updateRecordID); } else { utility::jsAlert(__('Bibliography Data FAILED to Updated. Please Contact System Administrator') . "\n" . $sql_op->error); } } else { /* INSERT RECORD MODE */ // insert the data $insert = $sql_op->insert('biblio', $data); if ($insert) { // get auto id of this record $last_biblio_id = $sql_op->insert_id; // add authors if ($_SESSION['biblioAuthor']) { foreach ($_SESSION['biblioAuthor'] as $author) { $sql_op->insert('biblio_author', array('biblio_id' => $last_biblio_id, 'author_id' => $author[0], 'level' => $author[1])); }
if (!empty($items)) { $item_sql = 'INSERT IGNORE INTO item (biblio_id, item_code) VALUES '; $item_array = explode('><', $items); foreach ($item_array as $item) { $item = trim(str_replace(array('>', '<'), '', $item)); $item_sql .= " ({$biblio_id}, '{$item}'),"; } // remove last comma $item_sql = substr_replace($item_sql, '', -1); // execute query $dbs->query($item_sql); } } // create biblio index if ($sysconf['index']['type'] == 'index') { $indexer->makeIndex($biblio_id); } } $row_count++; } } // close file handle fclose($file); $end_time = time(); $import_time_sec = $end_time - $start_time; utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'bibliography', 'Importing ' . $inserted_row . ' bibliographic records from file : ' . $_FILES['importFile']['name']); echo '<script type="text/javascript">' . "\n"; echo 'parent.$(\'#importInfo\').html(\'<strong>' . $inserted_row . '</strong> records inserted successfully to bibliographic database, from record <strong>' . $_POST['recordOffset'] . ' in ' . $import_time_sec . ' second(s)</strong>\');' . "\n"; echo 'parent.$(\'#importInfo\').css( {\'display\': \'block\'} );' . "\n"; echo '</script>'; exit;