"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", "q_txt_i18n" => "aff_q_txt_i18n_empr", "date_inter" => "aff_date_inter_empr", "date_flot" => "aff_date_flottante_empr" ); global $aff_list_empr_search; $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", "q_txt_i18n" => "aff_q_txt_i18n_empr_search", "date_inter" => "aff_date_inter_empr_search", "date_flot" => "aff_date_flottante_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", "q_txt_i18n" => "aff_filter_q_txt_i18n_empr", "date_inter" => "aff_filter_date_inter_empr", "date_flot" => "aff_filter_date_flottante_empr" ); global $chk_list_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", "q_txt_i18n" => "chk_q_txt_i18n_empr", "date_inter" => "chk_date_inter_empr", "date_flot" => "chk_date_flottante_empr" ); global $val_list_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", "q_txt_i18n" => "val_q_txt_i18n_empr", "date_inter" => "val_date_inter_empr", "date_flot" => "val_date_flottante_empr" ); global $type_list_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"], "q_txt_i18n" => $msg["parperso_q_txt_i18n"], "date_inter" => $msg["parperso_date_inter"], "date_flot" => $msg["parperso_date_flottante"] ); global $options_list_empr; $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", "q_txt_i18n" => "options_q_txt_i18n.php", "date_inter" => "options_date_inter.php", "date_flot" => "options_date_flottante.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; global $ajax_js_already_included; global $base_path, $caller; $id_thes_unique=$field["OPTIONS"][0]["ID_THES"]["0"]["value"]; $att_id_filter= $params = $element = ""; $selection_parameters = get_authority_selection_parameters($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]); $what = $selection_parameters['what']; $completion = $selection_parameters['completion']; $concept_schemes = []; switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) { case 2: $att_id_filter= $id_thes_unique; break;//categories case 9: $concept_schemes = []; if(isset($field['OPTIONS'][0]['ID_SCHEME_CONCEP'])) for($i=0 ; $i "; } $ret.="\n
"; $readonly=''; for ($i=0; $i<$n; $i++) { if(!isset($values[$i])) $values[$i] = ''; $id=$values[$i]; $val_dyn=3; $isbd=""; if($id) { $isbd=get_authority_isbd_from_field($field, $id); } switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) { case 9:// concept $element="&element=concept¶m1=".$field["NAME"]."¶m2=f_".$field["NAME"]; if(count($concept_schemes) && $concept_schemes[0] != -1){ $element.="&return_concept_id=1&unique_scheme=1&concept_scheme=".implode(',',$concept_schemes); } break; default: if($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]>1000){ // autperso $element="¶m1=".$field["NAME"]."¶m2=f_".$field["NAME"]; $val_dyn=4; } break; } if (($i==0)) { if ($options['MULTIPLE'][0]['value']=="yes") { $ret .= get_js_function_dnd('query_auth', $field['NAME']); $ret.=" "; $ret.=" "; }else { $ret.=""; } } $display_temp ="\n"; $display_temp.=""; $display_temp.="\n"; if ($i == $n-1 && $options['MULTIPLE'][0]['value']=="yes") { $display_temp .= ""; } if ($options['MULTIPLE'][0]['value']=="yes") { $ret.=get_block_dnd('query_auth', $field['NAME'], $i, $display_temp, $isbd); } else { $ret.=$display_temp."
"; } } $ret.="
"; return $ret; } function aff_query_auth_empr_search($field,&$check_scripts,$varname) { global $msg,$lang, $categ,$charset; global $_custom_prefixe_, $caller; global $ajax_js_already_included; global $base_path; if(!empty($field['NUMBER'])) { $field_name = $field['NAME']."_".$field['NUMBER']; } else { $field_name = $field['NAME']; } if($field["OPTIONS"][0]["METHOD"]["0"]["value"]==1) { $hidden_name=$field_name; } else { $hidden_name=$field_name."_id"; } $id=(isset($field['VALUES'][0]) ? $field['VALUES'][0] : ''); $selection_parameters = get_authority_selection_parameters($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]); $what = $selection_parameters['what']; $completion = $selection_parameters['completion']; $params = $att_id_filter= ""; $fnamevar_id = ''; $id_thesaurus = ''; $id_thes_unique=0; $element=""; switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) { case 2: //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"]; $att_id_filter = $id_thes_unique; } break;//categories case 9: $concept_schemes = []; if (!empty($field['OPTIONS'][0]['ID_SCHEME_CONCEP'])) { for($i=0 ; $i\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(); $tmp_values=${$name}; if(is_array($tmp_values)) { foreach ($tmp_values as $k=>$v) { if ($v!="") { $val[]=$v; } } } if ($field['MANDATORY']==1) { if ((!count($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 $pmb_perso_sep; $name=$field['NAME']; $options=$field['OPTIONS'][0]; $isbd_s=array(); if(!$val)return ""; foreach($val as $id){ if($id) { $isbd_s[] = get_authority_isbd_from_field($field, $id, true); } } $aff=implode($pmb_perso_sep,$isbd_s); return array("ishtml" => true, "value"=> $aff, "withoutHTML" => strip_tags($aff)); } function chk_datatype($field,$values,&$check_datatype_message) { global $chk_type_list; global $msg; //Nettoyage des valeurs vides if (is_array($values)) { if(isset($values)) { $chk_values = array(); foreach ($values as $val) { if ($val != "") $chk_values[] = $val; } $values = $chk_values; } if (((!count($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"]; $flag_id_origine = ($field['ID_ORIGINE'] ? $field['ID_ORIGINE'] : 0); $count = 0; $ret = ""; if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret .= get_js_function_dnd('date_box', $field['NAME']); $ret .= ''; } foreach ($values as $value) { $d=explode("-",$value); $val = ""; if ((!@checkdate($d[1],$d[2],$d[0]))&&(!isset($options["DEFAULT_TODAY"][0]["value"]) || !$options["DEFAULT_TODAY"][0]["value"])) { if(!$flag_id_origine) { //on est en création $val = date("Y-m-d",time()); } } elseif ((!@checkdate($d[1],$d[2],$d[0]))&&(isset($options["DEFAULT_TODAY"][0]["value"]) && $options["DEFAULT_TODAY"][0]["value"])) { $val = ""; } else { $val = $value; } $display_temp = get_input_date($field['NAME']."[]", $field['NAME']."_val_".$count, $val, $field['MANDATORY']); if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $button_add = ''; if (end($values) == $value) { $button_add = ''; } $ret.= get_block_dnd('date_box', $field['NAME'], $count, $display_temp.$button_add, $val); } else { $ret.= $display_temp; } $count++; } if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret .= ''; $ret .= '
'; $ret .= get_custom_dnd_on_add(); $ret .= ""; } if ($field['MANDATORY']==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].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']; $ret="
"; if(!isset($field['OP'])) $field['OP'] = ''; switch ($field['OP']) { case 'LESS_THAN_DAYS': case 'MORE_THAN_DAYS': $ret.=" ".htmlentities($msg['days'], ENT_QUOTES, $charset); break; default: $val=''; if (!empty($values[0])) { $d=explode("-",$values[0]); if (@checkdate($d[1],$d[2],$d[0])) { $val=$values[0]; } } $ret.=""; break; } $ret.="
"; $values=$field['VALUES1']; $val=''; if (!empty($values[0])) { $d=explode("-",$values[0]); if (@checkdate($d[1],$d[2],$d[0])) { $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, $pmb_perso_sep; $return = ""; $format_value = format_output($field,$value); if (!$value) $value = array(); foreach ($value as $key => $val) { if ($val == "0000-00-00") $val = ""; if ($val) { if ($return) $return .= $pmb_perso_sep; $return .= $format_value[$key]; } } return $return; } function aff_text_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(""); } if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret .= get_js_function_dnd('text', $field['NAME']); $ret.=''; } foreach ($values as $avalues) { $display_temp = ""; if(!empty($options['REPEATABLE'][0]['value'])) { $button_add = ''; if (end($values) == $avalues) { $button_add = ''; } $ret.=get_block_dnd('text', $field['NAME'], $count, $display_temp.$button_add, $avalues); } else { $ret.=$display_temp."
"; } $count++; } if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.=''; $ret .= '
'; $ret.=get_custom_dnd_on_add(); $ret.=""; } if ($field['MANDATORY']==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].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']; if(!isset($values[0])) $values[0] = ''; $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(!isset($field["OPTIONS"][0]["ISHTML"][0]["value"])) $field["OPTIONS"][0]["ISHTML"][0]["value"] = ''; 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']; $afield_name = $field["ID"]; $ret = ""; $count = 0; if (!$values) { $values = array(""); } if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret .= get_js_function_dnd('comment', $field['NAME']); $ret .= ''; } foreach ($values as $avalues) { $display_temp = ""; if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $button_add = ''; if(end($values) == $avalues) { $button_add=''; } $ret.=get_block_dnd('comment', $field['NAME'], $count, $display_temp.$button_add, $avalues); } else { $ret.=$display_temp."
"; } $ret.="
"; $count++; } if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.=''; $ret .= '
'; $ret.=get_custom_dnd_on_add(); $ret.=""; } if ($field['MANDATORY']==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].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']; if(!isset($values[0])) $values[0] = ''; $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,$pmb_perso_sep; $value=format_output($field,$value); if (!$value) $value=array(); if(!isset($field["OPTIONS"][0]["ISHTML"][0]["value"])) $field["OPTIONS"][0]["ISHTML"][0]["value"] = ''; 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 val_html_empr($field,$value) { global $charset,$pmb_perso_sep; $value=format_output($field,$value); if (!$value) $value=array(); return array("ishtml" => true, "value"=>implode($pmb_perso_sep,$value), "withoutHTML" =>implode($pmb_perso_sep,$value)); } function aff_list_empr($field,&$check_scripts,$script="") { global $charset; global $_custom_prefixe_; global $base_path, $msg; $ret = ''; $_custom_prefixe_=$field["PREFIX"]; $options=$field['OPTIONS'][0]; $values=$field['VALUES']; if ($values=="") $values=array(); if ($options["AUTORITE"][0]["value"]!="yes") { if ($field['MANDATORY'] == 1) { $check_scripts.= ' var fieldName = "'.$field['NAME'].'"; var fields = document.querySelectorAll("[data-form-name=\'"+fieldName+"\']"); fields = fields.length ? fields : document.querySelectorAll("[name=\'"+fieldName+"[]\']") if (("SELECT" == fields[0].tagName) && (-1 == fields[0].options.selectedIndex)) { return cancel_submit("'.sprintf($msg["parperso_field_is_needed"],$field['ALIAS']).'"); } if ("checkbox" == fields[0].type) { var valid = false; fields.forEach(field => { if (field.checked) valid = true; }) if (!valid) return cancel_submit("'.sprintf($msg["parperso_field_is_needed"],$field['ALIAS']).'"); }'; } if ($options["CHECKBOX"][0]["value"]=="yes"){ $i=0; $limit = (isset($options['CHECKBOX_NB_ON_LINE'][0]['value']) ? $options['CHECKBOX_NB_ON_LINE'][0]['value'] : 4); $ret.="
"; if ($options['MULTIPLE'][0]['value']=="yes") $type = "checkbox"; else $type = "radio"; if (($options['UNSELECT_ITEM'][0]['VALUE']!="")&&($options['UNSELECT_ITEM'][0]['value']!="")) { $i=1; $ret.=""; $ret.= " ".$options['UNSELECT_ITEM'][0]['value'].""; $ret.=""; } $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)) { if($limit && $i>0 && $i%$limit == 0) $ret.="
"; $ret.=""; $ret.= " ".$r[$_custom_prefixe_."_custom_list_lib"].""; $ret.=""; $i++; } } $ret.="
"; }else{ $ret.="\n"; } } else { $libelles=array(); $caller = get_form_name(); if ($values) { $values_received=$values; $values=array(); $list_values=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=pmb_mysql_query($requete); while ($r=pmb_mysql_fetch_array($resultat)) { $list_values[$r[$_custom_prefixe_."_custom_list_value"]] = $r[$_custom_prefixe_."_custom_list_lib"]; } foreach ($values_received as $value_received) { if (array_key_exists($value_received, $list_values)) { $values[]=$value_received; $libelles[]=$list_values[$value_received]; } } }else { //Recherche de la valeur par défaut if ($options['DEFAULT_VALUE'][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']." and ".$_custom_prefixe_."_custom_list_value='".$options['DEFAULT_VALUE'][0]['value']."' order by ordre"; $resultat=pmb_mysql_query($requete); while ($r=pmb_mysql_fetch_array($resultat)) { $values[0]=$r[$_custom_prefixe_."_custom_list_value"]; $libelles[0]=$r[$_custom_prefixe_."_custom_list_lib"]; } } } $readonly=''; $n=count($values); if(($options['MULTIPLE'][0]['value']=="yes") ) $val_dyn=1; else $val_dyn=0; if ($n==0) { $n=1; $libelles[0] = ''; $values[0] = ''; } if ($options['MULTIPLE'][0]['value']=="yes") { $readonly=''; $ret.=get_custom_dnd_on_add(); $ret.=" "; } $ret.="\n
"; $readonly=''; if($options['MULTIPLE'][0]['value']=="yes") { $ret .= get_js_function_dnd('list', $field['NAME']); $ret.=" "; } for ($i=0; $i<$n; $i++) { $display_temp ="\n"; $display_temp.=""; $display_temp.="\n"; if($options['MULTIPLE'][0]['value']=="yes") { $button_add = ''; if (($n - 1) == $i) { $button_add = ''; } $ret.=get_block_dnd('list', $field['NAME'], $i, $display_temp.$button_add, $libelles[$i]); } else { $ret.=$display_temp."
"; } } $ret.="
"; } return $ret; } function aff_list_empr_search($field,&$check_scripts,$varname,$script="") { global $charset; global $base_path; if(!empty($field['NUMBER'])) { $field_name = $field['NAME']."_".$field['NUMBER']; } else { $field_name = $field['NAME']; } $_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"){ $i=0; $limit = (isset($options['CHECKBOX_NB_ON_LINE'][0]['value']) ? $options['CHECKBOX_NB_ON_LINE'][0]['value'] : 4); $ret="
"; if ($options['MULTIPLE'][0]['value']=="yes") $type = "checkbox"; else $type = "radio"; if (($options['UNSELECT_ITEM'][0]['VALUE']!="")&&($options['UNSELECT_ITEM'][0]['value']!="")) { $i=1; $ret.=""; $ret.= " ".$options['UNSELECT_ITEM'][0]['value'].""; $ret.=""; } $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)) { if($limit && $i>0 && $i%$limit == 0) $ret.="
"; $ret.=""; $ret.= " ".$r[$_custom_prefixe_."_custom_list_lib"].""; $ret.=""; $i++; } } $ret.="
"; } else { $ret="\n"; } } else { $ret=" "; $libelles=array(); if (count($values)) { $values_received=$values; $values=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=pmb_mysql_query($requete); $i=0; while ($r=pmb_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++; } } } $nb_values=count($values); if(!$nb_values){ //Création de la ligne $nb_values=1; $libelles[0] = ''; $values[0] = ''; } $ret.=""; $ret.=""; $ret.=""; $ret.="
"; for($inc=0;$inc<$nb_values;$inc++){ $ret.="
"; $ret.=""; $ret.="\n"; $ret.="\n"; $ret.="
"; } $ret.="
"; } 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(); $tmp_values=${$name}; if (!empty($tmp_values)) { foreach ($tmp_values as $v) { if ($v!="") { $val[]=$v; } } } } if ($field['MANDATORY']==1) { if ((!count($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 (!isset($options_[$_custom_prefixe_][$field['ID']]) || !$options_[$_custom_prefixe_][$field['ID']]) { $options_[$_custom_prefixe_][$field['ID']] = 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=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(); if ($field["OPTIONS"][0]["AUTORITE"][0]["value"]!="yes") { $val_c=array_intersect_key($options_[$_custom_prefixe_][$field['ID']],$val_r); } else { // CP de type "Autorité", nous conservons l'ordre de saisie $val_c=array(); foreach ($val_r as $key_r=>$value_r) { if(!empty($options_[$_custom_prefixe_][$field['ID']][$key_r])) { $val_c[$key_r] = $options_[$_custom_prefixe_][$field['ID']][$key_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_; global $base_path; global $lang; $ret = ''; $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"; //on rajoute la langue si besoin dans le requete $query = str_replace('$lang', $lang, $options['QUERY'][0]['value']); $resultat=pmb_mysql_query($query); 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.=""; $ret.= ""; $i++; } $ret.="
 ".$r[1]."
"; } } else { $options=$field['OPTIONS'][0]; $ret="\n"; } } else { $caller = get_form_name(); $libelles=array(); if ($values) { $values_received=$values; $values_received_bis=$values; $values=array(); //on rajoute la langue si besoin dans le requete $query = str_replace('$lang', $lang, $options['QUERY'][0]['value']); $resultat=pmb_mysql_query($query); $query_options = array(); while ($r=pmb_mysql_fetch_row($resultat)) { $query_options[$r[0]] = $r[1]; } $i=0; foreach ($values_received as $key=>$value_received) { if (!empty($query_options[$value_received])) { $values[$i]=$value_received; $libelles[$i]=$query_options[$value_received]; $i++; unset($values_received_bis[$key]); } } 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) { $n=1; $libelles[0] = ''; $values[0] = ''; } if ($options['MULTIPLE'][0]['value']=="yes") { // $readonly="f_perso.setAttribute('readonly','');"; // if($options["INSERTAUTHORIZED"][0]["value"]=="yes"){ // $readonly=""; // } $readonly=''; $ret.=get_custom_dnd_on_add(); $ret.=" "; } $ret.="\n
"; // $readonly="readonly"; // if($options["INSERTAUTHORIZED"][0]["value"]=="yes"){ // $readonly=""; // } $readonly=''; if($options['MULTIPLE'][0]['value']=="yes") { $ret .= get_js_function_dnd('query_list', $field['NAME']); $ret.=" "; } for ($i=0; $i<$n; $i++) { $display_temp ="\n"; $display_temp.=""; $display_temp.="\n"; if($options['MULTIPLE'][0]['value']=="yes") { if ($i == $n-1) { $display_temp.= " "; } $ret.=get_block_dnd('query_list', $field['NAME'], $i, $display_temp, $libelles[$i]); } else { $ret.=$display_temp."
"; } } $ret.="
"; } return $ret; } function aff_query_list_empr_search($field,&$check_scripts,$varname,$script="") { global $charset; global $base_path; $_custom_prefixe_=$field["PREFIX"]; $values=$field['VALUES']; if ($values=="") $values=array(); $options=$field['OPTIONS'][0]; if ($options["AUTORITE"][0]["value"]!="yes") { $ret="\n"; } else { $ret=" "; $libelles=array(); if (count($values)) { $values_received=$values; $values=array(); $resultat=pmb_mysql_query($options['QUERY'][0]['value']); $i=0; while ($r=pmb_mysql_fetch_array($resultat)) { $as=array_search($r[0],$values_received); if (($as!==null)&&($as!==false)) { $values[$i]=$r[0]; $libelles[$i]=$r[1]; $i++; } } } $nb_values=count($values); if(!$nb_values){ //Création de la ligne $nb_values=1; $libelles[0] = ''; $values[0] = ''; } $ret.=""; $ret.=""; $ret.=""; $ret.="
"; for($inc=0;$inc<$nb_values;$inc++){ $ret.="
"; $ret.=""; $ret.="\n"; $ret.="\n"; $ret.="
"; } $ret.="
"; } return $ret; } function chk_query_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(); $tmp_values=${$name}; if(is_array($tmp_values)) { foreach ($tmp_values as $k=>$v) { if ($v!="") { $val[]=$v; }elseif($options["INSERTAUTHORIZED"][0]["value"]=="yes"){ $v2="f_".$field["NAME"]; global ${$v2}; $values_input = ${$v2}; if ($values_input[$k]!="") { $val[]=$values_input[$k]; } } } } } if ($field['MANDATORY']==1) { if ((!count($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")) { if(is_array($val) && count($val)) { $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=pmb_mysql_query($requete); if ($resultat && pmb_mysql_num_rows($resultat)) { while ($r=pmb_mysql_fetch_row($resultat)) { $val_c[]=$r[1]; } } } } else { $resultat=pmb_mysql_query($field['OPTIONS'][0]['QUERY'][0]['value']); if($resultat && pmb_mysql_num_rows($resultat)){ while ($r=pmb_mysql_fetch_row($resultat)) { $options_[$r[0]]=$r[1]; } } for ($i=0; $i'; } foreach ($values as $value) { $exploded_value = explode("|||", $value); $display_temp =""; $display_temp.=" ".$msg['param_perso_lang_select']." : "; $display_temp.=""; $display_temp.=""; $display_temp.=""; if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $button_add = ''; if(end($values) == $value) { $button_add=''; } $ret.=get_block_dnd('text_i18n', $field['NAME'], $count, $display_temp.$button_add, $exploded_value[0]); } else { $ret.=$display_temp."
"; } $count++; } if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.=''; $ret .= '
'; $ret .= get_custom_dnd_on_add(); $ret.=""; } if ($field['MANDATORY']==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].elements[\"".$field['NAME']."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field['ALIAS'])."\");\n"; } return $ret; } function aff_text_i18n_empr_search($field,&$check_scripts,$varname) { global $charset; global $msg; global $base_path; $langue_doc = get_langue_doc(); $options=$field['OPTIONS'][0]; $values=$field['VALUES']; if(!is_array($values)) { $values = array( 'text' => '', 'lang' => '' ); } $ret=""; $ret.=" ".$msg['param_perso_lang_select']." : "; $ret.=""; $ret.=""; $ret.=""; return $ret; } function chk_text_i18n_empr($field,&$check_message) { $name=$field['NAME']; global ${$name}, ${$name."_langs"}; $val=${$name}; $langs = (${$name."_langs"}); $final_value = array(); if (isset($val) && is_array($val)) { foreach ($val as $key => $value) { if ($value) { $final_value[] = $value."|||".($langs[$key] ? $langs[$key] : ''); } } } $check_datatype_message=""; $val_1=chk_datatype($field,$final_value,$check_datatype_message); if ($check_datatype_message) { $check_message=$check_datatype_message; return 0; } ${$name}=$val_1; return 1; } function val_text_i18n_empr($field,$value) { global $charset,$pmb_perso_sep; $langue_doc = get_langue_doc(); $value=format_output($field,$value); if (!$value) $value=array(); $formatted_values = array(); foreach ($value as $val) { $exploded_val = explode("|||", $val); $formatted_values[] = $exploded_val[0]." ".($exploded_val[1] ? "(".$langue_doc[$exploded_val[1]].")" : ''); } if(!isset($field["OPTIONS"][0]["ISHTML"][0]["value"])) $field["OPTIONS"][0]["ISHTML"][0]["value"] = ''; if($field["OPTIONS"][0]["ISHTML"][0]["value"]){ return array("ishtml" => true, "value"=>implode($pmb_perso_sep,$formatted_values), "withoutHTML" =>implode($pmb_perso_sep,$formatted_values)); }else{ return implode($pmb_perso_sep,$formatted_values); } } function aff_filter_comment_empr($field,$varname,$multiple) { global $charset; global $msg; $ret="\n"; return $ret; } function aff_filter_date_box_empr($field,$varname,$multiple) { global $charset; global $msg; $ret="\n"; return $ret; } function aff_filter_text_empr($field,$varname,$multiple) { global $charset; global $msg; $ret="\n"; return $ret; } function aff_filter_query_list_empr($field,$varname,$multiple) { global $charset; $options=$field['OPTIONS'][0]; $values=$field['VALUES']; if ($values=="") $values=array(); $ret="\n"; } function aff_filter_list_empr($field,$varname,$multiple) { global $charset; global $msg; $_custom_prefixe_=$field["PREFIX"]; $options=$field['OPTIONS'][0]; $values=$field['VALUES']; if ($values=="") $values=array(); $ret="\n"; return $ret; } function aff_external_empr($field,&$check_scripts) { global $charset; global $msg; $options=$field['OPTIONS'][0]; $values=$field['VALUES']; //Recherche du libellé $vallib=$values[0]; if ($options["QUERY"][0]["value"]) { $rvalues=pmb_mysql_query(str_replace("!!id!!",$values[0],$options["QUERY"][0]["value"])); if ($rvalues) { $vallib=@pmb_mysql_result($rvalues,0,0); } } $ret=""; if (!$options["HIDE"][0]["value"]) { $ret.=""; } $ret.=" "; if ($options["DELETE"][0]["value"]) $ret.=" "; if ($field["MANDATORY"]==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].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=pmb_mysql_query(str_replace("!!id!!",$values[0],$options["QUERY"][0]["value"])); if ($rvalues) { $vallib=@pmb_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=pmb_mysql_query(str_replace("!!id!!",$value[0],$options["QUERY"][0]["value"])); if ($rvalues) { return @pmb_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) { $linktarget_default_checked = (isset($options['LINKTARGET'][0]['value']) && $options['LINKTARGET'][0]['value'] ? 1 : 0); $values = array("||".$linktarget_default_checked); } if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret .= get_js_function_dnd('url', $field['NAME']); $ret.=""; } foreach ($values as $value) { $avalues = explode("|",$value); $display_temp ="
"; $display_temp.= $msg['persofield_url_link'].""; $display_temp.=" "; //$display_temp.="
"; $display_temp.=" ".$msg['persofield_url_linklabel'].""; $target_checked = 'checked="checked"'; if (isset($avalues[2]) && ($avalues[2] == 0)) { $target_checked = ''; } $display_temp.="  "; if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $button_add = ''; if (end($values) == $value) { $button_add = ""; } $ret.=get_block_dnd('url', $field['NAME'], $count, $display_temp.$button_add, $avalues[0]); } else { $ret.=$display_temp."
"; } $count++; } $ret.= " "; if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.=''; //$ret.=''; $ret .= '
'; $ret.=get_custom_dnd_on_add(); $ret.=""; } if ($field['MANDATORY']==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].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']; if(!isset($values[0])) $values[0] = ''; $ret=""; return $ret; } function chk_url_empr($field, &$check_message) { $name = $field['NAME']; global ${$name}; $val = ${$name}; $value = array(); $nb_vals = count($val['link']); for ($i = 0; $i < $nb_vals; $i++) { if ($val['link'][$i] != "") { $linktarget = '|0'; if (!empty($val['linktarget'][$i])) { $linktarget = '|1'; } $value[] = $val['link'][$i]."|".$val['linkname'][$i].$linktarget; } } $val = $value; $check_datatype_message = ""; $val_1 = chk_datatype($field, $val, $check_datatype_message); if (!empty($check_datatype_message)) { $check_message = $check_datatype_message; return 0; } ${$name} = $val_1; return 1; } function val_url_empr($field,$value) { global $charset,$pmb_perso_sep; $cut = $field['OPTIONS'][0]['MAXSIZE'][0]['value']; $values=format_output($field,$value); $ret = ""; $without = ""; $details = array(); for ($i=0;$i $cut ? substr($val[0],0,$cut)."[...]" : $val[0] ); if( $ret != "") $ret.= $pmb_perso_sep; $target = '_blank'; if (isset($val[2]) && ($val[2] == 0)) { $target = '_self'; } $ret .= "".htmlentities($lib, ENT_QUOTES, $charset).""; if( $without != "") $without.= $pmb_perso_sep; $without .= $lib; $details[] = array('url' => $val[0], 'label' => $lib, 'target' => $target); } return array("ishtml" => true, "value"=>$ret, "withoutHTML" =>$without, "details" => $details); } 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("|"); } if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret .= get_js_function_dnd('resolve', $field['NAME']); if(!isset($options['MAXSIZE'][0]['value'])) $options['MAXSIZE'][0]['value'] = ''; $ret.=''; } foreach ($values as $value) { $avalues = explode("|",$value); $display_temp = ""; $display_temp .= " "; if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $button_add = ''; if (end($values) == $value) { $button_add = ''; } $ret.=get_block_dnd('resolve', $field['NAME'], $count, $display_temp.$button_add, $avalues[0]); } else { $ret.=$display_temp."
"; } $count++; } if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.=''; //$ret.=''; $ret .= '
'; $ret.=get_custom_dnd_on_add(); $ret.=""; } if ($field['MANDATORY']==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].elements[\"".$field['NAME']."[id][]\"].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(); if (isset($val['id'])) { $nb_vals = count($val['id']); for ($i = 0; $i < $nb_vals; $i++) { if ($val['id'][$i] != "") { $value[] = $val['id'][$i]."|".$val['resolve'][$i]; } } } $val = $value; $check_datatype_message = ""; $val_1 = chk_datatype($field, $val, $check_datatype_message); if (!empty($check_datatype_message)) { $check_message = $check_datatype_message; return 0; } ${$name} = $val_1; return 1; } function val_resolve_empr($field,$value) { global $charset,$pmb_perso_sep,$pmb_opac_url,$use_opac_url_base; $without=""; $options=$field['OPTIONS'][0]; $values=format_output($field,$value); $ret = ""; 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']; if(!isset($values[0])) $values[0] = ''; $ret=""; return $ret; } function aff_html_empr($field,&$check_scripts) { global $charset; global $msg; global $pmb_editorial_dojo_editor,$pmb_javascript_office_editor; global $cms_dojo_plugins_editor; global $categ,$current; $options=$field['OPTIONS'][0]; $values=$field['VALUES']; $afield_name = $field["ID"]; $ret = ""; $count = 0; if (!$values) { $values = array(""); } if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret .= get_js_function_dnd('html', $field['NAME']); if($pmb_javascript_office_editor && $options['HTMLEDITOR'][0]['value']) { $use_editor_html = "1"; } else { $use_editor_html = "0"; } $ret.=''; } foreach ($values as $avalues) { $display_temp = ''; if($pmb_editorial_dojo_editor){ $display_temp.=""; $display_temp.="
".$avalues."
"; } else { $display_temp.=""; if ($pmb_javascript_office_editor && $options['HTMLEDITOR'][0]['value']) { $mcename=$field['NAME']."_".$count; $display_temp.= ""; } } if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.=get_block_dnd('html', $field['NAME'], $count, $display_temp); } else { $ret.=$display_temp."
"; } $ret.="
"; $count++; } if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.=''; $ret .= '
'; $ret.=get_custom_dnd_on_add(); if($pmb_editorial_dojo_editor){ $ret.=""; $caller = get_form_name(); $check_scripts.= " var i = 0; while(document.forms['".$caller."'].elements['".$field['NAME']."['+i+']']){ if(dijit.byId('".$field['NAME']."_'+i).get('value') && (dijit.byId('".$field['NAME']."_'+i).get('value') != '
') && (dijit.byId('".$field['NAME']."_'+i).get('value') != '
')) { document.forms['".$caller."'].elements['".$field['NAME']."['+i+']'].value = dijit.byId('".$field['NAME']."_'+i).get('value'); } i++; }"; } else { $ret.= get_custom_dnd_on_add(); $ret.=""; $check_scripts.= " var elts_cnt = 0; if (document.getElementsByName('".$field['NAME']."[]').length) { elts_cnt = document.getElementsByName('".$field['NAME']."[]').length; } if (elts_cnt) { if(typeof(tinyMCE)!= 'undefined') { for (var i = 0; i < elts_cnt; i++) { tinyMCE_execCommand('mceToggleEditor',true,'".$field['NAME']."_'+i); tinyMCE_execCommand('mceRemoveControl',true,'".$field['NAME']."_'+i); } } } "; } } else { if($pmb_editorial_dojo_editor){ $caller = get_form_name(); $check_scripts.= " var i = 0; while(document.forms['".$caller."'].elements['".$field['NAME']."['+i+']']){ if(dijit.byId('".$field['NAME']."_'+i).get('value') && (dijit.byId('".$field['NAME']."_'+i).get('value') != '
') && (dijit.byId('".$field['NAME']."_'+i).get('value') != '
')) { document.forms['".$caller."'].elements['".$field['NAME']."['+i+']'].value = dijit.byId('".$field['NAME']."_'+i).get('value'); } i++; }"; } else { $check_scripts.= " var elts_cnt = 0; if (document.getElementsByName('".$field['NAME']."[]').length) { elts_cnt = document.getElementsByName('".$field['NAME']."[]').length; } if (elts_cnt) { if(typeof(tinyMCE)!= 'undefined') { for (var i = 0; i < elts_cnt; i++) { tinyMCE_execCommand('mceToggleEditor',true,'".$field['NAME']."_'+i); tinyMCE_execCommand('mceRemoveControl',true,'".$field['NAME']."_'+i); } } } "; } } if ($field['MANDATORY']==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].elements[\"".$field['NAME']."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field['ALIAS'])."\");\n"; } return $ret; } function aff_marclist_empr($field,&$check_scripts,$script="") { global $charset; global $base_path; $_custom_prefixe_=$field["PREFIX"]; $options=$field['OPTIONS'][0]; $values=$field['VALUES']; if ($values=="") $values=array(); $ret = ""; switch($options['DATA_TYPE'][0]['value']){ case 'lang' : $completion='langue'; break; case 'function' : $completion='fonction'; break; default: $completion=$options['DATA_TYPE'][0]['value']; break; } $marclist_type = marc_list_collection::get_instance($options['DATA_TYPE'][0]['value']); if ($options["AUTORITE"][0]["value"]!="yes") { $ret="\n"; } else { $libelles=array(); $caller = get_form_name(); if (count($values)) { $values_received=$values; $values=array(); $i=0; foreach ($values_received as $id=>$value) { $as=array_key_exists($value,$marclist_type->table); if (($as!==null)&&($as!==false)) { $values[$i]=$value; $libelles[$i]=$marclist_type->table[$value]; $i++; } } } $readonly=''; $n=count($values); if(($options['MULTIPLE'][0]['value']=="yes") ) $val_dyn=1; else $val_dyn=0; if ($n==0) { $n=1; $libelles[0] = ''; $values[0] = ''; } if ($options['MULTIPLE'][0]['value']=="yes") { $readonly=''; $ret.= get_custom_dnd_on_add(); $ret.=" "; } $ret.="\n
"; $readonly=''; if($options['MULTIPLE'][0]['value']=="yes") { $ret.=""; $ret .= get_js_function_dnd('marclist', $field['NAME']); } for ($i=0; $i<$n; $i++) { $display_temp ="\n"; $display_temp.=""; $display_temp.="\n"; if($options['MULTIPLE'][0]['value']=="yes") { $add_button = ''; if (($n -1) == $i) { $add_button = ""; } $ret.=get_block_dnd('marclist', $field['NAME'], $i, $display_temp.$add_button, $libelles[$i]); } else { $ret.=$display_temp."
"; } } $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(); $tmp_values=${$name}; if(is_array($tmp_values)) { foreach ($tmp_values as $v) { if ($v!="") { $val[]=$v; } } } } if ($field['MANDATORY']==1) { if ((!count($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 = marc_list_collection::get_instance($options['DATA_TYPE'][0]['value']); if($ret)$ret.=$pmb_perso_sep; foreach($values as $id=>$value) { if(isset($marclist_type->table[$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; global $base_path; $_custom_prefixe_=$field["PREFIX"]; $options=$field['OPTIONS'][0]; $values=$field['VALUES']; if ($values=="") $values=array(); $marclist_type = marc_list_collection::get_instance($options['DATA_TYPE'][0]['value']); if ($options["AUTORITE"][0]["value"]!="yes") { $ret="\n"; } else { $ret=" "; $libelles=array(); if (count($values)) { $values_received=$values; $values=array(); foreach ($values_received as $i=>$value_received) { $values[$i]=$value_received; $libelles[$i]=$marclist_type->table[$value_received]; } } $nb_values=count($values); if(!$nb_values){ //Création de la ligne $nb_values=1; $libelles[0] = ''; $values[0] = ''; } $ret.=""; $ret.=""; $ret.=""; $ret.="
"; for($inc=0;$inc<$nb_values;$inc++){ $ret.="
"; $ret.=""; $ret.="\n"; $ret.="\n"; $ret.="
"; } $ret.="
"; } return $ret; } function aff_q_txt_i18n_empr($field,&$check_scripts) { global $charset, $base_path; global $msg; $langue_doc = get_langue_doc(); $datatype = $field['DATATYPE']; $options=$field['OPTIONS'][0]; $values=$field['VALUES']; $afield_name = $field["ID"]; $_custom_prefixe_=$field["PREFIX"]; $ret = ""; $count = 0; if (!$values) { if(isset($options['DEFAULT_LANG'][0]['value']) && $options['DEFAULT_LANG'][0]['value']) { $values = array("|||".$options['DEFAULT_LANG'][0]['value']."|||"); } else { $values = 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=pmb_mysql_query($requete); $options['ITEMS'] = array(); if ($resultat) { $i=0; while ($r=pmb_mysql_fetch_array($resultat)) { $options['ITEMS'][$i]['value']=$r[$_custom_prefixe_."_custom_list_value"]; $options['ITEMS'][$i]['label']=$r[$_custom_prefixe_."_custom_list_lib"]; $i++; } } if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret .= get_js_function_dnd('q_txt_i18n', $field['NAME']); $ret.=''; } $n = count($values); $maxlength = 200; foreach ($values as $value) { $exploded_value = explode("|||", $value); if (isset($options['TYPE'][0]['value']) && $options['TYPE'][0]['value'] == "textarea") { $maxlength = $options['MAXSIZE'][0]['value']; if ($datatype == "small_text" && $maxlength > 200) { /** * si le datatype choisie est small_text, * on force le maxlength à 200 pour pouvoir enregistrer * la qualification et la langue. */ $maxlength = 200; } $display_temp = ""; } else { $display_temp = ""; } if(count($options['ITEMS']) == 1) { $type = "checkbox"; $display_temp.= "". $options['ITEMS'][0]['label']." "; $display_temp.= ""; } else { $display_temp.=""; } $display_temp.=" ".$msg['param_perso_lang_select']." : "; $display_temp.=""; $display_temp.=""; $display_temp.=""; if(isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { if ($count == $n-1) { $display_temp.= ''; } $avalue = (isset($exploded_value[1]) && $exploded_value[1] ? $langue_doc[$exploded_value[1]] : ''); $ret.=get_block_dnd('q_txt_i18n', $field['NAME'], $count, $display_temp, $avalue); } else { $ret.=$display_temp."
"; } $count++; } if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.=''; $ret.= '
'; $ret.= get_custom_dnd_on_add(); $ret.=""; } if ($field['MANDATORY']==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].elements[\"".$field['NAME']."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field['ALIAS'])."\");\n"; } return $ret; } function aff_q_txt_i18n_empr_search($field,&$check_scripts,$varname) { global $charset; global $msg; global $base_path; $langue_doc = get_langue_doc(); $options=$field['OPTIONS'][0]; $values=$field['VALUES']; $_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); $options['ITEMS'] = array(); if ($resultat) { $i=0; while ($r=pmb_mysql_fetch_array($resultat)) { $options['ITEMS'][$i]['value']=$r[$_custom_prefixe_."_custom_list_value"]; $options['ITEMS'][$i]['label']=$r[$_custom_prefixe_."_custom_list_lib"]; $i++; } } $ret=""; if(count($options['ITEMS']) == 1) { $type = "checkbox"; $ret.= " ".$options['ITEMS'][0]['label'].""; } else { $ret.=""; } $ret.=" ".$msg['param_perso_lang_select']." : "; $ret.=""; $ret.=""; $ret.=""; return $ret; } function chk_q_txt_i18n_empr($field,&$check_message) { $name=$field['NAME']; global ${$name}, ${$name."_langs"}, ${$name."_qualifications"}; $val=${$name}; $langs = (${$name."_langs"}); $qualifications = (${$name."_qualifications"}); $final_value = array(); if(is_array($val)) { foreach ($val as $key => $value) { if ($value) { $final_value[] = $value."|||".($langs[$key] ? $langs[$key] : '')."|||".$qualifications[$key]; } } } $check_datatype_message=""; $val_1=chk_datatype($field,$final_value,$check_datatype_message); if ($check_datatype_message) { $check_message=$check_datatype_message; return 0; } ${$name}=$val_1; return 1; } function val_q_txt_i18n_empr($field,$value) { global $charset,$pmb_perso_sep; $langue_doc = get_langue_doc(); $_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); $items = array(); if ($resultat) { while ($r=pmb_mysql_fetch_array($resultat)) { $items[$r[$_custom_prefixe_."_custom_list_value"]] = $r[$_custom_prefixe_."_custom_list_lib"]; } } $value=format_output($field,$value); if (!$value) $value=array(); $formatted_values = array(); if(is_array($value)) { foreach ($value as $val) { $exploded_val = explode("|||", $val); $formatted_values[] = (isset($exploded_val[2]) && $exploded_val[2] ? "[".$items[$exploded_val[2]]."] " : "").$exploded_val[0]." ".(isset($exploded_val[1]) && $exploded_val[1] ? "(".$langue_doc[$exploded_val[1]].")" : ""); } } if(!isset($field["OPTIONS"][0]["ISHTML"][0]["value"])) $field["OPTIONS"][0]["ISHTML"][0]["value"] = ''; if($field["OPTIONS"][0]["ISHTML"][0]["value"]){ return array("ishtml" => true, "value"=>implode($pmb_perso_sep,$formatted_values), "withoutHTML" =>implode($pmb_perso_sep,$formatted_values)); }else{ return implode($pmb_perso_sep,$formatted_values); } } function aff_date_inter_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 = ""; if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.= get_js_function_dnd('date_inter', $field['NAME']); $ret.= ''; } foreach ($values as $value) { $timestamp_begin = ''; $timestamp_end = ''; $dates = explode("|",$value); if (isset($dates[0])) $timestamp_begin = $dates[0]; if (isset($dates[1])) $timestamp_end = $dates[1]; if (!$timestamp_begin && !$timestamp_end && !$options["DEFAULT_TODAY"][0]["value"]) { $time = time(); $date_begin = date("Y-m-d",$time); $date_end = date("Y-m-d",$time); $time_begin = null; $time_end = null; } elseif (!$timestamp_begin && !$timestamp_end && $options["DEFAULT_TODAY"][0]["value"]) { $date_begin = null; $date_end = null; $time_begin = null; $time_end = null; } else { $date_begin = date("Y-m-d",$timestamp_begin); $date_end = date("Y-m-d",$timestamp_end); $time_begin = "T".date("H:i",$timestamp_begin); $time_end = "T".date("H:i",$timestamp_end); } $display_temp = get_input_date_time_inter($field['NAME']."[".$count."]", $field['NAME']."_".$count, $date_begin, $time_begin, $date_end, $time_end, $field['MANDATORY']); if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $button_add = ''; if (end($values) == $value) { $button_add = ''; } $ret.= get_block_dnd('date_inter', $field['NAME'], $count, $display_temp.$button_add, $date_begin); } else { $ret.= $display_temp; } $count++; } if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret.= ''; $ret.= '
'; $ret.= get_custom_dnd_on_add(); $ret.= " "; } if ($field['MANDATORY'] == 1) { $caller = get_form_name(); $check_scripts.= "if (document.forms[\"".$caller."\"].elements[\"".$field['NAME']."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field['ALIAS'])."\");\n"; } return $ret; } function aff_date_inter_empr_search($field,&$check_scripts,$varname) { global $charset; global $msg; $timestamp_begin = ''; $timestamp_end = ''; $values=$field['VALUES']; if(!empty($values[0])) { $dates = explode("|",$values[0]); if (isset($dates[0])) $timestamp_begin = $dates[0]; if (isset($dates[1])) $timestamp_end = $dates[1]; } if (!$timestamp_begin && !$timestamp_end) { $time = time(); $date_begin = date("Y-m-d",$time); $date_end = date("Y-m-d",$time); $time_begin = date("H:i",$time); $time_end = date("H:i",$time); } else { $date_begin = date("Y-m-d",$timestamp_begin); $date_end = date("Y-m-d",$timestamp_end); $time_begin = date("H:i",$timestamp_begin); $time_end = date("H:i",$timestamp_end); } $ret = "
"; return $ret; } function aff_filter_date_inter_empr($field,$varname,$multiple) { global $charset; global $msg; $ret="\n"; return $ret; } function chk_date_inter_empr($field,&$check_message) { $name=$field['NAME']; global ${$name}; $val=${$name}; $value = array(); if (is_array($val)) { foreach($val as $interval){ if(!$interval['time_begin']) { $interval['time_begin'] = '00:00'; } if(!$interval['time_end']) { $interval['time_end'] = '23:59'; } if($interval['date_begin'] && $interval['date_end']) { $timestamp_begin = strtotime($interval['date_begin'] . ' ' . $interval['time_begin']); $timestamp_end = strtotime($interval['date_end'] . ' ' . $interval['time_end']); if ($timestamp_begin > $timestamp_end) { $value[] = $timestamp_end."|".$timestamp_begin; } else { $value[] = $timestamp_begin."|".$timestamp_end; } } } } $val = $value; $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_inter_empr($field,$value) { global $charset,$pmb_perso_sep, $msg; $without=""; $options=$field['OPTIONS'][0]; $values=format_output($field,$value); $return = ""; for ($i=0;$i"; $customfield_drop_already_included = true; } return $return." "; } function get_block_dnd($field_type, $field_name, $count, $html, $avalues='') { global $charset; return "
".$html."
"; } function get_custom_dnd_on_add() { global $charset; return " "; } function get_authority_isbd_from_field($field, $id=0, $with_permalink=false) { global $charset; global $lang; $isbd = ''; switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) { case 1:// auteur $aut = authorities_collection::get_authority(AUT_TABLE_AUTHORS, $id); $isbd .= html_entity_decode($aut->get_isbd(),ENT_QUOTES, $charset); break; case 2:// categories if (isset($field["OPTIONS"][0]["CATEG_SHOW"]["0"]["value"]) && $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 = authorities_collection::get_authority(AUT_TABLE_PUBLISHERS, $id); $isbd .= html_entity_decode($aut->get_isbd(),ENT_QUOTES, $charset); break; case 4:// collection $aut = authorities_collection::get_authority(AUT_TABLE_COLLECTIONS, $id); $isbd .= html_entity_decode($aut->get_isbd(),ENT_QUOTES, $charset); break; case 5:// subcollection $aut = authorities_collection::get_authority(AUT_TABLE_SUB_COLLECTIONS, $id); $isbd .= html_entity_decode($aut->get_isbd(),ENT_QUOTES, $charset); break; case 6:// Titre de serie $aut = authorities_collection::get_authority(AUT_TABLE_SERIES, $id); $isbd .= html_entity_decode($aut->get_isbd(),ENT_QUOTES, $charset); break; case 7:// Indexation decimale $aut = authorities_collection::get_authority(AUT_TABLE_INDEXINT, $id); $isbd .= html_entity_decode($aut->get_isbd(),ENT_QUOTES, $charset); break; case 8:// titre uniforme $aut = authorities_collection::get_authority(AUT_TABLE_TITRES_UNIFORMES, $id); $isbd .= html_entity_decode($aut->get_isbd(),ENT_QUOTES, $charset); break; case 9://Concept if(!intval($id)){ $id = onto_common_uri::get_id($id); } if(!$id) break; $aut = authorities_collection::get_authority(AUT_TABLE_INDEX_CONCEPT, $id); $isbd .= html_entity_decode($aut->get_display_label(),ENT_QUOTES, $charset); break; default: if($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]>1000){ // autperso $aut = authorities_collection::get_authority(AUT_TABLE_AUTHPERSO, $id); $isbd .= html_entity_decode($aut->get_isbd(),ENT_QUOTES, $charset); } break; } if($with_permalink && isset($aut) && is_object($aut)) { $isbd = "".$isbd.""; } return $isbd; } function get_authority_selection_parameters($authority_type) { $what = ''; $completion = ''; switch($authority_type) { case 1://auteurs $what="auteur"; $completion='authors'; break; case 2://categories $what="categorie"; $completion="categories_mul"; break; case 3://Editeurs $what="editeur"; $completion="publishers"; break; case 4://collection $what="collection"; $completion="collections"; break; case 5:// subcollection $what="subcollection"; $completion="subcollections"; break; case 6://Titre de serie $what="serie"; $completion="serie"; break; case 7:// Indexation decimale $what="indexint"; $completion="indexint"; break; case 8:// titre uniforme $what="titre_uniforme"; $completion="titre_uniforme"; break; case 9: $what="ontology"; $completion="onto"; break; default: if($authority_type>1000){ $what="authperso&authperso_id=".($authority_type-1000); $completion="authperso_".($authority_type-1000); } break; } return array( 'what' => $what, 'completion' => $completion ); } function get_authority_details_from_field($field, $id=0) { $details = array(); switch($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]) { case 1:// auteur $aut = authorities_collection::get_authority('author', $id); $details = $aut->format_datas(); break; case 2:// categories $aut = new category($id); $details = $aut->format_datas(); break; case 3:// Editeur $aut = authorities_collection::get_authority('publisher', $id); $details = $aut->format_datas(); break; case 4:// collection $aut = authorities_collection::get_authority('collection', $id); $details = $aut->format_datas(); break; case 5:// subcollection $aut = authorities_collection::get_authority('subcollection', $id); $details = $aut->format_datas(); break; case 6:// Titre de serie $aut = authorities_collection::get_authority('serie', $id); $details = $aut->format_datas(); break; case 7:// Indexation decimale $aut = authorities_collection::get_authority('indexint', $id); $details = $aut->format_datas(); break; case 8:// titre uniforme $aut = authorities_collection::get_authority('titre_uniforme', $id); $details = $aut->format_datas(); break; case 9://Concept if(!intval($id)){ $id = onto_common_uri::get_id($id); } if(!$id) break; $aut = authorities_collection::get_authority('concept', $id); $details = $aut->format_datas(); break; default: if($field["OPTIONS"][0]["DATA_TYPE"]["0"]["value"]>1000){ // autperso $aut = new authperso_authority($id); $details = $aut->format_datas(); } break; } return $details; } function aff_date_flottante_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 = ""; $ret .= " "; foreach ($values as $value) { // value: type (vers: 0, avant: 1, après: 2, date précise: 3, interval date: 4) // 1ere date // 2eme date // zone commentaire // exemple: 1|||1950|||1960|||commentaires $data = explode("|||", $value); $date_type = (!empty($data[0]) ? $data[0] : ""); $date_begin = (!empty($data[1]) ? $data[1] : ""); $date_end = (!empty($data[2]) ? $data[2] : ""); $comment = (!empty($data[3]) ? $data[3] : ""); if (!$date_begin && !$date_end && !$options["DEFAULT_TODAY"][0]["value"]) { $time = time(); $date_begin = date("Y-m-d", $time); $date_end = date("Y-m-d", $time); } elseif (!$date_begin && !$date_end && $options["DEFAULT_TODAY"][0]["value"]) { $date_begin = ""; $date_end = ""; } else { //$date_begin = date("Y-m-d", $date_begin); //$date_end = date("Y-m-d", $date_end); } $ret .= "
"; if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value'] && !$count) { $ret .= ''; } $ret .= "
"; $count++; } /* if (isset($options['REPEATABLE'][0]['value']) && $options['REPEATABLE'][0]['value']) { $ret .= ''; $ret .= '
'; $ret .= get_custom_dnd_on_add(); $ret .= " "; } */ if ($field['MANDATORY']==1) { $caller = get_form_name(); $check_scripts.="if (document.forms[\"".$caller."\"].elements[\"".$field['NAME']."[]\"].value==\"\") return cancel_submit(\"".sprintf($msg["parperso_field_is_needed"],$field['ALIAS'])."\");\n"; } return $ret; } function aff_date_flottante_empr_search($field, &$check_scripts, $varname) { global $charset; global $msg; $date_begin = ''; $date_end = ''; if (!empty($field['VALUES'][0])) $date_begin = $field['VALUES'][0]; if (!empty($field['VALUES1'][0])) $date_end = $field['VALUES1'][0]; $return = "
"; return $return; } function aff_filter_date_flottante_empr($field, $varname, $multiple) { global $charset; global $msg; $return = "\n"; return $return; } function chk_date_flottante_empr($field, &$check_message) { $name = $field['NAME']; global ${$name}; $val = ${$name}; $value = array(); if (is_array($val)) { foreach ($val as $interval) { if (isset($interval['date_type']) && ($interval['date_begin'] || $interval['date_end'])) { $value[] = $interval['date_type'] . "|||" . $interval['date_begin'] . "|||" . $interval['date_end'] . "|||" . $interval['comment']; } } } $val = $value; $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_flottante_empr($field, $value) { global $charset, $pmb_perso_sep, $msg; $without = ""; $options = $field['OPTIONS'][0]; $values = format_output($field, $value); $return = ""; for ($i = 0; $i < count($values); $i++) { $interval = explode("|||", $values[$i]); if ($return) { $return .= " " . $pmb_perso_sep . " "; } switch ($interval[0]) { case '4': // interval date $return .= $msg['parperso_option_duration_entre']." " . $interval[1] . " ".$msg['parperso_option_duration_et']." " . $interval[2]; break; case '0': // vers case '1': // avant case '2': // après case '3': // date précise $return .= $msg['parperso_option_duration_type'.$interval[0]]; $return .= " " . $interval[1]; break; case '4': // interval date $return .= $msg['parperso_option_duration_entre']." " . $interval[1] . " ".$msg['parperso_option_duration_et']." " . $interval[2]; break; // Pour l'human query de la recherche, BETWEEN, NEAR, =, <=, >= ... case 'BETWEEN': $return .= $msg['parperso_option_duration_entre']." " . $interval[1] . " ".$msg['parperso_option_duration_et']." " . $interval[2]; break; default: if (!empty($interval[1])) $return .= $interval[1]; break; } // Commentaire if (!empty($interval[3])) { $return .= " (" . $interval[3] . ")"; } } return $return; } function get_langue_doc() { global $langue_doc; if (!isset($langue_doc) || !count($langue_doc)) { $langue_doc = marc_list_collection::get_instance('lang'); $langue_doc = $langue_doc->table; } return $langue_doc; }