"aff_text_empr","list"=>"aff_list_empr","query_list"=>"aff_query_list_empr","query_auth"=>"aff_query_auth_empr","date_box"=>"aff_date_box_empr","comment"=>"aff_comment_empr","external"=>"aff_external_empr","url"=>"aff_url_empr","resolve"=>"aff_resolve_empr"); $aff_list_empr_search=array("text"=>"aff_text_empr_search","list"=>"aff_list_empr_search","query_list"=>"aff_query_list_empr_search","query_auth"=>"aff_query_auth_empr_search","date_box"=>"aff_date_box_empr_search","comment"=>"aff_comment_empr_search","external"=>"aff_external_empr_search","url"=>"aff_url_empr_search","resolve"=>"aff_resolve_empr_search"); $chk_list_empr=array("text"=>"chk_text_empr","list"=>"chk_list_empr","query_list"=>"chk_query_list_empr","query_auth"=>"chk_query_auth_empr","date_box"=>"chk_date_box_empr","comment"=>"chk_comment_empr","external"=>"chk_external_empr","url"=>"chk_url_empr","resolve"=>"chk_resolve_empr"); $val_list_empr=array("text"=>"val_text_empr","list"=>"val_list_empr","query_list"=>"val_query_list_empr","query_auth"=>"val_query_auth_empr","date_box"=>"val_date_box_empr","comment"=>"val_comment_empr","external"=>"val_external_empr","url"=>"val_url_empr","resolve"=>"val_resolve_empr"); $type_list_empr=array("text"=>$msg["parperso_text"],"list"=>$msg["parperso_choice_list"],"query_list"=>$msg["parperso_query_choice_list"],"query_auth"=>$msg["parperso_authorities"],"date_box"=>$msg["parperso_date"],"comment"=>$msg["parperso_comment"],"external"=>$msg["parperso_external"],"url"=>$msg["parperso_url"],"resolve"=>$msg["parperso_resolve"]); $options_list_empr=array("text"=>"options_text.php","list"=>"options_list.php","query_list"=>"options_query_list.php","query_auth"=>"options_query_authorities.php","date_box"=>"options_date_box.php","comment"=>"options_comment.php","external"=>"options_external.php","url"=>"options_url.php","resolve"=>"options_resolve.php"); function aff_query_auth_empr($field,&$check_scripts,$script="") { } function chk_query_auth_empr($field,&$check_message) { } function aff_query_auth_empr_search($field,&$check_scripts,$varname) { global $lang,$charset; $id=$field[VALUES][0]; switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) { case 1: $completion='authors'; $aut = new auteur($id); $isbd=$aut->isbd_entry; break; case 2: $completion="categories"; $isbd=categories::listAncestorNames($id,$lang); break; case 3:$completion="publishers"; $aut=new publisher($id); $isbd=$aut->isbd_entry; break; case 4:$completion="collections"; $aut = new collection($id); $isbd=$aut->isbd_entry; break; case 5:$completion="subcollections"; $aut = new subcollection($id); $isbd=$aut->isbd_entry; break; case 6:$completion="serie"; $aut = new serie($id); $isbd=$aut->name; break; case 7:$completion="indexint"; $aut = new indexint($id); $isbd=$aut->display; break; case 8:$completion="titre_uniforme"; $aut = new titre_uniforme($id); $isbd=$aut->libelle; break; } if(!$id){ $isbd=""; } $libelle=html_entity_decode($isbd,ENT_QUOTES, $charset); $fnamesans=$varname; $fname=$varname."[]"; $fname_id=$varname."_id"; $fnamesanslib=$varname."_lib"; $fnamelib=$varname."_lib[]"; $field_var="fieldvar_".substr($varname, 6); $fname_name_aut_id=$field_var."[authority_id][]"; $fname_aut_id=$field_var."_authority_id"; $ret.=" "; return $ret; } function val_query_auth_empr($field) { global $lang,$pmb_perso_sep,$charset; $name=$field[NAME]; $options=$field[OPTIONS][0]; $isbd_s=array(); $isbd_without=array(); if(!$field[VALUES])return ""; foreach($field[VALUES] as $id){ switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) { case 1:// auteur $aut = new auteur($id); $isbd_s[]=$aut->isbd_entry; $isbd_without[]=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset); break; case 2:// categories $isbd_s[]=htmlentities(categories::listAncestorNames($id,$lang),ENT_QUOTES,$charset); $isbd_without[]=categories::listAncestorNames($id,$lang); break; case 3:// Editeur $aut=new publisher($id); $isbd_s[]=$aut->isbd_entry; $isbd_without[]=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset); break; case 4:// collection $aut = new collection($id); $isbd_s[]=$aut->isbd_entry; $isbd_without[]=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset); break; case 5:// subcollection $aut = new subcollection($id); $isbd_s[]=$aut->isbd_entry; $isbd_without[]=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset); break; case 6:// Titre de serie $aut = new serie($id); $isbd_s[]=htmlentities($aut->name,ENT_QUOTES,$charset); $isbd_without[]=$aut->name; break; case 7:// Indexation decimale $aut = new indexint($id); $isbd_s[]=htmlentities($aut->display,ENT_QUOTES,$charset); $isbd_without[]=$aut->display; break; case 8:// titre uniforme $aut = new titre_uniforme($id); $isbd_s[]=htmlentities($aut->libelle,ENT_QUOTES,$charset); $isbd_without[]=$aut->libelle; break; } } return array("ishtml" => true, "value"=>implode($pmb_perso_sep,$isbd_s), "withoutHTML" =>implode($pmb_perso_sep,$isbd_without)); } function chk_datatype($field,$values,&$check_datatype_message) { global $chk_type_list; global $msg; if (((!isset($values))||((count($values)==1)&&($values[0]=="")))&&($field[MANDATORY]!=1)) return $values; for ($i=0; $i "; if ($field[MANDATORY]==1) $check_scripts.="if (document.forms[0].elements[\"".$field[NAME]."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field[ALIAS])."\");\n"; return $ret; } function aff_date_box_empr_search($field,&$check_scripts,$varname) { global $charset; global $msg; $values=$field[VALUES]; $d=explode("-",$values[0]); if (!checkdate($d[1],$d[2],$d[0])) { $val=date("Y-m-d",time()); $val_popup=date("Ymd",time()); } else { $val_popup=$d[0].$d[1].$d[2]; $val=$values[0]; } $ret=" "; return $ret; } function chk_date_box_empr($field,&$check_message) { $name=$field[NAME]; global $$name; $val=$$name; $check_datatype_message=""; $val_1=chk_datatype($field,$val,$check_datatype_message); if ($check_datatype_message) { $check_message=$check_datatype_message; return 0; } $$name=$val_1; return 1; } function val_date_box_empr($field,$value) { global $charset; if ($value[0]=="0000-00-00") $value[0]=""; if ($value[0]) $value=format_output($field,$value); return $value[0]; } function aff_text_empr($field,&$check_scripts) { global $charset; global $msg; $options=$field[OPTIONS][0]; $values=$field[VALUES]; $ret=""; if ($field[MANDATORY]==1) $check_scripts.="if (document.forms[0].elements[\"".$field[NAME]."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field[ALIAS])."\");\n"; return $ret; } function aff_text_empr_search($field,&$check_scripts,$varname) { global $charset; global $msg; $options=$field[OPTIONS][0]; $values=$field[VALUES]; $ret=""; return $ret; } function chk_text_empr($field,&$check_message) { $name=$field[NAME]; global $$name; $val=$$name; $check_datatype_message=""; $val_1=chk_datatype($field,$val,$check_datatype_message); if ($check_datatype_message) { $check_message=$check_datatype_message; return 0; } $$name=$val_1; return 1; } function val_text_empr($field,$value) { global $charset,$pmb_perso_sep; $value=format_output($field,$value); if (!$value) $value=array(); if($field["OPTIONS"][0]["ISHTML"][0]["value"]){ return array("ishtml" => true, "value"=>implode($pmb_perso_sep,$value), "withoutHTML" =>implode($pmb_perso_sep,$value)); }else{ return implode($pmb_perso_sep,$value); } } function aff_comment_empr($field,&$check_scripts) { global $charset; global $msg; $options=$field[OPTIONS][0]; $values=$field[VALUES]; $ret=""; if ($field[MANDATORY]==1) $check_scripts.="if (document.forms[0].elements[\"".$field[NAME]."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field[ALIAS])."\");\n"; return $ret; } function aff_comment_empr_search($field,&$check_scripts,$varname) { global $charset; global $msg; $options=$field[OPTIONS][0]; $values=$field[VALUES]; $ret=""; return $ret; } function chk_comment_empr($field,&$check_message) { $name=$field[NAME]; global $$name; $val=$$name; $check_datatype_message=""; $val_1=chk_datatype($field,$val,$check_datatype_message); if ($check_datatype_message) { $check_message=$check_datatype_message; return 0; } $$name=$val_1; return 1; } function val_comment_empr($field,$value) { global $charset; $value=format_output($field,$value); if($field["OPTIONS"][0]["ISHTML"][0]["value"]){ return array("ishtml" => true, "value"=>$value[0], "withoutHTML" =>$value[0]); }else{ return $value[0]; } } function aff_list_empr($field,&$check_scripts,$script="") { global $charset; $_custom_prefixe_=$field["PREFIX"]; $options=$field[OPTIONS][0]; $values=$field[VALUES]; if ($values=="") $values=array(); if ($options["AUTORITE"][0]["value"]!="yes") { if ($options["CHECKBOX"][0]["value"]=="yes"){ if ($options[MULTIPLE][0][value]=="yes") $type = "checkbox"; else $type = "radio"; $ret=""; if (($options[UNSELECT_ITEM][0][VALUE]!="")&&($options[UNSELECT_ITEM][0][value]!="")) { $ret.= " ".$options[UNSELECT_ITEM][0][value].""; } $requete="select ".$_custom_prefixe_."_custom_list_value, ".$_custom_prefixe_."_custom_list_lib from ".$_custom_prefixe_."_custom_lists where ".$_custom_prefixe_."_custom_champ=".$field[ID]." order by ordre"; $resultat=mysql_query($requete); if ($resultat) { $i=0; while ($r=mysql_fetch_array($resultat)) { $ret.= " ".$r[$_custom_prefixe_."_custom_list_lib"].""; $i++; } } }else{ $ret="\n"; } }else { // $caller=""; // switch ($_custom_prefixe_) { // case "empr": // $caller="empr_form"; // break; // case "notices": // $caller="notice"; // break; // case "expl": // $caller="expl"; // break; // case "gestfic0": // a modifier lorsque il y aura du multi fiches! // $caller="formulaire"; // break; // } if ($values) { $values_received=$values; $values=array(); $libelles=array(); $requete="select ".$_custom_prefixe_."_custom_list_value, ".$_custom_prefixe_."_custom_list_lib from ".$_custom_prefixe_."_custom_lists where ".$_custom_prefixe_."_custom_champ=".$field[ID]." order by ordre"; $resultat=mysql_query($requete); $i=0; while ($r=mysql_fetch_array($resultat)) { $as=array_search($r[$_custom_prefixe_."_custom_list_value"],$values_received); if (($as!==null)&&($as!==false)) { $values[$i]=$r[$_custom_prefixe_."_custom_list_value"]; $libelles[$i]=$r[$_custom_prefixe_."_custom_list_lib"]; $i++; } } } $readonly=''; $n=count($values); if(($options[MULTIPLE][0][value]=="yes") ) $val_dyn=1; else $val_dyn=0; if (($n==0)||($options[MULTIPLE][0][value]!="yes")) $n=1; if ($options[MULTIPLE][0][value]=="yes") { $readonly=''; $ret.=" "; } $ret.="\n
"; $readonly=''; for ($i=0; $i<$n; $i++) { $ret.="\n"; $ret.=""; // $ret.=" $ret.="\n"; if (($i==0)&&($options[MULTIPLE][0][value]=="yes")) { $ret.=" "; } $ret.="
"; } $ret.="
"; } return $ret; } function aff_list_empr_search($field,&$check_scripts,$varname) { global $charset; $_custom_prefixe_=$field["PREFIX"]; $options=$field[OPTIONS][0]; $values=$field[VALUES]; if ($values=="") $values=array(); $ret="\n"; return $ret; } function chk_list_empr($field,&$check_message) { global $charset; global $msg; $name=$field[NAME]; global $$name; $val=$$name; if ($field[MANDATORY]==1) { if ((!isset($val))||((count($val)==1)&&($val[0]==""))) { $check_message=sprintf($msg["parperso_field_is_needed"],$field[ALIAS]); return 0; } } $check_datatype_message=""; $val_1=chk_datatype($field,$val,$check_datatype_message); if ($check_datatype_message) { $check_message=$check_datatype_message; return 0; } $$name=$val_1; return 1; } function val_list_empr($field,$val) { global $charset,$pmb_perso_sep; global $options_; $_custom_prefixe_=$field["PREFIX"]; if ($val=="") return ""; if (!$options_[$_custom_prefixe_][$field[ID]]) { $requete="select ".$_custom_prefixe_."_custom_list_value, ".$_custom_prefixe_."_custom_list_lib from ".$_custom_prefixe_."_custom_lists where ".$_custom_prefixe_."_custom_champ=".$field[ID]." order by ordre"; $resultat=mysql_query($requete); if ($resultat) { while ($r=mysql_fetch_array($resultat)) { $options_[$_custom_prefixe_][$field[ID]][$r[$_custom_prefixe_."_custom_list_value"]]=$r[$_custom_prefixe_."_custom_list_lib"]; } } } if (!is_array($options_[$_custom_prefixe_][$field[ID]])) return ""; $val_r=array_flip($val); $val_c=array_intersect_key($options_[$_custom_prefixe_][$field[ID]],$val_r); if ($val_c=="") $val_c=array(); $val_=implode($pmb_perso_sep,$val_c); return $val_; } function aff_query_list_empr($field,&$check_scripts,$script="") { global $charset; global $_custom_prefixe_; $values=$field[VALUES]; $options=$field[OPTIONS][0]; if ($values=="") $values=array(); if ($options["AUTORITE"][0]["value"]!="yes") { if ($options["CHECKBOX"][0]["value"]=="yes"){ if ($options[MULTIPLE][0][value]=="yes") $type = "checkbox"; else $type = "radio"; $resultat=mysql_query($options[QUERY][0][value]); if ($resultat) { $i=0; $ret=""; $limit = $options[CHECKBOX_NB_ON_LINE][0][value]; if($limit==0) $limit = 4; while ($r=mysql_fetch_array($resultat)) { if ($i>0 && $i%$limit == 0)$ret.=""; $ret.= ""; $i++; } $ret.="
 ".$r[1]."
"; } } else { $options=$field[OPTIONS][0]; $ret="\n"; } else { // $caller=""; // switch ($_custom_prefixe_) { // case "empr": // $caller="empr_form"; // break; // case "notices": // $caller="notice"; // break; // case "expl": // $caller="expl"; // break; // case "gestfic0": // a modifier lorsque il y aura du multi fiches! // $caller="formulaire"; // break; // } if ($values) { $values_received=$values; $values_received_bis=$values; $values=array(); $libelles=array(); $resultat=mysql_query($options[QUERY][0][value]); $i=0; while ($r=mysql_fetch_row($resultat)) { $as=array_search($r[0],$values_received); if (($as!==null)&&($as!==false)) { $values[$i]=$r[0]; $libelles[$i]=$r[1]; $i++; unset($values_received_bis[$as]); } } if ($options["INSERTAUTHORIZED"][0]["value"]=="yes") { foreach ($values_received_bis as $key=>$val) { $values[$i]=""; $libelles[$i]=$val; $i++; } } } $n=count($values); if(($options[MULTIPLE][0][value]=="yes") ) $val_dyn=1; else $val_dyn=0; if (($n==0)||($options[MULTIPLE][0][value]!="yes")) $n=1; if ($options[MULTIPLE][0][value]=="yes") { // $readonly="f_perso.setAttribute('readonly','');"; // if($options["INSERTAUTHORIZED"][0]["value"]=="yes"){ // $readonly=""; // } $readonly=''; $ret.=" "; } $ret.="\n
"; // $readonly="readonly"; // if($options["INSERTAUTHORIZED"][0]["value"]=="yes"){ // $readonly=""; // } $readonly=''; for ($i=0; $i<$n; $i++) { $ret.="\n"; $ret.=""; // $ret.=" $ret.="\n"; if (($i==0)&&($options[MULTIPLE][0][value]=="yes")) { $ret.=" "; } $ret.="
"; } $ret.="
"; } return $ret; } function aff_query_list_empr_search($field,&$check_scripts,$varname) { global $charset; $values=$field[VALUES]; if ($values=="") $values=array(); $options=$field[OPTIONS][0]; $ret="\n"; return $ret; } function chk_query_list_empr($field,&$check_message) { global $charset; global $msg; $name=$field[NAME]; global $$name; $val=$$name; if ($field[MANDATORY]==1) { if ((!isset($val))||((count($val)==1)&&($val[0]==""))) { $check_message=sprintf($msg["parperso_field_is_needed"],$field[ALIAS]); return 0; } } $check_datatype_message=""; $val_1=chk_datatype($field,$val,$check_datatype_message); if ($check_datatype_message) { $check_message=$check_datatype_message; return 0; } $$name=$val_1; return 1; } function val_query_list_empr($field,$val) { global $charset,$pmb_perso_sep; if ($val=="") return ""; $val_c=""; if (($field["OPTIONS"][0]["FIELD0"][0]["value"])&&($field["OPTIONS"][0]["FIELD1"][0]["value"])&&($field["OPTIONS"][0]["OPTIMIZE_QUERY"][0]["value"]=="yes")) { $val_ads=array_map("addslashes",$val); $requete="select * from (".$field[OPTIONS][0][QUERY][0][value].") as sub1 where ".$field["OPTIONS"][0]["FIELD0"][0]["value"]." in (BINARY '".implode("',BINARY '",$val_ads)."')"; $resultat=mysql_query($requete); if ($resultat && mysql_num_rows($resultat)) { while ($r=mysql_fetch_row($resultat)) { $val_c[]=$r[1]; } } } else { $resultat=mysql_query($field[OPTIONS][0][QUERY][0][value]); if($resultat && mysql_num_rows($resultat)){ while ($r=mysql_fetch_row($resultat)) { $options_[$r[0]]=$r[1]; } } for ($i=0; $i"; if (!$options["HIDE"][0]["value"]) { $ret.=""; } $ret.=" "; if ($options["DELETE"][0]["value"]) $ret.=" "; if ($field["MANDATORY"]==1) $check_scripts.="if (document.forms[0].elements[\"".$field["NAME"]."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field["ALIAS"])."\");\n"; return $ret; } function aff_external_empr_search($field,&$check_scripts,$varname) { global $charset; global $msg; $options=$field[OPTIONS][0]; $values=$field[VALUES]; //Recherche du libellé $vallib=$values[0]; if ($options["QUERY"][0]["value"]) { $rvalues=mysql_query(str_replace("!!id!!",$values[0],$options["QUERY"][0]["value"])); if ($rvalues) { $vallib=@mysql_result($rvalues,0,0); } } $ret=""; $ret.=""; $ret.=" "; return $ret; } function chk_external_empr($field,&$check_message) { $name=$field[NAME]; global $$name; $val=$$name; $check_datatype_message=""; $val_1=chk_datatype($field,$val,$check_datatype_message); if ($check_datatype_message) { $check_message=$check_datatype_message; return 0; } $$name=$val_1; return 1; } function val_external_empr($field,$value) { global $charset; $options=$field[OPTIONS][0]; $value=format_output($field,$value); //Calcul du libelle if ($options["QUERY"][0]["value"]) { $rvalues=mysql_query(str_replace("!!id!!",$value[0],$options["QUERY"][0]["value"])); if ($rvalues) { return @mysql_result($rvalues,0,0); } } return $value[0]; } function aff_url_empr($field,&$check_scripts){ global $charset; global $msg; $options=$field[OPTIONS][0]; $values=$field[VALUES]; $afield_name = $field["ID"]; $ret = ""; $count = 0; if (!$values) { $values = array(""); } foreach ($values as $avalues) { $avalues = explode("|",$avalues); $ret.="lien : "; $ret.=" "; $ret.=" libelle : "; if ($options[REPEATABLE][0][value] && !$count) $ret.=''; $ret.="
"; $count++; } $ret.= " "; if ($options[REPEATABLE][0][value]) { $ret.=''; //$ret.=''; $ret .= '
'; $ret.=""; } if ($field[MANDATORY]==1) $check_scripts.="if (document.forms[0].elements[\"".$field[NAME]."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field[ALIAS])."\");\n"; return $ret; } function aff_url_empr_search($field,&$check_scripts,$varname) { global $charset; global $msg; $options=$field[OPTIONS][0]; $values=$field[VALUES]; $ret=""; return $ret; } function chk_url_empr($field,&$check_message) { $name=$field[NAME]; global $$name; $val=$$name; $value = array(); for($i=0;$i $cut ? substr($val[0],0,$cut)."[...]" : $val[0] ); if( $ret != "") $ret.= $pmb_perso_sep; $ret .= "".htmlentities($lib,ENT_QUOTES,$charset).""; if( $without != "") $without.= $pmb_perso_sep; $without .= $lib; } return array("ishtml" => true, "value"=>$ret, "withoutHTML" =>$without); } function aff_resolve_empr($field,&$check_scripts){ global $charset; global $msg; $options=$field[OPTIONS][0]; $values=$field[VALUES]; $afield_name = $field["ID"]; $ret = ""; $count = 0; if (!$values) { $values = array(""); } foreach ($values as $avalues) { $avalues = explode("|",$avalues); $ret.=""; $ret.=" "; if ($options[REPEATABLE][0][value] && !$count) $ret.=''; $ret.="
"; $count++; } if ($options[REPEATABLE][0][value]) { $ret.=''; //$ret.=''; $ret .= '
'; $ret.=""; } if ($field[MANDATORY]==1) $check_scripts.="if (document.forms[0].elements[\"".$field[NAME]."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field[ALIAS])."\");\n"; return $ret; } function chk_resolve_empr($field,&$check_message) { $name=$field[NAME]; global $$name; $val=$$name; $value = array(); for($i=0;$i1){ $id =$val[0]; foreach ($options[RESOLVE] as $res){ if($res[ID] == $val[1]){ $label = $res[LABEL]; $url= $res[value]; break; } } $link = str_replace("!!id!!",$id,$url); if( $ret != "") $ret.= " / "; //$ret.= "".htmlentities($link,ENT_QUOTES,$charset).""; if (!$use_opac_url_base) $ret.= htmlentities($label,ENT_QUOTES,$charset)." : $id $link"; else $ret.= htmlentities($label,ENT_QUOTES,$charset)." : $id $link"; if($without)$without.=$pmb_perso_sep; $without.=$link; }else{ if($without)$without.=$pmb_perso_sep; $without.=implode($pmb_perso_sep,$value); } } return array("ishtml" => true, "value"=>$ret,"withoutHTML"=> $without); } function aff_resolve_empr_search($field,&$check_scripts,$varname){ global $charset; global $msg; $options=$field[OPTIONS][0]; $values=$field[VALUES]; $ret=""; return $ret; } function aff_html_empr($field,&$check_scripts) { global $charset; global $msg; global $cms_dojo_plugins_editor; $options=$field[OPTIONS][0]; $values=$field[VALUES]; $ret="
".$values[0]."
"; $check_scripts.= " if(document.forms[0].elements['".$field[NAME]."[]']) document.forms[0].elements['".$field[NAME]."[]'].value = dijit.byId('".$field[NAME]."').get('value');"; if ($field[MANDATORY]==1) $check_scripts.="if (document.forms[0].elements[\"".$field[NAME]."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field[ALIAS])."\");\n"; return $ret; }