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 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; } }
function update_config_from_form() { global $dbh; parent::update_config_from_form(); global $repo_name, $admin_email, $included_sets, $repositoryIdentifier, $chunksize, $token_lifeduration, $cache_complete_records, $cache_complete_records_seconds, $link_status_to_deletion, $linked_status_to_deletion, $allow_gzip_compression, $baseURL, $include_items, $suppr_feuille_xslt; global $deletion_management, $deletion_management_transient_duration; //les trucs faciles $this->config["repo_name"] = stripslashes($repo_name); $this->config["admin_email"] = stripslashes($admin_email); $this->config["repositoryIdentifier"] = stripslashes($repositoryIdentifier); $this->config["chunksize"] = $chunksize + 0; $this->config["token_lifeduration"] = $token_lifeduration + 0; $this->config["cache_complete_records"] = isset($cache_complete_records); $this->config["cache_complete_records_seconds"] = $cache_complete_records_seconds + 0; $this->config["link_status_to_deletion"] = isset($link_status_to_deletion); $this->config["linked_status_to_deletion"] = $linked_status_to_deletion + 0; $this->config["allow_gzip_compression"] = isset($allow_gzip_compression); $this->config["baseURL"] = stripslashes($baseURL); $this->config["include_items"] = isset($include_items); $this->config["deletion_management"] = $deletion_management; $this->config["deletion_management_transient_duration"] = $deletion_management_transient_duration * 1; if (!$_FILES['feuille_xslt']['error']) { $this->config['feuille_xslt'] = file_get_contents($_FILES['feuille_xslt']['tmp_name']); $this->config['feuille_xslt_name'] = $_FILES['feuille_xslt']['name']; } if ($suppr_feuille_xslt) { $this->config['feuille_xslt'] = ""; $this->config['feuille_xslt_name'] = ""; } $this->config['include_links'] = array(); $this->config['include_links']['genere_lien'] = 0; global $include_path, $class_path; require_once $class_path . '/export_param.class.php'; $e_param = new export_param(EXP_GLOBAL_CONTEXT); $this->config['include_links'] = $e_param->get_parametres(EXP_OAI_CONTEXT); //Vérifions que le statut proposé existe bien $sql = "SELECT COUNT(1) > 0 FROM notice_statut WHERE id_notice_statut = " . ($linked_status_to_deletion + 0); $status_exists = pmb_mysql_result(pmb_mysql_query($sql, $dbh), 0, 0); if (!$status_exists) { $this->config["linked_status_to_deletion"] = 0; } if (!$this->config["cache_complete_records_seconds"]) { $this->config["cache_complete_records_seconds"] = 86400; } if ($this->config["deletion_management"] == 1 && !$this->config["deletion_management_transient_duration"]) { $this->config["deletion_management"] = 0; } //et maintenant les sets if (!is_array($included_sets)) { $included_sets = array($included_sets); } array_walk($included_sets, create_function('&$a', '$a+=0;')); //Virons ce qui n'est pas entier //Virons ce qui n'est pas un index de set de notice $sql = "SELECT connector_out_set_id FROM connectors_out_sets WHERE connector_out_set_type IN (" . implode(",", $this->allowed_set_types) . ") AND connector_out_set_id IN (" . implode(",", $included_sets) . ')'; $res = pmb_mysql_query($sql, $dbh); $this->config["included_sets"] = array(); while ($row = pmb_mysql_fetch_assoc($res)) { $this->config["included_sets"][] = $row["connector_out_set_id"]; } //Vérifions que les formats autorisés proposés existent bien $allowed_paths = array(); $admin_convert_catalog = external_services_converter_notices::get_export_possibilities(); foreach ($admin_convert_catalog as $aconvert) { $allowed_paths[] = $aconvert["path"]; } global $allowed_admin_convert_paths; if (!is_array($allowed_admin_convert_paths)) { $allowed_admin_convert_paths = array($allowed_admin_convert_paths); } $this->config["allowed_admin_convert_paths"] = array(); foreach ($allowed_admin_convert_paths as $apath) { if (!in_array($apath, $allowed_paths)) { continue; } $this->config["allowed_admin_convert_paths"][] = $apath; } return; }
$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 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(); } }
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(); } } } }
// $Id: export_param.php,v 1.2 2012-09-04 15:46:47 dbellamy Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once "{$include_path}/templates/export_param.tpl.php"; require_once $class_path . "/export_param.class.php"; switch ($act) { case 'update': if ($sub == 'paramopac') { $export_param_context = new export_param(EXP_GLOBAL_CONTEXT); $export_param_context->get_parametres(EXP_DEFAULT_OPAC); $export_param_context->update(); $export_param_context->check_default_param(); } elseif ($sub == 'paramgestion') { $export_param_context = new export_param(EXP_GLOBAL_CONTEXT); $export_param_context->get_parametres(EXP_DEFAULT_GESTION); $export_param_context->update(); $export_param_context->check_default_param(); } $act = ''; break; default: if ($sub == 'paramopac') { $export_param_opac = new export_param(EXP_DEFAULT_OPAC); $export_param_opac->check_default_param(); } else { $export_param_gestion = new export_param(EXP_DEFAULT_GESTION); $export_param_gestion->check_default_param(); } break; }