/** * Inserts data into the biblio table * @param $data * @return int last insterted id if succesefull */ function alreadyInDB($title, $author, $publication) { $biblioQ = new BiblioQuery(); $biblioQ->connect(); if (!$biblioQ->validateBiblio($title, $author, $publication)) { $sql = "select bibid from biblio where strcmp(title,'" . $title . "')=0"; $qShowStatusResult = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($qShowStatusResult); return $row["bibid"]; } return 0; }
require_once "../shared/logincheck.php"; require_once "../classes/Biblio.php"; require_once "../classes/BiblioQuery.php"; require_once "../classes/Localize.php"; $loc = new Localize(OBIB_LOCALE, $tab); if (isset($_GET["bibid"])) { unset($_SESSION["postVars"]); unset($_SESSION["pageErrors"]); #**************************************************************************** #* Retrieving get var #**************************************************************************** $bibid = $_GET["bibid"]; #**************************************************************************** #* Search database #**************************************************************************** $biblioQ = new BiblioQuery(); $biblioQ->connect(); if ($biblioQ->errorOccurred()) { $biblioQ->close(); displayErrorPage($biblioQ); } if (!($biblio = $biblioQ->doQuery($bibid))) { $biblioQ->close(); displayErrorPage($biblioQ); } foreach ($biblio->getBiblioFields() as $value) { $value->setFieldid(''); } #************************************************************************** #* load up post vars #**************************************************************************
echo '<th>' . $loc->getText("MarcUploadSubfield") . '</th>'; echo '<th>' . $loc->getText("MarcUploadData") . '</th>'; echo '</tr>'; foreach ($biblio->getBiblioFields() as $field) { echo '<tr><td>' . H($field->getTag()) . '</td>'; echo '<td>' . H($field->getSubfieldCd()) . '</td>'; echo '<td>' . H($field->getFieldData()) . '</td></tr>'; } echo '</table>'; } echo '<hr /><h3>' . $loc->getText("MarcUploadRawData") . '</h3>'; echo '<pre>'; readfile($_FILES["usmarc_data"]["tmp_name"]); echo '</pre>'; } else { $bq = new BiblioQuery(); $bq->connect(); if ($bq->errorOccurred()) { $bq->close(); displayErrorPage($bq); } foreach ($biblios as $biblio) { if (!$bq->insert($biblio)) { $bq->close(); displayErrorPage($bq); } } $bq->close(); echo $loc->getText("MarcUploadRecordsUploaded"); echo ": " . H(count($biblios)); }
function insertBiblio($biblio) { require_once "../classes/BiblioQuery.php"; $biblioQ = new BiblioQuery(); $biblioQ->connect(); if ($biblioQ->errorOccurred()) { $biblioQ->close(); displayErrorPage($biblioQ); } $bibid = $biblioQ->insert($biblio); if (!$bibid) { $biblioQ->close(); displayErrorPage($biblioQ); } $biblioQ->close(); return $bibid; }
function updateBiblio($biblio) { require_once "../classes/BiblioQuery.php"; $biblioQ = new BiblioQuery(); $biblioQ->connect(); if ($biblioQ->errorOccurred()) { $biblioQ->close(); displayErrorPage($biblioQ); } if (!$biblioQ->update($biblio)) { $biblioQ->close(); displayErrorPage($biblioQ); } $biblioQ->close(); }
$LmarcSubfldDmQ->connect(); if ($LmarcSubfldDmQ->errorOccurred()) { $LmarcSubfldDmQ->close(); displayErrorPage($marcSubfldDmQ); } $LmarcSubfldDmQ->execSelect(); if ($LmarcSubfldDmQ->errorOccurred()) { $LmarcSubfldDmQ->close(); displayErrorPage($LmarcSubfldDmQ); } $LmarcSubflds = $LmarcSubfldDmQ->fetchRows(); $LmarcSubfldDmQ->close(); #**************************************************************************** #* Search database marc #**************************************************************************** $LbiblioQ = new BiblioQuery(); $LbiblioQ->connect(); if ($biblioQ->errorOccurred()) { $biblioQ->close(); displayErrorPage($LbiblioQ); } if (!($Lbiblio = $LbiblioQ->doQuery($bibid))) { $LbiblioQ->close(); displayErrorPage($LbiblioQ); } $LbiblioFlds = $Lbiblio->getBiblioFields(); // hasta aqui la modificacion para la busqueda de valores marc, ya que la portada se guarda en marc 902a ?> <!--************************************************************************** * Mostrar foto de autores joanlga@hotmail.com campo marc 902c
function _insertBiblio($biblio) { require_once "BiblioQuery.php"; $biblioQ = new BiblioQuery(); $biblioQ->connect(); if ($biblioQ->errorOccurred()) { $biblioQ->close(); return false; } $bibid = $biblioQ->insert($biblio); if (!$bibid) { $biblioQ->close(); return false; } $biblioQ->close(); return $bibid; }
function validateData() { $loc = new Localize(OBIB_LOCALE, "classes"); $valid = true; if ($this->_isRequired and $this->_fieldData == "") { $valid = false; $this->_fieldDataError = $loc->getText("biblioFieldError1"); } if ($this->_tag == "") { $valid = false; $this->_tagError = $loc->getText("biblioFieldError1"); } else { if (!is_numeric($this->_tag)) { $valid = false; $this->_tagError = $loc->getText("biblioFieldError2"); } } if ($this->_subfieldCd == "") { $valid = false; $this->_subfieldCdError = $loc->getText("biblioFieldError1"); } // Check for image if ($this->getTag() == "902" && $this->getSubfieldCd() == "a") { $fieldData = $this->getFieldData(); if (!empty($fieldData)) { if ($fieldData['uselookup'] === true) { // Override with cover lookup $isbn = $fieldData['isbn']; require_once "BiblioCoverQuery.php"; $cq = new BiblioCoverQuery(); $path = $cq->lookup($isbn, "large"); if (!$path) { $this->_fieldDataError = $loc->getText("biblioFieldErrorCoverLookupFailed"); $valid = false; } else { $filename = $cq->save($path, 0); $this->setFieldData($filename); } } else { $index = $this->getTag() . $this->getSubfieldCd(); if (!empty($fieldData["tmp_name"][$index])) { if ($info = getimagesize($fieldData["tmp_name"][$index])) { $filename = $fieldData["name"][$index]; $filename_parts = explode(".", $filename); unset($filename_parts[count($filename_parts) - 1]); $filename = implode("-", $filename_parts); $allow_types = array('image/jpeg', 'image/png', 'image/gif'); // If file type is allowed if (in_array($info["mime"], $allow_types)) { // Create directory when necessary, raise error when failed to create "not exist" one. if (!(is_dir('../' . COVER_PATH) || is_dir('../' . COVER_PATH_TMP))) { $dir_error = FALSE; if (is_dir('../' . dirname(COVER_PATH))) { // Create new one. $cover_path = @mkdir('../' . COVER_PATH, 0777); $tmp_path = @mkdir('../' . COVER_PATH_TMP, 0777); if (!$cover_path) { if (is_dir('../' . COVER_PATH)) { if (decoct(fileperms('../' . COVER_PATH)) != 0777) { $force_chmod = @chmod('../' . COVER_PATH, 0777); if (!$force_chmod) { $dir_error = TRUE; } } } else { $dir_error = TRUE; } } if (!$tmp_path) { if (is_dir('../' . COVER_PATH_TMP)) { if (decoct(fileperms('../' . COVER_PATH_TMP)) != 0777) { $force_chmod = @chmod('../' . COVER_PATH_TMP, 0777); if (!$force_chmod) { $dir_error = TRUE; } } } else { $dir_error = TRUE; } } if ($dir_error) { print_r('<span style="color: red"><strong>Error:</strong> Failed to save book cover! please set chmod 777 to /media directory.</span><br />'); return false; } } } $ext = image_type_to_extension($info[2]); $tmp = md5($filename . session_id() . time()); $filename = $filename . "_" . substr($tmp, strlen($tmp) - 7, strlen($tmp)) . $ext; $filepath = "../" . COVER_PATH . "/{$filename}"; copy($fieldData["tmp_name"][$index], $filepath); make_thumbnail($filepath, array('height' => 160)); $this->setFieldData($filename); } else { $valid = false; $this->_fieldDataError = $loc->getText("biblioFieldErrorPictureType"); } } else { $valid = false; $this->_fieldDataError = $loc->getText("biblioFieldErrorPictureLoadFailed"); } } } } else { } } else { if ($this->getTag() == "20" && $this->getSubfieldCd() == "a") { require_once "../classes/BiblioQuery.php"; $biblio = new BiblioQuery(); $existBibId = $biblio->ISBNExists($this->getFieldData()); if ($existBibId && $this->_bibid != $existBibId) { $valid = false; $this->_fieldDataError = $loc->getText("biblioFieldErrorDuplicatedISBN") . ' <a href="../shared/biblio_view.php?bibid=' . $existBibId . '&tab=cataloging">' . $loc->getText("biblioFieldViewExistingISBN") . '</a>'; } } } unset($loc); return $valid; }
$helpPage = "cataloging"; require_once "../shared/header.php"; require_once "../functions/searchFuncs.php"; require_once "../classes/BiblioQuery.php"; require_once "../classes/BiblioSearchQuery.php"; require_once "../classes/DmQuery.php"; require_once "../classes/Localize.php"; $loc = new Localize(OBIB_LOCALE, $tab); $locsh = new Localize(OBIB_LOCALE, "shared"); if ($_SERVER['REQUEST_METHOD'] == "POST" && $_POST['action_delete'] == true) { $count = 0; foreach ($_POST as $k => $v) { if (strpos($k, "chk-") !== false) { $bib_id = substr($k, 4); // 'chk-123' $biblio = new BiblioQuery(); $biblio->delete($bib_id); $count++; } } echo '<div id="message"><font class="error">'; if ($count == 1) { echo $count . ' ' . $locsh->getText("sharedRecordIsDeleted"); } elseif ($count > 1) { echo $count . ' ' . $locsh->getText("sharedRecordsAreDeleted"); } echo '</font></div>'; } $dmQ = new DmQuery(); $dmQ->connect(); $collectionDm = $dmQ->getAssoc("collection_dm");