array(),"auteurs" => array()); // les auteurs public $categories = array();// les categories public $show_resa = 0; // flag indiquant si on affiche les infos de resa public $p_perso; public $print_mode=0; public $show_explnum=1; public $show_statut=0; public $aff_statut = '' ; // carré de couleur pour signaler le statut de la notice public $tit_serie_lien_gestion ; public $childs=array(); //Filles de la notice public $anti_loop=""; public $drag=""; //Notice draggable ? public $no_link; public $show_opac_hidden_fields=true; public $num_notice; public $id_bulletin; public $ajax_mode = 0; public $lien_suppr_cart = ''; public $expl_data; // constructeur------------------------------------------------------------ public function __construct($cb,$expl_id=0, $level=1, $action='', $expl=1, $expl_link='', $lien_suppr_cart="", $explnum_link='', $show_resa=0, $print=0, $show_explnum=1, $no_link=true,$ajax_mode=0 ) { // $id = id de la notice à afficher // $action = URL associée au header // $level : // 0 : juste le header (titre / auteur principal avec le lien si applicable) // suppression des niveaux entre 1 et 6, seul reste level // 1 : ISBD seul, pas de note, bouton modif, expl, explnum et résas // 6 : cas général détaillé avec notes, categ, langues, indexation... + boutons // $expl -> affiche ou non les exemplaires associés // $expl_link -> lien associé à l'exemplaire avec !!expl_id!!, !!notice_id!! et !!expl_cb!! à mettre à jour // $lien_suppr_cart -> lien de suppression de la notice d'un caddie // // $show_resa = affichage des resa ou pas global $pmb_recherche_ajax_mode; global $explr_visible_mod,$pmb_droits_explr_localises, $dbh; $expl_id += 0; if(!$expl_id && $cb) { $query = " select expl_id from exemplaires where expl_cb='".$cb."'"; $result = pmb_mysql_query($query, $dbh); if(pmb_mysql_num_rows($result)) { $expl = pmb_mysql_fetch_object($result); $expl_id = $expl->expl_id; } } $this->expl_data = $this->get_expl_info($cb,$expl_id); $this->notice_id = $this->expl_data->expl_notice; $this->id_bulletin = $this->expl_data->expl_bulletin; if($this->id_bulletin) { $req="select num_notice from bulletins where bulletin_id=".$this->id_bulletin; $result = pmb_mysql_query($req); if(pmb_mysql_num_rows($result)) { $res = pmb_mysql_fetch_object($result); $this->num_notice = $res->num_notice; } } $this->header=$this->expl_titre_diplay()." / "; $this->isbd=$this->expl_info_display(); // notice de monographie if($this->notice_id) { $display = new mono_display($this->notice_id,$level, "", $expl, $expl_link, '', $explnum_link,1, 0, 1, 0, "", 1 , $no_link,true,0); $link_notice = str_replace("!!id!!", $this->notice_id, $action ); } // notice de bulletin if($this->num_notice) { $display = new mono_display($this->num_notice, $level, "", $expl, $expl_link, '', $explnum_link,1, 0, 1, 0, "", 1 , $no_link,true,0); $link_notice = str_replace("!!id!!", $this->id_bulletin, $action ); } // bulletin sans notice if(!$this->num_notice && $this->id_bulletin) { $display = new bulletinage_display($this->id_bulletin); $link_notice = str_replace("!!id!!", $this->id_bulletin, $action ); } $this->header.= $display->header; $this->isbd.= "".$display->header.""; // $this->isbd.= $display->isbd; //visibilité des exemplaires if ($pmb_droits_explr_localises) { $explr_tab_modif=explode(",",$explr_visible_mod); $as_modif = array_search($this->expl_data->idlocation,$explr_tab_modif); } else { $as_modif = true; } if (($expl_link) && ($as_modif!== FALSE && $as_modif!== NULL) ) { $expl_link = str_replace("!!notice_id!!", $this->notice_id, $expl_link ); $expl_link = str_replace("!!expl_cb!!", $cb, $expl_link ); $expl_link = str_replace("!!expl_id!!", $expl_id, $expl_link ); $expl_link = str_replace("!!bulletin_id!!", $this->id_bulletin, $expl_link ); $this->header= "".$this->header.""; } switch($level) { case 0: // là, c'est le niveau 0 : juste le header $this->result = $this->header; break; default: // niveau 1 et plus : header + isbd à générer $this->init_javascript(); $this->finalize(); break; } } public function expl_titre_diplay() { global $charset; global $msg; global $pmb_expl_title_display_format,$p_perso, $perso_, $nb_param; if(!$pmb_expl_title_display_format) return''; $liste_format=explode(",",$pmb_expl_title_display_format); foreach($liste_format as $format) { switch($format) { case "expl_cb":$liste_aff[]=htmlentities($this->expl_data->expl_cb,ENT_QUOTES,$charset);break; case "expl_notice":$liste_aff[]=htmlentities($this->expl_data->id_notice,ENT_QUOTES,$charset);break; case "expl_bulletin":$liste_aff[]=htmlentities($this->expl_data->id_bulletin,ENT_QUOTES,$charset);break; case "expl_typdoc":$liste_aff[]=htmlentities($this->expl_data->tdoc_libelle,ENT_QUOTES,$charset);break; case "expl_cote":$liste_aff[]=htmlentities($this->expl_data->expl_cote,ENT_QUOTES,$charset);break; case "expl_section":$liste_aff[]=htmlentities($this->expl_data->section_libelle,ENT_QUOTES,$charset);break; case "expl_statut":$liste_aff[]=htmlentities($this->expl_data->statut,ENT_QUOTES,$charset);break; case "expl_location":$liste_aff[]=htmlentities($this->expl_data->location_libelle,ENT_QUOTES,$charset);break; case "expl_codestat":$liste_aff[]=htmlentities($this->expl_data->codestat,ENT_QUOTES,$charset);break; case "expl_note":$liste_aff[]=htmlentities($this->expl_data->note,ENT_QUOTES,$charset);break; case "expl_prix":$liste_aff[]=htmlentities($this->expl_data->prix,ENT_QUOTES,$charset);break; case "expl_owner":$liste_aff[]=htmlentities($this->expl_data->lender_libelle,ENT_QUOTES,$charset);break; case "expl_lastempr":$liste_aff[]=htmlentities($this->expl_data->lastempr,ENT_QUOTES,$charset);break; case "last_loan_date":$liste_aff[]=htmlentities(format_date($this->expl_data->last_loan_date),ENT_QUOTES,$charset);break; case "create_date":$liste_aff[]=htmlentities(format_date($this->expl_data->create_date),ENT_QUOTES,$charset);break; case "update_date":$liste_aff[]=htmlentities(format_date($this->expl_data->update_date),ENT_QUOTES,$charset);break; case "expl_date_depot":$liste_aff[]=htmlentities(format_date($this->expl_data->expl_date_depot),ENT_QUOTES,$charset);break; case "expl_date_retour":$liste_aff[]=htmlentities(format_date($this->expl_data->expl_date_retour),ENT_QUOTES,$charset);break; case "type_antivol":$liste_aff[]=htmlentities($this->expl_data->type_antivol,ENT_QUOTES,$charset);break; case "transfert_location_origine":$liste_aff[]=htmlentities($this->expl_data->transfert_location_origine,ENT_QUOTES,$charset);break; case "transfert_statut_origine":$liste_aff[]=htmlentities($this->expl_data->transfert_statut_origine,ENT_QUOTES,$charset);break; case "transfert_section_origine":$liste_aff[]=htmlentities($this->expl_data->transfert_section_origine,ENT_QUOTES,$charset);break; default: if (is_numeric($format)) { // c'est un id de champ perso if(!$p_perso) $p_perso=new parametres_perso("expl"); if (!$p_perso->no_special_fields) { if(!$perso_) { $perso_=$p_perso->show_fields($this->expl_data->expl_id); $nb_param=count($perso_["FIELDS"]); } for ($i=0; $i<$nb_param; $i++) { $p=$perso_["FIELDS"][$i]; if($p["ID"]==$format) { if($p["AFF"] !== '') $liste_aff[]=$p["AFF"]; } } } } break; } } if(!$liste_aff) return''; return implode(", ", $liste_aff); } // récupération des infos exemplaires public function get_expl_info($cb, $id, $lien_notice=1) { global $dbh; global $cart_link_non; if ($cb && !$id) $clause_where = " WHERE expl_cb = '$cb' "; if ( (!$cb && $id) || ($cb && $id) ) $clause_where = " WHERE expl_id = '$id' "; if ($cb || $id) { $query = " select * from exemplaires expl, docs_location location, docs_codestat, lenders "; $query .= ", docs_section section, docs_statut statut, docs_type dtype"; $query .= $clause_where; $query .= " and location.idlocation=expl.expl_location"; $query .= " and section.idsection=expl.expl_section"; $query .= " and statut.idstatut=expl.expl_statut"; $query .= " and dtype.idtyp_doc=expl.expl_typdoc"; $query .= " and idcode=expl.expl_codestat"; $query .= " and idlender=expl.expl_owner"; $result = pmb_mysql_query($query, $dbh); if(pmb_mysql_num_rows($result)) { $expl = pmb_mysql_fetch_object($result); if ($expl->expl_lastempr) { $lastempr = new emprunteur($expl->expl_lastempr, '', FALSE, 0) ; $expl->lastempr_nom = $lastempr->nom; $expl->lastempr_prenom = $lastempr->prenom; $expl->lastempr_cb = $lastempr->cb; } return $expl; } } return FALSE; } public function expl_info_display($affichage_emprunteurs=1,$affichage_zone_notes=1) { global $msg,$expl_view_form,$pmb_expl_show_dates,$charset; $expl_aff=$expl_view_form; $expl_aff=str_replace('!!code_barre!!', htmlentities($this->expl_data->expl_cb,ENT_QUOTES,$charset), $expl_aff); $expl_aff=str_replace('!!cote!!', htmlentities($this->expl_data->expl_cote,ENT_QUOTES,$charset), $expl_aff); $expl_aff=str_replace('!!type_doc!!', htmlentities($this->expl_data->tdoc_libelle,ENT_QUOTES,$charset), $expl_aff); $expl_aff=str_replace('!!localisation!!', htmlentities($this->expl_data->location_libelle,ENT_QUOTES,$charset), $expl_aff); $expl_aff=str_replace('!!section!!', htmlentities($this->expl_data->section_libelle,ENT_QUOTES,$charset), $expl_aff); $expl_aff=str_replace('!!owner!!', htmlentities($this->expl_data->lender_libelle,ENT_QUOTES,$charset), $expl_aff); $expl_aff=str_replace('!!statut!!', htmlentities($this->expl_data->statut_libelle,ENT_QUOTES,$charset), $expl_aff); $expl_aff=str_replace('!!codestat!!', htmlentities($this->expl_data->codestat_libelle,ENT_QUOTES,$charset), $expl_aff); $expl_aff=str_replace('!!note!!', htmlentities($this->expl_data->expl_note,ENT_QUOTES,$charset), $expl_aff); $expl_aff=str_replace('!!comment!!', htmlentities($this->expl_data->expl_comment,ENT_QUOTES,$charset), $expl_aff); //on compte de nombre de prets pour cet exemplaire $req = "select count(arc_expl_id) from pret_archive where arc_expl_id = ".$this->expl_data->expl_id; $res = pmb_mysql_query($req); $nb_prets = pmb_mysql_result($res,0,0); $expl_aff=str_replace('!!nb_prets!!', $nb_prets, $expl_aff); //Date de création / modification if($pmb_expl_show_dates=='1' || $pmb_expl_show_dates=='3') { $tmp=" ".htmlentities(format_date($this->expl_data->create_date),ENT_QUOTES,$charset)." ".htmlentities(format_date($this->expl_data->update_date),ENT_QUOTES,$charset)." "; $expl_aff=str_replace('', $tmp, $expl_aff); } //Date de dépôt / retour if($pmb_expl_show_dates=='2' || $pmb_expl_show_dates=='3') { $tmp=" ".htmlentities(format_date($this->expl_data->expl_date_depot),ENT_QUOTES,$charset)." ".htmlentities(format_date($this->expl_data->expl_date_retour),ENT_QUOTES,$charset)." "; $expl_aff=str_replace('', $tmp, $expl_aff); } $p_perso=new parametres_perso("expl"); if (!$p_perso->no_special_fields) { $c=0; $perso=""; $perso_=$p_perso->show_fields($this->expl_data->expl_id); $nb_param=count($perso_["FIELDS"]); $perso_aff=''; for ($i=0; $i<$nb_param; $i++) { $nb_colonne=2; $perso_aff.="\n"; for ($i; $i<$nb_param; $i++) { $p=$perso_["FIELDS"][$i]; $perso_aff.=""; $perso_aff.="".$p["AFF"].""; if(!--$nb_colonne) break; } $perso_aff.="\n"; } } $expl_aff=str_replace('!!champs_perso!!', $perso_aff, $expl_aff); return $expl_aff; } // finalisation du résultat (écriture de l'isbd) public function finalize() { $this->result = str_replace('!!ISBD!!', $this->isbd, $this->result); } // génération du template javascript--------------------------------------- public function init_javascript() { global $msg,$pmb_recherche_ajax_mode, $categ; // propriétés pour le selecteur de panier $cart_click = "onClick=\"openPopUp('./cart.php?object_type=EXPL&item=!!id!!', 'cart')\""; $cart_over_out = "onMouseOver=\"show_div_access_carts(event,!!id!!,'EXPL');\" onMouseOut=\"set_flag_info_div(false);\""; $checkbox = ''; if(isset($categ) && $categ == 'search') { $checkbox = ""; } if($pmb_recherche_ajax_mode && $this->ajax_mode){ $javascript_template ="
" . $checkbox . " !!heada!!
"; }else{ $javascript_template ="
" . $checkbox . " !!heada!!
"; } $id_part = ""; if ($this->anti_loop) { $id_part = "_p" . substr($this->anti_loop, count($this->anti_loop)-1, 1); } $this->result = str_replace('!!id!!', $this->expl_data->expl_id . $id_part, $javascript_template); $this->result = str_replace('!!heada!!', $this->lien_suppr_cart.$this->header, $this->result); } // fin class }