function postVarsToBiblio($post) { require_once "../classes/Biblio.php"; require_once "../classes/BiblioField.php"; $biblio = new Biblio(); $biblio->setMaterialCd($post["materialCd"]); $biblio->setCollectionCd($post["collectionCd"]); $biblio->setCallNmbr1($post["callNmbr1"]); $biblio->setCallNmbr2($post["callNmbr2"]); $biblio->setCallNmbr3($post["callNmbr3"]); $biblio->setLastChangeUserid($_SESSION["userid"]); $biblio->setOpacFlg(isset($post["opacFlg"])); $indexes = $post["indexes"]; foreach ($indexes as $index) { $value = $post["values"][$index]; $fieldid = $post["fieldIds"][$index]; $tag = $post["tags"][$index]; $subfieldCd = $post["subfieldCds"][$index]; $requiredFlg = $post["requiredFlgs"][$index]; $biblioFld = new BiblioField(); $biblioFld->setFieldid($fieldid); $biblioFld->setTag($tag); $biblioFld->setSubfieldCd($subfieldCd); $biblioFld->setIsRequired($requiredFlg); $biblioFld->setFieldData($value); $biblio->addBiblioField($index, $biblioFld); } return $biblio; }
function postVarsToBiblio($post) { require_once "../classes/Biblio.php"; require_once "../classes/BiblioField.php"; $biblio = new Biblio(); $biblio->setMaterialCd($post["materialCd"]); $biblio->setCollectionCd($post["collectionCd"]); $biblio->setCallNmbr1($post["callNmbr1"]); $biblio->setCallNmbr2($post["callNmbr2"]); $biblio->setCallNmbr3($post["callNmbr3"]); //#C1 - begin $biblio->setReadingLevel($post["readingLevel"]); $GLOBALS["title"] = $post['values']['245a']; $GLOBALS["author"] = $post['values']['100a']; $GLOBALS["publication"] = $post['values']['260b']; //#C1 - end $biblio->setLastChangeUserid($_SESSION["userid"]); $biblio->setOpacFlg(isset($post["opacFlg"])); $indexes = $post["indexes"]; foreach ($indexes as $index) { $value = $post["values"][$index]; $fieldid = $post["fieldIds"][$index]; $tag = $post["tags"][$index]; $subfieldCd = $post["subfieldCds"][$index]; $requiredFlg = $post["requiredFlgs"][$index]; $biblioFld = new BiblioField(); $biblioFld->setFieldid($fieldid); $biblioFld->setTag($tag); $biblioFld->setSubfieldCd($subfieldCd); $biblioFld->setIsRequired($requiredFlg); $biblioFld->setFieldData($value); $biblio->addBiblioField($index, $biblioFld); } return $biblio; }
function postVarsToBiblio($post) { require_once "../classes/Biblio.php"; require_once "../classes/BiblioField.php"; $biblio = new Biblio(); $biblio->setBibid($post['bibid']); $biblio->setMaterialCd($post["materialCd"]); $biblio->setCollectionCd($post["collectionCd"]); $biblio->setCallNmbr1($post["callNmbr1"]); $biblio->setCallNmbr2($post["callNmbr2"]); $biblio->setCallNmbr3($post["callNmbr3"]); $biblio->setLanguage($post["language"]); $biblio->setOthernumber($post["othernumber"]); $biblio->setImageLocation($post["image_location"]); $biblio->setLastChangeUserid($_SESSION["userid"]); $biblio->setOpacFlg(isset($post["opacFlg"])); $indexes = $post["indexes"]; foreach ($indexes as $index) { $value = $post["values"][$index]; $fieldid = $post["fieldIds"][$index]; $tag = $post["tags"][$index]; $subfieldCd = $post["subfieldCds"][$index]; $requiredFlg = $post["requiredFlgs"][$index]; $biblioFld = new BiblioField(); $biblioFld->setBibid($post['bibid']); $biblioFld->setFieldid($fieldid); $biblioFld->setTag($tag); $biblioFld->setSubfieldCd($subfieldCd); $biblioFld->setIsRequired($requiredFlg); $biblioFld->setFieldData($value); $biblio->addBiblioField($index, $biblioFld); } //update image, if no file is uploaded do not set image location if ($_FILES['input_upload']['size'] != 0) { $img = fileUpload("input_upload"); $biblio->setImageLocation($img); print $img; } else { //use original img path / location } return $biblio; }
function doQuery($bibid, $tab = "cataloging") { # reset rowNmbr $this->_rowNmbr = 0; $this->_currentRowNmbr = 1; $this->_rowCount = 1; $this->_pageCount = 1; $exclude = array("363x", "526x", "583x", "754x", "852x", "856x"); /*********************************************************** * Reading biblio data ***********************************************************/ # setting query that will return all the data in biblio $sql = $this->mkSQL("select biblio.*, staff.username " . "from biblio left join staff " . "on biblio.last_change_userid = staff.userid " . "where biblio.bibid = %N ", $bibid); if (!$this->_query($sql, $this->_loc->getText("biblioQueryQueryErr1"))) { return false; } $array = $this->_conn->fetchRow(); $bib = new Biblio(); $bib->setBibid($array["bibid"]); $bib->setCreateDt($array["create_dt"]); $bib->setLastChangeDt($array["last_change_dt"]); $bib->setLastChangeUserid($array["last_change_userid"]); if (isset($array["username"])) { $bib->setLastChangeUsername($array["username"]); } $bib->setMaterialCd($array["material_cd"]); $bib->setCollectionCd($array["collection_cd"]); $bib->setCallNmbr1($array["call_nmbr1"]); $bib->setCallNmbr2($array["call_nmbr2"]); $bib->setCallNmbr3($array["call_nmbr3"]); if ($array["opac_flg"] == "Y") { $bib->setOpacFlg(true); } else { $bib->setOpacFlg(false); } /*********************************************************** * Reading biblio_field data ***********************************************************/ # setting query that will return all the data in biblio $sql = $this->mkSQL("select biblio_field.* " . "from biblio_field " . "where biblio_field.bibid = %N " . "order by tag, subfield_cd ", $bibid); if (!$this->_query($sql, $this->_loc->getText("biblioQueryQueryErr2"))) { return false; } /*********************************************************** * Adding fields from biblio to Biblio object ***********************************************************/ foreach ($this->_fieldsInBiblio as $key => $name) { $tag = substr($key, 0, 3); $subfieldCd = substr($key, 3, 1); $subfieldIdx = ''; if (count($key) > 4) { $index = substr($key, 4); } $this->_addField($tag, $subfieldCd, $array[$name], $bib, $subfieldIdx); } /*********************************************************** * Adding fields from biblio_field to Biblio object ***********************************************************/ # subfieldIdx will be used to construct index $subfieldIdx = 0; $saveTag = ""; $saveSubfield = ""; while ($array = $this->_conn->fetchRow()) { $tag = $array["tag"]; $subfieldCd = $array["subfield_cd"]; if ($tab == "opac" and in_array($tag . $subfieldCd, $exclude)) { continue; } # checking for tag and subfield break in order to set the subfield Idx correctly. if ($tag == $saveTag and $subfieldCd == $saveSubfield) { $subfieldIdx = $subfieldIdx + 1; } else { $subfieldIdx = 0; $saveTag = $tag; $saveSubfield = $subfieldCd; } # setting the index. # format is ttts[i] where # t=tag # s=subfield code # i=subfield index if > 0 # examples: 020a 650a 650a1 650a2 $index = sprintf("%03d", $tag) . $subfieldCd; if ($subfieldIdx > 0) { $index = $index . $subfieldIdx; } $bibFld = new BiblioField(); $bibFld->setBibid($array["bibid"]); $bibFld->setFieldid($array["fieldid"]); $bibFld->setTag($array["tag"]); $bibFld->setInd1Cd($array["ind1_cd"]); $bibFld->setInd2Cd($array["ind2_cd"]); $bibFld->setSubfieldCd($array["subfield_cd"]); $bibFld->setFieldData($array["field_data"]); $bib->addBiblioField($index, $bibFld); } return $bib; }
break; case "showO": if (preg_match('/^[yYtT]/', $entry)) { $biblio->setOpacFlg(true); } else { $biblio->setOpacFlg(false); } break; case "Call1": $biblio->setCallNmbr1($entry); break; case "Call2": $biblio->setCallNmbr2($entry); break; case "Call3": $biblio->setCallNmbr3($entry); break; default: if (preg_match('/^[0-9][0-9]*\\$[a-z]$/', $target)) { $tag = explode('$', $target); $f = new BiblioField(); $f->setTag($tag[0]); $f->setSubfieldCd($tag[1]); $f->setFieldData($entry); $biblio->addBiblioField($tag[0] . $tag[1], $f); } break; } } // Display the biblio. Don't keep it in a array due to memory reasons. $validate = $biblio->validateData();
function _getBiblio($post) { require_once "Biblio.php"; require_once "BiblioField.php"; $biblio = new Biblio(); $biblio->setMaterialCd($post["materialCd"]); $biblio->setCollectionCd($post["collectionCd"]); $biblio->setCallNmbr1($post["callNmbr1"]); $biblio->setCallNmbr2($post["callNmbr2"]); $biblio->setCallNmbr3($post["callNmbr3"]); $biblio->setLastChangeUserid($_SESSION["userid"]); $biblio->setOpacFlg(true); unset($post['callNmbr1'], $post['callNmbr2'], $post['callNmbr3'], $post['collectionCd'], $post['materialCd']); $post['020a'] = BulkLookup::verifyISBN($post['020a']); $title_trail = substr($post['245a'], strlen($post['245a']) - 1); if ($title_trail == '/' || $title_trail == ':') { $post['245a'] = substr($post['245a'], 0, -1); } foreach ($post as $index => $val) { $value = $val; $fieldid = ''; $tag = 0 + substr($index, 0, 3); $subfieldCd = substr($index, 3, 1); $requiredFlg = ''; if ($index == '100a' || $index == '245a') { // Author, Title $requiredFlg = 1; } $biblioFld = new BiblioField(); $biblioFld->setFieldid($fieldid); $biblioFld->setTag($tag); $biblioFld->setSubfieldCd($subfieldCd); $biblioFld->setIsRequired($requiredFlg); $biblioFld->setFieldData($value); $biblio->addBiblioField($index, $biblioFld); } return $biblio; }