function fetch_data() { global $dbh, $lang, $include_path; if (file_exists($include_path . "/section_param/{$lang}.xml")) { _parser_($include_path . "/section_param/{$lang}.xml", array("SECTION" => "_section_"), "PMBSECTIONS"); $this->allow_section = 1; } $this->subst_param = array(); $myQuery = pmb_mysql_query("SELECT * FROM param_subst where subst_type_param= '" . $this->type . "' and subst_module_param= '" . $this->module . "' and subst_module_num= '" . $this->module_num . "' ", $dbh); if (pmb_mysql_num_rows($myQuery)) { while ($r = pmb_mysql_fetch_assoc($myQuery)) { $this->subst_param[] = $r; } } $this->no_subst_param = array(); $myQuery = pmb_mysql_query("SELECT * FROM parametres where type_param= '" . $this->type . "' and gestion=0 order by section_param,sstype_param", $dbh); while ($r = pmb_mysql_fetch_assoc($myQuery)) { $found = 0; foreach ($this->subst_param as $key => $subst_param) { if ($subst_param['subst_sstype_param'] == $r['sstype_param']) { $this->subst_param[$key]['valeur_param_origine'] = $r['valeur_param']; $this->subst_param[$key]['section_param'] = $r['section_param']; $found = 1; break; } } if (!$found) { $this->no_subst_param[] = $r; } } }
function __construct($notice_ids, $filter_by_view = 1) { if (is_array($notice_ids)) { $notice_ids = implode(',', $notice_ids); } $this->notice_ids = $notice_ids; if ($this->notice_ids != '') { //filtrage sur statut ou droits d'accès.. $query = $this->_get_filter_query(); $res = pmb_mysql_query($query); $this->notice_ids = ""; if (pmb_mysql_num_rows($res)) { while ($row = pmb_mysql_fetch_assoc($res)) { if ($this->notice_ids != "") { $this->notice_ids .= ","; } $this->notice_ids .= $row['id_notice']; } } //filtrage par vue... if ($filter_by_view) { $this->_filter_by_view(); } } }
function __construct($notice_ids, $user = 0) { global $PMBuserid; $this->user = $user; if ($this->user = 0) { $this->user = $PMBuserid; } $this->notice_ids = $notice_ids; if ($this->notice_ids != '') { //filtrage sur statut ou droits d'accès.. $query = $this->_get_filter_query(); if ($query) { $res = pmb_mysql_query($query); $this->notice_ids = ""; if (pmb_mysql_num_rows($res)) { while ($row = pmb_mysql_fetch_assoc($res)) { if ($this->notice_ids != "") { $this->notice_ids .= ","; } $this->notice_ids .= $row['id_notice']; } } } } }
function listBannettesAuto($filtre_search = "", $id_classement = 0) { global $dbh; if (SESSrights & DSI_AUTH) { $result = array(); //auto = 1 : bannettes automatiques sans contrôle de date $auto = 1; $filtre_search = str_replace("*", "%", $filtre_search); if ($filtre_search) { $clause = "WHERE nom_bannette like '{$filtre_search}%' and bannette_auto='{$auto}' "; } else { $clause = "WHERE bannette_auto='{$auto}' "; } // if ($id_classement!=0) $clause.= " and num_classement=0 "; if ($id_classement > 0) { $clause .= " and num_classement='{$id_classement}' "; } $requete = "SELECT COUNT(1) FROM bannettes {$clause} "; $res = pmb_mysql_query($requete, $dbh); $nbr_lignes = pmb_mysql_result($res, 0, 0); if ($nbr_lignes) { $requete = "SELECT id_bannette, nom_bannette, date_last_remplissage, date_last_envoi, proprio_bannette, bannette_auto, nb_notices_diff FROM bannettes {$clause} ORDER BY nom_bannette, id_bannette "; $res = pmb_mysql_query($requete, $dbh); while ($row = pmb_mysql_fetch_assoc($res)) { $result[] = array("id_bannette" => $row["id_bannette"], "nom_bannette" => utf8_normalize($row["nom_bannette"]), "date_last_remplissage" => $row["date_last_remplissage"], "date_last_envoi" => $row["date_last_envoi"], "proprio_bannette" => $row["proprio_bannette"], "bannette_auto" => $row["bannette_auto"], "nb_notices_diff" => $row["nb_notices_diff"]); } } return $result; } else { return array(); } }
function indexGlobal() { global $msg, $dbh, $charset, $PMBusername; if (SESSrights & ADMINISTRATION_AUTH) { $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_global"], ENT_QUOTES, $charset) . "</h3>"; pmb_mysql_query("set wait_timeout=3600"); //remise a zero de la table au début pmb_mysql_query("delete from notices_global_index", $dbh); pmb_mysql_query("delete from notices_mots_global_index", $dbh); $query = pmb_mysql_query("select notice_id from notices order by notice_id"); if (pmb_mysql_num_rows($query)) { while ($mesNotices = pmb_mysql_fetch_assoc($query)) { // Mise à jour de la table "notices_global_index" notice::majNoticesGlobalIndex($mesNotices['notice_id']); // Mise à jour de la table "notices_mots_global_index" notice::majNoticesMotsGlobalIndex($mesNotices['notice_id']); } pmb_mysql_free_result($query); } $not = pmb_mysql_query("SELECT count(1) FROM notices_global_index", $dbh); $count = pmb_mysql_result($not, 0, 0); $result .= $count . " " . htmlentities($msg["nettoyage_res_reindex_global"], ENT_QUOTES, $charset); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }
public function get_authors_informations() { $return = array(); $query = "select count(author_id) as nb from authors"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $return = pmb_mysql_fetch_assoc($result); } return $return; }
function list_agnostic_repositories($source_id, $notice) { $result = array(); $sql = 'SELECT source_id, comment, name FROM connectors_sources WHERE id_connector = \'agnostic\''; $res = pmb_mysql_query($sql); while ($row = pmb_mysql_fetch_assoc($res)) { $result[] = array('id' => $row["source_id"], 'name' => utf8_normalize($row["name"]), 'comment' => utf8_normalize($row["comment"])); } return $result; }
function fetch_data() { global $dbh; $this->subst_param = array(); $myQuery = pmb_mysql_query("SELECT * FROM param_subst where subst_type_param= '" . $this->type . "' and subst_module_param= '" . $this->module . "' and subst_module_num= '" . $this->module_num . "' ", $dbh); if (pmb_mysql_num_rows($myQuery)) { while ($r = pmb_mysql_fetch_assoc($myQuery)) { $this->subst_param[] = $r; } } }
function listProcs() { global $dbh; if (SESSrights & ADMINISTRATION_AUTH) { $result = array(); $rqt = 'select idproc, name, requete, comment from procs'; $res = pmb_mysql_query($rqt, $dbh); while ($row = pmb_mysql_fetch_assoc($res)) { $result[] = array('idproc' => $row->idproc, 'name' => $row->name, 'requete' => $row->requete, 'comment' => $row->comment); } return $result; } else { return array(); } }
function listEntrepotSources() { global $dbh; if (SESSrights & ADMINISTRATION_AUTH) { $result = array(); $requete = "select source_id, id_connector, comment, name from connectors_sources where repository=1"; $res = pmb_mysql_query($requete) or die(pmb_mysql_error()); while ($row = pmb_mysql_fetch_assoc($res)) { $result[] = array("source_id" => $row["source_id"], "id_connector" => utf8_normalize($row["id_connector"]), "comment" => utf8_normalize($row["comment"]), "name_connector_in" => utf8_normalize($row["name"])); } return $result; } else { return array(); } }
function render($context, $stream) { global $dbh; $query_stream = new StreamWriter(); $this->pmb_query->render($context, $query_stream); $query = $query_stream->close(); $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $struct = array(); while ($row = pmb_mysql_fetch_assoc($result)) { $struct[] = $row; } $context->set($this->struct_name, $struct); } else { $context->set($this->struct_name, 0); } }
function getStatopacView($id_view) { global $dbh; if (SESSrights & ADMINISTRATION_AUTH) { $result = array(); $query = "select * from statopac_vue_" . $id_view; $res = pmb_mysql_query($query, $dbh); if ($res) { while ($row = pmb_mysql_fetch_assoc($res)) { $result[] = $row; } } return $result; } else { return array(); } }
/** * Pour initialiser un parcours des tris * Retourne le nombre de tris */ function initParcoursTris($objSort) { //on initialise la position du parcours $this->posParcours = 0; $this->nbResult = 0; $this->tabParcours = null; switch ($this->typeData) { case 'base': $result = pmb_mysql_query("SELECT id_tri, nom_tri, tri_par FROM tris WHERE tri_reference='" . $this->sortName . "' ORDER BY nom_tri;"); //echo "SELECT id_tri, nom_tri, tri_par FROM tris WHERE tri_reference='" . $this->sortName . "' ORDER BY nom_tri<br />"; if ($result) { //on charge les tris dans un tableau while ($this->tabParcours[$this->nbResult] = pmb_mysql_fetch_assoc($result)) { $this->nbResult++; } pmb_mysql_free_result($result); //s'il n'y a pas de tris if ($this->nbResult == 0) { //on vide la session stockant le tri en cours $_SESSION["tri"] = ""; } return $this->nbResult; } else { $_SESSION["tri"] = ""; return 0; } break; case 'session': $this->nbResult = $_SESSION["nb_sort" . $this->sortName]; //s'il n'y a pas de tris if ($this->nbResult == 0) { //on vide la session stockant le tri en cours $_SESSION["last_sort" . $this->sortName] = ""; } else { //on charge les tris dans un tableau for ($i = 0; $i < $this->nbResult; $i++) { $this->tabParcours[$i]["id_tri"] = $i; $this->tabParcours[$i]["nom_tri"] = $objSort->descriptionTri($_SESSION["sort" . $this->sortName . $i]); $this->tabParcours[$i]["tri_par"] = $_SESSION["sort" . $this->sortName . $i]; } } return $this->nbResult; break; } }
function get_publisher_information($publisher_id) { global $dbh; global $msg; $result = array(); $publisher_id += 0; if (!$publisher_id) { throw new Exception("Missing parameter: publisher_id"); } $sql = "SELECT * FROM publishers WHERE ed_id = " . $publisher_id; $res = pmb_mysql_query($sql); if (!$res) { throw new Exception("Not found: publisher_id = " . $publisher_id); } $row = pmb_mysql_fetch_assoc($res); $result = array("publisher_id" => $row["ed_id"], "publisher_name" => utf8_normalize($row["ed_name"]), "publisher_address1" => utf8_normalize($row["ed_adr1"]), "publisher_address2" => utf8_normalize($row["ed_adr2"]), "publisher_zipcode" => utf8_normalize($row["ed_cp"]), "publisher_city" => utf8_normalize($row["ed_ville"]), "publisher_country" => utf8_normalize($row["ed_pays"]), "publisher_web" => utf8_normalize($row["ed_web"]), "publisher_comment" => utf8_normalize($row["ed_comment"]), "publisher_links" => $this->proxy_parent->pmbesAutLinks_getLinks(3, $publisher_id)); return $result; }
function get_author_information($author_id) { global $dbh; global $msg; $result = array(); $author_id += 0; if (!$author_id) { throw new Exception("Missing parameter: author_id"); } $sql = "SELECT * FROM authors WHERE author_id = " . $author_id; $res = pmb_mysql_query($sql); if (!$res) { throw new Exception("Not found: author_id = " . $author_id); } $row = pmb_mysql_fetch_assoc($res); $result = array("author_id" => $row["author_id"], "author_type" => $row["author_type"], "author_name" => utf8_normalize($row["author_name"]), "author_rejete" => utf8_normalize($row["author_rejete"]), "author_see" => $row["author_see"], "author_date" => utf8_normalize($row["author_date"]), "author_web" => utf8_normalize($row["author_web"]), "author_comment" => utf8_normalize($row["author_comment"]), "author_lieu" => utf8_normalize($row["author_lieu"]), "author_ville" => utf8_normalize($row["author_ville"]), "author_pays" => utf8_normalize($row["author_pays"]), "author_subdivision" => utf8_normalize($row["author_subdivision"]), "author_numero" => utf8_normalize($row["author_numero"])); if (method_exists($this->proxy_parent, "pmbesAutLinks_getLinks")) { $result['author_links'] = $this->proxy_parent->pmbesAutLinks_getLinks(1, $author_id); } else { $result['author_links'] = array(); } return $result; }
function get_empr_information($idempr) { global $pmb_lecteurs_localises, $deflt_docs_location; global $dbh; global $msg; if (SESSrights & CIRCULATION_AUTH) { $result = array(); $empr_id += 0; if (!$idempr) { throw new Exception("Missing parameter: idempr"); } $sql = "SELECT id_empr, empr_cb, empr_nom, empr_prenom FROM empr WHERE id_empr = " . $idempr; $res = pmb_mysql_query($sql); if (!$res) { throw new Exception("Not found: idempr = " . $idempr); } $row = pmb_mysql_fetch_assoc($res); $result = $row; return $result; } else { return array(); } }
function fetch_data() { global $dbh; $this->docs_location_data = array(); if ($this->id) { $requete = "SELECT * FROM sur_location WHERE surloc_id='" . $this->id . "' LIMIT 1"; $res = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}"); if (pmb_mysql_num_rows($res)) { $row = pmb_mysql_fetch_object($res); } $this->libelle = $row->surloc_libelle; $this->pic = $row->surloc_pic; $this->visible_opac = $row->surloc_visible_opac; $this->name = $row->surloc_name; $this->adr1 = $row->surloc_adr1; $this->adr2 = $row->surloc_adr2; $this->cp = $row->surloc_cp; $this->town = $row->surloc_town; $this->state = $row->surloc_state; $this->country = $row->surloc_country; $this->phone = $row->surloc_phone; $this->email = $row->surloc_email; $this->website = $row->surloc_website; $this->logo = $row->surloc_logo; $this->comment = $row->surloc_comment; $this->num_infopage = $row->surloc_num_infopage; $this->css_style = $row->surloc_css_style; $requete = "SELECT * FROM docs_location where surloc_num='" . $this->id . "' or surloc_num=0 ORDER BY location_libelle"; } else { $requete = "SELECT * FROM docs_location where surloc_num=0 ORDER BY location_libelle"; } $myQuery = pmb_mysql_query($requete, $dbh); while ($r = pmb_mysql_fetch_assoc($myQuery)) { $this->docs_location_data[] = $r; } $this->get_list(); }
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; }
} print "<br /><br /><h2 align='center'>" . htmlentities($msg["nettoyage_synchrordfstore_reindexation"], ENT_QUOTES, $charset) . "</h2>"; $NoIndex = 1; $query = pmb_mysql_query("select notice_id from notices order by notice_id LIMIT {$start}, {$lot}"); if (pmb_mysql_num_rows($query)) { // définition de l'état de la jauge $state = floor($start / ($count / $jauge_size)); $state .= "px"; // mise à jour de l'affichage de la jauge print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge' width='100%'>"; print "<img src='../../images/jauge.png' width='{$state}' height='16px'></td></tr></table>"; // calcul pourcentage avancement $percent = floor($start / $count * 100); // affichage du % d'avancement et de l'état print "<div align='center'>{$percent}%</div>"; while ($mesNotices = pmb_mysql_fetch_assoc($query)) { $synchro_rdf->addRdf($mesNotices['notice_id'], 0); $notice = new notice($mesNotices['notice_id']); $niveauB = strtolower($notice->biblio_level); //Si c'est un article, il faut réindexer son bulletin if ($niveauB == 'a') { $bulletin = analysis::getBulletinIdFromAnalysisId($mesNotices['notice_id']); $synchro_rdf->addRdf(0, $bulletin); } } pmb_mysql_free_result($query); $next = $start + $lot; print "\n\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t<input type='hidden' name='start' value=\"{$next}\">\n\t<input type='hidden' name='count' value=\"{$count}\">\n\t</form>\n\t<script type=\"text/javascript\"><!-- \n\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t-->\n\t</script>"; } else { $spec = $spec - INDEX_SYNCHRORDFSTORE; $compte = 0;
function get_form($action, $id_notice = 0, $retour = 'link', $article = false) { // construit le formulaire de catalogage pré-rempli global $msg, $dbh, $charset, $current_module; global $include_path; global $base_path; global $znotices_id; global $item; $fonction = new marc_list('function'); $this->action = $action; include "{$include_path}/templates/z3950_form.tpl.php"; global $bt_undo; // mise à jour de l'entête du formulaire $form_notice = str_replace('!!libelle_form!!', $this->libelle_form, $form_notice); // mise à jour des flags de niveau hiérarchique $form_notice = str_replace('!!b_level!!', $this->bibliographic_level, $form_notice); $form_notice = str_replace('!!h_level!!', $this->hierarchic_level, $form_notice); for ($i = 0; $i < 4; $i++) { z3950_notice::substitute("title_{$i}", $this->titles[$i], $ptab[0]); } z3950_notice::substitute("serie", $this->serie, $ptab[0]); z3950_notice::substitute("nbr_in_serie", $this->nbr_in_serie, $ptab[0]); $form_notice = str_replace('!!tab0!!', $ptab[0], $form_notice); // mise à jour de l'onglet 1 // constitution de la mention de responsabilité $nb_autres_auteurs = 0; $nb_auteurs_secondaires = 0; //print "<pre>";print_r($this->aut_array);print "</pre>"; for ($as = 0; $as < sizeof($this->aut_array); $as++) { if ($this->aut_array[$as]["responsabilite"] === 0) { $numrows = 0; if ($this->aut_array[$as]["date"]) { $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "' AND author_date ='" . addslashes($this->aut_array[$as]["date"]) . "'"; $res = pmb_mysql_query($sql_author_find); $numrows = pmb_mysql_num_rows($res); } if (!$numrows) { $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "'"; $res = pmb_mysql_query($sql_author_find); $numrows = pmb_mysql_num_rows($res); } if ($numrows == 1) { $existing_author = pmb_mysql_fetch_array($res); $existing_author_id = $existing_author["author_id"]; } else { $existing_author_id = 0; } z3950_notice::substitute("author0_type_use_existing", $existing_author_id ? "checked" : "", $ptab[1]); z3950_notice::substitute("author0_type_insert_new", $existing_author_id ? "" : "checked", $ptab[1]); if ($existing_author_id) { z3950_notice::substitute("f_author_name_0_existing", $existing_author["author_name"] . ", " . $existing_author["author_rejete"] . ($existing_author["author_date"] ? " (" . $existing_author["author_date"] . ")" : ""), $ptab[1]); z3950_notice::substitute("f_aut0_existing_id", $existing_author_id, $ptab[1]); } else { z3950_notice::substitute("f_author_name_0_existing", '', $ptab[1]); z3950_notice::substitute("f_aut0_existing_id", 0, $ptab[1]); } z3950_notice::substitute("author_name_0", $this->aut_array[$as]["entree"], $ptab[1]); z3950_notice::substitute("author_rejete_0", $this->aut_array[$as]["rejete"], $ptab[1]); z3950_notice::substitute("author_date_0", $this->aut_array[$as]["date"], $ptab[1]); z3950_notice::substitute("author_function_0", $this->aut_array[$as]["fonction"], $ptab[1]); z3950_notice::substitute("author_function_label_0", $fonction->table[$this->aut_array[$as]["fonction"]], $ptab[1]); z3950_notice::substitute("author_lieu_0", $this->aut_array[$as]["lieu"], $ptab[1]); z3950_notice::substitute("author_pays_0", $this->aut_array[$as]["pays"], $ptab[1]); z3950_notice::substitute("author_comment_0", $this->aut_array[$as]["author_comment"], $ptab[1]); z3950_notice::substitute("author_ville_0", $this->aut_array[$as]["ville"], $ptab[1]); z3950_notice::substitute("author_subdivision_0", $this->aut_array[$as]["subdivision"], $ptab[1]); z3950_notice::substitute("author_numero_0", $this->aut_array[$as]["numero"], $ptab[1]); z3950_notice::substitute("author_web_0", $this->aut_array[$as]["web"], $ptab[1]); z3950_notice::substitute("authority_number_0", $this->aut_array[$as]["authority_number"], $ptab[1]); for ($type = 70; $type <= 72; $type++) { if ($this->aut_array[$as]["type_auteur"] == $type) { $sel = " selected"; } else { $sel = ""; } z3950_notice::substitute("author_type_" . $type . "_0", $sel, $ptab[1]); if ($this->aut_array[$as]["type_auteur"] == '70') { z3950_notice::substitute('display_0', 'none', $ptab[1]); } else { z3950_notice::substitute('display_0', '', $ptab[1]); } } } if ($this->aut_array[$as]["responsabilite"] == 1) { if ($this->aut_array[$as]["entree"] == "") { continue; } $ptab_aut_autres = str_replace('!!iaut!!', $nb_autres_auteurs, $ptab[11]); $numrows = 0; if ($this->aut_array[$as]["date"]) { $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "' AND author_date ='" . addslashes($this->aut_array[$as]["date"]) . "'"; $res = pmb_mysql_query($sql_author_find); $numrows = pmb_mysql_num_rows($res); } if (!$numrows) { $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "'"; $res = pmb_mysql_query($sql_author_find); $numrows = pmb_mysql_num_rows($res); } if ($numrows == 1) { $existing_author = pmb_mysql_fetch_array($res); $existing_author_id = $existing_author["author_id"]; } else { $existing_author_id = 0; } z3950_notice::substitute("author1_type_use_existing_", $existing_author_id ? "checked" : "", $ptab_aut_autres); z3950_notice::substitute("author1_type_insert_new_", $existing_author_id ? "" : "checked", $ptab_aut_autres); if ($existing_author_id) { z3950_notice::substitute("f_aut1", $existing_author["author_name"] . ", " . $existing_author["author_rejete"] . ($existing_author["author_date"] ? " (" . $existing_author["author_date"] . ")" : ""), $ptab_aut_autres); z3950_notice::substitute("f_aut1_id", $existing_author_id, $ptab_aut_autres); } else { z3950_notice::substitute("f_aut1", '', $ptab_aut_autres); z3950_notice::substitute("f_aut1_id", '', $ptab_aut_autres); } z3950_notice::substitute("author_name_1", $this->aut_array[$as]["entree"], $ptab_aut_autres); z3950_notice::substitute("author_rejete_1", $this->aut_array[$as]["rejete"], $ptab_aut_autres); z3950_notice::substitute("author_date_1", $this->aut_array[$as]["date"], $ptab_aut_autres); z3950_notice::substitute("author_function_1", $this->aut_array[$as]["fonction"], $ptab_aut_autres); z3950_notice::substitute("author_function_label_1", $fonction->table[$this->aut_array[$as]["fonction"]], $ptab_aut_autres); z3950_notice::substitute("author_lieu_1", $this->aut_array[$as]["lieu"], $ptab_aut_autres); z3950_notice::substitute("author_pays_1", $this->aut_array[$as]["pays"], $ptab_aut_autres); z3950_notice::substitute("author_comment_1", $this->aut_array[$as]["author_comment"], $ptab_aut_autres); z3950_notice::substitute("author_ville_1", $this->aut_array[$as]["ville"], $ptab_aut_autres); z3950_notice::substitute("author_subdivision_1", $this->aut_array[$as]["subdivision"], $ptab_aut_autres); z3950_notice::substitute("author_numero_1", $this->aut_array[$as]["numero"], $ptab_aut_autres); z3950_notice::substitute("author_web_1", $this->aut_array[$as]["web"], $ptab_aut_autres); z3950_notice::substitute("authority_number_1", $this->aut_array[$as]["authority_number"], $ptab_aut_autres); for ($type = 70; $type <= 72; $type++) { if ($this->aut_array[$as]["type_auteur"] == $type) { $sel = " selected"; } else { $sel = ""; } z3950_notice::substitute("author_type_" . $type . "_1", $sel, $ptab_aut_autres); if ($this->aut_array[$as]["type_auteur"] == '70') { z3950_notice::substitute('display_1' . $nb_autres_auteurs, 'none', $ptab_aut_autres); } else { z3950_notice::substitute('display_1' . $nb_autres_auteurs, '', $ptab_aut_autres); } } $autres_auteurs .= $ptab_aut_autres; $nb_autres_auteurs++; } if ($this->aut_array[$as]["responsabilite"] == 2) { if ($this->aut_array[$as]["entree"] == "") { continue; } $ptab_aut_autres = str_replace('!!iaut!!', $nb_auteurs_secondaires, $ptab[12]); $numrows = 0; if ($this->aut_array[$as]["date"]) { $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "' AND author_date ='" . addslashes($this->aut_array[$as]["date"]) . "'"; $res = pmb_mysql_query($sql_author_find); $numrows = pmb_mysql_num_rows($res); } if (!$numrows) { $sql_author_find = "SELECT author_id, author_name, author_rejete, author_date FROM authors WHERE author_name = '" . addslashes($this->aut_array[$as]["entree"]) . "' AND author_rejete = '" . addslashes($this->aut_array[$as]["rejete"]) . "' AND author_type = '" . $this->aut_array[$as]["type_auteur"] . "'"; $res = pmb_mysql_query($sql_author_find); $numrows = pmb_mysql_num_rows($res); } if ($numrows == 1) { $existing_author = pmb_mysql_fetch_array($res); $existing_author_id = $existing_author["author_id"]; } else { $existing_author_id = 0; } z3950_notice::substitute("author2_type_use_existing_", $existing_author_id ? "checked" : "", $ptab_aut_autres); z3950_notice::substitute("author2_type_insert_new_", $existing_author_id ? "" : "checked", $ptab_aut_autres); if ($existing_author_id) { z3950_notice::substitute("f_aut2", $existing_author["author_name"] . ", " . $existing_author["author_rejete"] . ($existing_author["author_date"] ? " (" . $existing_author["author_date"] . ")" : ""), $ptab_aut_autres); z3950_notice::substitute("f_aut2_id", $existing_author_id, $ptab_aut_autres); } else { z3950_notice::substitute("f_aut2", '', $ptab_aut_autres); z3950_notice::substitute("f_aut2_id", 0, $ptab_aut_autres); } z3950_notice::substitute("author_name_2", $this->aut_array[$as]["entree"], $ptab_aut_autres); z3950_notice::substitute("author_rejete_2", $this->aut_array[$as]["rejete"], $ptab_aut_autres); z3950_notice::substitute("author_date_2", $this->aut_array[$as]["date"], $ptab_aut_autres); z3950_notice::substitute("author_function_2", $this->aut_array[$as]["fonction"], $ptab_aut_autres); z3950_notice::substitute("author_function_label_2", $fonction->table[$this->aut_array[$as]["fonction"]], $ptab_aut_autres); z3950_notice::substitute("author_lieu_2", $this->aut_array[$as]["lieu"], $ptab_aut_autres); z3950_notice::substitute("author_pays_2", $this->aut_array[$as]["pays"], $ptab_aut_autres); z3950_notice::substitute("author_comment_2", $this->aut_array[$as]["author_comment"], $ptab_aut_autres); z3950_notice::substitute("author_ville_2", $this->aut_array[$as]["ville"], $ptab_aut_autres); z3950_notice::substitute("author_subdivision_2", $this->aut_array[$as]["subdivision"], $ptab_aut_autres); z3950_notice::substitute("author_numero_2", $this->aut_array[$as]["numero"], $ptab_aut_autres); z3950_notice::substitute("author_web_2", $this->aut_array[$as]["web"], $ptab_aut_autres); z3950_notice::substitute("authority_number_2", $this->aut_array[$as]["authority_number"], $ptab_aut_autres); for ($type = 70; $type <= 72; $type++) { if ($this->aut_array[$as]["type_auteur"] == $type) { $sel = " selected"; } else { $sel = ""; } z3950_notice::substitute("author_type_" . $type . "_2", $sel, $ptab_aut_autres); if ($this->aut_array[$as]["type_auteur"] == '70') { z3950_notice::substitute('display_2' . $nb_auteurs_secondaires, 'none', $ptab_aut_autres); } else { z3950_notice::substitute('display_2' . $nb_auteurs_secondaires, '', $ptab_aut_autres); } } $auteurs_secondaires .= $ptab_aut_autres; $nb_auteurs_secondaires++; } } // au cas ou pas d'auteur principal : on fait le ménage dans le formulaire z3950_notice::substitute("author_name_0", "", $ptab[1]); z3950_notice::substitute("author_rejete_0", "", $ptab[1]); z3950_notice::substitute("author_date_0", "", $ptab[1]); z3950_notice::substitute("author_function_0", "", $ptab[1]); z3950_notice::substitute("author_function_label_0", "", $ptab[1]); z3950_notice::substitute("f_author_name_0_existing", "", $ptab[1]); z3950_notice::substitute("f_aut0_existing_id", "", $ptab[1]); z3950_notice::substitute("author0_type_use_existing", "", $ptab[1]); z3950_notice::substitute("author0_type_insert_new", "checked", $ptab[1]); z3950_notice::substitute("author_lieu_0", "", $ptab[1]); z3950_notice::substitute("author_pays_0", "", $ptab[1]); z3950_notice::substitute("author_comment_0", "", $ptab[1]); z3950_notice::substitute("author_ville_0", "", $ptab[1]); z3950_notice::substitute("author_subdivision_0", "", $ptab[1]); z3950_notice::substitute("author_numero_0", "", $ptab[1]); z3950_notice::substitute("author_web_0", "", $ptab[1]); z3950_notice::substitute("authority_number_0", "", $ptab[1]); z3950_notice::substitute('display_0', 'none', $ptab[1]); $ptab[1] = str_replace('!!max_aut1!!', $nb_autres_auteurs + 1, $ptab[1]); $ptab[1] = str_replace('!!iaut_added1!!', $nb_autres_auteurs, $ptab[1]); $ptab[1] = str_replace('!!max_aut2!!', $nb_auteurs_secondaires + 1, $ptab[1]); $ptab[1] = str_replace('!!iaut_added2!!', $nb_auteurs_secondaires, $ptab[1]); $ptab[1] = str_replace('!!autres_auteurs!!', $autres_auteurs, $ptab[1]); $ptab[1] = str_replace('!!auteurs_secondaires!!', $auteurs_secondaires, $ptab[1]); $form_notice = str_replace('!!tab1!!', $ptab[1], $form_notice); //Editeur 1 //On tente avec toutes les infos if ($this->editors[0]['name'] && $this->editors[0]['ville']) { $sql_find_publisher = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[0]['name']) . "' AND ed_ville = '" . addslashes($this->editors[0]['ville']) . "'"; $res = pmb_mysql_query($sql_find_publisher); if (pmb_mysql_num_rows($res) == 1) { $existing_publisher = pmb_mysql_fetch_array($res); $existing_publisher_id = $existing_publisher["ed_id"]; } } //Non? Le nom sans ville peut être alors? if (!$existing_publisher_id && $this->editors[0]['name']) { $sql_find_publisher = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[0]['name']) . "' AND ed_ville = ''"; $res = pmb_mysql_query($sql_find_publisher); if (pmb_mysql_num_rows($res) == 1) { $existing_publisher = pmb_mysql_fetch_array($res); $existing_publisher_id = $existing_publisher["ed_id"]; } } //Juste le nom alors? if (!$existing_publisher_id && $this->editors[0]['name'] && !$this->editors[0]['ville']) { $sql_find_publisher = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[0]['name']) . "'"; $res = pmb_mysql_query($sql_find_publisher); if (pmb_mysql_num_rows($res) == 1) { $existing_publisher = pmb_mysql_fetch_array($res); $existing_publisher_id = $existing_publisher["ed_id"]; } } if (!$existing_publisher_id) { $existing_publisher_id = 0; } z3950_notice::substitute("editor_type_use_existing", $existing_publisher_id ? 'checked' : '', $ptab[2]); z3950_notice::substitute("editor_type_insert_new", $existing_publisher_id ? '' : 'checked', $ptab[2]); if ($existing_publisher_id) { $editor = new editeur($existing_publisher_id); $editor_display = $editor->display; if (!$editor_display) { $info_ville = $existing_publisher["ed_ville"] ? ' (' . $existing_publisher["ed_ville"] . ')' : ""; $editor_display = $existing_publisher["ed_name"] . $info_ville; } z3950_notice::substitute("f_ed1", $editor_display, $ptab[2]); z3950_notice::substitute("f_ed1_id", $existing_publisher_id, $ptab[2]); } else { z3950_notice::substitute("f_ed1", '', $ptab[2]); z3950_notice::substitute("f_ed1_id", '', $ptab[2]); } z3950_notice::substitute("editor_name_0", $this->editors[0]['name'], $ptab[2]); z3950_notice::substitute("editor_ville_0", $this->editors[0]['ville'], $ptab[2]); //Editeur 2 //On tente avec toutes les infos if ($this->editors[1]['name'] && $this->editors[1]['ville']) { $sql_find_publisher2 = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[1]['name']) . "' AND ed_ville = '" . addslashes($this->editors[1]['ville']) . "'"; $res = pmb_mysql_query($sql_find_publisher2); if (pmb_mysql_num_rows($res) == 1) { $existing_publisher2 = pmb_mysql_fetch_array($res); $existing_publisher_id2 = $existing_publisher2["ed_id"]; } } //Non? Le nom sans ville peut être alors? if (!$existing_publisher_id2 && $this->editors[1]['name']) { $sql_find_publisher2 = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[1]['name']) . "' AND ed_ville = ''"; $res = pmb_mysql_query($sql_find_publisher2); if (pmb_mysql_num_rows($res) == 1) { $existing_publisher2 = pmb_mysql_fetch_array($res); $existing_publisher_id2 = $existing_publisher2["ed_id"]; } } //Juste le nom alors? if (!$existing_publisher_id2 && $this->editors[1]['name'] && !$this->editors[1]['ville']) { $sql_find_publisher2 = "SELECT ed_id,ed_ville,ed_name FROM publishers WHERE ed_name = '" . addslashes($this->editors[1]['name']) . "'"; $res = pmb_mysql_query($sql_find_publisher2); if (pmb_mysql_num_rows($res) == 1) { $existing_publisher2 = pmb_mysql_fetch_array($res); $existing_publisher_id2 = $existing_publisher2["ed_id"]; } } if (!$existing_publisher_id2) { $existing_publisher_id2 = 0; } z3950_notice::substitute("editor1_type_use_existing", $existing_publisher_id2 ? 'checked' : '', $ptab[2]); z3950_notice::substitute("editor1_type_insert_new", $existing_publisher_id2 ? '' : 'checked', $ptab[2]); if ($existing_publisher_id2) { $editor = new editeur($existing_publisher_id2); $editor_display = $editor->display; if (!$editor_display) { $info_ville = $existing_publisher2["ed_ville"] ? ' (' . $existing_publisher2["ed_ville"] . ')' : ""; $editor_display = $existing_publisher2["ed_name"] . $info_ville; } z3950_notice::substitute("f_ed11", $editor_display, $ptab[2]); z3950_notice::substitute("f_ed11_id", $existing_publisher_id2, $ptab[2]); } else { z3950_notice::substitute("f_ed11", '', $ptab[2]); z3950_notice::substitute("f_ed11_id", '', $ptab[2]); } z3950_notice::substitute("editor_name_1", $this->editors[1]['name'], $ptab[2]); z3950_notice::substitute("editor_ville_1", $this->editors[1]['ville'], $ptab[2]); //Collection if ($existing_publisher_id && $this->collection['name']) { $sql_collection_find = "SELECT collection_id, collection_name FROM collections WHERE collection_name = '" . addslashes($this->collection['name']) . "' AND collection_parent = '" . $existing_publisher_id . "'"; $res = pmb_mysql_query($sql_collection_find); if (pmb_mysql_num_rows($res) == 1) { $existing_collection = pmb_mysql_fetch_array($res); $existing_collection_id = $existing_collection["collection_id"]; } else { $existing_collection_id = 0; } } else { $existing_collection_id = 0; } z3950_notice::substitute("collection_type_use_existing", $existing_collection_id ? 'checked' : '', $ptab[2]); z3950_notice::substitute("collection_type_insert_new", $existing_collection_id ? '' : 'checked', $ptab[2]); if ($existing_collection_id) { z3950_notice::substitute("f_coll_existing", $existing_collection["collection_name"], $ptab[2]); z3950_notice::substitute("f_coll_existing_id", $existing_collection_id, $ptab[2]); } else { z3950_notice::substitute("f_coll_existing", '', $ptab[2]); z3950_notice::substitute("f_coll_existing_id", '0', $ptab[2]); } z3950_notice::substitute("collection_name", $this->collection['name'], $ptab[2]); z3950_notice::substitute("collection_issn", $this->collection['issn'], $ptab[2]); //Sous Collection if ($existing_collection_id && $this->subcollection['name']) { $sql_subcollection_find = "SELECT sub_coll_id, sub_coll_name FROM sub_collections WHERE sub_coll_name = '" . addslashes($this->subcollection['name']) . "' AND sub_coll_parent = '" . $existing_collection_id . "'"; $res = pmb_mysql_query($sql_subcollection_find) or die(pmb_mysql_error() . "<br />{$sql_subcollection_find}"); if (pmb_mysql_num_rows($res) == 1) { $existing_subcollection = pmb_mysql_fetch_array($res); $existing_subcollection_id = $existing_subcollection["sub_coll_id"]; } else { $existing_subcollection_id = 0; } } else { $existing_subcollection_id = 0; } z3950_notice::substitute("subcollection_type_use_existing", $existing_subcollection_id ? 'checked' : '', $ptab[2]); z3950_notice::substitute("subcollection_type_insert_new", $existing_subcollection_id ? '' : 'checked', $ptab[2]); if ($existing_subcollection_id) { z3950_notice::substitute("f_subcoll_existing", $existing_subcollection["sub_coll_name"], $ptab[2]); z3950_notice::substitute("f_subcoll_existing_id", $existing_subcollection_id, $ptab[2]); } else { z3950_notice::substitute("f_subcoll_existing", '', $ptab[2]); z3950_notice::substitute("f_subcoll_existing_id", '0', $ptab[2]); } z3950_notice::substitute("subcollection_name", $this->subcollection['name'], $ptab[2]); z3950_notice::substitute("subcollection_issn", $this->subcollection['issn'], $ptab[2]); z3950_notice::substitute("nbr_in_collection", $this->nbr_in_collection, $ptab[2]); z3950_notice::substitute("year", $this->year, $ptab[2]); z3950_notice::substitute("mention_edition", $this->mention_edition, $ptab[2]); $form_notice = str_replace('!!tab2!!', $ptab[2], $form_notice); z3950_notice::substitute("isbn", $this->isbn, $ptab[3]); $form_notice = str_replace('!!tab3!!', $ptab[3], $form_notice); z3950_notice::substitute("page_nbr", $this->page_nbr, $ptab[4]); z3950_notice::substitute("illustration", $this->illustration, $ptab[4]); z3950_notice::substitute("prix", $this->prix, $ptab[4]); z3950_notice::substitute("accompagnement", $this->accompagnement, $ptab[4]); z3950_notice::substitute("size", $this->size, $ptab[4]); $form_notice = str_replace('!!tab4!!', $ptab[4], $form_notice); z3950_notice::substitute("general_note", $this->general_note, $ptab[5]); z3950_notice::substitute("content_note", $this->content_note, $ptab[5]); z3950_notice::substitute("abstract_note", $this->abstract_note, $ptab[5]); $form_notice = str_replace('!!tab5!!', $ptab[5], $form_notice); // indexation interne $pclassement_sql = "SELECT * FROM pclassement"; $res = pmb_mysql_query($pclassement_sql); $pclassement_count = pmb_mysql_num_rows($res); if (!$pclassement_count) { $pclassement_count = 1; } if ($pclassement_count > 1) { $pclassements = array(); while ($row = pmb_mysql_fetch_assoc($res)) { $pclassements[] = array("id" => $row["id_pclass"], "name" => $row["name_pclass"]); } $pclassement_combobox = '<select name="f_indexint_new_pclass">'; foreach ($pclassements as $pclassement) { $pclassement_combobox .= '<option value="' . $pclassement["id"] . '">' . $pclassement["name"] . '</option>'; } $pclassement_combobox .= '</select>'; } else { $pclassement_combobox = ""; } $ptab[6] = str_replace("!!multiple_pclass_combo_box!!", $pclassement_combobox, $ptab[6]); $index_int_sql = "SELECT indexint_name, indexint_comment, indexint_id, name_pclass FROM indexint LEFT JOIN pclassement ON (pclassement.id_pclass = indexint.num_pclass) WHERE indexint_name = '" . addslashes($this->dewey[0]) . "'"; $res = pmb_mysql_query($index_int_sql, $dbh); $num_rows = pmb_mysql_num_rows($res); if ($num_rows == 1) { $the_row = pmb_mysql_fetch_assoc($res); z3950_notice::substitute("indexint", $the_row["indexint_name"] . ': ' . $the_row["indexint_comment"], $ptab[6]); z3950_notice::substitute("indexint_id", $the_row["indexint_id"], $ptab[6]); z3950_notice::substitute("indexint_type_use_existing", 'checked', $ptab[6]); z3950_notice::substitute("indexint_type_insert_new", '', $ptab[6]); z3950_notice::substitute("multiple_index_int_propositions", '', $ptab[6]); } else { if ($num_rows > 1) { $index_ints = array(); while ($row = pmb_mysql_fetch_assoc($res)) { $index_ints[] = array("id" => $row["indexint_id"], "name" => $row["indexint_name"], "comment" => $row["indexint_comment"], "pclass" => $row["name_pclass"]); } $form_indexint_proposition = "<ul>"; foreach ($index_ints as $index_int) { $form_indexint_proposition .= "<li><b>[" . $index_int["pclass"] . "]</b> " . $index_int["name"] . ": " . $index_int["comment"] . ' '; $jsaction = "document.getElementById('indexint_type_use_existing').checked=1; document.getElementById('f_indexint').value='" . addslashes($index_int["name"] . ' - ' . $index_int["comment"]) . "'; document.getElementById('f_indexint_id').value='" . addslashes($index_int["id"]) . "'"; $form_indexint_proposition .= '<input type="button" class="bouton" value="' . $msg["notice_integre_indexint_use"] . '" onclick="' . $jsaction . '">'; $form_indexint_proposition .= '</li>'; } $form_indexint_proposition .= "</ul>"; $ptab[6] = str_replace("!!multiple_index_int_propositions!!", $form_indexint_proposition, $ptab[6]); z3950_notice::substitute("indexint", "", $ptab[6]); z3950_notice::substitute("indexint_id", "", $ptab[6]); z3950_notice::substitute("indexint_type_use_existing", 'checked', $ptab[6]); z3950_notice::substitute("indexint_type_insert_new", '', $ptab[6]); } else { z3950_notice::substitute("indexint", "", $ptab[6]); z3950_notice::substitute("indexint_id", "", $ptab[6]); z3950_notice::substitute("indexint_type_use_existing", '', $ptab[6]); z3950_notice::substitute("indexint_type_insert_new", 'checked', $ptab[6]); z3950_notice::substitute("multiple_index_int_propositions", '', $ptab[6]); } } z3950_notice::substitute("indexint_new_name", $this->dewey[0], $ptab[6]); z3950_notice::substitute("indexint_new_comment", "", $ptab[6]); // indexation libre z3950_notice::substitute("f_free_index", $this->free_index, $ptab[6]); global $pmb_keyword_sep; $sep = "'{$pmb_keyword_sep}'"; if (!$pmb_keyword_sep) { $sep = "' '"; } if (ord($pmb_keyword_sep) == 0xa || ord($pmb_keyword_sep) == 0xd) { $sep = $msg['catalogue_saut_de_ligne']; } $ptab[6] = str_replace("!!sep!!", htmlentities($sep, ENT_QUOTES, $charset), $ptab[6]); $form_notice = str_replace('!!tab6!!', $ptab[6], $form_notice); // Gestion des titres uniformes $nb_tu = sizeof($this->tu_500); for ($i = 0; $i < $nb_tu; $i++) { $value_tu[$i]['name'] = $this->tu_500[$i]['a']; $ntu_data[$i]->tu->name = $this->tu_500[$i]['a']; $value_tu[$i]['tonalite'] = $this->tu_500[$i]['u']; for ($j = 0; $j < count($this->tu_500_r[$i]); $j++) { $value_tu[$i]['distrib'][$j] = $this->tu_500_r[$i][$j]; } for ($j = 0; $j < count($this->tu_500_s[$i]); $j++) { $value_tu[$i]['ref'][$j] = $this->tu_500_s[$i][$j]; } if ($tu_id = titre_uniforme::import_tu_exist($value_tu, 1)) { // le titre uniforme est déjà existant $ntu_data[$i]->num_tu = $tu_id; } else { // le titre uniforme n'est pas existant for ($j = 0; $j < count($this->tu_500_n[$i]); $j++) { $value_tu[$i]['comment'] .= $this->tu_500_r[$i][$j]; if ($j + 1 < count($this->tu_500_n[$i])) { $value_tu[$i]['comment'] .= "\n"; } } for ($j = 0; $j < count($this->tu_500_j[$i]); $j++) { $value_tu[$i]['subdiv'][$j] = $this->tu_500_j[$i][$j]; } } // memorisation du niveau biblio de ce titre uniforme for ($j = 0; $j < count($this->tu_500_i[$i]); $j++) { $ntu_data[$i]->titre .= $this->tu_500_i[$i][$j]; if ($j + 1 < count($this->tu_500_i[$i])) { $ntu_data[$i]->titre .= "; "; } } $ntu_data[$i]->date = $this->tu_500[$i]['k']; for ($j = 0; $j < count($this->tu_500_l[$i]); $j++) { $ntu_data[$i]->sous_vedette .= $this->tu_500_l[$i][$j]; if ($j + 1 < count($this->tu_500_l[$i])) { $ntu_data[$i]->sous_vedette .= "; "; } } $ntu_data[$i]->langue = $this->tu_500[$i]['m']; $ntu_data[$i]->version = $this->tu_500[$i]['q']; $ntu_data[$i]->mention = $this->tu_500[$i]['w']; } // serialisation des champs de l'autorité titre uniforme global $pmb_use_uniform_title; if ($pmb_use_uniform_title) { $memo_value_tu = "<input type='hidden' name='memo_value_tu' value=\"" . rawurlencode(serialize($value_tu)) . "\">"; $ptab[230] = str_replace("!!titres_uniformes!!", $memo_value_tu . tu_notice::get_form_import("notice", $ntu_data), $ptab[230]); $form_notice = str_replace('!!tab230!!', $ptab[230], $form_notice); } // mise à jour de l'onglet 7 : langues // langues répétables $lang = new marc_list('lang'); if (sizeof($this->language_code) == 0) { $max_lang = 1; } else { $max_lang = sizeof($this->language_code); } for ($i = 0; $i < $max_lang; $i++) { if ($i) { $ptab_lang = str_replace('!!ilang!!', $i, $ptab[701]); } else { $ptab_lang = str_replace('!!ilang!!', $i, $ptab[70]); } if (sizeof($this->language_code) == 0) { $ptab_lang = str_replace('!!lang_code!!', '', $ptab_lang); $ptab_lang = str_replace('!!lang!!', '', $ptab_lang); } else { $ptab_lang = str_replace('!!lang_code!!', $this->language_code[$i], $ptab_lang); $ptab_lang = str_replace('!!lang!!', htmlentities($lang->table[$this->language_code[$i]], ENT_QUOTES, $charset), $ptab_lang); } $lang_repetables .= $ptab_lang; } $ptab[7] = str_replace('!!max_lang!!', $max_lang, $ptab[7]); $ptab[7] = str_replace('!!langues_repetables!!', $lang_repetables, $ptab[7]); // langues originales répétables if (sizeof($this->original_language_code) == 0) { $max_langorg = 1; } else { $max_langorg = sizeof($this->original_language_code); } for ($i = 0; $i < $max_langorg; $i++) { if ($i) { $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[711]); } else { $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[71]); } if (sizeof($this->original_language_code) == 0) { $ptab_lang = str_replace('!!langorg_code!!', '', $ptab_lang); $ptab_lang = str_replace('!!langorg!!', '', $ptab_lang); } else { $ptab_lang = str_replace('!!langorg_code!!', $this->original_language_code[$i], $ptab_lang); $ptab_lang = str_replace('!!langorg!!', htmlentities($lang->table[$this->original_language_code[$i]], ENT_QUOTES, $charset), $ptab_lang); } $langorg_repetables .= $ptab_lang; } $ptab[7] = str_replace('!!max_langorg!!', $max_langorg, $ptab[7]); $ptab[7] = str_replace('!!languesorg_repetables!!', $langorg_repetables, $ptab[7]); $form_notice = str_replace('!!tab7!!', $ptab[7], $form_notice); z3950_notice::substitute("link_url", $this->link_url, $ptab[8]); z3950_notice::substitute("link_format", $this->link_format, $ptab[8]); $form_notice = str_replace('!!tab8!!', $ptab[8], $form_notice); // définition de la page cible du form $form_notice = str_replace('!!action!!', $this->action, $form_notice); // ajout des selecteurs $select_doc = new marc_select('doctype', 'typdoc', $this->document_type); $form_notice = str_replace('!!document_type!!', $select_doc->display, $form_notice); if ($article) { $form_notice = str_replace('!!checked_mono!!', "", $form_notice); $form_notice = str_replace('!!checked_perio!!', "", $form_notice); $form_notice = str_replace('!!checked_art!!', "selected=\"selected\"", $form_notice); } else { if ($this->bibliographic_level == 's') { $form_notice = str_replace('!!checked_mono!!', "", $form_notice); $form_notice = str_replace('!!checked_perio!!', "selected=\"selected\"", $form_notice); $form_notice = str_replace('!!checked_art!!', "", $form_notice); } else { $form_notice = str_replace('!!checked_mono!!', "selected=\"selected\"", $form_notice); $form_notice = str_replace('!!checked_perio!!', "", $form_notice); $form_notice = str_replace('!!checked_art!!', "", $form_notice); } } //Zone des perios et des bulletins pour les articles $zone_article_form = str_replace("!!perio_titre!!", $this->perio_titre[0], $zone_article_form); $zone_article_form = str_replace("!!perio_issn!!", $this->perio_issn[0], $zone_article_form); $zone_article_form = str_replace("!!bull_date!!", $this->bull_mention[0], $zone_article_form); $zone_article_form = str_replace("!!bull_titre!!", $this->bull_titre[0], $zone_article_form); $zone_article_form = str_replace("!!bull_num!!", $this->bull_num[0], $zone_article_form); if ($this->bull_date[0]) { $date_date_formatee = formatdate_input($this->bull_date[0]); $date_date_hid = $this->bull_date[0]; } else { $date_date_formatee = ''; $date_date_hid = ''; } $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=notice&date_caller=¶m1=f_bull_new_date¶m2=date_date_lib&auto_submit=NO&date_anterieure=YES', 'date_date', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\" "; $date_date = "<input type='hidden' id='f_bull_new_date' name='f_bull_new_date' value='{$date_date_hid}' />\n\t\t\t<input class='saisie-10em' type='text' name='date_date_lib' value='" . $date_date_formatee . "' placeholder='" . $msg["format_date_input_placeholder"] . "' />\n\t\t\t<input class='bouton' type='button' name='date_date_lib_bouton' value='" . $msg["bouton_calendrier"] . "' " . $date_clic . " />"; $zone_article_form = str_replace("!!date_date!!", $date_date, $zone_article_form); //On cherche si le perio existe if ($this->perio_titre[0] && $this->perio_issn[0]) { $req = "select notice_id, tit1 from notices where niveau_biblio='s' and niveau_hierar='1' \n\t\t\t\t\tand tit1='" . addslashes($this->perio_titre[0]) . "'\n\t\t\t\t\tand code='" . addslashes($this->perio_issn[0]) . "' limit 1"; $res_perio = pmb_mysql_query($req, $dbh); $num_rows_perio = pmb_mysql_num_rows($res_perio); } if (!$num_rows_perio) { if ($this->perio_titre[0]) { $req = "select notice_id, tit1 from notices where niveau_biblio='s' and niveau_hierar='1' \n\t\t\t\t\tand tit1='" . addslashes($this->perio_titre[0]) . "'\n\t\t\t\t\tlimit 1"; $res_perio = pmb_mysql_query($req, $dbh); $num_rows_perio = pmb_mysql_num_rows($res_perio); } } if (!$num_rows_perio) { if ($this->perio_issn[0]) { $req = "select notice_id, tit1 from notices where niveau_biblio='s' and niveau_hierar='1' \n\t\t\t\t\t\tand code='" . addslashes($this->perio_issn[0]) . "' limit 1"; $res_perio = pmb_mysql_query($req, $dbh); $num_rows_perio = pmb_mysql_num_rows($res_perio); } } if ($num_rows_perio == 1) { $perio_found = pmb_mysql_fetch_object($res_perio); $idperio = $perio_found->notice_id; $zone_article_form = str_replace("!!f_perio_existing!!", htmlentities($perio_found->tit1, ENT_QUOTES, $charset), $zone_article_form); $zone_article_form = str_replace("!!f_perio_existing_id!!", $perio_found->notice_id, $zone_article_form); $zone_article_form = str_replace("!!perio_type_new!!", "", $zone_article_form); $zone_article_form = str_replace("!!perio_type_use_existing!!", "checked", $zone_article_form); } else { $idperio = 0; $zone_article_form = str_replace("!!f_perio_existing!!", "", $zone_article_form); $zone_article_form = str_replace("!!f_perio_existing_id!!", "", $zone_article_form); $zone_article_form = str_replace("!!perio_type_new!!", "checked", $zone_article_form); $zone_article_form = str_replace("!!perio_type_use_existing!!", "", $zone_article_form); } //On cherche si le bulletin existe $num_rows_bull = 0; if ($this->bull_num[0] && $idperio) { $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and bulletin_numero like '%" . addslashes($this->bull_num[0]) . "%' "; $res_bull = pmb_mysql_query($req, $dbh); $num_rows_bull = pmb_mysql_num_rows($res_bull); } if (!$num_rows_bull && $this->bull_date[0] && $idperio) { $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and date_date='" . addslashes($this->bull_date[0]) . "' "; $res_bull = pmb_mysql_query($req, $dbh); $num_rows_bull = pmb_mysql_num_rows($res_bull); } elseif ($num_rows_bull > 1 && $this->bull_date[0] && $idperio) { $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and date_date='" . addslashes($this->bull_date[0]) . "' and bulletin_numero like '%" . addslashes($this->bull_num[0]) . "%' "; $res_bull = pmb_mysql_query($req, $dbh); $num_rows_bull = pmb_mysql_num_rows($res_bull); } if (!$num_rows_bull && $this->bull_mention[0] && $idperio) { $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and mention_date='" . addslashes($this->bull_mention[0]) . "' "; $res_bull = pmb_mysql_query($req, $dbh); $num_rows_bull = pmb_mysql_num_rows($res_bull); } elseif ($num_rows_bull > 1 && $this->bull_mention[0] && $idperio) { if ($this->bull_date[0]) { $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and date_date='" . addslashes($this->bull_date[0]) . "' and mention_date='" . addslashes($this->bull_mention[0]) . "' "; } else { $req = "select bulletin_id, bulletin_numero,date_date,mention_date from bulletins where bulletin_notice='" . $idperio . "' and mention_date='" . addslashes($this->bull_mention[0]) . "' and bulletin_numero like '%" . addslashes($this->bull_num[0]) . "%' "; } $res_bull = pmb_mysql_query($req, $dbh); $num_rows_bull = pmb_mysql_num_rows($res_bull); } if ($num_rows_bull) { $bull_found = pmb_mysql_fetch_object($res_bull); $f_bull_existing = trim($bull_found->bulletin_numero); if (!$f_bull_existing && trim($bull_found->date_date)) { $f_bull_existing = "[" . trim($bull_found->date_date) . "]"; } elseif (!$f_bull_existing && trim($bull_found->mention_date)) { $f_bull_existing = "(" . trim($bull_found->mention_date) . ")"; } $zone_article_form = str_replace("!!f_bull_existing!!", htmlentities($f_bull_existing, ENT_QUOTES, $charset), $zone_article_form); $zone_article_form = str_replace("!!f_bull_existing_id!!", $bull_found->bulletin_id, $zone_article_form); $zone_article_form = str_replace("!!bull_type_new!!", $num_rows_bull ? '' : "checked='checked'", $zone_article_form); $zone_article_form = str_replace("!!bull_type_use_existing!!", $num_rows_bull ? "checked='checked'" : '', $zone_article_form); } else { $zone_article_form = str_replace("!!f_bull_existing!!", "", $zone_article_form); $zone_article_form = str_replace("!!f_bull_existing_id!!", "", $zone_article_form); $zone_article_form = str_replace("!!bull_type_new!!", "checked='checked'", $zone_article_form); $zone_article_form = str_replace("!!bull_type_use_existing!!", "", $zone_article_form); } $form_notice = str_replace("!!zone_article!!", $zone_article_form, $form_notice); if ($article) { $form_notice = str_replace("!!display_zone_article!!", "", $form_notice); } else { $form_notice = str_replace("!!display_zone_article!!", "none", $form_notice); } if ($item) { $form_notice = str_replace('!!notice_entrepot!!', "<input type='hidden' name='item' value='{$item}' />", $form_notice); } else { $form_notice = str_replace('!!notice_entrepot!!', "", $form_notice); } $form_notice = str_replace('!!orinot_nom!!', $this->origine_notice[nom], $form_notice); $form_notice = str_replace('!!orinot_pays!!', $this->origine_notice[pays], $form_notice); //Traitement du 503 "titre de forme" pour le Musée des beaux arts de Nantes global $tableau_503; $tableau_503 = array("info_503" => $this->info_503, "info_503_d" => $this->info_503_d, "info_503_j" => $this->info_503_j); // traitement des catégories : affichage dans le formulaire $tableau_600 = array("info_600_3" => $this->info_600_3, "info_600_a" => $this->info_600_a, "info_600_b" => $this->info_600_b, "info_600_c" => $this->info_600_c, "info_600_d" => $this->info_600_d, "info_600_f" => $this->info_600_f, "info_600_g" => $this->info_600_g, "info_600_j" => $this->info_600_j, "info_600_p" => $this->info_600_p, "info_600_t" => $this->info_600_t, "info_600_x" => $this->info_600_x, "info_600_y" => $this->info_600_y, "info_600_z" => $this->info_600_z); $tableau_601 = array("info_601_3" => $this->info_601_3, "info_601_a" => $this->info_601_a, "info_601_b" => $this->info_601_b, "info_601_c" => $this->info_601_c, "info_601_d" => $this->info_601_d, "info_601_e" => $this->info_601_e, "info_601_f" => $this->info_601_f, "info_601_g" => $this->info_601_g, "info_601_h" => $this->info_601_h, "info_601_j" => $this->info_601_j, "info_601_t" => $this->info_601_t, "info_601_x" => $this->info_601_x, "info_601_y" => $this->info_601_y, "info_601_z" => $this->info_601_z); $tableau_602 = array("info_602_3" => $this->info_602_3, "info_602_a" => $this->info_602_a, "info_602_f" => $this->info_602_f, "info_602_j" => $this->info_602_j, "info_602_t" => $this->info_602_t, "info_602_x" => $this->info_602_x, "info_602_y" => $this->info_602_y, "info_602_z" => $this->info_602_z); $tableau_604 = array("info_604_3" => $this->info_604_3, "info_604_a" => $this->info_604_a, "info_604_h" => $this->info_604_h, "info_604_i" => $this->info_604_i, "info_604_j" => $this->info_604_j, "info_604_k" => $this->info_604_k, "info_604_l" => $this->info_604_l, "info_604_x" => $this->info_604_x, "info_604_y" => $this->info_604_y, "info_604_z" => $this->info_604_z); $tableau_605 = array("info_605_3" => $this->info_605_3, "info_605_a" => $this->info_605_a, "info_605_h" => $this->info_605_h, "info_605_i" => $this->info_605_i, "info_605_k" => $this->info_605_k, "info_605_l" => $this->info_605_l, "info_605_m" => $this->info_605_m, "info_605_n" => $this->info_605_n, "info_605_q" => $this->info_605_q, "info_605_r" => $this->info_605_r, "info_605_s" => $this->info_605_s, "info_605_u" => $this->info_605_u, "info_605_w" => $this->info_605_w, "info_605_j" => $this->info_605_j, "info_605_x" => $this->info_605_x, "info_605_y" => $this->info_605_y, "info_605_z" => $this->info_605_z); $tableau_606 = array("info_606_3" => $this->info_606_3, "info_606_a" => $this->info_606_a, "info_606_j" => $this->info_606_j, "info_606_x" => $this->info_606_x, "info_606_y" => $this->info_606_y, "info_606_z" => $this->info_606_z); $tableau_607 = array("info_607_3" => $this->info_607_3, "info_607_a" => $this->info_607_a, "info_607_j" => $this->info_607_j, "info_607_x" => $this->info_607_x, "info_607_y" => $this->info_607_y, "info_607_z" => $this->info_607_z); $tableau_608 = array("info_608_3" => $this->info_608_3, "info_608_a" => $this->info_608_a, "info_608_j" => $this->info_608_j, "info_608_x" => $this->info_608_x, "info_608_y" => $this->info_608_y, "info_608_z" => $this->info_608_z); // catégories $max_categ = 1; $ptab_categ = str_replace('!!icateg!!', 0, $ptab[60]); $ptab_categ = str_replace('!!categ_id!!', 0, $ptab_categ); $ptab_categ = str_replace('!!categ_libelle!!', '', $ptab_categ); $ptab[6] = str_replace("!!categories_repetables!!", $ptab_categ, $ptab[6]); $ptab[6] = str_replace('!!tab_categ_order!!', "", $ptab[6]); $traitement_rameau = traite_categories_for_form($tableau_600, $tableau_601, $tableau_602, $tableau_605, $tableau_606, $tableau_607, $tableau_608); if (!is_array($traitement_rameau)) { $traitement_rameau = array("form" => $traitement_rameau, "message" => ""); } $form_notice = str_replace('!!message_rameau!!', $traitement_rameau["message"], $form_notice); $form_notice = str_replace('!!traitement_rameau!!', $traitement_rameau["form"], $form_notice); $manual_categorisation_form = get_manual_categorisation_form($tableau_600, $tableau_601, $tableau_602, $tableau_604, $tableau_605, $tableau_606, $tableau_607, $tableau_608); $form_notice = str_replace('!!manual_categorisation!!', $manual_categorisation_form, $form_notice); //Mise à jour de l'onglet 9 $p_perso = new parametres_perso("notices"); if (function_exists("param_perso_form")) { param_perso_form($p_perso); } //pour Pubmed et DOI, on regarde si on peut remplir un champ résolveur... if (count($this->others_ids) > 0) { foreach ($p_perso->t_fields as $key => $t_field) { if ($t_field['TYPE'] == "resolve") { $field_options = _parser_text_no_function_("<?xml version='1.0' encoding='" . $charset . "'?>\n" . $t_field['OPTIONS'], "OPTIONS"); foreach ($field_options['RESOLVE'] as $resolve) { //pubmed = 1 | DOI = 2 foreach ($this->others_ids as $other_id) { if ($other_id['b'] == "PMID" && $resolve['ID'] == "1") { //on a le champ perso résolveur PubMed $p_perso->values[$key][] = $other_id['a'] . "|1"; } else { if ($other_id['b'] == "DOI" && $resolve['ID'] == "2") { //on a le champ perso résolveur DOI $p_perso->values[$key][] = $other_id['a'] . "|2"; } } } } } } } if (!$p_perso->no_special_fields) { $perso_ = $p_perso->show_editable_fields($id_notice, true); $perso = ""; for ($i = 0; $i < count($perso_["FIELDS"]); $i++) { $p = $perso_["FIELDS"][$i]; $perso .= "<div class='row'>\n\t\t\t\t\t<label for='" . $p["NAME"] . "' class='etiquette'>" . $p["TITRE"] . " </label>" . $p["COMMENT_DISPLAY"] . "\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='row'>\n\t\t\t\t\t" . $p["AFF"] . "\n\t\t\t\t\t</div>\n\t\t\t\t\t"; } $perso .= $perso_["CHECK_SCRIPTS"]; $ptab[9] = str_replace("!!champs_perso!!", $perso, $ptab[9]); } else { $ptab[9] = "\n<script type='text/javascript' >function check_form() { return true; }</script>\n"; } $form_notice = str_replace('!!tab9!!', $ptab[9], $form_notice); // champs de gestion global $pmb_notice_img_folder_id; $message_folder = ""; if ($pmb_notice_img_folder_id) { $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'"; $res = pmb_mysql_query($req); if (pmb_mysql_num_rows($res)) { $rep = pmb_mysql_fetch_object($res); if (!is_dir($rep->repertoire_path)) { $notice_img_folder_error = 1; } } else { $notice_img_folder_error = 1; } if ($notice_img_folder_error) { if (SESSrights & ADMINISTRATION_AUTH) { $requete = "select * from parametres where gestion=0 and type_param='pmb' and sstype_param='notice_img_folder_id' "; $res = pmb_mysql_query($requete); $i = 0; if ($param = pmb_mysql_fetch_object($res)) { $message_folder = " <a class='erreur' href='./admin.php?categ=param&action=modif&id_param=" . $param->id_param . "' >" . $msg['notice_img_folder_admin_no_access'] . "</a> "; } } else { $message_folder = $msg['notice_img_folder_no_access']; } } } $ptab[10] = str_replace('!!message_folder!!', $message_folder, $ptab[10]); // langue de la notice global $lang, $xmlta_indexation_lang; $user_lang = $this->indexation_lang; if (!$user_lang) { $user_lang = $xmlta_indexation_lang; } // if(!$user_lang) $user_lang="fr_FR"; $langues = new XMLlist("{$include_path}/messages/languages.xml"); $langues->analyser(); $clang = $langues->table; $combo = "<select name='indexation_lang' id='indexation_lang' class='saisie-20em' >"; if (!$user_lang) { $combo .= "<option value='' selected>--</option>"; } else { $combo .= "<option value='' >--</option>"; } while (list($cle, $value) = each($clang)) { // arabe seulement si on est en utf-8 if ($charset != 'utf-8' and $user_lang != 'ar' or $charset == 'utf-8') { if (strcmp($cle, $user_lang) != 0) { $combo .= "<option value='{$cle}'>{$value} ({$cle})</option>"; } else { $combo .= "<option value='{$cle}' selected>{$value} ({$cle})</option>"; } } } $combo .= "</select>"; $ptab[10] = str_replace('!!indexation_lang!!', $combo, $ptab[10]); $form_notice = str_replace('!!indexation_lang_sel!!', $user_lang, $form_notice); global $deflt_integration_notice_statut; if ($id_notice) { $rqt_statut = "select statut from notices where notice_id='{$id_notice}' "; $res_statut = pmb_mysql_query($rqt_statut); $stat = pmb_mysql_fetch_object($res_statut); $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $stat->statut, "", "", "", "", 0); } else { $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $deflt_integration_notice_statut, "", "", "", "", 0); } $ptab[10] = str_replace('!!notice_statut!!', $select_statut, $ptab[10]); $ptab[10] = str_replace('!!commentaire_gestion!!', htmlentities($this->commentaire_gestion, ENT_QUOTES, $charset), $ptab[10]); $ptab[10] = str_replace('!!thumbnail_url!!', htmlentities($this->thumbnail_url, ENT_QUOTES, $charset), $ptab[10]); $form_notice = str_replace('!!tab10!!', $ptab[10], $form_notice); // Documents Numériques $docnum_infos = ""; $count = 0; $upload_doc_num = ""; if ($this->source_id) { $requete = "select * from connectors_sources where source_id=" . $this->source_id . ""; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { $r = pmb_mysql_fetch_object($resultat); if (!$r->upload_doc_num) { $upload_doc_num = "checked"; } } } if (count($this->doc_nums)) { global $deflt_explnum_statut; $statutlist = gen_liste_multiple("select id_explnum_statut, gestion_libelle from explnum_statut order by 2", "id_explnum_statut", "gestion_libelle", "id_explnum_statut", "doc_num_statut!!docnumid!!", "", $deflt_explnum_statut, "", "", "", "", 0); foreach ($this->doc_nums as $doc_num) { $docnum_info = $ptab[1111]; // $alink = '<a target="_blank" href="'.htmlspecialchars($doc_num["a"]).'">'.htmlspecialchars($doc_num["a"]).'</a>'; $docnum_info = str_replace('!!docnum_url!!', htmlspecialchars($doc_num["a"], ENT_QUOTES, $charset), $docnum_info); $docnum_info = str_replace('!!docnum_caption!!', htmlspecialchars($doc_num["b"], ENT_QUOTES, $charset), $docnum_info); $docnum_info = str_replace('!!docnum_filename!!', htmlspecialchars($doc_num["f"], ENT_QUOTES, $charset), $docnum_info); $docnum_info = str_replace('!!docnum_statutlist!!', $statutlist, $docnum_info); $docnum_info = str_replace('!!docnumid!!', $count, $docnum_info); $docnum_info = str_replace('!!upload_doc_num!!', $upload_doc_num, $docnum_info); $docnum_infos .= $docnum_info; $count++; } } if (!$docnum_infos) { $docnum_infos = $msg["noticeintegre_nodocnum"]; } $ptab[1110] = str_replace('!!docnum_count!!', $count, $ptab[1110]); $ptab[1110] = str_replace('!!docnums!!', $docnum_infos, $ptab[1110]); $form_notice = str_replace('!!tab11!!', $ptab[1110], $form_notice); $aac = explode('&', $action); $retact = '&' . $aac[2] . '&' . $aac[5] . '&' . $aac[6]; global $force; $retares = ''; switch ($retour) { case 'button': if ($this->message_retour) { $retares = "<input type='button' class='bouton' onclick='history.go(-1);' value='" . $this->message_retour . "' />"; } else { if ($force == 1) { $retares = "<a href='javascript:history.go(-2);'>" . $msg['z3950_retour_a_resultats'] . "</a>"; } else { $retares = "<a href='javascript:history.go(-1);'>" . $msg['z3950_retour_a_resultats'] . "</a>"; } } break; case 'link': $retares = "<a href='./catalog.php?categ=z3950&action=display" . $retact . "'>" . $msg['z3950_retour_a_resultats'] . "</a>"; break; default: break; } $form_notice = str_replace('!!retour_a_resultats!!', $retares, $form_notice); if (!$this->bt_integr_value) { if (!$id_notice) { $form_notice = str_replace('!!bouton_integration!!', $msg['z3950_integr_not_seule'], $form_notice); } else { $form_notice = str_replace('!!bouton_integration!!', $msg['notice_z3950_remplace_catal'], $form_notice); } } else { $form_notice = str_replace('!!bouton_integration!!', $this->bt_integr_value, $form_notice); } if ($this->bt_undo_value && $this->bt_undo_action) { $bt_undo = str_replace('!!value!!', $this->bt_undo_value, $bt_undo); $bt_undo = str_replace('!!action!!', $this->bt_undo_action, $bt_undo); $form_notice = str_replace('<!-- bt_undo -->', $bt_undo, $form_notice); } $form_notice = str_replace('!!id_notice!!', $id_notice, $form_notice); $form_notice = str_replace('!!notice!!', $znotices_id, $form_notice); $form_notice = str_replace('!!notice_type!!', $this->notice_type, $form_notice); return $form_notice; }
function get_typdoc_list() { if ($this->external_search) { return array(); } global $dbh; $requete = $this->cache->get_objectref_list_with_content_sql(CACHE_TYPE_NOTICE, $this->search_realm . "_" . $this->search_unique_id, 'pmbesSearch', "notice_id", "pert"); $req = "SELECT distinct(typdoc) as docType FROM (" . $requete . ") as every_derived_table_must_have_its_own_alias LEFT JOIN notices ON every_derived_table_must_have_its_own_alias.notice_id = notices.notice_id"; $res = pmb_mysql_query($req, $dbh); while ($row = pmb_mysql_fetch_assoc($res)) { $records[] = $row["docType"]; } return $records; }
function get_all_locations_and_sections() { global $dbh; $results = array(); $sql = "SELECT idlocation, location_libelle FROM docs_location WHERE location_visible_opac = 1"; $res = pmb_mysql_query($sql, $dbh); while ($row = pmb_mysql_fetch_assoc($res)) { $aresult = array('location' => array("location_id" => $row["idlocation"], "location_caption" => utf8_normalize($row["location_libelle"])), 'sections' => array()); $sql2 = "select idsection, section_libelle, section_pic from docs_section, exemplaires where expl_location=" . $row["idlocation"] . " and section_visible_opac=1 and expl_section=idsection group by idsection order by section_libelle "; $res2 = pmb_mysql_query($sql2); $n = 0; while ($r = pmb_mysql_fetch_object($res2)) { $asection = array(); $asection["section_id"] = $r->idsection; $asection["section_location"] = $row["idlocation"]; $asection["section_caption"] = utf8_normalize($r->section_libelle); $asection["section_image"] = $r->section_pic ? utf8_normalize($r->section_pic) : "images/rayonnage-small.png"; $aresult['sections'][] = $asection; } $results[] = $aresult; } return $results; }
function show_esgroup_form_anonymous() { global $msg, $charset, $dbh; print '<form method="POST" action="admin.php?categ=external_services&sub=esusergroups&action=updateanonymous" name="form_esgroup">'; print '<h3>' . $msg['es_groups_edit'] . '</h3>'; print '<div class="form-contenu">'; //id print '<input type="hidden" name="id" value="' . $id . '">'; //name print '<div class=row><label class="etiquette" for="es_group_name">' . $msg["es_group_name"] . '</label><br />'; print $msg["admin_connecteurs_outauth_anonymgroupname"]; print '</div>'; //fullname print '<div class=row><label class="etiquette" for="es_group_fullname">' . $msg["es_group_fullname"] . '</label><br />'; print $msg["admin_connecteurs_outauth_anonymgroupfullname"]; print '</div>'; $pmbusers_sql = "SELECT userid, username, nom, prenom FROM users"; $pmbusers_res = pmb_mysql_query($pmbusers_sql, $dbh); $pmbusers = array(); while ($pmbusers_row = pmb_mysql_fetch_assoc($pmbusers_res)) { $pmbusers[] = $pmbusers_row; } $sql = "SELECT esgroup_pmbusernum FROM es_esgroups WHERE esgroup_id = -1"; $res = pmb_mysql_query($sql, $dbh); if (!pmb_mysql_num_rows($res)) { $esg_pmbuserid = 1; } else { $esg_pmbuserid = pmb_mysql_result($res, 0, 0); } //pmbuser print '<div class=row><label class="etiquette" for="es_group_pmbuserid">' . $msg["es_group_pmbuserid"] . '</label><br />'; print '<select name="es_group_pmbuserid">'; foreach ($pmbusers as $apmbuser) { print '<option ' . ($apmbuser["userid"] == $esg_pmbuserid ? ' selected ' : '') . ' value="' . $apmbuser["userid"] . '">' . htmlentities($apmbuser["username"] . ' (' . $apmbuser["nom"] . ' ' . $apmbuser['prenom'] . ')', ENT_QUOTES, $charset) . '</option>'; } print '</select></div>'; //buttons print "<br /><div class='row'>\n\t<div class='left'>"; print "<input class='bouton' type='button' value=' {$msg['76']} ' onClick=\"document.location='./admin.php?categ=external_services&sub=esusergroups'\" /> "; print '<input class="bouton" type="submit" value="' . $msg[77] . '">'; print "</div>\n\t<br /><br /></div>"; print '</form>'; }
function fetchSerialList($OPACUserId = -1) { global $dbh; $sql = "\nSELECT n1.notice_id,\n n1.tit1,\n (SELECT COUNT(1)\n FROM notices n2\n RIGHT JOIN bulletins b2\n ON ( n2.notice_id = b2.bulletin_notice )\n WHERE n2.notice_id = n1.notice_id) AS issue_count,\n (SELECT COUNT(1)\n FROM notices n3\n RIGHT JOIN bulletins b3\n ON ( n3.notice_id = b3.bulletin_notice )\n RIGHT JOIN analysis a3\n ON ( b3.bulletin_id = a3.analysis_bulletin )\n WHERE n3.notice_id = n1.notice_id) AS analysis_count,\n (SELECT COUNT(1)\n FROM notices n4\n RIGHT JOIN bulletins b4\n ON ( n4.notice_id = b4.bulletin_notice )\n RIGHT JOIN exemplaires e4\n ON ( b4.bulletin_id = e4.expl_bulletin )\n WHERE n4.notice_id = n1.notice_id) AS item_count\nFROM notices n1\nWHERE n1.niveau_biblio = 's'\n AND n1.niveau_hierar = 1\nORDER BY tit1 "; $res = pmb_mysql_query($sql, $dbh); $results = array(); while ($row = pmb_mysql_fetch_assoc($res)) { //Je filtre les notices en fonction des droits $notice_ids = $this->filter_tabl_notices(array($row['notice_id'])); if (count($notice_ids)) { $aresult = array('serial_id' => $row['notice_id'], 'serial_title' => utf8_normalize($row['tit1']), 'serial_issues_count' => $row['issue_count'], 'serial_items_count' => $row['item_count'], 'serial_analysis_count' => $row['analysis_count']); $results[] = $aresult; } } return $results; }
function maj_entrepot($source_id, $callback_progress = "", $recover = false, $recover_env = "") { global $dbh, $base_path, $file_in, $suffix, $converted, $origine, $charset, $outputtype; //Allons chercher plein d'informations utiles et amusantes $params = $this->get_source_params($source_id); $this->fetch_global_properties(); if ($params["PARAMETERS"]) { //Affichage du formulaire avec $params["PARAMETERS"] $vars = unserialize($params["PARAMETERS"]); foreach ($vars as $key => $val) { global ${$key}; ${$key} = $val; } } if (!isset($xslt_exemplaire)) { $xslt_exemplaire = ""; } $file_type = "iso_2709"; //Récupérons le nom du fichier if ($converted) { //Fichier converti $f = explode(".", $file_in); if (count($f) > 1) { unset($f[count($f) - 1]); } $final_file = implode(".", $f) . "." . $suffix . "~"; $final_file = "{$base_path}/temp/" . $final_file; $file_type = $outputtype; } else { $final_file = "{$base_path}/temp/" . $file_in; $file_type = $outputtype; } /* * ISO-2709 * */ if ($file_type == "iso_2709") { //Chargeons ces notices dans la base $this->loadfile_in_table_unimarc($final_file, $origine); $import_marc_count = "SELECT count(*) FROM import_marc"; $count_total = pmb_mysql_result(pmb_mysql_query($import_marc_count, $dbh), 0, 0); if (!$count_total) { return 0; } $count_lu = 0; $latest_percent = floor(100 * $count_lu / $count_total); //Et c'est parti $import_sql = "SELECT id_import, notice FROM import_marc WHERE origine = " . $origine; $res = pmb_mysql_query($import_sql); while ($row = pmb_mysql_fetch_assoc($res)) { $xmlunimarc = new xml_unimarc(); $nxml = $xmlunimarc->iso2709toXML_notice($row["notice"]); $xmlunimarc->notices_xml_[0] = '<?xml version="1.0" encoding="' . $charset . '"?>' . $xmlunimarc->notices_xml_[0]; if ($xslt_exemplaire) { $xmlunimarc->notices_xml_[0] = $this->apply_xsl_to_xml($xmlunimarc->notices_xml_[0], $xslt_exemplaire["content"]); } if ($nxml == 1) { $params = _parser_text_no_function_($xmlunimarc->notices_xml_[0], "NOTICE"); $this->rec_record($params, $source_id, 0); $count_lu++; } $sql_delete = "DELETE FROM import_marc WHERE id_import = " . $row['id_import']; @pmb_mysql_query($sql_delete); if (floor(100 * $count_lu / $count_total) > $latest_percent) { //Mise à jour de source_sync pour reprise en cas d'erreur /* $envt["current_origine"]=$origine; $envt["already_read_count"]=$count_lu; $requete="update source_sync set env='".addslashes(serialize($envt))."' where source_id=".$source_id; pmb_mysql_query($requete);*/ //Inform call_user_func($callback_progress, $count_lu / $count_total, $count_lu, $count_total); // $callback_progress($count_lu / $count_total, $count_lu, $count_total); $latest_percent = floor(100 * $count_lu / $count_total); flush(); ob_flush(); } } } else { if ($file_type == "xml") { //Chargeons ces notices dans la base $this->loadfile_in_table_xml($final_file, $origine); $import_marc_count = "SELECT count(*) FROM import_marc"; $count_total = pmb_mysql_result(pmb_mysql_query($import_marc_count, $dbh), 0, 0); if (!$count_total) { return 0; } $count_lu = 0; $latest_percent = floor(100 * $count_lu / $count_total); //Et c'est parti $import_sql = "SELECT id_import, notice FROM import_marc WHERE origine = " . $origine; $res = pmb_mysql_query($import_sql); while ($row = pmb_mysql_fetch_assoc($res)) { $xmlunimarc = '<?xml version="1.0" encoding="' . $charset . '"?>' . $row["notice"]; if ($xslt_exemplaire) { $xmlunimarc = $this->apply_xsl_to_xml($xmlunimarc, $xslt_exemplaire["content"]); } $params = _parser_text_no_function_($xmlunimarc, "NOTICE"); $this->rec_record($params, $source_id, 0); $count_lu++; $sql_delete = "DELETE FROM import_marc WHERE id_import = " . $row['id_import']; @pmb_mysql_query($sql_delete); if (floor(100 * $count_lu / $count_total) > $latest_percent) { //Mise à jour de source_sync pour reprise en cas d'erreur /* $envt["current_origine"]=$origine; $envt["already_read_count"]=$count_lu; $requete="update source_sync set env='".addslashes(serialize($envt))."' where source_id=".$source_id; pmb_mysql_query($requete);*/ //Inform call_user_func($callback_progress, $count_lu / $count_total, $count_lu, $count_total); // $callback_progress($count_lu / $count_total, $count_lu, $count_total); $latest_percent = floor(100 * $count_lu / $count_total); flush(); ob_flush(); } } } } return $count_lu; }
function make_search() { global $gestion_acces_active, $gestion_acces_empr_notice, $class_path; // var_dump($_SESSION); $id = $_SESSION['last_module_search']['search_id']; $location = $_SESSION['last_module_search']['search_location']; $plettreaut = $_SESSION["last_module_search"]["search_plettreaut"]; $dcote = $_SESSION["last_module_search"]["search_dcote"]; $lcote = $_SESSION["last_module_search"]["search_lcote"]; $nc = $_SESSION["last_module_search"]["search_nc"]; $ssub = $_SESSION["last_module_search"]["search_ssub"]; /* * récupérer les infos de session */ $requete = "SELECT num_pclass FROM docsloc_section WHERE num_location='" . $location . "' AND num_section='" . $id . "' "; $res = pmb_mysql_query($requete); $type_aff_navigopac = 0; if (pmb_mysql_num_rows($res)) { $type_aff_navigopac = pmb_mysql_result($res, 0, 0); } //droits d'acces emprunteur/notice $acces_j = ''; if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); $dom_2 = $ac->setDomain(2); $acces_j = $dom_2->getJoin($_SESSION['id_empr_session'], 4, 'notice_id'); } if ($acces_j) { $statut_j = ''; $statut_r = ''; } else { $statut_j = ',notice_statut'; $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")"; } if ($_SESSION["opac_view"] && $_SESSION["opac_view_query"]) { $opac_view_restrict = " notice_id in (select opac_view_num_notice from opac_view_notices_" . $_SESSION["opac_view"] . ") "; $statut_r .= " and " . $opac_view_restrict; } if ($type_aff_navigopac == 0) { //Pas de navigation //on ne peut pas arriver ici... } elseif ($type_aff_navigopac == -1) { //Navigation par auteurs $requete = "create temporary table temp_n_id ENGINE=MyISAM ( SELECT notice_id FROM notices " . $acces_j . " JOIN exemplaires ON expl_section='" . $id . "' and expl_location='" . $location . "' and expl_notice=notice_id " . $statut_j . " WHERE 1 " . $statut_r . " GROUP BY notice_id)"; pmb_mysql_query($requete); //On récupère les notices de périodique avec au moins un exemplaire d'un bulletin dans la localisation et la section $requete = "INSERT INTO temp_n_id (SELECT notice_id FROM exemplaires JOIN bulletins ON expl_section='" . $id . "' and expl_location='" . $location . "' and expl_bulletin=bulletin_id JOIN notices ON notice_id=bulletin_notice " . $acces_j . " " . $statut_j . " WHERE 1 " . $statut_r . " GROUP BY notice_id)"; pmb_mysql_query($requete); @pmb_mysql_query("alter table temp_n_id add index(notice_id)"); //On sait par quoi doit commencer le nom de l'auteur if ($plettreaut == "num") { $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN responsability ON responsability_notice=temp_n_id.notice_id JOIN authors ON author_id=responsability_author and trim(index_author) REGEXP '^[0-9]' JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id"; } elseif ($plettreaut == "vide") { $requeteSource = "SELECT notices.notice_id FROM temp_n_id LEFT JOIN responsability ON responsability_notice=temp_n_id.notice_id LEFT JOIN notices ON notices.notice_id=temp_n_id.notice_id WHERE responsability_author IS NULL GROUP BY notices.notice_id"; } elseif ($plettreaut) { $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN responsability ON responsability_notice=temp_n_id.notice_id JOIN authors ON author_id=responsability_author and trim(index_author) REGEXP '^[" . $plettreaut . "]' JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id"; } else { $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id"; } } else { //Navigation par un plan de classement if ($ssub) { $t_expl_cote_cond = array(); for ($i = 0; $i < count($t_dcote); $i++) { $t_expl_cote_cond[] = "expl_cote regexp '(^" . $t_dcote[$i] . " )|(^" . $t_dcote[$i] . "[0-9])|(^" . $t_dcote[$i] . "\$)|(^" . $t_dcote[$i] . ".)'"; } $expl_cote_cond = "(" . implode(" or ", $t_expl_cote_cond) . ")"; } if (!$ssub) { $requete = "SELECT COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires {$statut_j} "; $requete .= "where expl_location={$location} and expl_section={$id} and notice_id=expl_notice "; if (strlen($dcote)) { $requete .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' "; } $requete .= $statut_r; $res = pmb_mysql_query($requete, $dbh); $nbr_lignes = @pmb_mysql_result($res, 0, 0); $requete2 = "SELECT COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires, bulletins {$statut_j} "; $requete2 .= "where expl_location={$location} and expl_section={$id} and notice_id=bulletin_notice and expl_bulletin=bulletin_id "; if (strlen($dcote)) { $requete2 .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' "; } $requete2 .= $statut_r; $res = pmb_mysql_query($requete2, $dbh); $nbr_lignes += @pmb_mysql_result($res, 0, 0); } else { $requete = "select COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires {$statut_j} "; $requete .= "where expl_location={$location} and expl_section={$id} and notice_id=expl_notice "; if (strlen($dcote)) { $requete .= " and {$expl_cote_cond} "; } $requete .= $statut_r; $res = pmb_mysql_query($requete, $dbh); $nbr_lignes = @pmb_mysql_result($res, 0, 0); $requete2 = "SELECT COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires, bulletins {$statut_j} "; $requete2 .= "where expl_location={$location} and expl_section={$id} and notice_id=bulletin_notice and expl_bulletin=bulletin_id "; if (strlen($dcote)) { $requete2 .= "and {$expl_cote_cond} "; } $requete2 .= $statut_r; $res = pmb_mysql_query($requete2, $dbh); $nbr_lignes += @pmb_mysql_result($res, 0, 0); } if ($nbr_lignes) { //Table temporaire de tous les id $requete = "create temporary table temp_n_id ENGINE=MyISAM (select notice_id FROM notices {$acces_j} ,exemplaires {$statut_j} "; $requete .= "WHERE expl_location={$location} and expl_section={$id} and notice_id=expl_notice "; if (strlen($dcote)) { if (!$ssub) { $requete .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' "; $level_ref = strlen($dcote) + 1; } else { $requete .= "and {$expl_cote_cond} "; } } $requete .= "{$statut_r} "; $requete .= "group by notice_id) "; pmb_mysql_query($requete); $requete2 = "insert into temp_n_id (SELECT notice_id FROM notices {$acces_j} ,exemplaires, bulletins {$statut_j} "; $requete2 .= "where expl_location={$location} and expl_section={$id} and notice_id=bulletin_notice and expl_bulletin=bulletin_id "; if (strlen($dcote)) { if (!$ssub) { $requete2 .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' "; } else { $requete2 .= "and {$expl_cote_cond} "; } } $requete2 .= "{$statut_r} "; $requete2 .= "group by notice_id) "; @pmb_mysql_query($requete2); @pmb_mysql_query("alter table temp_n_id add index(notice_id)"); //Calcul du classement if (!$ssub) { $rq1_index = "create temporary table union1 ENGINE=MyISAM (select distinct expl_cote from exemplaires, temp_n_id where expl_location={$location} and expl_section={$id} and expl_notice=temp_n_id.notice_id) "; $res1_index = pmb_mysql_query($rq1_index); $rq2_index = "create temporary table union2 ENGINE=MyISAM (select distinct expl_cote from exemplaires, temp_n_id, bulletins where expl_location={$location} and expl_section={$id} and bulletin_notice=temp_n_id.notice_id and expl_bulletin=bulletin_id) "; $res2_index = pmb_mysql_query($rq2_index); $req_index = "select distinct expl_cote from union1 union select distinct expl_cote from union2"; $res_index = pmb_mysql_query($req_index); if ($level_ref == 0) { $level_ref = 1; } // Prepare indexint pre selection - Zend $zendIndexInt = array(); //$zendIndexIntCache = array(); $zendQ1 = "SELECT indexint_name, indexint_comment FROM indexint WHERE indexint_name NOT REGEXP '^[0-9][0-9][0-9]' AND indexint_comment != '' AND num_pclass='" . $type_aff_navigopac . "'"; $zendRes = pmb_mysql_query($zendQ1); while ($zendRow = pmb_mysql_fetch_assoc($zendRes)) { $zendIndexInt[$zendRow['indexint_name']] = $zendRow['indexint_comment']; } // Zend while ($ct = pmb_mysql_fetch_object($res_index)) { //Je regarde si le début existe dans indexint $lf = 5; $t = array(); while ($lf > 0) { $zendKey = substr($ct->expl_cote, 0, $lf); if ($zendIndexInt[$zendKey]) { if (!$nc) { $t["comment"] = $zendIndexInt[$zendKey]; $t["dcote"] = $zendKey; $t["ssub"] = 1; $index[$t["dcote"]] = $t; break; } else { $rq_del = "select distinct notice_id from notices, exemplaires where expl_cote='" . $ct->expl_cote . "' and expl_notice=notice_id "; $rq_del .= " union select distinct notice_id from notices, exemplaires, bulletins where expl_cote='" . $ct->expl_cote . "' and expl_bulletin=bulletin_id and bulletin_notice=notice_id "; $res_del = pmb_mysql_query($rq_del); while (list($n_id) = pmb_mysql_fetch_row($res_del)) { pmb_mysql_query("delete from temp_n_id where notice_id=" . $n_id); } } } $lf--; } if ($lf == 0) { if (preg_match("/[0-9][0-9][0-9]/", $ct->expl_cote, $c)) { $found = false; $lcote = 3; $level = $level_ref; while (!$found && $level <= $lcote) { $cote = substr($c[0], 0, $level); $compl = str_repeat("0", $lcote - $level); $rq_index = "select indexint_name,indexint_comment from indexint where indexint_name='" . $cote . $compl . "' and length(indexint_name)>={$lcote} and indexint_comment!='' and num_pclass='" . $type_aff_navigopac . "' order by indexint_name limit 1 "; $res_index_1 = pmb_mysql_query($rq_index); if (pmb_mysql_num_rows($res_index_1)) { $name = pmb_mysql_result($res_index_1, 0, 0); if (!$nc) { if (substr($name, 0, $level - 1) == $dcote) { $t["comment"] = pmb_mysql_result($res_index_1, 0, 1); if ($level > 1) { $cote_n_1 = substr($c[0], 0, $level - 1); $compl_n_1 = str_repeat("0", $lcote - $level + 1); if ($cote . $compl == $cote_n_1 . $compl_n_1) { $t["comment"] = "Généralités"; } } $t["lcote"] = $lcote; $t["dcote"] = $cote; $index[$name] = $t; $found = true; } else { $level++; } } else { if (substr($name, 0, $level - 1) == $dcote) { $rq_del = "select distinct notice_id from notices, exemplaires where expl_cote='" . $ct->expl_cote . "' and expl_notice=notice_id "; $rq_del .= " union select distinct notice_id from notices, exemplaires, bulletins where expl_cote='" . $ct->expl_cote . "' and expl_bulletin=bulletin_id and bulletin_notice=notice_id "; $res_del = pmb_mysql_query($rq_del); while (list($n_id) = pmb_mysql_fetch_row($res_del)) { pmb_mysql_query("delete from temp_n_id where notice_id=" . $n_id); } $found = true; } else { $level++; } } } else { $level++; } } if ($level > $lcote && $lf == 0) { $t["comment"] = $msg["l_unclassified"]; $t["lcote"] = $lcote; $t["dcote"] = $dcote; $index["NC"] = $t; } } else { $t["comment"] = $msg["l_unclassified"]; $t["lcote"] = $lcote; $t["dcote"] = $dcote; $index["NC"] = $t; } } } } if ($nc) { $nbr_lignes = pmb_mysql_result(pmb_mysql_query("select count(1) from temp_n_id"), 0, 0); } if ($nbr_lignes) { $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN notices ON notices.notice_id=temp_n_id.notice_id "; } } } pmb_mysql_query("create temporary table t_s_navigation_section (notice_id integer unsigned not null)"); $requete = "insert into t_s_navigation_section " . $requeteSource; pmb_mysql_query($requete); pmb_mysql_query("alter table t_s_navigation_section add primary key(notice_id)"); return "t_s_navigation_section"; }
function connecteur_out_source($connector, $id, $msg) { global $dbh; $id += 0; $this->id = $id; $this->connector = $connector; $this->connector_id = $connector->id; $this->msg = $msg; if ($this->id) { $sql = "SELECT * FROM connectors_out_sources WHERE connectors_out_source_id = " . $id; $res = pmb_mysql_query($sql, $dbh); $row = pmb_mysql_fetch_assoc($res); $this->name = $row["connectors_out_source_name"]; $this->comment = $row["connectors_out_source_comment"]; $this->config = unserialize($row["connectors_out_source_config"]); $this->config = stripslashes_array($this->config); } }
function get_values($first = false, $count = false, $datefrom = false, $dateuntil = false) { if ($this->values) { return $this->values; } global $dbh; //Values if ($first !== false && $count !== false) { $limit = "LIMIT " . $first . ", " . $count; } else { $limit = ""; } if ($datefrom or $dateuntil) { $where_clauses = array(); if ($datefrom) { $where_clauses[] .= "notices.update_date > FROM_UNIXTIME(" . $datefrom . ")"; } if ($dateuntil) { $where_clauses[] .= "notices.update_date < FROM_UNIXTIME(" . $dateuntil . ')'; } $where_clause = implode(" AND ", $where_clauses); $sql = "SELECT connectors_out_setcache_values_value FROM connectors_out_setcache_values LEFT JOIN notices ON (notices.notice_id = connectors_out_setcache_values_value) WHERE " . $where_clause . ($where_clause ? ' AND ' : '') . " connectors_out_setcache_values_cachenum = " . $this->id . " " . $limit; } else { $sql = "SELECT connectors_out_setcache_values_value FROM connectors_out_setcache_values WHERE connectors_out_setcache_values_cachenum = " . $this->id . " " . $limit; } $res = pmb_mysql_query($sql, $dbh); while ($row = pmb_mysql_fetch_assoc($res)) { $this->values[] = $row["connectors_out_setcache_values_value"]; } return $this->values; }
function getInfoTaskPlanned($planificateur_id, $active = "") { global $dbh; $result = array(); $planificateur_id += 0; if (!$planificateur_id) { throw new Exception("Missing parameter: planificateur_id"); } if ($active != "") { $critere = " and statut=" . $active; } else { $critere = ""; } $sql = "SELECT * FROM planificateur WHERE id_planificateur = " . $planificateur_id; $sql = $sql . $critere; $res = pmb_mysql_query($sql, $dbh); if (!$res) { throw new Exception("Not found: planificateur_id = " . $planificateur_id); } while ($row = pmb_mysql_fetch_assoc($res)) { $result[] = array("id_planificateur" => $row["id_planificateur"], "num_type_tache" => $row["num_type_tache"], "libelle_tache" => utf8_normalize($row["libelle_tache"]), "desc_tache" => utf8_normalize($row["desc_tache"]), "num_user" => $row["num_user"], "statut" => $row["statut"], "calc_next_date_deb" => utf8_normalize($row["calc_next_date_deb"]), "calc_next_heure_deb" => utf8_normalize($row["calc_next_heure_deb"])); } return $result; }
function show_auth_edit_form_anonymous() { global $msg, $charset, $dbh; print '<form method="POST" action="admin.php?categ=connecteurs&sub=out_auth&action=updateanonymous" name="form_outauth">'; print '<h3>' . $msg['admin_connecteurs_outauth_edit'] . '</h3>'; print '<div class="form-contenu">'; //Nom du groupe print '<div class=row><label class="etiquette" for="set_caption">' . $msg["admin_connecteurs_outauth_groupname"] . '</label><br />'; print '<' . $msg["admin_connecteurs_outauth_anonymgroupname"] . '>'; print '</div><br />'; //Nom complet du groupe print '<div class=row><label class="etiquette" for="set_caption">' . $msg["admin_connecteurs_outauth_groupfullname"] . '</label><br />'; print $msg["admin_connecteurs_outauth_anonymgroupfullname"]; print '</div><br />'; $current_sources = array(); $current_sql = "SELECT connectors_out_source_esgroup_sourcenum FROM connectors_out_sources_esgroups WHERE connectors_out_source_esgroup_esgroupnum = -1"; $current_res = pmb_mysql_query($current_sql, $dbh); while ($row = pmb_mysql_fetch_assoc($current_res)) { $current_sources[] = $row["connectors_out_source_esgroup_sourcenum"]; } $data_sql = "SELECT connectors_out_sources_connectornum, connectors_out_source_id, connectors_out_source_name, EXISTS(SELECT 1 FROM connectors_out_sources_esgroups WHERE connectors_out_source_esgroup_sourcenum = connectors_out_source_id AND connectors_out_source_esgroup_esgroupnum = -1) AS authorized FROM connectors_out_sources ORDER BY connectors_out_sources_connectornum"; $data_res = pmb_mysql_query($data_sql, $dbh); $current_connid = 0; print '<div class=row><label class="etiquette">' . $msg["admin_connecteurs_outauth_usesource"] . '</label><br />'; while ($asource = pmb_mysql_fetch_assoc($data_res)) { if ($current_connid != $asource["connectors_out_sources_connectornum"]) { if ($current_connid) { print '<br />'; } $current_connid = $asource["connectors_out_sources_connectornum"]; } print '<input ' . (in_array($asource["connectors_out_source_id"], $current_sources) ? 'checked' : '') . ' type="checkbox" name="authorized_sources[]" value="' . $asource["connectors_out_source_id"] . '">'; print $asource["connectors_out_source_name"]; print '<br />'; } print '</div>'; //buttons print "<br /><div class='row'>\n\t<div class='left'>"; print "<input class='bouton' type='button' value=' {$msg['76']} ' onClick=\"document.location='./admin.php?categ=connecteurs&sub=out_auth'\" /> "; print '<input class="bouton" type="submit" value="' . $msg[77] . '">'; print "</div>\n\t<br /><br /></div>"; print '</form>'; }