function get_notice_unimarc($notice_id) { //récupère les param d'exports $export_param = new export_param(); $param = $export_param->get_parametres($export_param->context); //petit nettoyage pour un bon fonctionnement... foreach ($param as $key => $value) { $param[str_replace("export_", "", $key)] = $param[$key]; } //maintenant que c'est en ordre, on peut y aller! $export = new export(array($notice_id), array(), array()); $export->get_next_notice("", array(), array(), false, $param); return $export->xml_array; }
function save_to_agnostic_warehouse($notice_ids = array(), $source_id = 0, $keep_expl = 0) { global $base_path, $class_path, $include_path; if (is_array($notice_ids) && count($notice_ids) && $source_id * 1) { $export_params = array('genere_lien' => 1, 'notice_mere' => 1, 'notice_fille' => 1, 'mere' => 0, 'fille' => 0, 'bull_link' => 1, 'perio_link' => 1, 'art_link' => 0, 'bulletinage' => 0, 'notice_perio' => 0, 'notice_art' => 0); require_once $base_path . '/admin/convert/export.class.php'; require_once $base_path . "/admin/connecteurs/in/agnostic/agnostic.class.php"; $conn = new agnostic($base_path . '/admin/connecteurs/in/agnostic'); $source_params = $conn->get_source_params($source_id); $export_params['docnum'] = 1; $export_params['docnum_rep'] = $source_params['REP_UPLOAD']; $notice_ids = array_unique($notice_ids); $e = new export($notice_ids); $records = array(); do { $nn = $e->get_next_notice('', array(), array(), $keep_expl, $export_params); if ($e->notice) { $records[] = $e->xml_array; } } while ($nn); $conn->rec_records_from_xml_array($records, $source_id); } }
function fetch_data() { //si on a rien, on peut pas travailler... if (!$this->notice_id && !$this->notice_externe_id) { return false; } if ($this->notice_id) { //pour une notice de la base... //récupère les param d'exports $export_param = new export_param(); $param = $export_param->get_parametres($export_param->context); //petit nettoyage pour un bon fonctionnement... foreach ($param as $key => $value) { $param[str_replace("export_", "", $key)] = $param[$key]; } //maintenant que c'est en ordre, on peut y aller! $export = new export(array($this->notice_id), array(), array()); $export->get_next_notice("", array(), array(), false, $param); $this->notice_infos = $export->xml_array; //on regarde si on veut aussi les infos de la notice contenante... if ($this->params['entities']['referring_entity']['allow'] == "yes") { //il nous faut déjà l'identifiant du parent, s'il existe... $this->parent_id = 0; switch ($this->notice_infos['bl']['value'] . $this->notice_infos['hl']['value']) { case "a2": case "s2": $field = "461"; break; default: $field = "463"; break; } foreach ($this->notice_infos['f'] as $f) { switch ($f['c']) { case $field: foreach ($f['s'] as $s) { switch ($s['c']) { case "9": if (strpos($s['value'], "id:") !== false) { $this->parent_id = str_replace("id:", "", $s['value']); } break; } } break; } } if ($this->parent_id) { $export_parent = new export(array($this->parent_id), array(), array()); $export_parent->get_next_notice("", array(), array(), false, $param); $this->parent_infos = $export_parent->xml_array; } } } else { //pour une notice externe //TODO : récup notice infos } //on récup la sérialization pour gérer nos objets switch ($this->params['serialization']) { case "kev": default: $this->serialization = "kev_mtx"; break; } }
$notice_exporte = $_SESSION["param_export"]["notice_exporte"]; } else { $notice_exporte = array(); } if ($_SESSION["param_export"]["bulletin_exporte"]) { $bulletin_exporte = $_SESSION["param_export"]["bulletin_exporte"]; } else { $bulletin_exporte = array(); } while (list($id) = pmb_mysql_fetch_row($resultat)) { if (!$specialexport) { $e_notice = array(); $param = new export_param(EXP_SESSION_CONTEXT); $e = new export(array($id), $notice_exporte, $bulletin_exporte); do { $nn = $e->get_next_notice($lender, $td, $sd, $keep_expl, $param->get_parametres($param->context)); if ($e->notice) { $e_notice[] = $e->notice; } } while ($nn); $notice_exporte = $e->notice_exporte; //Pour les exemplaires de bulletin do { $nn = $e->get_next_bulletin($lender, $td, $sd, $keep_expl, $param->get_parametres($param->context)); if ($e->notice) { $e_notice[] = $e->notice; } } while ($nn); $bulletin_exporte = $e->bulletins_exporte; } else { $e_notice = _export_($id, $keep_expl);
function save_to_agnostic_warehouse($expl_ids = array(), $source_id = 0, $keep_expl = 1) { global $base_path, $class_path, $include_path, $dbh; if (is_array($expl_ids) && count($expl_ids) && $source_id * 1) { $export_params = array('genere_lien' => 1, 'notice_mere' => 1, 'notice_fille' => 1, 'mere' => 0, 'fille' => 0, 'bull_link' => 1, 'perio_link' => 1, 'art_link' => 0, 'bulletinage' => 0, 'notice_perio' => 0, 'notice_art' => 0, 'export_only_expl_ids' => $expl_ids); $notice_ids = array(); $bulletin_ids = array(); $perio_ids = array(); $q = 'select expl_notice,expl_bulletin,bulletin_notice from exemplaires left join bulletins on expl_bulletin=bulletin_id and expl_bulletin!=0 where expl_id in (' . implode(',', $expl_ids) . ')'; $r = pmb_mysql_query($q, $dbh); if (pmb_mysql_num_rows($r)) { while ($row = pmb_mysql_fetch_object($r)) { if ($row->expl_notice) { $notice_ids[] = $row->expl_notice; } if ($row->expl_bulletin) { $bulletin_ids[] = $row->expl_bulletin; } if ($row->bulletin_notice) { $perio_ids[] = $row->bulletin_notice; } } } if (count($notice_ids) || count($bulletin_ids)) { require_once $base_path . '/admin/convert/export.class.php'; require_once $base_path . "/admin/connecteurs/in/agnostic/agnostic.class.php"; $conn = new agnostic($base_path . '/admin/connecteurs/in/agnostic'); $source_params = $conn->get_source_params($source_id); $export_params['docnum'] = 1; $export_params['docnum_rep'] = $source_params['REP_UPLOAD']; } if (count($notice_ids)) { $notice_ids = array_unique($notice_ids); $e = new export($notice_ids); $records = array(); do { $nn = $e->get_next_notice('', array(), array(), $keep_expl, $export_params); if ($e->notice) { $records[] = $e->xml_array; } } while ($nn); $conn->rec_records_from_xml_array($records, $source_id); } if (count($bulletin_ids)) { $bulletin_ids = array_unique($bulletin_ids); $perio_ids = array_unique($perio_ids); $e = new export($perio_ids); $e->expl_bulletin_a_exporter = $bulletin_ids; $records = array(); do { $nn = $e->get_next_bulletin('', array(), array(), $keep_expl, $export_params); if ($e->notice) { $records[] = $e->xml_array; } } while ($nn); $conn->rec_records_from_xml_array($records, $source_id); } } }
function getByRefContent($source_id, $notice_id, $uri, $entity) { global $include_path; global $openurl_map; $openurl_map = array(); $params = $this->get_source_params($source_id); if ($params["PARAMETERS"]) { //Affichage du formulaire avec $params["PARAMETERS"] $vars = unserialize($params["PARAMETERS"]); foreach ($vars as $key => $val) { global ${$key}; ${$key} = $val; } } require_once $include_path . "/parser.inc.php"; _parser_($include_path . "/openurl/openurl_mapping.xml", array("ITEM" => "_getMapItem_"), "MAP"); if ($entity) { //récupère les param d'exports $export_param = new export_param(); $param = $export_param->get_parametres($export_param->context); //petit nettoyage pour un bon fonctionnement... foreach ($param as $key => $value) { $param["exp_" . $key] = $param[$key]; } //maintenant que c'est en ordre, on peut y aller! $export = new export(array($notice_id), array(), array()); $export->get_next_notice("", array(), array(), false, $param); $elem = new $openurl_map[$uri]['class']($export->xml_array, true); $elem->setEntityType($entity); print $elem->serialize(); } else { //si on demande pas une entité, c'est un contextObject $openurl_param = new openurl_parameters(); $openurl_param->setParameters($vars); $openurl_instance = new openurl_instance($notice_id, 0, $openurl_param->getParameters(), $source_id); $openurl_instance->generateContextObject(); print $openurl_instance->contextObject->serialize(); } }
${$op} = $corresp_op[$use[0]]; return $idf; } } return; } switch ($command) { case "search": //print $query."<br />"; construct_query($query, 0, 0); $s = new search(); $table = $s->make_search(); //print $s->make_human_query(); $sql_query = "select notice_id from {$table} limit 100"; $resultat = @mysql_query($sql_query); echo "0@No errors@"; echo @mysql_num_rows($resultat); while (list($id) = @mysql_fetch_row($resultat)) { echo "@{$id}"; } break; case "get_notice": $id = $query; $e = new export(array($id)); $e->get_next_notice(); $toiso = new xml_unimarc(); $toiso->XMLtoiso2709_notice($e->notice); echo "0@No errors@"; echo $toiso->notices_[0]; break; }
function start_export($id_notice, $type_export, $param_export) { global $i; global $param_path; global $specialexport; global $output_type; global $output_params; global $step; global $export_type; global $base_path; global $class_path; global $include_path; global $msg; $step = array(); if ($id_notice) { $this->id_notice = $id_notice; $this->export_type = $type_export; $export_type = $type_export; $this->param_export = $param_export; //Récupération du répertoire $i = 0; $param_path = ""; if (file_exists("{$base_path}/admin/convert/imports/catalog_subst.xml")) { $fic_catal = "{$base_path}/admin/convert/imports/catalog_subst.xml"; } else { $fic_catal = "{$base_path}/admin/convert/imports/catalog.xml"; } _parser_($fic_catal, array("ITEM" => "_item_"), "CATALOG"); //Lecture des paramètres _parser_("{$base_path}/admin/convert/imports/" . $param_path . "/params.xml", array("IMPORTNAME" => "_import_name_", "STEP" => "_step_", "OUTPUT" => "_output_", "INPUT" => "_input_"), "PARAMS"); //Si l'export est spécial, on charge la fonction d'export if ($specialexport) { require_once "{$base_path}/admin/convert/imports/" . $param_path . "/export.inc.php"; } //En fonction du type de fichier de sortie, inclusion du script de gestion des sorties switch ($output_type) { case "xml": require_once "{$base_path}/admin/convert/imports/output_xml.inc.php"; break; case "iso_2709": require_once "{$base_path}/admin/convert/imports/output_iso_2709.inc.php"; break; case "custom": require_once "{$base_path}/admin/convert/imports/" . $param_path . "/" . $output_params['SCRIPT']; break; case "txt": require_once "{$base_path}/admin/convert/imports/output_txt.inc.php"; break; default: die($msg["export_cant_find_output_type"]); } $e_notice = array(); if ($_SESSION["param_export"]["notice_exporte"]) { $notice_exporte = $_SESSION["param_export"]["notice_exporte"]; } else { $notice_exporte = array(); } if ($_SESSION["param_export"]["bulletin_exporte"]) { $bulletin_exporte = $_SESSION["param_export"]["bulletin_exporte"]; } else { $bulletin_exporte = array(); } if (!$specialexport) { $param = new export_param(EXP_DSI_CONTEXT, $this->param_export); $e = new export(array($this->id_notice), $notice_exporte, $bulletin_exporte); do { $nn = $e->get_next_notice("", "", "", 0, $param->get_parametres($param->context)); if ($e->notice) { $e_notice[] = $e->notice; } } while ($nn); $notice_exporte = $e->notice_exporte; $_SESSION["param_export"]["notice_exporte"] = $notice_exporte; //Pour les exemplaires de bulletin do { $nn = $e->get_next_bulletin("", "", "", 0, $param->get_parametres($param->context)); if ($e->notice) { $e_notice[] = $e->notice; } } while ($nn); $bulletin_exporte = $e->bulletins_exporte; $_SESSION["param_export"]["bulletin_exporte"] = $bulletin_exporte; } else { $e_notice = _export_($this->id_notice); } if (!is_array($e_notice)) { $this->prepared_notice = $e_notice; $this->output_notice .= $this->transform(); } else { for ($i = 0; $i < sizeof($e_notice); $i++) { $this->prepared_notice = $e_notice[$i]; $this->output_notice .= $this->transform(); } } } }
function convert_batch_to_php_array_assoc($notices_to_convert, $target_charset = 'iso-8859-1') { global $charset; if (!$notices_to_convert) { //Rien à faire? On fait rien return; } $xmlexport = new export($notices_to_convert); $current_notice_id = $xmlexport->notice_list[$xmlexport->current_notice]; $parametres = array(); if (is_array($this->params['include_links'])) { $parametres = $this->params['include_links']; } else { if ($this->params["include_links"]) { $parametres["genere_lien"] = 1; //Notices liées, relations entre notices $parametres["mere"] = 1; //Exporter les liens vers les notices mères $parametres["notice_mere"] = 0; //Exporter aussi les notices mères liées $parametres["fille"] = 1; //Exporter les liens vers les notices filles $parametres["notice_fille"] = 0; //Exporter aussi les notices filles liées $parametres["art_link"] = 1; //Exporter les liens vers les articles pour les notices de pério $parametres["notice_art"] = 0; //Exporter aussi les articles pour les notices de pério $parametres["bulletinage"] = 0; //Exporter le bulletinage pour les notices de pério $parametres["bull_link"] = 1; //Exporter les liens vers les bulletins pour les notices d'article $parametres["perio_link"] = 1; //Exporter les liens vers les périodiques pour les notices d'articles $parametres["notice_perio"] = 0; //Exporter aussi les périodiques pour les notices d'articles } } if ($this->params["include_authorite_ids"]) { $parametres["include_authorite_ids"] = true; } $parametres["docnum"] = 1; $keep_expl = isset($this->params["include_items"]) && $this->params["include_items"]; while ($xmlexport->get_next_notice("", array(), array(), $keep_expl, $parametres)) { $xmlexport->to_raw_array(); if ($current_notice_id != -1) { $xmlexport_notice = $xmlexport->notice; $aresult = array(); $headers = array(); if (isset($xmlexport_notice['rs']["value"])) { $headers["rs"] = $xmlexport_notice['rs']["value"]; } if (isset($xmlexport_notice['dt']["value"])) { $headers["dt"] = $xmlexport_notice['dt']["value"]; } if (isset($xmlexport_notice['bl']["value"])) { $headers["bl"] = $xmlexport_notice['bl']["value"]; } if (isset($xmlexport_notice['hl']["value"])) { $headers["hl"] = $xmlexport_notice['hl']["value"]; } if (isset($xmlexport_notice['el']["value"])) { $headers["el"] = $xmlexport_notice['el']["value"]; } if (isset($xmlexport_notice['ru']["value"])) { $headers["ru"] = $xmlexport_notice['ru']["value"]; } $aresult["id"] = $current_notice_id; $aresult["header"] = $headers; $aresult["f"] = array(); foreach ($xmlexport_notice['f'] as &$af) { if (!isset($af["c"])) { continue; } if (!isset($aresult["f"][$af["c"]])) { $aresult["f"][$af["c"]] = array(); } $arf = array(); $arf["ind"] = isset($af["ind"]) ? $af["ind"] : ""; $arf["id"] = isset($af["id"]) ? $af["id"] : ""; if (isset($af["s"])) { foreach ($af["s"] as &$as) { //La classe export exporte ses données dans la charset de la base. //Convertissons si besoin $value = $as["value"]; if ($charset != 'utf-8' && $target_charset == 'utf-8') { $value = utf8_encode($value); } else { if ($charset == 'utf-8' && $target_charset != 'utf-8') { $value = utf8_decode($value); } } if (isset($arf[$as["c"]]) && !is_array($arf[$as["c"]])) { $arf[$as["c"]] = array($arf[$as["c"]]); } if (isset($arf[$as["c"]]) && is_array($arf[$as["c"]])) { $arf[$as["c"]][] = $value; } else { $arf[$as["c"]] = $value; } } } else { if (isset($af["value"])) { $arf["value"] = $af["value"]; } } $aresult["f"][$af["c"]][] = $arf; } $this->results[$current_notice_id] = $aresult; $current_notice_id = $xmlexport->notice_list[$xmlexport->current_notice]; } } }