recursif=$recursif; $this->id = $id; $this->getData(); } else { // la notice n'existe pas $this->id = 0; $this->getData(); } } // --------------------------------------------------------------- // getData() : récupération infos auteur // --------------------------------------------------------------- function getData() { global $dbh,$msg; $this->name = ''; $this->tonalite = ''; $this->comment =''; $this->distrib=array(); $this->ref=array(); $this->subdiv=array(); if($this->id) { $requete = "SELECT * FROM titres_uniformes WHERE tu_id='".addslashes($this->id)."' LIMIT 1 "; $result = @mysql_query($requete, $dbh); if(mysql_num_rows($result)) { $temp = mysql_fetch_object($result); $this->id = $temp->tu_id; $this->name = $temp->tu_name; $this->tonalite = $temp->tu_tonalite; $this->comment = $temp->tu_comment ; $requete = "SELECT * FROM tu_distrib WHERE distrib_num_tu='$this->id' order by distrib_ordre"; $result = mysql_query($requete, $dbh); if(mysql_num_rows($result)) { while(($param=mysql_fetch_object($result))) { $this->distrib[]["label"]=$param->distrib_name; } } $requete = "SELECT * FROM tu_ref WHERE ref_num_tu='$this->id' order by ref_ordre"; $result = mysql_query($requete, $dbh); if(mysql_num_rows($result)) { while(($param=mysql_fetch_object($result))) { $this->ref[]["label"]=$param->ref_name; } } $requete = "SELECT * FROM tu_subdiv WHERE subdiv_num_tu='$this->id' order by subdiv_ordre"; $result = mysql_query($requete, $dbh); if(mysql_num_rows($result)) { while(($param=mysql_fetch_object($result))) { $this->subdiv[]["label"]=$param->subdiv_name; } } } else { // pas trouvé avec cette clé $this->id = 0; } } } // --------------------------------------------------------------- // print_resume($level) : affichage d'informations sur la collection // --------------------------------------------------------------- function print_resume($level = 2) { global $msg; if(!$this->id) return; // adaptation par rapport au niveau de détail souhaité switch ($level) { // case x : case 2 : default : global $titre_uniforme_level2_display; $titre_uniforme_display = $titre_uniforme_level2_display; break; } $print = $titre_uniforme_display; $print_distrib=$print_ref=$print_subdiv=''; foreach ($this->distrib as $field) { if($print_distrib) $print_distrib.="; "; $print_distrib.=$field["label"]; } foreach ($this->ref as $field) { if($print_ref) $print_ref.="; "; $print_ref.=$field["label"]; } foreach ($this->subdiv as $field) { if($print_subdiv) $print_subdiv.="; "; $print_subdiv.=$field["label"]; } // remplacement des champs $print = str_replace("!!id!!", $this->id, $print); $print = str_replace("!!name!!", $this->name, $print); $print = str_replace("!!distribution!!", $print_distrib, $print); $print = str_replace("!!reference!!", $print_ref, $print); $print = str_replace("!!tonalite!!", $this->tonalite, $print); $print = str_replace("!!subdivision!!", $print_subdiv, $print); $print = str_replace("!!aut_comment!!", $this->comment, $print); return $print; } function gen_input_selection($label,$form_name,$item,$values,$what_sel,$class='saisie-80em' ) { global $msg; $select_prop = "scrollbars=yes, toolbar=no, dependent=yes, resizable=yes"; $link="'./select.php?what=$what_sel&caller=$form_name&p1=f_".$item."_code!!num!!&p2=f_".$item."!!num!!&deb_rech='+escape(this.form.f_".$item."!!num!!.value), '$what_sel', 400, 400, -2, -2, '$select_prop'"; $size_item=strlen($item)+2; $script_js=" "; //template de zone de texte pour chaque valeur $aff="
!!bouton_parcourir!! !!bouton_ajouter!!
\n"; if($what_sel)$bouton_parcourir=""; else $bouton_parcourir=""; $aff= str_replace('!!bouton_parcourir!!', $bouton_parcourir, $aff); $template=$script_js."
"; $template.="
"; $num=0; if(!$values[0])$values[0]=""; foreach($values as $value) { $label_element=$value["label"]; $id_element=$value["id"]; $temp= str_replace('!!id_element!!', $id_element, $aff); $temp= str_replace('!!label_element!!', $label_element, $temp); $temp= str_replace('!!num!!', $num, $temp); if(!$num) $temp= str_replace('!!bouton_ajouter!!', " ", $temp); else $temp= str_replace('!!bouton_ajouter!!', "", $temp); $template.=$temp; $num++; } $template.=""; $template.="
"; return $template; } // --------------------------------------------------------------- // search_form() : affichage du form de recherche // --------------------------------------------------------------- function search_form() { global $user_query; global $msg; $user_query = str_replace ('!!user_query_title!!', $msg[357]." : ".$msg["aut_menu_titre_uniforme"] , $user_query); $user_query = str_replace ('!!action!!', './autorites.php?categ=titres_uniformes&sub=reach&id=', $user_query); $user_query = str_replace ('!!add_auth_msg!!', $msg["aut_titre_uniforme_ajouter"] , $user_query); $user_query = str_replace ('!!add_auth_act!!', './autorites.php?categ=titres_uniformes&sub=titre_uniforme_form', $user_query); $user_query = str_replace ('', "".$msg["aut_titre_uniforme_derniers_crees"]."", $user_query); print pmb_bidi($user_query) ; } } // class auteur