id=$id+0; $this->fetch_data(); } public function fetch_data() { global $include_path; $this->info=array(); $this->info['fields']=array(); if(!$this->id) { $this->info['onglet_num']= 0; $this->info['opac_search']= 0; $this->info['opac_multi_search']= 0; $this->info['gestion_search']= 0; $this->info['gestion_multi_search']= 0; $this->info['oeuvre_event']= 0; return; } $req="select * from authperso where id_authperso=". $this->id; $resultat=pmb_mysql_query($req); if (pmb_mysql_num_rows($resultat)) { $r=pmb_mysql_fetch_object($resultat); $this->info['id']= $r->id_authperso; $this->info['name']= $r->authperso_name; $this->info['onglet_num']= $r->authperso_notice_onglet_num; $this->info['isbd_script']= $r->authperso_isbd_script; $this->info['view_script']= $r->authperso_view_script; $this->info['opac_search']= $r->authperso_opac_search; $this->info['opac_multi_search']= $r->authperso_gestion_multi_search; $this->info['gestion_search']= $r->authperso_gestion_search; $this->info['gestion_multi_search']= $r->authperso_gestion_multi_search; $this->info['oeuvre_event']= $r->authperso_oeuvre_event; $this->info['comment']= $r->authperso_comment; $this->info['onglet_name']=""; $req="SELECT * FROM notice_onglet where id_onglet=".$r->authperso_notice_onglet_num; $resultat=pmb_mysql_query($req); if (pmb_mysql_num_rows($resultat)) { $r_onglet=pmb_mysql_fetch_object($resultat); $this->info['onglet_name']= $r_onglet->onglet_name; } } } public function get_form() { global $authperso_form_tpl,$msg,$charset; $tpl=$authperso_form_tpl; if($this->id){ $tpl=str_replace('!!msg_title!!',$msg['admin_authperso_form_edit'],$tpl); //bouton supprimer $req="select * from authperso_authorities where authperso_authority_authperso_num=". $this->id; $res = pmb_mysql_query($req); if((pmb_mysql_num_rows($res))) { $tpl=str_replace('!!delete!!','', $tpl); } else { $tpl=str_replace('!!delete!!',"", $tpl); } $name=$this->info['name']; $isbd_script=$this->info['isbd_script']; $view_script=$this->info['view_script']; $comment=$this->info['comment']; }else{ $tpl=str_replace('!!msg_title!!',$msg['admin_authperso_form_add'],$tpl); $tpl_objet=""; $tpl=str_replace('!!delete!!',"",$tpl); $name=""; $isbd_script=""; $view_script=""; $comment=""; } $notice_onglet_list=gen_liste ("SELECT * FROM notice_onglet", "id_onglet", "onglet_name", "notice_onglet", "", $this->info['onglet_num'], 0, $msg["admin_authperso_notice_onglet_no"],0,$msg["admin_authperso_notice_onglet_sel"]); $multi_search_checked=""; if($this->info['opac_multi_search']) $search_multi_checked= " checked='checked' "; else $search_multi_checked= ""; $search_simple_checked[$this->info['opac_search']+0]= " checked='checked' "; $search_tpl=" ".$msg["admin_authperso_opac_search_no"]." ".$msg["admin_authperso_opac_search_yes"]." ".$msg["admin_authperso_opac_search_yes_active"]." "; if($this->info['gestion_multi_search']) $search_multi_checked_gestion= " checked='checked' "; else $search_multi_checked_gestion= ""; $search_simple_checked_gestion[$this->info['gestion_search']+0]= " checked='checked' "; $search_tpl_gestion=" ".$msg["admin_authperso_gestion_search_no"]." ".$msg["admin_authperso_gestion_search_yes"]." ".$msg["admin_authperso_gestion_search_yes_active"]." "; $fields_options=""; $fields_options_view=""; if($this->info['oeuvre_event']){ $tpl=str_replace('!!oeuvre_event!!'," checked='checked' ",$tpl); }else{ $tpl=str_replace('!!oeuvre_event!!',"",$tpl); } $tpl=str_replace('!!name!!',htmlentities($name, ENT_QUOTES, $charset),$tpl); $tpl=str_replace('!!notice_onglet_list!!',$notice_onglet_list,$tpl); $tpl=str_replace('!!fields_options!!',$fields_options,$tpl); $tpl=str_replace('!!isbd_script!!',htmlentities($isbd_script, ENT_QUOTES, $charset),$tpl); $tpl=str_replace('!!fields_options_view!!',$fields_options_view,$tpl); $tpl=str_replace('!!view_script!!',htmlentities($view_script, ENT_QUOTES, $charset),$tpl); $tpl=str_replace('!!search_simple!!',$search_tpl,$tpl); $tpl=str_replace('!!search_multi!!',$search_multi_checked,$tpl); $tpl=str_replace('!!search_simple_gestion!!',$search_tpl_gestion,$tpl); $tpl=str_replace('!!search_multi_gestion!!',$search_multi_checked_gestion,$tpl); $tpl=str_replace('!!comment!!',htmlentities($comment, ENT_QUOTES, $charset),$tpl); $tpl=str_replace('!!id_authperso!!',$this->id,$tpl); return $tpl; } public function save() { global $dbh; global $name; global $notice_onglet; global $isbd_script; global $view_script; global $comment; global $search_simple; global $search_multi; global $gestion_search_simple; global $gestion_search_multi; global $oeuvre_event; global $base_path; $notice_onglet+=0; $fields=" authperso_name='".$name."', authperso_notice_onglet_num='".$notice_onglet."', authperso_isbd_script='".$isbd_script."' , authperso_view_script='".$view_script."' , authperso_opac_search='".$search_simple."', authperso_opac_multi_search='".$search_multi."', authperso_gestion_search='".$gestion_search_simple."', authperso_gestion_multi_search='".$gestion_search_multi."', authperso_oeuvre_event='".$oeuvre_event."', authperso_comment='".$comment."' "; if(!$this->id){ // Ajout $req="INSERT INTO authperso SET $fields "; pmb_mysql_query($req, $dbh); $this->id = pmb_mysql_insert_id($dbh); } else { $req="UPDATE authperso SET $fields where id_authperso=".$this->id; pmb_mysql_query($req, $dbh); $isbd_template_path = $base_path.'/temp/'.LOCATION.'_authperso_isbd_'.$this->id; if(file_exists($isbd_template_path)){ unlink($isbd_template_path); } $view_template_path = $base_path.'/temp/'.LOCATION.'_authperso_view_'.$this->id; if(file_exists($view_template_path)){ unlink($view_template_path); } } $this->fetch_data(); } public function delete() { global $dbh; $p_perso=new custom_parametres_perso("authperso","authperso",$this->id,"./admin.php?categ=authorities&sub=authperso&auth_action=edition&id_authperso=".$this->id,$option_navigation,$option_visibilite); $p_perso->delete_all(); $query = "delete from authperso_authorities where authperso_authority_authperso_num = '".$this->id."' "; $result = pmb_mysql_query($query); $req="DELETE from authperso WHERE id_authperso=".$this->id; pmb_mysql_query($req, $dbh); $this->id=0; $this->fetch_data(); } public function fields_edition() { global $msg; $option_visibilite=array(); $option_visibilite["multiple"]="block"; $option_visibilite["obligatoire"]="block"; $option_visibilite["search"]="block"; $option_visibilite["export"]="none"; $option_visibilite["exclusion"]="none"; $option_visibilite["opac_sort"]="none"; $option_navigation=array(); $option_navigation['msg_title']=$msg["admin_menu_docs_perso_authperso"]." : ".$this->info['name']; $option_navigation['url_return_list']="./admin.php?categ=authorities&sub=authperso&auth_action="; $option_navigation['msg_return_list']=$msg["admin_authperso_return_list"]; $option_navigation['url_update_global_index']="./admin.php?categ=authorities&sub=authperso&auth_action=update_global_index&id_authperso=".$this->id; $option_navigation['msg_update_global_index']=$msg["admin_authperso_update_global_index"]; $p_perso=new custom_parametres_perso("authperso","authperso",$this->id,"./admin.php?categ=authorities&sub=authperso&auth_action=edition&id_authperso=".$this->id,$option_navigation,$option_visibilite); $p_perso->proceed(); } public function get_fields_options(){ global $msg; $p_perso=new custom_parametres_perso("authperso","authperso",$this->id); return $p_perso->get_selector_options_1().""; } public function get_gestion() { global $msg; $tpl="