array(),"auteurs" => array()); // les auteurs public $ed1_id = ''; // id editeur 1 public $ed1 =''; // libelle editeur 1 public $coll_id = ''; // id collection public $coll = ''; // libelle collection public $subcoll_id = ''; // id sous collection public $subcoll = ''; // libelle sous collection public $year = ''; // annee de publication public $nocoll = ''; // no. dans la collection public $mention_edition = ''; // mention d'edition (1ere, deuxieme...) public $ed2_id = ''; // id editeur 2 public $ed2 =''; // libelle editeur 2 public $code = ''; // ISBN, code barre commercial ou no. commercial public $npages = ''; // importance materielle (nombre de pages, d'elements...) public $ill = ''; // mention d'illustration public $size = ''; // format public $prix = ''; // prix du document public $accomp = ''; // materiel d'accompagnement public $n_gen = ''; // note generale public $n_contenu = ''; // note de contenu public $n_resume = ''; // resume/extrait public $categories = array();// les categories public $indexint = 0; // indexation interne public $index_l = ''; // indexation libre public $langues = array(); public $languesorg = array(); public $lien = ''; // URL de la ressource electronique associee public $eformat = ''; // format de la ressource electronique associee public $ok = 1; public $type_doc = ''; public $biblio_level = 'm'; // niveau bibliographique public $hierar_level = '0'; // niveau hierarchique public $action = './catalog.php?categ=update&id='; public $link_annul = './catalog.php'; public $statut = 0 ; // statut public $commentaire_gestion = '' ; // commentaire de gestion public $thumbnail_url = '' ; public $notice_link=array(); public $date_parution; public $is_new=0; // nouveauté public $date_is_new="0000-00-00 00:00:00"; // date nouveauté public $create_date="0000-00-00 00:00:00"; // date création public $update_date="0000-00-00 00:00:00"; // date modification public $num_notice_usage = 0; // droit d'usage public $concepts_ids; public $indexation_lang; /** * Affichage des éléments contenu dans les onglets * @var elements_list_ui */ private $records_list_ui = null; /** * Onglets à afficher * @var records_tabs */ private $record_tabs = null; /** * Nomenclatures associées * @var nomenclature_record_formations */ private $nomenclature_record_formations = null; // methodes private static $sphinx_indexer = null; protected static $notice = array(); public static $indexation_record; protected static $deleted_index = false; protected static $aut_pperso_instance; protected static $parametres_perso=array(); public static function get_notice($id, $cb = '') { if (!$id || !isset(self::$notice[$id])) { $notice = new notice($id, $cb); if ($id) { self::$notice[$id] = $notice; return self::$notice[$id]; } return $notice; } return self::$notice[$id]; } // constructeur public function __construct($id=0, $cb='') { global $dbh; global $msg; global $include_path, $class_path ; global $deflt_notice_is_new; $this->id = $id+0; if($this->id) { $this->libelle_form = $msg[278]; // libelle du form : modification d'une notice $requete = "SELECT *, date_format(create_date, '".$msg["format_date_heure"]."') as aff_create, date_format(update_date, '".$msg["format_date_heure"]."') as aff_update FROM notices WHERE notice_id='".$this->id."' LIMIT 1 "; $result = @pmb_mysql_query($requete, $dbh); if($result) { $notice = pmb_mysql_fetch_object($result); $this->type_doc = $notice->typdoc; // type du document $this->tit1 = $notice->tit1; // titre propre $this->tit2 = $notice->tit2; // titre propre 2 $this->tit3 = $notice->tit3; // titre parallele $this->tit4 = $notice->tit4; // complement du titre $this->tparent_id = $notice->tparent_id; // id du titre parent // libelle du titre parent if($this->tparent_id) { $serie = new serie($this->tparent_id); $this->tparent = $serie->get_isbd(); } else { $this->tparent = ''; } $this->tnvol = $notice->tnvol; // numero de partie $this->responsabilites = get_notice_authors($this->id) ; $this->subcoll_id = $notice->subcoll_id; // id sous collection $this->coll_id = $notice->coll_id; // id collection $this->ed1_id = $notice->ed1_id ; // id editeur 1 require_once("$class_path/editor.class.php"); if($this->subcoll_id) { require_once("$class_path/subcollection.class.php"); require_once("$class_path/collection.class.php"); $collection = new subcollection($this->subcoll_id); $this->subcoll = $collection->get_isbd(); } if($this->coll_id) { require_once("$class_path/collection.class.php"); $collection = new collection($this->coll_id); $this->coll = $collection->get_isbd(); } if($this->ed1_id) { $editeur = new editeur($this->ed1_id); $this->ed1 = $editeur->get_isbd(); } $this->year = $notice->year; // annee de publication $this->nocoll = $notice->nocoll; // no. dans la collection $this->mention_edition = $notice->mention_edition; // mention d'edition (1ere, deuxieme...) $this->ed2_id = $notice->ed2_id; // id editeur 2 if($this->ed2_id) { // libelle editeur 2 $editeur = new editeur($this->ed2_id); $this->ed2 = $editeur->get_isbd(); } $this->code = $notice->code; // ISBN, code barre commercial ou no. commercial $this->npages = $notice->npages; // importance materielle (nombre de pages, d'elements...) $this->ill = $notice->ill; // mention d'illustration $this->size = $notice->size; // format $this->prix = $notice->prix; // Prix du document $this->accomp = $notice->accomp; // materiel d'accompagnement $this->n_gen = $notice->n_gen; // note generale $this->n_contenu = $notice->n_contenu; // note de contenu $this->n_resume = $notice->n_resume; // resume/extrait $this->categories = get_notice_categories($this->id) ; $this->indexint = $notice->indexint; // indexation interne $this->index_l = $notice->index_l; // indexation libre $this->langues = get_notice_langues($this->id, 0) ; // langues de la publication $this->languesorg = get_notice_langues($this->id, 1) ; // langues originales $this->lien = $notice->lien; // URL de la ressource electronique associee $this->eformat = $notice->eformat; // format de la ressource electronique associee $this->biblio_level = $notice->niveau_biblio; // niveau bibliographique $this->hierar_level = $notice->niveau_hierar; // niveau hierarchique $this->statut = $notice->statut; if ((trim($notice->date_parution)) && ($notice->date_parution!='0000-00-00')){ $this->date_parution = $notice->date_parution; } else { $this->date_parution = notice::get_date_parution($notice->year); } $this->indexation_lang = $notice->indexation_lang; $this->is_new = $notice->notice_is_new; $this->date_is_new = $notice->notice_date_is_new; $this->num_notice_usage = $notice->num_notice_usage; //liens vers autres notices $this->notice_link = notice_relations::get_notice_links($this->id, 'm'); $this->commentaire_gestion = $notice->commentaire_gestion; $this->thumbnail_url = $notice->thumbnail_url; $this->create_date = $notice->aff_create; $this->update_date = $notice->aff_update; } else { require_once("$include_path/user_error.inc.php"); error_message("", $msg[280], 1, "./catalog.php"); $this->ok = 0; } return; } else { // initialisation des valeurs (vides) $this->libelle_form = $msg[270]; // libelle du form : creation d'une notice $this->code = $cb; // initialisation avec les parametres du user : global $value_deflt_lang, $value_deflt_relation ; if ($value_deflt_lang) { $lang = new marc_list('lang'); $this->langues[] = array( 'lang_code' => $value_deflt_lang, 'langue' => $lang->table[$value_deflt_lang] ) ; } global $deflt_notice_statut ; if ($deflt_notice_statut) $this->statut = $deflt_notice_statut; else $this->statut = 1; global $xmlta_doctype ; $this->type_doc = $xmlta_doctype ; global $notice_parent; //relation montante ou descendante if ($notice_parent) { $this->notice_link['down'][0] = new notice_relation(); $this->notice_link['down'][0]->set_linked_notice($notice_parent); } $this->is_new = $deflt_notice_is_new; // penser au test d'existence de la notice sur code-barre return; } } // Donne l'id de la notice par son isbn public static function get_notice_id_from_cb($code) { if(!$code) return 0; $isbn = traite_code_isbn($code); if(isISBN10($isbn)) { $isbn13 = formatISBN($isbn,13); $isbn10 = $isbn; } elseif (isISBN13($isbn)) { $isbn10 = formatISBN($isbn,10); $isbn13 = $isbn; } else { // ce n'est pas un code au format isbn $isbn10=$code; } $requete = "SELECT notice_id FROM notices WHERE ( code='$isbn10' or code='$isbn13') and code !='' LIMIT 1 "; if(($result = pmb_mysql_query($requete))) { if (pmb_mysql_num_rows($result)) { $notice = pmb_mysql_fetch_object($result); return($notice->notice_id); } } return 0; } //Récupération d'un titre de notice public static function get_notice_title($notice_id) { // $requete="select serie_name, tnvol, tit1, code from notices left join series on serie_id=tparent_id where notice_id=".$notice_id; // $resultat=pmb_mysql_query($requete); // if (pmb_mysql_num_rows($resultat)) { // $r=pmb_mysql_fetch_object($resultat); // return ($r->serie_name?$r->serie_name." ":"").($r->tnvol?$r->tnvol." ":"").$r->tit1.($r->code?" (".$r->code.")":""); // } // return ''; $mono_display = new mono_display($notice_id, 0, '', 0, '', '', '',0, 0, 0, 0,"", 0, false, true); return strip_tags($mono_display->header_texte); } public static function get_notice_view_link($notice_id) { $requete="select niveau_biblio, serie_name, tnvol, tit1, code from notices left join series on serie_id=tparent_id where notice_id=".$notice_id; $fetch = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($fetch)) { $header_perio=''; $r = pmb_mysql_fetch_object($fetch); if($r->niveau_biblio == 's'){ // périodique $link = './catalog.php?categ=serials&sub=view&serial_id='.$notice_id; }elseif($r->niveau_biblio == 'b') { // notice de bulletin $query = 'select bulletin_id, bulletin_notice from bulletins where num_notice = '.$notice_id; $result = pmb_mysql_query($query,$dbh); if($result && pmb_mysql_num_rows($result)){ $row = pmb_mysql_fetch_object($result); $link = './catalog.php?categ=serials&sub=view&sub=bulletinage&action=view&bul_id='.$row->bulletin_id; $requete_perio="select tit1, code from notices where notice_id=".$row->bulletin_notice; $fetch_perio = pmb_mysql_query($requete_perio, $dbh); if (pmb_mysql_num_rows($fetch_perio)) { $r_perio = pmb_mysql_fetch_object($fetch_perio); $header_perio= $r_perio->tit1.($r_perio->code?" (".$r_perio->code.") ":" "); } } }else{ // notice de monographie $link = './catalog.php?categ=isbd&id='.$notice_id; } $header= ($r->serie_name?$r->serie_name." ":"").($r->tnvol?$r->tnvol." ":"").$r->tit1.($r->code?" (".$r->code.")":""); return "".$header_perio.$header.""; } return ''; } //Récupérer une date au format AAAA-MM-JJ public static function get_date_parution($annee) { return detectFormatDate($annee); } // affichage du form associe public function show_form() { global $msg; global $charset; global $lang; global $include_path, $class_path; global $current_module ; global $pmb_type_audit,$select_categ_prop, $z3950_accessible ; global $value_deflt_fonction, $value_deflt_relation; global $thesaurus_mode_pmb ; global $PMBuserid, $pmb_form_editables,$thesaurus_classement_mode_pmb; global $xmlta_indexation_lang; global $thesaurus_concepts_active; global $pmb_map_activate; global $pmb_notices_show_dates; global $thesaurus_categories_affichage_ordre; include("$include_path/templates/catal_form.tpl.php"); $fonction = new marc_list('function'); // mise a jour de l'action en fonction de l'id $this->action .= $this->id; // mise a jour de l'en-tete du formulaire if (isset($this->notice_mere[0]) && $this->notice_mere[0]) $this->libelle_form.=" ".$msg["catalog_notice_fille_lib"]." ".substr($this->notice_mere[0],0,100).(count($this->notice_mere)>1?", ...":""); $form_notice = str_replace('!!libelle_form!!', $this->libelle_form, $form_notice); // mise a jour des flags de niveau hierarchique $form_notice = str_replace('!!b_level!!', $this->biblio_level, $form_notice); $form_notice = str_replace('!!h_level!!', $this->hierar_level, $form_notice); // Titre de la page $form_notice = str_replace('!!document_title!!', addslashes(($this->tit1 ? $this->tit1.' - ' : '').$this->libelle_form), $form_notice); // mise a jour de l'onglet 0 $ptab[0] = str_replace('!!tit1!!', htmlentities($this->tit1,ENT_QUOTES, $charset) , $ptab[0]); $ptab[0] = str_replace('!!tit2!!', htmlentities($this->tit2,ENT_QUOTES, $charset) , $ptab[0]); $ptab[0] = str_replace('!!tit3!!', htmlentities($this->tit3,ENT_QUOTES, $charset) , $ptab[0]); $ptab[0] = str_replace('!!tit4!!', htmlentities($this->tit4,ENT_QUOTES, $charset) , $ptab[0]); $ptab[0] = str_replace('!!tparent_id!!', $this->tparent_id , $ptab[0]); $ptab[0] = str_replace('!!tparent!!', htmlentities($this->tparent,ENT_QUOTES, $charset) , $ptab[0]); $ptab[0] = str_replace('!!tnvol!!', htmlentities($this->tnvol,ENT_QUOTES, $charset) , $ptab[0]); $form_notice = str_replace('!!tab0!!', $ptab[0], $form_notice); // mise a jour de l'onglet 1 // constitution de la mention de responsabilite //$this->responsabilites $as = array_search ("0", $this->responsabilites["responsabilites"]) ; if ($as!== FALSE && $as!== NULL) { $auteur_0 = $this->responsabilites["auteurs"][$as] ; } else { $auteur_0 = array( 'id' => 0, 'fonction' => ($value_deflt_fonction ? $value_deflt_fonction : ''), 'responsability' => '', 'id_responsability' => 0 ); } $auteur = new auteur($auteur_0["id"]); if($pmb_authors_qualification){ $vedette_ui = new vedette_ui(new vedette_composee(vedette_composee::get_vedette_id_from_object($auteur_0["id_responsability"],TYPE_NOTICE_RESPONSABILITY_PRINCIPAL), 'notice_authors')); $ptab[1] = str_replace('!!vedette_author!!', $vedette_ui->get_form('role', 0, 'notice'), $ptab[1]); }else{ $ptab[1] = str_replace('!!vedette_author!!', "", $ptab[1]); } $ptab[1] = str_replace('!!iaut!!', 0, $ptab[1]); $ptab[1] = str_replace('!!aut0_id!!', $auteur_0["id"], $ptab[1]); $ptab[1] = str_replace('!!aut0!!', htmlentities($auteur->get_isbd(),ENT_QUOTES, $charset), $ptab[1]); $ptab[1] = str_replace('!!f0_code!!', $auteur_0["fonction"], $ptab[1]); $ptab[1] = str_replace('!!f0!!', ($auteur_0["fonction"] ? $fonction->table[$auteur_0["fonction"]] : ''), $ptab[1]); $autres_auteurs = ''; $as = array_keys ($this->responsabilites["responsabilites"], "1" ) ; $max_aut1 = (count($as)) ; if ($max_aut1==0) $max_aut1=1; for ($i = 0 ; $i < $max_aut1 ; $i++) { if (isset($as[$i]) && $as[$i]!== FALSE && $as[$i]!== NULL) { $indice = $as[$i] ; $auteur_1 = $this->responsabilites["auteurs"][$indice] ; } else { $auteur_1 = array( 'id' => 0, 'fonction' => ($value_deflt_fonction ? $value_deflt_fonction : ''), 'responsability' => '', 'id_responsability' => 0 ); } $auteur = new auteur($auteur_1["id"]); $ptab_aut_autres =$ptab[11]; if($i){ $ptab_aut_autres = str_replace('!!bouton_add_display!!', 'display:none', $ptab_aut_autres); }else{ $ptab_aut_autres = str_replace('!!bouton_add_display!!', '', $ptab_aut_autres); } if($pmb_authors_qualification){ $vedette_ui = new vedette_ui(new vedette_composee(vedette_composee::get_vedette_id_from_object($auteur_1["id_responsability"],TYPE_NOTICE_RESPONSABILITY_AUTRE), 'notice_authors')); $ptab_aut_autres = str_replace('!!vedette_author!!', $vedette_ui->get_form('role_autre', $i, 'notice','',0), $ptab_aut_autres); }else{ $ptab_aut_autres = str_replace('!!vedette_author!!', "", $ptab_aut_autres); } $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab_aut_autres) ; $ptab_aut_autres = str_replace('!!aut1_id!!', $auteur_1["id"], $ptab_aut_autres); $ptab_aut_autres = str_replace('!!aut1!!', htmlentities($auteur->get_isbd(),ENT_QUOTES, $charset), $ptab_aut_autres); $ptab_aut_autres = str_replace('!!f1_code!!', $auteur_1["fonction"], $ptab_aut_autres); $ptab_aut_autres = str_replace('!!f1!!', ($auteur_1["fonction"] ? $fonction->table[$auteur_1["fonction"]] : ''), $ptab_aut_autres); $autres_auteurs .= $ptab_aut_autres ; } $ptab[1] = str_replace('!!max_aut1!!', $max_aut1, $ptab[1]); $auteurs_secondaires = ''; $as = array_keys ($this->responsabilites["responsabilites"], "2" ) ; $max_aut2 = (count($as)) ; if ($max_aut2==0) $max_aut2=1; for ($i = 0 ; $i < $max_aut2 ; $i++) { if (isset($as[$i]) && $as[$i]!== FALSE && $as[$i]!== NULL) { $indice = $as[$i] ; $auteur_2 = $this->responsabilites["auteurs"][$indice] ; } else { $auteur_2 = array( 'id' => 0, 'fonction' => ($value_deflt_fonction ? $value_deflt_fonction : ''), 'responsability' => '', 'id_responsability' => 0 ); } $auteur = new auteur($auteur_2["id"]); $ptab_aut_autres =$ptab[12]; if($i){ $ptab_aut_autres = str_replace('!!bouton_add_display!!', 'display:none', $ptab_aut_autres); }else{ $ptab_aut_autres = str_replace('!!bouton_add_display!!', '', $ptab_aut_autres); } if($pmb_authors_qualification){ $vedette_ui = new vedette_ui(new vedette_composee(vedette_composee::get_vedette_id_from_object($auteur_2["id_responsability"],TYPE_NOTICE_RESPONSABILITY_SECONDAIRE), 'notice_authors')); $ptab_aut_autres = str_replace('!!vedette_author!!', $vedette_ui->get_form('role_secondaire', $i, 'notice','',0), $ptab_aut_autres); }else{ $ptab_aut_autres = str_replace('!!vedette_author!!', "", $ptab_aut_autres); } $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab_aut_autres); $ptab_aut_autres = str_replace('!!aut2_id!!', $auteur_2["id"], $ptab_aut_autres); $ptab_aut_autres = str_replace('!!aut2!!', htmlentities($auteur->get_isbd(),ENT_QUOTES, $charset), $ptab_aut_autres); $ptab_aut_autres = str_replace('!!f2_code!!', $auteur_2["fonction"], $ptab_aut_autres); $ptab_aut_autres = str_replace('!!f2!!', ($auteur_2["fonction"] ? $fonction->table[$auteur_2["fonction"]] : ''), $ptab_aut_autres); $auteurs_secondaires .= $ptab_aut_autres ; } $ptab[1] = str_replace('!!max_aut2!!', $max_aut2, $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); // mise a jour de l'onglet 2 $ptab[2] = str_replace('!!ed1_id!!', $this->ed1_id , $ptab[2]); $ptab[2] = str_replace('!!ed1!!', htmlentities($this->ed1,ENT_QUOTES, $charset) , $ptab[2]); $ptab[2] = str_replace('!!coll_id!!', $this->coll_id , $ptab[2]); $ptab[2] = str_replace('!!coll!!', htmlentities($this->coll,ENT_QUOTES, $charset) , $ptab[2]); $ptab[2] = str_replace('!!subcoll_id!!', $this->subcoll_id , $ptab[2]); $ptab[2] = str_replace('!!subcoll!!', htmlentities($this->subcoll,ENT_QUOTES, $charset) , $ptab[2]); $ptab[2] = str_replace('!!year!!', $this->year , $ptab[2]); $ptab[2] = str_replace('!!nocoll!!', htmlentities($this->nocoll,ENT_QUOTES, $charset) , $ptab[2]); $ptab[2] = str_replace('!!mention_edition!!', htmlentities($this->mention_edition,ENT_QUOTES, $charset) , $ptab[2]); $ptab[2] = str_replace('!!ed2_id!!', $this->ed2_id , $ptab[2]); $ptab[2] = str_replace('!!ed2!!', htmlentities($this->ed2,ENT_QUOTES, $charset) , $ptab[2]); $form_notice = str_replace('!!tab2!!', $ptab[2], $form_notice); // mise a jour de l'onglet 3 $ptab[3] = str_replace('!!cb!!', $this->code , $ptab[3]); $ptab[3] = str_replace('!!notice_id!!', $this->id , $ptab[3]); $form_notice = str_replace('!!tab3!!', $ptab[3], $form_notice); // Gestion des titres uniformes global $pmb_use_uniform_title; if ($pmb_use_uniform_title) { if($this->duplicate_from_id) $tu=new tu_notice($this->duplicate_from_id); else $tu=new tu_notice($this->id); $ptab[230] = str_replace("!!titres_uniformes!!", $tu->get_form("notice"), $ptab[230]); $form_notice = str_replace('!!tab230!!', $ptab[230], $form_notice); } // mise a jour de l'onglet 4 $ptab[4] = str_replace('!!npages!!', htmlentities($this->npages ,ENT_QUOTES, $charset) , $ptab[4]); $ptab[4] = str_replace('!!ill!!', htmlentities($this->ill ,ENT_QUOTES, $charset) , $ptab[4]); $ptab[4] = str_replace('!!size!!', htmlentities($this->size ,ENT_QUOTES, $charset) , $ptab[4]); $ptab[4] = str_replace('!!prix!!', htmlentities($this->prix ,ENT_QUOTES, $charset) , $ptab[4]); $ptab[4] = str_replace('!!accomp!!', htmlentities($this->accomp ,ENT_QUOTES, $charset) , $ptab[4]); $form_notice = str_replace('!!tab4!!', $ptab[4], $form_notice); // mise a jour de l'onglet 5 $ptab[5] = str_replace('!!n_gen!!', htmlentities($this->n_gen ,ENT_QUOTES, $charset) , $ptab[5]); $ptab[5] = str_replace('!!n_contenu!!', htmlentities($this->n_contenu ,ENT_QUOTES, $charset) , $ptab[5]); $ptab[5] = str_replace('!!n_resume!!', htmlentities($this->n_resume ,ENT_QUOTES, $charset) , $ptab[5]); $form_notice = str_replace('!!tab5!!', $ptab[5], $form_notice); // mise a jour de l'onglet 6 // categories $categ_repetables = ''; //tri ? if(($thesaurus_categories_affichage_ordre==0) && count($this->categories)){ $tmp=array(); foreach ( $this->categories as $key=>$value ) { $tmp[$key]=strip_tags($value['categ_libelle']); } $tmp=array_map("convert_diacrit",$tmp);//On enlève les accents $tmp=array_map("strtoupper",$tmp);//On met en majuscule asort($tmp);//Tri sur les valeurs en majuscule sans accent foreach ( $tmp as $key => $value ) { $tmp[$key]=$this->categories[$key];//On reprend les bons couples } $this->categories=array_values($tmp); } if (sizeof($this->categories)==0) $max_categ = 1 ; else $max_categ = sizeof($this->categories) ; $tab_categ_order=""; for ($i = 0 ; $i < $max_categ ; $i++) { if(isset($this->categories[$i]["categ_id"]) && $this->categories[$i]["categ_id"]) { $categ_id = $this->categories[$i]["categ_id"] ; } else { $categ_id = 0; } $categ = new category($categ_id); if ($i==0) $ptab_categ = str_replace('!!icateg!!', $i, $ptab[60]) ; else $ptab_categ = str_replace('!!icateg!!', $i, $ptab[601]) ; $ptab_categ = str_replace('!!categ_id!!', $categ_id, $ptab_categ); if ( sizeof($this->categories)==0 ) { $ptab_categ = str_replace('!!categ_libelle!!', '', $ptab_categ); } else { if ($thesaurus_mode_pmb) $nom_thesaurus='['.$categ->thes->getLibelle().'] ' ; else $nom_thesaurus='' ; $ptab_categ = str_replace('!!categ_libelle!!', htmlentities($nom_thesaurus.$categ->catalog_form,ENT_QUOTES, $charset), $ptab_categ); if($tab_categ_order!="")$tab_categ_order.=","; $tab_categ_order.=$i; } $categ_repetables .= $ptab_categ ; } $ptab[6] = str_replace('!!max_categ!!', $max_categ, $ptab[6]); $ptab[6] = str_replace('!!categories_repetables!!', $categ_repetables, $ptab[6]); $ptab[6] = str_replace('!!tab_categ_order!!', $tab_categ_order, $ptab[6]); // indexation interne $ptab[6] = str_replace('!!indexint_id!!', $this->indexint, $ptab[6]); if ($this->indexint){ $indexint = new indexint($this->indexint); $ptab[6] = str_replace('!!indexint!!', htmlentities($indexint->get_isbd(),ENT_QUOTES, $charset), $ptab[6]); $ptab[6] = str_replace('!!num_pclass!!', $indexint->id_pclass, $ptab[6]); } else { $ptab[6] = str_replace('!!indexint!!', '', $ptab[6]); $ptab[6] = str_replace('!!num_pclass!!', '', $ptab[6]); } // indexation libre $ptab[6] = str_replace('!!f_indexation!!', htmlentities($this->index_l,ENT_QUOTES, $charset), $ptab[6]); global $pmb_keyword_sep ; //if (!$pmb_keyword_sep) $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]); // Indexation concept if($thesaurus_concepts_active == 1){ if($this->duplicate_from_id) { $index_concept = new index_concept($this->duplicate_from_id, TYPE_NOTICE); } else { $index_concept = new index_concept($this->id, TYPE_NOTICE); } $ptab[6] = str_replace('!!index_concept_form!!', $index_concept->get_form("notice"), $ptab[6]); }else{ $ptab[6] = str_replace('!!index_concept_form!!', "", $ptab[6]); } $form_notice = str_replace('!!tab6!!', $ptab[6], $form_notice); // mise a jour de l'onglet 7 : langues // langues repetables $lang_repetables = ''; if (sizeof($this->langues)==0) $max_lang = 1 ; else $max_lang = sizeof($this->langues) ; 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->langues)==0 ) { $ptab_lang = str_replace('!!lang_code!!', '', $ptab_lang); $ptab_lang = str_replace('!!lang!!', '', $ptab_lang); } else { $ptab_lang = str_replace('!!lang_code!!', $this->langues[$i]["lang_code"], $ptab_lang); $ptab_lang = str_replace('!!lang!!',htmlentities($this->langues[$i]["langue"],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 repetables $langorg_repetables = ''; if (sizeof($this->languesorg)==0) $max_langorg = 1 ; else $max_langorg = sizeof($this->languesorg) ; 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->languesorg)==0 ) { $ptab_lang = str_replace('!!langorg_code!!', '', $ptab_lang); $ptab_lang = str_replace('!!langorg!!', '', $ptab_lang); } else { $ptab_lang = str_replace('!!langorg_code!!', $this->languesorg[$i]["lang_code"], $ptab_lang); $ptab_lang = str_replace('!!langorg!!',htmlentities($this->languesorg[$i]["langue"],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); // mise a jour de l'onglet 8 global $pmb_curl_timeout; $ptab[8] = str_replace('!!lien!!', htmlentities($this->lien ,ENT_QUOTES, $charset) , $ptab[8]); $ptab[8] = str_replace('!!eformat!!', htmlentities($this->eformat ,ENT_QUOTES, $charset) , $ptab[8]); $ptab[8] = str_replace('!!pmb_curl_timeout!!', $pmb_curl_timeout , $ptab[8]); $form_notice = str_replace('!!tab8!!', thumbnail::get_js_function_chklnk_tpl().$ptab[8], $form_notice); //Mise a jour de l'onglet 9 $p_perso=new parametres_perso("notices"); if (!$p_perso->no_special_fields) { // si on duplique, construire le formulaire avec les donnees de la notice d'origine if ($this->duplicate_from_id) $perso_=$p_perso->show_editable_fields($this->duplicate_from_id); else $perso_=$p_perso->show_editable_fields($this->id); $perso=""; for ($i=0; $i
".$p["COMMENT_DISPLAY"]."
".$p["AFF"]."
"; } } } } } } } $perso.=$perso_["CHECK_SCRIPTS"]; $ptab[9]=str_replace("!!champs_perso!!",$perso,$ptab[9]); } else $ptab[9]="\n\n"; $form_notice = str_replace('!!tab9!!', $ptab[9], $form_notice); //------------------------------------------ //Mise a jour de l'onglet 9 $p_perso1=new parametres_perso("notices"); if (!$p_perso1->no_special_fields) { // si on duplique, construire le formulaire avec les donnees de la notice d'origine if ($this->duplicate_from_id) $perso1_=$p_perso1->show_editable_fields($this->duplicate_from_id); else $perso1_=$p_perso1->show_editable_fields($this->id); $perso1=""; for ($i=0; $i
".$p["COMMENT_DISPLAY"]."
".$p["AFF"]."
"; }else{ if (strncmp($p["NAME"], $c2,6)== 0) { $perso1.="
".$p["COMMENT_DISPLAY"]."
".$p["AFF"]."
"; }else { if (strncmp($p["NAME"], $c3,6)== 0) { $perso1.="
".$p["COMMENT_DISPLAY"]."
".$p["AFF"]."
"; }else{ if (strncmp($p["NAME"], $c4,6)== 0) { $perso1.="
".$p["COMMENT_DISPLAY"]."
".$p["AFF"]."
"; }else{ if (strncmp($p["NAME"], $c5,6)== 0) { $perso1.="
".$p["COMMENT_DISPLAY"]."
".$p["AFF"]."
"; }else{ if (strncmp($p["NAME"], $c6,6)== 0) { $perso1.="
".$p["COMMENT_DISPLAY"]."
".$p["AFF"]."
"; } } } } } } } $perso1.=$perso1_["CHECK_SCRIPTS"]; $ptab[999]=str_replace("!!champs_perso!!",$perso1,$ptab[999]); } else $ptab[999]="\n\n"; $form_notice = str_replace('!!tab999!!', $ptab[999], $form_notice); //---------------------------------------------- //Liens vers d'autres notices if($this->duplicate_from_id) { $notice_relations = notice_relations_collection::get_object_instance($this->duplicate_from_id); } else { $notice_relations = notice_relations_collection::get_object_instance($this->id); } $form_notice = str_replace('!!tab11!!', $notice_relations->get_form($this->notice_link, 'm', ($this->duplicate_from_id ? true : false)),$form_notice); // champs de gestion $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", "", $this->statut, "", "","","",0) ; $ptab[10] = str_replace('!!notice_statut!!', $select_statut, $ptab[10]); if($this->is_new){ $ptab[10] = str_replace('!!checked_yes!!', "checked", $ptab[10]); $ptab[10] = str_replace('!!checked_no!!', "", $ptab[10]); }else{ $ptab[10] = str_replace('!!checked_no!!', "checked", $ptab[10]); $ptab[10] = str_replace('!!checked_yes!!', "", $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]); $ptab[10] = str_replace('!!message_folder!!',thumbnail::get_message_folder(), $ptab[10]); $select_num_notice_usage = gen_liste_multiple ("select id_usage, usage_libelle from notice_usage order by 2", "id_usage", "usage_libelle", "id_usage", "form_num_notice_usage", "", $this->num_notice_usage, "", "", 0, $msg['notice_usage_none'],0) ; $ptab[10] = str_replace('!!num_notice_usage!!', $select_num_notice_usage, $ptab[10]); if ($this->id && $pmb_notices_show_dates) { $dates_notices = "
 ".$this->create_date."
 ".$this->update_date; $ptab[10] = str_replace('!!dates_notice!!',$dates_notices, $ptab[10]); } else { $ptab[10] = str_replace('!!dates_notice!!',"", $ptab[10]); } //affichage des formulaires des droits d'acces $rights_form = $this->get_rights_form(); $ptab[10] = str_replace('', $rights_form, $ptab[10]); // langue de la notice global $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 = ""; $ptab[10] = str_replace('!!indexation_lang!!',$combo, $ptab[10]); $form_notice = str_replace('!!indexation_lang_sel!!', $user_lang, $form_notice); $form_notice = str_replace('!!tab10!!', thumbnail::get_js_function_chklnk_tpl().$ptab[10], $form_notice); // autorité personnalisées if($this->duplicate_from_id) { $authperso = new authperso_notice($this->duplicate_from_id); } else { $authperso = new authperso_notice($this->id); } $authperso_tpl=$authperso->get_form(); $form_notice = str_replace('!!authperso!!', $authperso_tpl, $form_notice); $form_notice = str_replace('!!tab10!!', $ptab[10], $form_notice); // map if($pmb_map_activate){ if($this->duplicate_from_id) $map_edition=new map_edition_controler(TYPE_RECORD,$this->duplicate_from_id); else $map_edition=new map_edition_controler(TYPE_RECORD,$this->id); $map_form=$map_edition->get_form(); if($this->duplicate_from_id) $map_info=new map_info($this->duplicate_from_id); else $map_info=new map_info($this->id); $map_form_info=$map_info->get_form(); $map_notice_form=$ptab[14]; $map_notice_form = str_replace('!!notice_map!!', $map_form.$map_form_info, $map_notice_form); $form_notice = str_replace('!!tab14!!', $map_notice_form, $form_notice); }else{ $form_notice = str_replace('!!tab14!!', "", $form_notice); } // Nomenclature if($pmb_nomenclature_activate){ if($this->duplicate_from_id) { $nomenclature= new nomenclature_record_ui($this->duplicate_from_id); } else { $nomenclature= new nomenclature_record_ui($this->id); } $nomenclature_notice_form=$ptab[15]; $nomenclature_notice_form = str_replace('!!nomenclature_form!!', $nomenclature->get_form(), $nomenclature_notice_form); $form_notice = str_replace('!!tab15!!', $nomenclature_notice_form, $form_notice); }else{ $form_notice = str_replace('!!tab15!!', "", $form_notice); } // definition 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->type_doc, "get_pos(); expandAll(); ajax_parse_dom(); if (inedit) move_parse_dom(relative); else initIt();"); $form_notice = str_replace('!!doc_type!!', $select_doc->display, $form_notice); // Ajout des localisations pour edition $select_loc=""; if ($PMBuserid==1) { $req_loc="select idlocation,location_libelle from docs_location"; $res_loc=pmb_mysql_query($req_loc); if (pmb_mysql_num_rows($res_loc)>1) { $select_loc="\n"; } } $form_notice=str_replace("!!location!!",$select_loc,$form_notice); // affichage du lien pour suppression et du lien d'annulation if ($this->id) { $link_supp = " "; $link_annul = ""; $link_remplace = ""; $link_duplicate = ""; if ($z3950_accessible) $link_z3950 = ""; else $link_z3950=""; if ($pmb_type_audit) $link_audit = "id', 'audit_popup', 700, 500, -2, -2, '$select_categ_prop')\" title='$msg[audit_button]' value='$msg[audit_button]' />"; else $link_audit = "" ; } else { $link_supp = ""; $link_remplace = ""; $link_duplicate = "" ; $link_z3950 = "" ; $link_audit = "" ; // if ($this->notice_mere_id || $this->duplicate_from_id) $link_annul = ""; if ((isset($this->notice_link['up']) && $this->notice_link['up'][0]->get_linked_notice()) || $this->duplicate_from_id) $link_annul = ""; else $link_annul = "link_annul."';\" />"; } $form_notice = str_replace('!!link_supp!!', $link_supp, $form_notice); $form_notice = str_replace('!!link_annul!!', $link_annul, $form_notice); $form_notice = str_replace('!!link_remplace!!', $link_remplace, $form_notice); $form_notice = str_replace('!!link_duplicate!!', $link_duplicate, $form_notice); $form_notice = str_replace('!!link_z3950!!', $link_z3950, $form_notice); $form_notice = str_replace('!!link_audit!!', $link_audit, $form_notice); $event = new event_record('record', 'after_show_form'); $event->set_record_id($this->id); $event_handler = events_handler::get_instance(); $event_handler->send($event); $plugins_form = ''; if ($event->get_result()) { $plugins_form = $event->get_result(); } $form_notice = str_replace('!!plugins_form!!', $plugins_form, $form_notice); return $form_notice; } //creation formulaire droits d'acces pour notices public function get_rights_form() { global $dbh,$msg,$charset; global $gestion_acces_active,$gestion_acces_user_notice, $gestion_acces_empr_notice; global $gestion_acces_user_notice_def, $gestion_acces_empr_notice_def; global $PMBuserid; if ($gestion_acces_active!=1) return ''; $ac = new acces(); $form = ''; $c_form = "
