"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","marclist"=>"aff_marclist_empr","html"=>"aff_html_empr","text_i18n"=>"aff_text_i18n_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","marclist"=>"aff_marclist_empr_search","html"=>"aff_comment_empr_search","text_i18n"=>"aff_text_i18n_empr_search");
$aff_filter_list_empr=array("text"=>"aff_filter_text_empr","list"=>"aff_filter_list_empr","query_list"=>"aff_filter_query_list_empr","query_auth"=>"aff_filter_query_auth_empr","date_box"=>"aff_filter_date_box_empr","comment"=>"aff_filter_comment_empr","external"=>"aff_filter_external_empr","url"=>"aff_filter_resolve_empr","resolve"=>"aff_filter_resolve_empr","marclist"=>"aff_filter_marclist_empr","html"=>"aff_filter_comment_empr","text_i18n"=>"aff_filter_text_i18n_empr");
$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","marclist"=>"chk_marclist_empr","html"=>"chk_comment_empr","text_i18n"=>"chk_text_i18n_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","marclist"=>"val_marclist_empr","html"=>"val_html_empr","text_i18n"=>"val_text_i18n_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"],"marclist"=>$msg["parperso_marclist"],"html"=>$msg["parperso_html"],"text_i18n"=>$msg["parperso_text_i18n"]);
$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","marclist"=>"options_marclist.php","html"=>"options_html.php","text_i18n"=>"options_text_i18n.php");
// formulaire de saisie des param perso des autorités
function aff_query_auth_empr($field,&$check_scripts,$script="") {
global $charset;
global $_custom_prefixe_;
global $msg,$lang;
if($field["OPTIONS"][0]["METHOD"]["0"]["value"]==1) {
$text_name=$field[NAME]."_id";
$hidden_name=$field[NAME];
} else {
$text_name=$field[NAME];
$hidden_name=$field[NAME]."_id";
}
//pré-remplissage
$param = $text_name;
global $$param;
switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) {
case 1:$what="auteur";$completion='authors';break;//auteurs
case 2:$what="categorie";$completion="categories_mul";break;//categories
case 3:$what="editeur";$completion="publishers";break;//Editeurs
case 4:$what="collection";$completion="collections";break;//collection
case 5:$what="subcollection";$completion="subcollections";break;// subcollection
case 6:$what="serie";$completion="serie";break;//Titre de serie
case 7:$what="indexint";$completion="indexint"; break;// Indexation decimale
case 8:$what="titre_uniforme";$completion="titre_uniforme"; break;// titre uniforme
}
$values=$field[VALUES];
$options=$field[OPTIONS][0];
if ($values=="") $values=array();
$caller = get_form_name();
$id_thes_unique=$field["OPTIONS"][0]["ID_THES"]["0"]["value"];
$n=count($values);
$ret="";
if (($n==0)||($options[MULTIPLE][0][value]!="yes")) $n=1;
if ($options[MULTIPLE][0][value]=="yes") {
$readonly='';
$ret.="
";
}
$ret.="\n
";
$readonly='';
$val_dyn=3;
for ($i=0; $i<$n; $i++) {
$id=$values[$i];
$isbd="";
if($id){
switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) {
case 1:// auteur
$aut = new auteur($id);
$isbd=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset);
break;
case 2:// categories
if ($field["OPTIONS"][0]["CATEG_SHOW"]["0"]["value"]==1) {
$isbd=html_entity_decode(categories::getLibelle($id,$lang),ENT_QUOTES, $charset);
} else {
$isbd=html_entity_decode(categories::listAncestorNames($id,$lang),ENT_QUOTES, $charset);
}
break;
case 3:// Editeur
$aut = new editeur($id);
$isbd=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset);
break;
case 4:// collection
$aut = new collection($id);
$isbd=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset);
break;
case 5:// subcollection
$aut = new subcollection($id);
$isbd=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset);
break;
case 6:// Titre de serie
$aut = new serie($id);
$isbd=html_entity_decode($aut->name,ENT_QUOTES, $charset);
break;
case 7:// Indexation decimale
$aut = new indexint($id);
$isbd=html_entity_decode($aut->display,ENT_QUOTES, $charset);
break;
case 8:// titre uniforme
$aut = new titre_uniforme($id);
$isbd=html_entity_decode($aut->libelle,ENT_QUOTES, $charset);
break;
}
}
$ret.="\n";
$ret.="";
$ret.="\n";
if (($i==0)) {
if ($options[MULTIPLE][0][value]=="yes") {
$ret.="";
$ret.=" ";
}else {
$ret.="";
}
}
$ret.=" ";
}
$ret.="
";
return $ret;
}
function aff_query_auth_empr_search($field,&$check_scripts,$varname) {
global $msg,$lang, $categ,$charset;
if($field["OPTIONS"][0]["METHOD"]["0"]["value"]==1) {
$text_name=$field[NAME]."_id";
$hidden_name=$field[NAME];
} else {
$text_name=$field[NAME];
$hidden_name=$field[NAME]."_id";
}
$id=$field[VALUES][0];
//pré-remplissage
$param = $text_name;
global $$param;
switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) {
case 1:$what="auteur";$completion='authors';break;//auteurs
case 2:
$what="categorie";$completion="categories_mul";
//Pour n'appeler que le thésaurus choisi en champ perso
if(isset($field["OPTIONS"][0]["ID_THES"]["0"]["value"])){
$fnamevar_id = "linkfield=\"fieldvar_".$varname."_id_thesaurus\"";
$id_thesaurus="";
$id_thes_unique=$field["OPTIONS"][0]["ID_THES"]["0"]["value"];
}
break;//categories
case 3:$what="editeur";$completion="publishers";break;//Editeurs
case 4:$what="collection";$completion="collections";break;//collection
case 5:$what="subcollection";$completion="subcollections";break;// subcollection
case 6:$what="serie";$completion="serie";break;//Titre de serie
case 7:$what="indexint";$completion="indexint"; break;// Indexation decimale
case 8:$what="titre_uniforme";$completion="titre_uniforme"; break;// titre uniforme
}
$libelle="";
if($id){
switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) {
case 1:
$aut = new auteur($id);
$isbd=$aut->isbd_entry;
break;
case 2:
if ($field["OPTIONS"][0]["CATEG_SHOW"]["0"]["value"]==1) {
$isbd=categories::getLibelle($id,$lang);
} else {
$isbd=categories::listAncestorNames($id,$lang);
}
//print $isbd;
break;
case 3:
$aut=new editeur($id);
$isbd=$aut->isbd_entry;
break;
case 4:
$aut = new collection($id);
$isbd=$aut->isbd_entry;
break;
case 5:
$aut = new subcollection($id);
$isbd=$aut->isbd_entry;
break;
case 6:
$aut = new serie($id);
$isbd=$aut->name;
break;
case 7:
$aut = new indexint($id);
$isbd=$aut->display;
break;
case 8:
$aut = new titre_uniforme($id);
$isbd=$aut->libelle;
break;
}
$libelle=html_entity_decode($isbd,ENT_QUOTES, $charset);
}
$ret="";
switch ($categ) {
case "planificateur" :
$form_name = "planificateur_form";
break;
default :
$form_name = "formulaire";
break;
}
$val_dyn=3;
$ret.="\n";
$ret.="";
$ret.="";
$ret.="$id_thesaurus";
if ($field[MANDATORY]=="yes") $check_scripts.="if (document.".$form_name.".".$field[NAME].".value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field[ALIAS][0][value])."\");\n";
return $ret;
}
// Sauvegarde du formulaire
function chk_query_auth_empr($field,&$check_message) {
global $charset;
global $msg;
$name=$field[NAME];
$options=$field[OPTIONS][0];
global $$name;
$val=array();
$nn="n_".$name;
global $$nn;
$n=$$nn;
for ($i=0; $i<$n; $i++) {
$v=$field["NAME"]."_".$i;
global $$v;
if ($$v!="") {
$val[]=$$v;
}elseif($options["INSERTAUTHORIZED"][0]["value"]=="yes"){
$v2="f_".$v;
global $$v2;
if ($$v2!="") {
$val[]=$$v2;
}
}
}
if (count($val)==0) unset($val);
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;
}
// affichage de l'autorité
function val_query_auth_empr($field,$val) {
global $lang,$pmb_perso_sep,$charset;
$name=$field[NAME];
$options=$field[OPTIONS][0];
$isbd_s=array();
if(!$val)return "";
foreach($val as $id){
if($id)
switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) {
case 1:// auteur
$aut = new auteur($id);
$isbd_s[]=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset);
break;
case 2:// categories
if ($field["OPTIONS"][0]["CATEG_SHOW"]["0"]["value"]==1) {
$isbd_s[]=html_entity_decode(categories::getLibelle($id,$lang),ENT_QUOTES, $charset);
} else {
$isbd_s[]=html_entity_decode(categories::listAncestorNames($id,$lang),ENT_QUOTES, $charset);
}
break;
case 3:// Editeur
$aut = new editeur($id);
$isbd_s[]=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset);
break;
case 4:// collection
$aut = new collection($id);
$isbd_s[]=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset);
break;
case 5:// subcollection
$aut = new subcollection($id);
$isbd_s[]=html_entity_decode($aut->isbd_entry,ENT_QUOTES, $charset);
break;
case 6:// Titre de serie
$aut = new serie($id);
$isbd_s[]=html_entity_decode($aut->name,ENT_QUOTES, $charset);
break;
case 7:// Indexation decimale
$aut = new indexint($id);
$isbd_s[]=html_entity_decode($aut->display,ENT_QUOTES, $charset);
break;
case 8:// titre uniforme
$aut = new titre_uniforme($id);
$isbd_s[]=html_entity_decode($aut->libelle,ENT_QUOTES, $charset);
break;
}
}
$aff=implode($pmb_perso_sep,$isbd_s);
return $aff;
}
function chk_datatype($field,$values,&$check_datatype_message) {
global $chk_type_list;
global $msg;
//Nettoyage des valeurs vides
if(isset($values)) {
$chk_values = array();
foreach ($values as $val) {
if ($val != "") $chk_values[] = $val;
}
$values = $chk_values;
}
if (((!isset($values))||((count($values)==1)&&($values[0]=="")))&&($field[MANDATORY]!=1)) return $values;
for ($i=0; $i=20) {
$pos=strrpos(substr($valeur,0,20)," ");
if ($pos) {
$valeur=substr($valeur,0,$pos+1)."...";
} else $valeur=substr($valeur,0,20)."...";
}
return $valeur;
}
function aff_date_box_empr($field,&$check_scripts) {
global $charset;
global $msg;
global $base_path;
$values = ($field['VALUES'] ? $field['VALUES'] : array(""));
$options=$field[OPTIONS][0];
$afield_name = $field["ID"];
$count = 0;
$ret = "";
foreach ($values as $value) {
$d=explode("-",$value);
if ((!@checkdate($d[1],$d[2],$d[0]))&&(!$options["DEFAULT_TODAY"][0]["value"])) {
$val=date("Y-m-d",time());
$val_popup=date("Ymd",time());
} else if ((!@checkdate($d[1],$d[2],$d[0]))&&($options["DEFAULT_TODAY"][0]["value"])) {
$val_popup="";
$val="";
} else {
$val_popup=$d[0].$d[1].$d[2];
$val=$value;
}
$ret .= "
";
}
return $ret;
}
function aff_list_empr_search($field,&$check_scripts,$varname,$script="") {
global $charset;
$_custom_prefixe_=$field["PREFIX"];
$options=$field[OPTIONS][0];
$values=$field[VALUES];
if ($values=="") $values=array();
$ret="\n";
return $ret;
}
function aff_empr_search($field) {
$table = array();
$table['label'] = $field['TITRE'];
$table['name'] = $field['NAME'];
$table['type'] =$field['DATATYPE'];
$_custom_prefixe_=$field['PREFIX'];
$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=pmb_mysql_query($requete);
if ($resultat) {
while ($r=pmb_mysql_fetch_array($resultat)) {
$value['value_id']=$r[$_custom_prefixe_."_custom_list_value"];
$value['value_caption']=$r[$_custom_prefixe_."_custom_list_lib"];
$table['values'][]=$value;
}
}else{
$table['values'] = array();
}
return $table;
}
function chk_list_empr($field,&$check_message) {
global $charset;
global $msg;
$name=$field[NAME];
$options=$field[OPTIONS][0];
global $$name;
if ($options["AUTORITE"][0]["value"]!="yes") {
$val=$$name;
} else {
$val=array();
$nn="n_".$name;
global $$nn;
$n=$$nn;
for ($i=0; $i<$n; $i++) {
$v=$field["NAME"]."_".$i;
global $$v;
if ($$v!="") {
$val[]=$$v;
}
}
if (count($val)==0) unset($val);
}
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=pmb_mysql_query($requete);
if ($resultat) {
$i=0;
while ($r=pmb_mysql_fetch_array($resultat)) {
$options_[$_custom_prefixe_][$field[ID]][$r[$_custom_prefixe_."_custom_list_value"]]=$r[$_custom_prefixe_."_custom_list_lib"];
$i++;
}
}
}
if (!is_array($options_[$_custom_prefixe_][$field[ID]])) return "";
$exec_func_array_flip = true;
foreach ($val as $key=>$value) {
if ($value == "") $exec_func_array_flip = false;
}
if ($exec_func_array_flip) $val_r=array_flip($val);
else $val_r=array();
$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=pmb_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=pmb_mysql_fetch_array($resultat)) {
if ($i>0 && $i%$limit == 0)$ret.="
";
}
return $ret;
}
function chk_marclist_empr($field,&$check_message) {
global $charset;
global $msg;
$name=$field[NAME];
$options=$field[OPTIONS][0];
global $$name;
if ($options["AUTORITE"][0]["value"]!="yes") {
$val=$$name;
} else {
$val=array();
$nn="n_".$name;
global $$nn;
$n=$$nn;
for ($i=0; $i<$n; $i++) {
$v=$field["NAME"]."_".$i;
global $$v;
if ($$v!="") {
$val[]=$$v;
}
}
if (count($val)==0) unset($val);
}
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_marclist_empr($field,$value) {
global $charset,$pmb_perso_sep;
$options=$field[OPTIONS][0];
$values=format_output($field,$value);
$ret = "";
if (count($values)) {
$marclist_type = new marc_list($options['DATA_TYPE'][0]['value']);
if($ret)$ret.=$pmb_perso_sep;
foreach($values as $id=>$value) {
if($ret)$ret.=$pmb_perso_sep;
$ret.= $marclist_type->table[$value];
}
}
return $ret;
}
function aff_marclist_empr_search($field,&$check_scripts,$varname){
global $charset;
$_custom_prefixe_=$field["PREFIX"];
$options=$field[OPTIONS][0];
$values=$field[VALUES];
if ($values=="") $values=array();
$marclist_type = new marc_list($options['DATA_TYPE'][0]['value']);
$ret="\n";
return $ret;
}
function get_form_name() {
global $_custom_prefixe_;
$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;
case "author":
$caller="saisie_auteur";
break;
case "categ":
$caller="categ_form";
break;
case "publisher":
$caller="saisie_editeur";
break;
case "collection":
$caller="saisie_collection";
break;
case "subcollection":
$caller="saisie_sub_collection";
break;
case "serie":
$caller="saisie_serie";
break;
case "tu":
$caller="saisie_titre_uniforme";
break;
case "indexint":
$caller="saisie_indexint";
break;
case "authperso":
$caller="saisie_authperso";
break;
case "cms_editorial":
global $elem;
$caller="cms_".$elem."_edit";
break;
case "pret":
$caller="pret_doc";
break;
case "demandes":
$caller="modif_dmde";
break;
}
return $caller;
}