id = $id; $this->fetch_data(); } if($serial_id) { $this->serial_id = $serial_id; } return $this->id; } // récupération des infos en base function fetch_data() { global $dbh; global $explr_invisible, $explr_visible_unmod, $explr_visible_mod, $pmb_droits_explr_localises ; global $pmb_sur_location_activate; $myQuery = mysql_query("SELECT * FROM collections_state WHERE collstate_id='".$this->id."' LIMIT 1", $dbh); $mycoll= mysql_fetch_object($myQuery); $this->serial_id=$mycoll->id_serial; $this->location_id=$mycoll->location_id; $this->state_collections=$mycoll->state_collections; $this->emplacement=$mycoll->collstate_emplacement; $this->type=$mycoll->collstate_type; $this->origine=$mycoll->collstate_origine; $this->note=$mycoll->collstate_note; $this->cote=$mycoll->collstate_cote; $this->archive=$mycoll->collstate_archive; $this->lacune=$mycoll->collstate_lacune; $this->statut=$mycoll->collstate_statut; $myQuery = mysql_query("SELECT * FROM arch_emplacement WHERE archempla_id='".$this->emplacement."' LIMIT 1", $dbh); $myempl= mysql_fetch_object($myQuery); $this->emplacement_libelle=$myempl->archempla_libelle; $myQuery = mysql_query("SELECT * FROM arch_type WHERE archtype_id='".$this->type."' LIMIT 1", $dbh); $mytype= mysql_fetch_object($myQuery); $this->type_libelle=$mytype->archtype_libelle; // Lecture des statuts $myQuery = mysql_query("SELECT * FROM arch_statut WHERE archstatut_id='".$this->statut."' LIMIT 1", $dbh); $mystatut= mysql_fetch_object($myQuery); $this->statut_gestion_libelle=$mystatut->archstatut_gestion_libelle; $this->statut_opac_libelle=$mystatut->archstatut_opac_libelle; $this->statut_visible_opac=$mystatut->archstatut_visible_opac; $this->statut_visible_opac_abon=$mystatut->archstatut_visible_opac_abon; $this->statut_visible_gestion=$mystatut->archstatut_visible_gestion; $this->statut_class_html=$mystatut->archstatut_class_html; $myQuery = mysql_query("select location_libelle, surloc_num from docs_location where idlocation='".$this->location_id."' LIMIT 1", $dbh); $mylocation= mysql_fetch_object($myQuery); $this->location_libelle=$mylocation->location_libelle; if ($pmb_droits_explr_localises) { $tab_invis=explode(",",$explr_invisible); $tab_unmod=explode(",",$explr_visible_unmod); $as_invis = array_search($this->location_id,$tab_invis); $as_unmod = array_search($this->location_id,$tab_unmod); if ($as_invis!== FALSE && $as_invis!== NULL) $this->explr_acces_autorise="INVIS" ; elseif ($as_unmod!== FALSE && $as_unmod!== NULL) $this->explr_acces_autorise="UNMOD" ; else $this->explr_acces_autorise="MODIF" ; } else $this->explr_acces_autorise="MODIF" ; if ($pmb_sur_location_activate) { $this->surloc_id = $mylocation->surloc_num; $myQuery = mysql_query("select surloc_libelle from sur_location where surloc_id='".$this->surloc_id."' LIMIT 1", $dbh); $mysurloc = mysql_fetch_object($myQuery); $this->surloc_libelle=$mysurloc->surloc_libelle; } } //Récupération de l'affichage dans l'isbd function get_callstate_isbd() { global $msg, $pmb_etat_collections_localise,$pmb_droits_explr_localises,$explr_visible_mod; if ($pmb_etat_collections_localise && $pmb_droits_explr_localises && $explr_visible_mod) { $restrict_location=" and location_id in (".$explr_visible_mod.") and idlocation=location_id"; $table_location=",docs_location"; $select_location=",location_libelle"; } $rqt="select state_collections $select_location from collections_state $table_location where id_serial=".$this->serial_id.$restrict_location; $execute_query=mysql_query($rqt); if (mysql_num_rows($execute_query)) { $bool=false; $affichage="
".$msg["4001"]."
"; while (($r=mysql_fetch_object($execute_query))) { if ($r->state_collections) { if ($r->location_libelle) $affichage .= "".$r->location_libelle." : "; $affichage .= str_replace("\n","
",$r->state_collections)."
\n"; $bool=true; } } if ($bool==true) return($affichage); } return ""; } //Récupérer de l'affichage complet function get_display_list($base_url,$filtre,$debut=0,$page=0, $type=0,$form=1,$no_pagination=false) { global $dbh, $msg,$nb_per_page_a_search,$tpl_collstate_liste,$tpl_collstate_liste_line,$tpl_collstate_liste_form, $tpl_collstate_surloc_liste, $tpl_collstate_surloc_liste_line; global $explr_invisible,$pmb_droits_explr_localises,$pmb_etat_collections_localise,$deflt_docs_location; global $pmb_sur_location_activate; $location=$filtre->location; if (!$pmb_etat_collections_localise) { $location=""; } if (($pmb_droits_explr_localises)&&($explr_invisible)) $restrict_location=" location_id not in (".$explr_invisible.") and "; else $restrict_location=""; //On compte les bulletins à afficher $rqt="SELECT count( collstate_id) FROM collections_state WHERE $restrict_location ".($location?"(location_id='$location') and ":"")." id_serial='".$this->serial_id."' "; $myQuery = mysql_query($rqt, $dbh); $nbr_lignes = mysql_result($myQuery,0,0); $req="SELECT collstate_id , location_id FROM collections_state LEFT JOIN docs_location ON location_id=idlocation LEFT JOIN arch_emplacement ON collstate_emplacement=archempla_id WHERE $restrict_location ".($location?"(location_id='$location') and ":"")." id_serial='".$this->serial_id."' ORDER BY ".($pmb_etat_collections_localise?"location_libelle, ":"")."archempla_libelle, collstate_cote " .(($no_pagination)?'':"LIMIT $debut,$nb_per_page_a_search"); $myQuery = mysql_query($req, $dbh); if((mysql_num_rows($myQuery))) { if ($pmb_sur_location_activate) { $tpl_collstate_liste[$type] = str_replace('',$tpl_collstate_surloc_liste,$tpl_collstate_liste[$type]); $tpl_collstate_liste_line[$type] = str_replace('',$tpl_collstate_surloc_liste_line,$tpl_collstate_liste_line[$type]); } $parity=1; while(($coll = mysql_fetch_object($myQuery))) { $my_collstate=new collstate($coll->collstate_id); /* Avoir comment gerer un + pour des grands etats de collections if (count($my_collstate->state_collections)>80 || count($my_collstate->lacune)>80) { $plus_statecollection=""; $texte_statecollection=" "; } else $plus_statecollection=""; */ if ($parity++ % 2) $pair_impair = "even"; else $pair_impair = "odd"; // Si modifiable, ajout du lien vers le formulaire if($my_collstate->explr_acces_autorise=="MODIF") { $tr_javascript=" onmousedown=\"document.location='./catalog.php?categ=serials&sub=collstate_form&id=".$coll->collstate_id."&serial_id=".$this->serial_id."';\" "; } else { $tr_javascript=""; } $tr_surbrillance = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".$pair_impair."'\" "; $line = str_replace('!!tr_javascript!!',$tr_javascript , $tpl_collstate_liste_line[$type]); $line = str_replace('!!tr_surbrillance!!',$tr_surbrillance , $line); $line = str_replace('!!pair_impair!!',$pair_impair , $line); if ($pmb_sur_location_activate) { $line = str_replace('!!surloc!!', $my_collstate->surloc_libelle, $line); } $line = str_replace('!!localisation!!', $my_collstate->location_libelle, $line); $line = str_replace('!!cote!!', $my_collstate->cote, $line); $line = str_replace('!!type_libelle!!', $my_collstate->type_libelle, $line); $line = str_replace('!!emplacement_libelle!!', $my_collstate->emplacement_libelle, $line); $line = str_replace('!!statut_libelle!!', "".$my_collstate->statut_gestion_libelle, $line); $line = str_replace('!!origine!!', $my_collstate->origine, $line); $line = str_replace('!!state_collections!!',str_replace("\n","
",$my_collstate->state_collections), $line); $line = str_replace('!!lacune!!', str_replace("\n","
",$my_collstate->lacune), $line); $liste.=$line; } $liste = str_replace('!!collstate_liste!!',$liste , $tpl_collstate_liste[$type]); } else { $liste= $msg["collstate_no_collstate"]; } if($form)$liste = str_replace('!!collstate_table!!',$liste , $tpl_collstate_liste_form); $liste = str_replace('!!base_url!!', $base_url, $liste); $liste = str_replace('!!location!!', $location, $liste); $this->liste=$liste; $this->nbr=$nbr_lignes; // barre de navigation par page $this->pagination = aff_pagination ($base_url."&location=$location", $nbr_lignes, $nb_per_page_a_search, $page, 10, false, true) ; } // fonction de mise à jour ou de création d'état de collection function update($value) { global $dbh,$msg; $fields=""; foreach($value as $key => $val) { if($fields) $fields.=","; $fields.=" $key='".addslashes($val)."' "; } if($this->id) { // modif $no_erreur=mysql_query("UPDATE collections_state SET $fields WHERE collstate_id=".$this->id, $dbh); if(!$no_erreur) { error_message($msg["collstate_add_collstate"], $msg["collstate_add_error"],1); exit; } } else { // create $no_erreur=mysql_query("INSERT INTO collections_state SET $fields ", $dbh); $this->id = mysql_insert_id($dbh); if(!$no_erreur) { error_message($msg["collstate_edit_collstate"], $msg["collstate_add_error"],1); exit; } } return $this->id; } function update_from_form() { global $state_collections,$origine,$archive,$cote,$note,$lacune,$serial_id,$archstatut_id,$archtype_id,$location_id,$archempla_id; global $deflt_docs_location; $value->id_serial=stripslashes($serial_id); if(!$location_id) $location_id=$deflt_docs_location; $value->location_id=stripslashes($location_id); $value->state_collections=stripslashes($state_collections); $value->collstate_emplacement=stripslashes($archempla_id); $value->collstate_type=stripslashes($archtype_id); $value->collstate_origine=stripslashes($origine); $value->collstate_note=stripslashes($note); $value->collstate_cote=stripslashes($cote); $value->collstate_archive=stripslashes($archive); $value->collstate_lacune=stripslashes($lacune); if(!$archstatut_id)$archstatut_id=1; $value->collstate_statut=stripslashes($archstatut_id); $this->update($value); //Traitement des champs perso $p_perso=new parametres_perso("collstate"); $p_perso->check_submited_fields(); $p_perso->rec_fields_perso($this->id); } // fonction générant le form de saisie de notice chapeau function do_form() { global $msg; global $collstate_form,$statut_field,$emplacement_field, $location_field, $support_field; global $deflt_docs_location; global $deflt_arch_statut,$deflt_arch_emplacement,$deflt_arch_type; global $charset; global $pmb_etat_collections_localise; // titre formulaire if($this->id) { $libelle=$libelle=$msg["collstate_edit_collstate"]; $link_delete=""; } else { $libelle=$msg["collstate_add_collstate"]; $link_delete=""; } $collstate_form = str_replace('!!id!!', htmlentities($this->id,ENT_QUOTES,$charset), $collstate_form); $collstate_form = str_replace('!!location_id!!', htmlentities($this->location_id,ENT_QUOTES,$charset), $collstate_form); $collstate_form = str_replace('!!serial_id!!', htmlentities($this->serial_id,ENT_QUOTES,$charset), $collstate_form); $action="./catalog.php?categ=serials&sub=collstate_update&serial_id=".rawurlencode($this->serial_id)."&id=".rawurlencode($this->id); $collstate_form = str_replace('!!action!!', $action, $collstate_form); $collstate_form = str_replace('!!delete!!', $link_delete, $collstate_form); $collstate_form = str_replace('!!libelle!!',$libelle , $collstate_form); $collstate_form = str_replace('!!origine!!',htmlentities($this->origine,ENT_QUOTES,$charset) , $collstate_form); $collstate_form = str_replace('!!archive!!',htmlentities($this->archive,ENT_QUOTES,$charset) , $collstate_form); $collstate_form = str_replace('!!cote!!',htmlentities($this->cote,ENT_QUOTES,$charset) , $collstate_form); $collstate_form = str_replace('!!note!!',htmlentities($this->note,ENT_QUOTES,$charset) , $collstate_form); $collstate_form = str_replace('!!lacune!!',htmlentities($this->lacune,ENT_QUOTES,$charset) , $collstate_form); $collstate_form = str_replace('!!state_collections!!',htmlentities($this->state_collections,ENT_QUOTES,$charset) , $collstate_form); // champs des localisations if($pmb_etat_collections_localise) { if(!$this->location_id) $this->location_id=$deflt_docs_location; $select = gen_liste("select distinct idlocation, location_libelle from docs_location order by 2 ", "idlocation", "location_libelle", 'location_id', "", $this->location_id, "", "","","",0); $field=""; if($select) $field = str_replace('!!location!!',$select, $location_field); $collstate_form = str_replace('!!location_field!!',$field, $collstate_form); }else{ $field=" "; $collstate_form = str_replace('!!location_field!!',$field, $collstate_form); } // champs des emplacements if(!$this->emplacement) $this->emplacement=$deflt_arch_emplacement; $select = gen_liste("select archempla_id, archempla_libelle from arch_emplacement order by 2", "archempla_id", "archempla_libelle", "archempla_id", "",$this->emplacement, "", "", "","","",0) ; $field=""; if($select) $field = str_replace('!!emplacement!!',$select, $emplacement_field); $collstate_form = str_replace('!!emplacement_field!!',$field, $collstate_form); // champs des supports if(!$this->type) $this->type=$deflt_arch_type; $select = gen_liste("select archtype_id, archtype_libelle from arch_type order by 2", "archtype_id", "archtype_libelle", "archtype_id", "", $this->type, "", "","","",0) ; $field=""; if($select) $field = str_replace('!!support!!',$select, $support_field); $collstate_form = str_replace('!!support_field!!',$field, $collstate_form); // champs des statuts if(!$this->statut) $this->statut=$deflt_arch_statut; $select = gen_liste("select archstatut_id, archstatut_gestion_libelle from arch_statut order by 2", "archstatut_id", "archstatut_gestion_libelle", "archstatut_id", "", $this->statut, "", "","","",0) ; $field=""; if($select) $field = str_replace('!!statut!!',$select, $statut_field); $collstate_form = str_replace('!!statut_field!!',$field, $collstate_form); // Champs perso $p_perso=new parametres_perso("collstate"); $parametres_perso=""; if (!$p_perso->no_special_fields) { $perso_=$p_perso->show_editable_fields($this->id); $perso=""; for ($i=0; $i".$p["TITRE"]."
".$p["AFF"]."
"; } $perso.=$perso_["CHECK_SCRIPTS"]; $parametres_perso.=$perso; } $collstate_form = str_replace('!!parametres_perso!!',$parametres_perso , $collstate_form); $link_annul = "onClick=\"unload_off();history.go(-1);\""; $collstate_form = str_replace('!!annul!!', $link_annul, $collstate_form); //vérification de la présence de champs perso //si non, on confirme la soumission du formulaire if($p_perso->no_special_fields) $return_form = "return true"; //sinon, on vérifie leurs valeurs else $return_form = "return check_form()"; $collstate_form = str_replace('!!return_form!!',$return_form, $collstate_form); return $collstate_form; } // suppression d'une collection ou de toute les collections d'un périodique function delete() { global $dbh; if($this->id) { //elimination des champs persos $p_perso=new parametres_perso("collstate"); $p_perso->delete_values($this->id); mysql_query("DELETE from collections_state WHERE collstate_id='".$this->id."' ", $dbh); } else if($this->serial_id) { $myQuery = mysql_query("SELECT collstate_id FROM collections_state WHERE id_serial='".$this->serial_id."' ", $dbh); if((mysql_num_rows($myQuery))) { while(($coll = mysql_fetch_object($myQuery))) { $my_collstate=new collstate($coll->collstate_id); $my_collstate->delete(); } } } } } // fin définition classe
".str_replace("\n","
",$my_collstate->state_collections)."
".str_replace("\n","
",$my_collstate->lacune)."