".htmlentities($msg['dom_cur_prf'],ENT_QUOTES,$charset)."
".htmlentities($msg['dom_cur_rights'],ENT_QUOTES,$charset)."
"; if($gestion_acces_user_notice==1) { $r_form=$c_form; $dom_1 = $ac->setDomain(1); $r_form = str_replace('', htmlentities($dom_1->getComment('long_name'), ENT_QUOTES, $charset) ,$r_form); if($this->id) { //profil ressource $def_prf=$dom_1->getComment('res_prf_def_lib'); $res_prf=$dom_1->getResourceProfile($this->id); $q=$dom_1->loadUsedResourceProfiles(); //recuperation droits utilisateur $user_rights = $dom_1->getRights($PMBuserid,$this->id,3); if($user_rights & 2) { $p_sel = gen_liste($q,'prf_id','prf_name', 'res_prf[1]', '', $res_prf, '0', $def_prf , '0', $def_prf); $p_rad = ""; $r_form = str_replace('', $p_rad, $r_form); } else { $r_form = str_replace('', htmlentities($dom_1->getResourceProfileName($res_prf), ENT_QUOTES, $charset), $r_form); } //droits/profils utilisateurs if($user_rights & 1) { $r_rad = ""; $r_form = str_replace('', $r_rad, $r_form); } //recuperation profils utilisateurs $t_u=array(); $t_u[0]= $dom_1->getComment('user_prf_def_lib'); //niveau par defaut $qu=$dom_1->loadUsedUserProfiles(); $ru=pmb_mysql_query($qu, $dbh); if (pmb_mysql_num_rows($ru)) { while(($row=pmb_mysql_fetch_object($ru))) { $t_u[$row->prf_id]= $row->prf_name; } } //recuperation des controles dependants de l'utilisateur $t_ctl=$dom_1->getControls(0); //recuperation des droits $t_rights = $dom_1->getResourceRights($this->id); if (count($t_u)) { $h_tab = "
"; foreach($t_u as $k=>$v) { $h_tab.= ""; } $h_tab.="
".htmlentities($v, ENT_QUOTES, $charset)."
"; $c_tab = ''; foreach($t_u as $k=>$v) { $c_tab.= "
"; $t_rows = ""; foreach($t_ctl as $k2=>$v2) { $t_rows.=" "; } $c_tab = str_replace('', $t_rows, $c_tab); } $c_tab.= ""; } $h_tab = str_replace('', $c_tab, $h_tab); $r_form=str_replace('', $h_tab, $r_form); } else { $r_form = str_replace('', htmlentities($msg['dom_prf_unknown'], ENT_QUOTES, $charset), $r_form); $r_form = str_replace('', htmlentities($msg['dom_rights_unknown'], ENT_QUOTES, $charset), $r_form); } $form.= $r_form; } if($gestion_acces_empr_notice==1) { $r_form=$c_form; $dom_2 = $ac->setDomain(2); $r_form = str_replace('', htmlentities($dom_2->getComment('long_name'), ENT_QUOTES, $charset) ,$r_form); if($this->id) { //profil ressource $def_prf=$dom_2->getComment('res_prf_def_lib'); $res_prf=$dom_2->getResourceProfile($this->id); $q=$dom_2->loadUsedResourceProfiles(); //Recuperation droits generiques utilisateur $user_rights = $dom_2->getDomainRights(0,$res_prf); if($user_rights & 2) { $p_sel = gen_liste($q,'prf_id','prf_name', 'res_prf[2]', '', $res_prf, '0', $def_prf , '0', $def_prf); $p_rad = ""; $r_form = str_replace('', $p_rad, $r_form); } else { $r_form = str_replace('', htmlentities($dom_2->getResourceProfileName($res_prf), ENT_QUOTES, $charset), $r_form); } //droits/profils utilisateurs if($user_rights & 1) { $r_rad = ""; $r_form = str_replace('', $r_rad, $r_form); } //recuperation profils utilisateurs $t_u=array(); $t_u[0]= $dom_2->getComment('user_prf_def_lib'); //niveau par defaut $qu=$dom_2->loadUsedUserProfiles(); $ru=pmb_mysql_query($qu, $dbh); if (pmb_mysql_num_rows($ru)) { while(($row=pmb_mysql_fetch_object($ru))) { $t_u[$row->prf_id]= $row->prf_name; } } //recuperation des controles dependants de l'utilisateur $t_ctl=$dom_2->getControls(0); //recuperation des droits $t_rights = $dom_2->getResourceRights($this->id); if (count($t_u)) { $h_tab = "
"; foreach($t_u as $k=>$v) { $h_tab.= ""; } $h_tab.="
".htmlentities($v, ENT_QUOTES, $charset)."
"; $c_tab = ''; foreach($t_u as $k=>$v) { $c_tab.= "
"; $t_rows = ""; foreach($t_ctl as $k2=>$v2) { $t_rows.=" "; } $c_tab = str_replace('', $t_rows, $c_tab); } $c_tab.= ""; } $h_tab = str_replace('', $c_tab, $h_tab);; $r_form=str_replace('', $h_tab, $r_form); } else { $r_form = str_replace('', htmlentities($msg['dom_prf_unknown'], ENT_QUOTES, $charset), $r_form); $r_form = str_replace('', htmlentities($msg['dom_rights_unknown'], ENT_QUOTES, $charset), $r_form); } $form.= $r_form; } return $form; } // --------------------------------------------------------------- // replace_form : affichage du formulaire de remplacement // --------------------------------------------------------------- public function replace_form() { global $notice_replace; global $msg; global $include_path; global $deflt_notice_replace_keep_categories; global $notice_replace_categories, $notice_replace_category; global $thesaurus_mode_pmb; global $charset; // a completer if(!$this->id) { require_once("$include_path/user_error.inc.php"); error_message($msg[161], $msg[162], 1, './catalog.php'); return false; } $notice_replace=str_replace('!!old_notice_libelle!!', $this->tit1." - ".$this->code, $notice_replace); $notice_replace=str_replace('!!id!!', $this->id, $notice_replace); if ($deflt_notice_replace_keep_categories && sizeof($this->categories)) { // categories $categories_to_replace = ""; for ($i = 0 ; $i < sizeof($this->categories) ; $i++) { $categ_id = $this->categories[$i]["categ_id"] ; $categ = new category($categ_id); $ptab_categ = str_replace('!!icateg!!', $i, $notice_replace_category) ; $ptab_categ = str_replace('!!categ_id!!', $categ_id, $ptab_categ); if ($thesaurus_mode_pmb) $nom_thesaurus='['.$categ->thes->getLibelle().'] ' ; else $nom_thesaurus='' ; $ptab_categ = str_replace('!!categ_libelle!!', htmlentities($nom_thesaurus.$categ->catalog_form,ENT_QUOTES, $charset), $ptab_categ); $categories_to_replace .= $ptab_categ ; } $notice_replace_categories=str_replace('!!notice_replace_category!!', $categories_to_replace, $notice_replace_categories); $notice_replace_categories=str_replace('!!nb_categ!!', sizeof($this->categories), $notice_replace_categories); $notice_replace=str_replace('!!notice_replace_categories!!', $notice_replace_categories, $notice_replace); } else { $notice_replace=str_replace('!!notice_replace_categories!!', "", $notice_replace); } print $notice_replace; return true; } // --------------------------------------------------------------- // replace($by) : remplacement de la notice // --------------------------------------------------------------- public function replace($by,$supp_notice=true) { global $msg; global $keep_categories; global $notice_replace_links; if($this->id == $by) { return $msg[223]; } if (($this->id == $by) || (!$this->id)) { return $msg[223]; } $by_notice= new notice($by); if ($this->biblio_level != $by_notice->biblio_level || $this->hierar_level != $by_notice->hierar_level) { return $msg[catal_rep_not_err1]; } // traitement des catégories (si conservation cochée) if ($keep_categories) { update_notice_categories_from_form($by); } //gestion des liens notice_relations::replace_links($this->id, $by, $notice_replace_links); vedette_composee::replace(10, $this->id, $by); // Mise à jour des vedettes composées contenant cette notice vedette_composee::update_vedettes_built_with_element($by, "records"); // remplacement dans les exemplaires numériques $requete = "UPDATE explnum SET explnum_notice='$by' WHERE explnum_notice='$this->id' "; pmb_mysql_query($requete); // remplacement dans les exemplaires $requete = "UPDATE exemplaires SET expl_notice='$by' WHERE expl_notice='$this->id' "; pmb_mysql_query($requete); // remplacement dans les depouillements $requete = "UPDATE analysis SET analysis_notice='$by' WHERE analysis_notice='$this->id' "; pmb_mysql_query($requete); // remplacement dans les bulletins $requete = "UPDATE bulletins SET bulletin_notice='$by' WHERE bulletin_notice='$this->id' "; pmb_mysql_query($requete); // remplacement dans les resas $requete = "UPDATE resa SET resa_idnotice='$by' WHERE resa_idnotice='$this->id' "; pmb_mysql_query($requete); $req="UPDATE notices_authperso SET notice_authperso_notice_num='$by' where notice_authperso_notice_num='$this->id' "; pmb_mysql_query($req); //Suppression de la notice if($supp_notice){ notice::del_notice($this->id); } return FALSE; } public static function del_notice ($id) { global $dbh,$class_path,$pmb_synchro_rdf; global $sphinx_active; //Suppression de la vignette de la notice si il y en a une d'uploadée thumbnail::delete($id); //synchro_rdf (à laisser en premier : a besoin des éléments de la notice pour retirer du graphe rdf) if($pmb_synchro_rdf){ $synchro_rdf = new synchro_rdf(); $synchro_rdf->delRdf($id,0); } $p_perso=new parametres_perso("notices"); $p_perso->delete_values($id); $requete = "DELETE FROM notices_categories WHERE notcateg_notice='$id'" ; @pmb_mysql_query($requete, $dbh); $requete = "DELETE FROM notices_langues WHERE num_notice='$id'" ; @pmb_mysql_query($requete, $dbh); $requete = "DELETE FROM notices WHERE notice_id='$id'" ; @pmb_mysql_query($requete, $dbh); audit::delete_audit (AUDIT_NOTICE, $id) ; // Effacement de l'occurence de la notice ds la table notices_global_index : $requete = "DELETE FROM notices_global_index WHERE num_notice=".$id; @pmb_mysql_query($requete, $dbh); // Effacement des occurences de la notice ds la table notices_mots_global_index : $requete = "DELETE FROM notices_mots_global_index WHERE id_notice=".$id; @pmb_mysql_query($requete, $dbh); // Effacement des occurences de la notice ds la table notices_fields_global_index : $requete = "DELETE FROM notices_fields_global_index WHERE id_notice=".$id; @pmb_mysql_query($requete, $dbh); //Suppression des nomenclatures avant la suppression des relations entre notices (manif / sous manif) $nomenclature_record = new nomenclature_record_ui($id); $nomenclature_record->delete(); notice_relations::delete($id); // elimination des docs numeriques $req_explNum = "select explnum_id from explnum where explnum_notice=".$id." "; $result_explNum = @pmb_mysql_query($req_explNum, $dbh); while(($explNum = pmb_mysql_fetch_object($result_explNum))) { $myExplNum = new explnum($explNum->explnum_id); $myExplNum->delete(); } // Clean des vedettes $id_vedettes_links_deleted=notice::delete_vedette_links($id); foreach ($id_vedettes_links_deleted as $id_vedette){ $vedette_composee = new vedette_composee($id_vedette); $vedette_composee->delete(); } $requete = "DELETE FROM responsability WHERE responsability_notice='$id'" ; @pmb_mysql_query($requete, $dbh); $requete = "DELETE FROM bannette_contenu WHERE num_notice='$id'" ; @pmb_mysql_query($requete, $dbh); $requete = "delete from caddie_content using caddie, caddie_content where caddie_id=idcaddie and type='NOTI' and object_id='".$id."' "; @pmb_mysql_query($requete, $dbh); $requete = "delete from analysis where analysis_notice='".$id."' "; @pmb_mysql_query($requete, $dbh); $requete = "update bulletins set num_notice=0 where num_notice='".$id."' "; @pmb_mysql_query($requete, $dbh); //Suppression de la reference a la notice dans la table suggestions $requete = "UPDATE suggestions set num_notice = 0 where num_notice=".$id; @pmb_mysql_query($requete, $dbh); //Suppression de la reference a la notice dans la table lignes_actes $requete = "UPDATE lignes_actes set num_produit=0, type_ligne=0 where num_produit='".$id."' and type_ligne in ('1','5') "; @pmb_mysql_query($requete, $dbh); //suppression des droits d'acces user_notice $requete = "delete from acces_res_1 where res_num=".$id; @pmb_mysql_query($requete, $dbh); // suppression des tags $rqt_del = "delete from tags where num_notice=".$id; @pmb_mysql_query($rqt_del, $dbh); //suppression des avis avis_records::delete_from_object($id); //suppression des droits d'acces empr_notice $requete = "delete from acces_res_2 where res_num=".$id; @pmb_mysql_query($requete, $dbh); // Supression des liens avec les titres uniformes $requete = "DELETE FROM notices_titres_uniformes WHERE ntu_num_notice='$id'" ; @pmb_mysql_query($requete, $dbh); //Suppression dans les listes de lecture partagées $requete = "SELECT id_liste, notices_associees from opac_liste_lecture" ; $res=pmb_mysql_query($requete, $dbh); $id_tab=array(); while(($notices=pmb_mysql_fetch_object($res))){ $id_tab = explode(',',$notices->notices_associees); for($i=0;$imap_emprise_id; pmb_mysql_query($req_areas,$dbh); } $query = "update docwatch_items set item_num_notice=0 where item_num_notice = ".$id; pmb_mysql_query($query, $dbh); //Suppression de la reference a la notice dans les veilles $requete = "UPDATE docwatch_items set item_num_notice = 0 where item_num_notice=".$id; @pmb_mysql_query($requete, $dbh); // Nettoyage indexation concepts $index_concept = new index_concept($id, TYPE_NOTICE); $index_concept->delete(); scan_requests::clean_scan_requests_on_delete_record($id); if($sphinx_active){ $si = self::get_sphinx_indexer(); $si->deleteIndex($id); } } // Clean des vedettes public static function delete_vedette_links($id) { global $dbh; $id_vedettes=array(); $rqt_responsability = 'select id_responsability, responsability_type from responsability where responsability_notice="'.$id.'" '; $res_responsability=pmb_mysql_query($rqt_responsability, $dbh); if (pmb_mysql_num_rows($res_responsability)) { while($r=pmb_mysql_fetch_object($res_responsability)){ $object_id=$r->id_responsability; $type_aut=$r->responsability_type; $id_vedette=0; switch($type_aut){ case 0: $id_vedette=vedette_link::delete_vedette_link_from_object(new vedette_composee(0,'notice_authors'), $object_id, TYPE_NOTICE_RESPONSABILITY_PRINCIPAL); break; case 1: $id_vedette=vedette_link::delete_vedette_link_from_object(new vedette_composee(0,'notice_authors'), $object_id,TYPE_NOTICE_RESPONSABILITY_AUTRE); break; case 2: $id_vedette=vedette_link::delete_vedette_link_from_object(new vedette_composee(0,'notice_authors'), $object_id,TYPE_NOTICE_RESPONSABILITY_SECONDAIRE); break; } if($id_vedette)$id_vedettes[]=$id_vedette; } } return $id_vedettes; } //sauvegarde un ensemble de notices dans un entrepot agnostique a partir d'un tableau d'ids de notices public static function save_to_agnostic_warehouse($notice_ids=array(),$source_id=0,$keep_expl=0) { global $base_path,$class_path,$include_path; if (is_array($notice_ids) && count($notice_ids) && $source_id*1) { $export_params=array( 'genere_lien' =>1, 'notice_mere' =>1, 'notice_fille' =>1, 'mere' =>0, 'fille' =>0, 'bull_link' =>1, 'perio_link' =>1, 'art_link' =>0, 'bulletinage' =>0, 'notice_perio' =>0, 'notice_art' =>0 ); require_once($base_path."/admin/connecteurs/in/agnostic/agnostic.class.php"); $conn=new agnostic($base_path.'/admin/connecteurs/in/agnostic'); $source_params = $conn->get_source_params($source_id); $export_params['docnum']=1; $export_params['docnum_rep']=$source_params['REP_UPLOAD']; $notice_ids=array_unique($notice_ids); $e=new export($notice_ids); $records=array(); do{ $nn = $e->get_next_notice('',array(),array(),$keep_expl,$export_params); if ($e->notice) $records[] = $e->xml_array; } while($nn); $conn->rec_records_from_xml_array($records,$source_id); } } // Donne les id des notices liés a une notice public static function get_list_child($notice_id,$liste=array()){ $tab=array(); $liste[]=$notice_id; $notice_relations = notice_relations_collection::get_object_instance($notice_id); $childs = $notice_relations->get_childs(); foreach ($childs as $childs_relations) { foreach ($childs_relations as $child) { if(!in_array($child->get_linked_notice(),$liste)) { $liste[]=$child->get_linked_notice(); $tab_tmp=notice::get_list_child($child->get_linked_notice(),$liste); $tab=array_merge($tab,$tab_tmp); }else { // cas de rebouclage d'une fille sur une mère: donc on sort. $tab[]=$notice_id; return $tab; } } } $tab[]=$notice_id; return $tab; } public static function majNotices_clean_tags($notice=0,$with_reindex=true) { global $dbh; $requete = "select index_l ,notice_id from notices where index_l is not null and index_l!='' "; if($notice) { $requete.= " and notice_id = $notice "; } $res = pmb_mysql_query($requete, $dbh); if($res && pmb_mysql_num_rows($res)){ while (($r = pmb_mysql_fetch_object($res))) { $val=clean_tags($r->index_l); $requete = "update notices set index_l='".addslashes($val)."' where notice_id=".$r->notice_id; pmb_mysql_query($requete, $dbh); if($with_reindex && ($val != $r->index_l)){//On réindexe la notice si le nettoyage à réalisé des changements notice::majNoticesTotal($r->notice_id); } } } } // Fonction statique pour la creation / maj d'un n-uplet dans la table "notices_global_index" lors de la creation ou mise a jour d'une notice. public static function majNoticesGlobalIndex($notice, $NoIndex = 1) { global $dbh; if(!static::$deleted_index) { pmb_mysql_query("delete from notices_global_index where num_notice = ".$notice." AND no_index = ".$NoIndex,$dbh); } $titres = pmb_mysql_query("select index_serie, tnvol, index_wew, index_sew, index_l, index_matieres, n_gen, n_contenu, n_resume, index_n_gen, index_n_contenu, index_n_resume, eformat, niveau_biblio from notices where notice_id = ".$notice, $dbh); $mesNotices = pmb_mysql_fetch_assoc($titres); $tit = $mesNotices['index_wew']; $indTit = $mesNotices['index_sew']; $indMat = $mesNotices['index_matieres']; $indL = $mesNotices['index_l']; $indResume = $mesNotices['index_n_resume']; $indGen = $mesNotices['index_n_gen']; $indContenu = $mesNotices['index_n_contenu']; $resume = $mesNotices['n_resume']; $gen = $mesNotices['n_gen']; $contenu = $mesNotices['n_contenu']; $indSerie = $mesNotices['index_serie']; $tvol = $mesNotices['tnvol']; $eformatlien = $mesNotices['eformat']; $infos_notice_global=' '.$tvol.' '.$tit.' '.$resume.' '.$gen.' '.$contenu.' '.$indL.' '; $infos_notice_global_index=' '.$indSerie.' '.$indTit.' '.$indResume.' '.$indGen.' '.$indContenu.' '.$indMat.' '; $infos_global=''; // Authors : $auteurs = pmb_mysql_query("select author_id, author_type, author_name, author_rejete, author_date, author_lieu,author_ville,author_pays,author_numero,author_subdivision, index_author from authors, responsability WHERE responsability_author = author_id AND responsability_notice = $notice", $dbh); $numA = pmb_mysql_num_rows($auteurs); if($numA) { if(!isset(static::$aut_pperso_instance['author'])) { static::$aut_pperso_instance['author'] = new aut_pperso("author"); } for($j=0;$j < $numA; $j++) { $mesAuteurs = pmb_mysql_fetch_assoc($auteurs); $infos_global.= $mesAuteurs['author_name'].' '. $mesAuteurs['author_rejete'].' '. $mesAuteurs['author_lieu'].' '. $mesAuteurs['author_ville'].' '. $mesAuteurs['author_pays'].' '. $mesAuteurs['author_numero'].' '. $mesAuteurs['author_subdivision'].' '; if($mesAuteurs['author_type'] == "72") $infos_global.= ' '.$mesAuteurs['author_date'].' '; $mots_perso = static::$aut_pperso_instance['author']->get_fields_recherche($mesAuteurs['author_id']); if($mots_perso) { $infos_global.= $mots_perso.' '; } } } pmb_mysql_free_result($auteurs); // Nom du periodique //cas d'un article if($mesNotices['niveau_biblio'] == 'a'){ $temp = pmb_mysql_query("select bulletin_notice, bulletin_titre, index_titre, index_wew, index_sew from analysis, bulletins, notices WHERE analysis_notice=".$notice." and analysis_bulletin = bulletin_id and bulletin_notice=notice_id", $dbh); $numP = pmb_mysql_num_rows($temp); if ($numP) { // La notice appartient a un periodique, on selectionne le titre de periodique : $mesTemp = pmb_mysql_fetch_assoc($temp); $infos_global.= $mesTemp['index_wew'].' '.$mesTemp['bulletin_titre'].' '.$mesTemp['index_titre'].' '; } pmb_mysql_free_result($temp); //cas d'un bulletin }else if ($mesNotices['niveau_biblio'] == 'b'){ $temp = pmb_mysql_query("select serial.index_wew from notices join bulletins on bulletins.num_notice = notices.notice_id join notices as serial on serial.notice_id = bulletins.bulletin_notice where notices.notice_id = ".$notice); $numP = pmb_mysql_num_rows($temp); if ($numP) { // La notice appartient a un periodique, on selectionne le titre de periodique : $mesTemp = pmb_mysql_fetch_assoc($temp); $infos_global.= $mesTemp['index_wew'].' '; } pmb_mysql_free_result($temp); } // Categories : $noeud = pmb_mysql_query("select notices_categories.num_noeud as categ_id, libelle_categorie from notices_categories,categories where notcateg_notice = ".$notice." and notices_categories.num_noeud=categories.num_noeud order by ordre_categorie", $dbh); $numNoeuds = pmb_mysql_num_rows($noeud); if($numNoeuds) { if(!isset(static::$aut_pperso_instance['categ'])) { static::$aut_pperso_instance['categ'] = new aut_pperso("categ"); } // Pour chaque noeud trouve on cherche les noeuds parents et les noeuds fils : for($j=0;$j < $numNoeuds; $j++) { // On met a jour la table notices_global_index avec le noeud trouve: $mesNoeuds = pmb_mysql_fetch_assoc($noeud); $infos_global.= $mesNoeuds['libelle_categorie'].' '; $mots_perso = static::$aut_pperso_instance['categ']->get_fields_recherche($mesNoeuds['categ_id']); if($mots_perso) { $infos_global.= $mots_perso.' '; } } } // Sous-collection : $subColls = pmb_mysql_query("select subcoll_id, sub_coll_name, index_sub_coll from notices, sub_collections WHERE subcoll_id = sub_coll_id AND notice_id = ".$notice, $dbh); $numSC = pmb_mysql_num_rows($subColls); if($numSC) { if(!isset(static::$aut_pperso_instance['subcollection'])) { static::$aut_pperso_instance['subcollection'] = new aut_pperso("subcollection"); } for($j=0;$j < $numSC; $j++) { $mesSubColl = pmb_mysql_fetch_assoc($subColls); $infos_global.=$mesSubColl['index_sub_coll'].' '.$mesSubColl['sub_coll_name'].' '; $mots_perso = static::$aut_pperso_instance['subcollection']->get_fields_recherche($mesSubColl['subcoll_id']); if($mots_perso) { $infos_global.= $mots_perso.' '; } } } pmb_mysql_free_result($subColls); // Indexation numerique : $indexNums = pmb_mysql_query("select indexint_id, indexint_name, indexint_comment from notices, indexint WHERE indexint = indexint_id AND notice_id = ".$notice, $dbh); $numIN = pmb_mysql_num_rows($indexNums); if($numIN) { if(!isset(static::$aut_pperso_instance['indexint'])) { static::$aut_pperso_instance['indexint'] = new aut_pperso("indexint"); } for($j=0;$j < $numIN; $j++) { $mesindexNums = pmb_mysql_fetch_assoc($indexNums); $infos_global.=$mesindexNums['indexint_name'].' '.$mesindexNums['indexint_comment'].' '; $mots_perso = static::$aut_pperso_instance['indexint']->get_fields_recherche($mesindexNums['indexint_id']); if($mots_perso) { $infos_global.= $mots_perso.' '; } } } pmb_mysql_free_result($indexNums); // Collection : $Colls = pmb_mysql_query("select coll_id, collection_name ,collection_issn from notices, collections WHERE coll_id = collection_id AND notice_id = ".$notice, $dbh); $numCo = pmb_mysql_num_rows($Colls); if($numCo) { if(!isset(static::$aut_pperso_instance['collection'])) { static::$aut_pperso_instance['collection'] = new aut_pperso("collection"); } for($j=0;$j < $numCo; $j++) { $mesColl = pmb_mysql_fetch_assoc($Colls); $infos_global.= $mesColl['collection_name'].' '.$mesColl['collection_issn'].' '; $mots_perso = static::$aut_pperso_instance['collection']->get_fields_recherche($mesColl['coll_id']); if($mots_perso) { $infos_global.= $mots_perso.' '; } } } pmb_mysql_free_result($Colls); // Editeurs : $editeurs = pmb_mysql_query("select ed_id, ed_name from notices, publishers WHERE (ed1_id = ed_id OR ed2_id = ed_id) AND notice_id = ".$notice, $dbh); $numE = pmb_mysql_num_rows($editeurs); if($numE) { if(!isset(static::$aut_pperso_instance['publisher'])) { static::$aut_pperso_instance['publisher'] = new aut_pperso("publisher"); } for($j=0;$j < $numE; $j++) { $mesEditeurs = pmb_mysql_fetch_assoc($editeurs); $infos_global.= $mesEditeurs['ed_name'].' '; $mots_perso = static::$aut_pperso_instance['publisher']->get_fields_recherche($mesEditeurs['ed_id']); if($mots_perso) { $infos_global.= $mots_perso.' '; } } } pmb_mysql_free_result($editeurs); pmb_mysql_free_result($titres); // Titres Uniformes : $tu = pmb_mysql_query("select tu_id, ntu_titre, tu_name, tu_tonalite, tu_sujet, tu_lieu, tu_contexte from notices_titres_uniformes,titres_uniformes WHERE tu_id=ntu_num_tu and ntu_num_notice=".$notice, $dbh); $numtu = pmb_mysql_num_rows($tu); if($numtu){ if(!isset(static::$aut_pperso_instance['tu'])) { static::$aut_pperso_instance['tu'] = new aut_pperso("tu"); } for($j=0;$j < $numtu; $j++) { $mesTu = pmb_mysql_fetch_assoc($tu); $infos_global.=$mesTu['ntu_titre'].' '.$mesTu['tu_name'].' '.$mesTu['tu_tonalite'].' '.$mesTu['tu_sujet'].' '.$mesTu['tu_lieu'].' '.$mesTu['tu_contexte'].' '; $mots_perso = static::$aut_pperso_instance['tu']->get_fields_recherche($mesTu['tu_id']); if($mots_perso) { $infos_global.= $mots_perso.' '; } } } pmb_mysql_free_result($tu); // indexer les cotes des etat des collections : $p_perso = static::get_parametres_perso_class("collstate"); $coll = pmb_mysql_query("select collstate_id, collstate_cote from collections_state WHERE id_serial=".$notice, $dbh); $numcoll = pmb_mysql_num_rows($coll); for($j=0;$j < $numcoll; $j++) { $mescoll = pmb_mysql_fetch_assoc($coll); $infos_global.=$mescoll['collstate_cote'].' '; // champ perso cherchable $mots_perso=$p_perso->get_fields_recherche($mescoll['collstate_id']); if($mots_perso) { $infos_global.= $mots_perso.' '; } } pmb_mysql_free_result($coll); // Nomenclature global $pmb_nomenclature_activate; if($pmb_nomenclature_activate){ $mots=nomenclature_record_ui::get_index($notice); $infos_global.= $mots.' '; } // champ perso cherchable $p_perso = static::get_parametres_perso_class("notices"); $mots_perso=$p_perso->get_fields_recherche($notice); if($mots_perso) { $infos_global.= $mots_perso.' '; } // champs des authperso $auth_perso=new authperso_notice($notice); $mots_authperso=$auth_perso->get_fields_search(); if($mots_authperso) { $infos_global.= $mots_authperso.' '; } $infos_global_index = $infos_notice_global_index.strip_empty_words($infos_global).' '; $infos_global = $infos_notice_global.$infos_global; // flux RSS éventuellement $eformat=array(); $eformat = explode(' ', $eformatlien) ; if ($eformat[0]=='RSS' && $eformat[3]=='1') { $flux=strip_tags(affiche_rss($notice)) ; $infos_global_index.= strip_empty_words($flux).' '; } pmb_mysql_query("insert into notices_global_index SET num_notice=".$notice.",no_index =".$NoIndex.", infos_global='".addslashes($infos_global)."', index_infos_global='".addslashes($infos_global_index)."'" , $dbh); } // Fonction statique pour la creation / maj d'un n-uplet dans la table "notices_mots_global_index" lors de la creation ou mise a jour d'une notice. public static function majNoticesMotsGlobalIndex($notice, $datatype='all') { global $include_path; global $dbh; global $lang; global $indexation_lang; global $sphinx_active; if(!isset(static::$indexation_record)) { static::$indexation_record = new indexation_record($include_path."/indexation/notices/champs_base.xml", 'notices'); } static::$indexation_record->set_deleted_index(static::$deleted_index); static::$indexation_record->maj($notice, $datatype); } public static function get_sphinx_indexer(){ if(!self::$sphinx_indexer){ self::$sphinx_indexer = new sphinx_records_indexer(); } return self::$sphinx_indexer; } //Fonction statique pour la maj des champs index de la notice public static function majNotices($notice){ global $pmb_keyword_sep; if($notice){ $query = pmb_mysql_query("SELECT notice_id,tparent_id,tit1,tit2,tit3,tit4,index_l, n_gen, n_contenu, n_resume, tnvol, indexation_lang FROM notices WHERE notice_id='".$notice."'"); if(pmb_mysql_num_rows($query)) { //Nettoyage des mots clès notice::majNotices_clean_tags($notice,false); $row = pmb_mysql_fetch_object($query); // titre de série if ($row->tparent_id) { $tserie = new serie($row->tparent_id); $ind_serie = ' '.strip_empty_words($tserie->name).' '; } else { $ind_serie = ''; } $ind_wew = $ind_serie." ".$row->tnvol." ".$row->tit1." ".$row->tit2." ".$row->tit3." ".$row->tit4 ; $ind_sew = strip_empty_words($ind_wew) ; $row->index_l ? $ind_matieres = ' '.strip_empty_words(str_replace($pmb_keyword_sep," ",$row->index_l)).' ' : $ind_matieres = ''; $row->n_gen ? $ind_n_gen = ' '.strip_empty_words($row->n_gen).' ' : $ind_n_gen = ''; $row->n_contenu ? $ind_n_contenu = ' '.strip_empty_words($row->n_contenu).' ' : $ind_n_contenu = ''; $row->n_resume ? $ind_n_resume = ' '.strip_empty_words($row->n_resume).' ' : $ind_n_resume = ''; $req_update = "UPDATE notices"; $req_update .= " SET index_wew='".addslashes($ind_wew)."'"; $req_update .= ", index_sew=' ".addslashes($ind_sew)." '"; $req_update .= ", index_serie='".addslashes($ind_serie)."'"; $req_update .= ", index_n_gen='".addslashes($ind_n_gen)."'"; $req_update .= ", index_n_contenu='".addslashes($ind_n_contenu)."'"; $req_update .= ", index_n_resume='".addslashes($ind_n_resume)."'"; $req_update .= ", index_matieres='".addslashes($ind_matieres)."'"; $req_update .= " WHERE notice_id=$row->notice_id "; $update = pmb_mysql_query($req_update); pmb_mysql_free_result($query); // Mise à jour des vedettes composées contenant cette notice vedette_composee::update_vedettes_built_with_element($notice, "records"); } } } public static function indexation_prepare($notice){ global $lang,$include_path; global $pmb_indexation_lang; global $empty_word; global $indexation_lang; $info=array(); $info['flag_lang_change']=0; if(!$notice) return; $query = pmb_mysql_query("SELECT indexation_lang FROM notices WHERE notice_id='".$notice."'"); if(pmb_mysql_num_rows($query)) { $row = pmb_mysql_fetch_object($query); $indexation_lang=$row->indexation_lang; pmb_mysql_free_result($query); if($indexation_lang && $indexation_lang!= $lang){ $info['save_pmb_indexation_lang']=$pmb_indexation_lang; $info['save_lang']=$lang; $info['flag_lang_change']=1; $pmb_indexation_lang=$indexation_lang; $lang=$indexation_lang; $empty_word=array(); include("$include_path/marc_tables/".$lang."/empty_words"); }else{ //$indexation_lang=$lang; } } return $info; } public static function indexation_restaure($info){ global $lang,$include_path; global $pmb_indexation_lang; global $empty_word; if($info['flag_lang_change']){ // restauration de l'environemment $pmb_indexation_lang=$info['save_pmb_indexation_lang']; $lang=$info['save_lang']; $empty_word=array(); include("$include_path/marc_tables/$lang/empty_words"); } //$pmb_indexation_lang=""; //$flag_lang_change=0; } //Met à jour toutes les informations liées une notice public static function majNoticesTotal($notice){ $info=notice::indexation_prepare($notice); notice::majNotices($notice); notice::majNoticesGlobalIndex($notice); notice::majNoticesMotsGlobalIndex($notice); notice::indexation_restaure($info); } public static function getAutomaticTu($notice) { global $dbh,$charset,$opac_enrichment_bnf_sparql; if (!$opac_enrichment_bnf_sparql) return 0; $requete="select code, responsability_author from notices left join responsability on (responsability_notice=$notice and responsability_type=0) left join notices_titres_uniformes on notice_id=ntu_num_notice where notice_id=$notice and ntu_num_notice is null"; $resultat=pmb_mysql_query($requete,$dbh); if ($resultat && pmb_mysql_num_rows($resultat,$dbh)) { $code=pmb_mysql_result($resultat,0,0,$dbh); $id_author=pmb_mysql_result($resultat,0,1,$dbh); } else $code=""; $id_tu=0; if (isISBN($code)) { $uri=titre_uniforme::get_data_bnf_uri($code); if ($uri) { //Recherche du titre uniforme déjà existant ? $requete="select tu_id from titres_uniformes where tu_databnf_uri='".addslashes($uri)."'"; $resultat=pmb_mysql_query($requete,$dbh); if ($resultat && pmb_mysql_num_rows($resultat,$dbh)) $id_tu=pmb_mysql_result($resultat,0,0,$dbh); else { //Interrogation de data.bnf pour obtenir les infos ! $configbnf = array( 'remote_store_endpoint' => 'http://data.bnf.fr/sparql' ); $storebnf = ARC2::getRemoteStore($configbnf); $sparql = " PREFIX dc: SELECT ?title ?date ?description WHERE { <".$uri."> dc:title ?title. OPTIONAL { <".$uri."> dc:date ?date. } OPTIONAL { <".$uri."> dc:description ?description. } }"; $rows = $storebnf->query($sparql, 'rows'); // On vérifie qu'il n'y a pas d'erreur sinon on stoppe le programme et on renvoi une chaine vide $err = $storebnf->getErrors(); if (!$err) { $value=array( "name"=>encoding_normalize::charset_normalize($rows[0]['title'],"utf-8"), "num_author"=>$id_author, "date"=>encoding_normalize::charset_normalize($rows[0]['date'],"utf-8"), "comment"=>encoding_normalize::charset_normalize($rows[0]['description'],"utf-8"), "databnf_uri"=>$uri ); $id_tu=titre_uniforme::import($value); } } } } if ($id_tu) { $titres_uniformes=array(array("num_tu"=>$id_tu)); $ntu=new tu_notice($notice); $ntu->update($titres_uniformes); } return $id_tu; } public function get_records_list_ui(){ global $quoi; if(!$this->records_list_ui){ $tab = null; foreach($this->record_tabs->get_tabs() as $current_tab){ if (!$tab && $current_tab->get_nb_results()) { $tab = $current_tab; } if(($current_tab->get_name() == $quoi) && $current_tab->get_nb_results()){ $tab = $current_tab; break; } } if ($tab) { $quoi = $tab->get_name(); switch($tab->get_content_type()){ case 'records': $this->records_list_ui = new elements_records_list_ui($tab->get_contents(), $tab->get_nb_results(), $tab->is_mixed(), $tab->get_groups(), $tab->get_nb_filtered_results()); break; case 'authorities': $this->records_list_ui = new elements_authorities_list_ui($tab->get_contents(), $tab->get_nb_results(), $tab->is_mixed(), $tab->get_groups(), $tab->get_nb_filtered_results()); break; case 'docnums': $this->records_list_ui = new elements_docnums_list_ui($tab->get_contents(), $tab->get_nb_results(), $tab->is_mixed(), $tab->get_groups(), $tab->get_nb_filtered_results()); break; case 'graph': $this->records_list_ui = new elements_graph_ui($tab->get_contents(), $tab->get_nb_results(), $tab->is_mixed(), $tab->get_groups(), $tab->get_nb_filtered_results()); break; } } } return $this->records_list_ui; } public function set_record_tabs($record_tabs){ $this->record_tabs = $record_tabs; } public function get_nomenclature_record_formations() { global $pmb_nomenclature_activate; if ($pmb_nomenclature_activate && !$this->nomenclature_record_formations) { $this->nomenclature_record_formations = new nomenclature_record_formations($this->id); } return $this->nomenclature_record_formations; } public static function manage_access_rights($id, $create=false){ global $gestion_acces_active; global $gestion_acces_empr_notice; global $gestion_acces_user_notice; global $res_prf; global $prf_rad; global $r_rad; global $dbh; global $chk_rights; global $class_path; global $PMBuserid; if ($gestion_acces_active==1 && $id) { $ac = new acces(); //droits d'acces utilisateur/notice (modification) if ($gestion_acces_active==1 && $gestion_acces_user_notice==1) { $dom_1= $ac->setDomain(1); } //traitement des droits acces user_notice if ($gestion_acces_active==1 && $gestion_acces_user_notice==1) { if (!$create) { $dom_1->storeUserRights(1, $id, $res_prf, $chk_rights, $prf_rad, $r_rad); } else { $dom_1->storeUserRights(0, $id, $res_prf, $chk_rights, $prf_rad, $r_rad); } } //traitement des droits acces empr_notice if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) { $dom_2= $ac->setDomain(2); if (!$create) { $dom_2->storeUserRights(1, $id, $res_prf, $chk_rights, $prf_rad, $r_rad); } else { $dom_2->storeUserRights(0, $id, $res_prf, $chk_rights, $prf_rad, $r_rad); } } } } public static function get_icon($id) { global $icon_list_instance; if(!isset($icon_list_instance)) { $icon_list_instance=new marc_list("icondoc"); } $requete="select concat(niveau_biblio,typdoc) as i from notices where notice_id=".$id; $resultat=pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { $icon="./images/".$icon_list_instance->table[pmb_mysql_result($resultat,0,0)]; } else $icon='./images/icon_a_16x16.gif'; return $icon; } public static function get_gestion_link($notice_id) { $requete="select niveau_biblio, serie_name, tnvol, tit1, code from notices left join series on serie_id=tparent_id where notice_id=".$notice_id; $fetch = pmb_mysql_query($requete); if (pmb_mysql_num_rows($fetch)) { $r = pmb_mysql_fetch_object($fetch); if($r->niveau_biblio == 's'){ // périodique $link = './catalog.php?categ=serials&sub=view&serial_id='.$notice_id; }elseif($r->niveau_biblio == 'b') { // notice de bulletin $query = 'select bulletin_id, bulletin_notice from bulletins where num_notice = '.$notice_id; $result = pmb_mysql_query($query); if($result && pmb_mysql_num_rows($result)){ $row = pmb_mysql_fetch_object($result); $link = './catalog.php?categ=serials&sub=view&sub=bulletinage&action=view&bul_id='.$row->bulletin_id; } }else{ // notice de monographie $link = './catalog.php?categ=isbd&id='.$notice_id; } return $link; } return ''; } public function get_id(){ return $this->id; } /** * Retourne les identifiants de concepts associés à la notice */ public function get_concepts_ids(){ if (!isset($this->concepts_ids)) { $this->concepts_ids = array(); $vedette_composee_found = vedette_composee::get_vedettes_built_with_element($this->id, 'records'); foreach($vedette_composee_found as $vedette_id){ $this->concepts_ids[] = vedette_composee::get_object_id_from_vedette_id($vedette_id, TYPE_CONCEPT_PREFLABEL); } } return $this->concepts_ids; } public function get_entity_type(){ return 'record'; } public static function set_deleted_index($deleted_index) { static::$deleted_index = $deleted_index; } protected static function get_parametres_perso_class($type){ if(!isset(self::$parametres_perso[$type])){ self::$parametres_perso[$type] = new parametres_perso($type); } return self::$parametres_perso[$type]; } //Récupération de la no_image public static function get_picture_url_no_image($niveau_biblio, $typdoc) { $picture_url = get_url_icon("no_image_".$niveau_biblio.$typdoc.".jpg"); if(!file_exists($picture_url)) { $picture_url = get_url_icon("no_image_".$niveau_biblio.".jpg"); if(!file_exists($picture_url)) { $picture_url = get_url_icon("no_image.jpg"); } } return $picture_url; } } } # fin de declaration