idlocation."\" style=\"display:block\">\r\n";
else $selector .= "
idlocation."\" style=\"display:none\">\r\n";
$selector .= "\r\n";
while($line = mysql_fetch_row($result)) {
$selector .= "\r\n';
}
$selector .= '
';
}
}
$deflt_user.="
".
$msg[$field]." :
\n
"
.$selector.
"
\n";
} elseif ($field=="deflt_upload_repertoire") {
$selector = "";
$req = "select repertoire_id, repertoire_nom from upload_repertoire";
$res = mysql_query($req, $dbh);
$selector .= "
";
$selector .= "";
$selector .= "".$msg[upload_repertoire_sql]." ";
while(($rep = mysql_fetch_object($res))){
$selector .= "repertoire_id) ? 'SELECTED' : '') . ">";
$selector .= htmlentities($rep->repertoire_nom,ENT_QUOTES,$charset)." ";
}
$selector .= "
";
$deflt_user.="
".$msg[$field]." :
".$selector."
";
} elseif($field=="deflt_import_thesaurus"){
$requete="select * from thesaurus order by 2";
$resultat_liste=mysql_query($requete,$dbh);
$nb_liste=mysql_num_rows($resultat_liste);
if ($nb_liste==0) {
$deflt_user.="" ;
} else {
$deflt_user.="
".$msg[$field]." :
\n
";
$j=0;
while ($j<$nb_liste) {
$liste_values = mysql_fetch_row ( $resultat_liste );
$deflt_user.="".$liste_values[1]." \n" ;
$j++;
}
$deflt_user.="
\n" ;
}
} elseif ($field=="deflt_short_loan_activate") {
$deflt_user.="
\n" ;
} elseif ($field=="deflt_cashdesk"){
$requete="select * from cashdesk order by cashdesk_name";
$resultat_liste=mysql_query($requete,$dbh);
$nb_liste=mysql_num_rows($resultat_liste);
if ($nb_liste==0) {
$deflt_user.="" ;
} else {
$deflt_user.="
".$msg[$field]." :
\n
";
$j=0;
while ($j<$nb_liste) {
$liste_values = mysql_fetch_object( $resultat_liste );
$deflt_user.="cashdesk_id."\" " ;
if ($field_values[$i]==$liste_values->cashdesk_id) {
$deflt_user.="selected" ;
}
$deflt_user.=">".htmlentities($liste_values->cashdesk_name,ENT_QUOTES,$charset)." \n" ;
$j++;
}
$deflt_user.="
\n" ;
}
} else {
$deflt_table = substr($field,6);
if($deflt_table == "integration_notice_statut") $deflt_table= "notice_statut";
$requete="select * from ".$deflt_table." order by 2";
$resultat_liste=mysql_query($requete,$dbh);
$nb_liste=mysql_num_rows($resultat_liste);
if ($nb_liste==0) {
$deflt_user.="" ;
} else {
$deflt_user.="
".
$msg[$field]." :
\n";
$deflt_user.= "
";
$j=0;
while ($j<$nb_liste) {
$liste_values = mysql_fetch_row ( $resultat_liste );
$deflt_user.="".$liste_values[1]." \n" ;
$j++;
}
$deflt_user.="
\n" ;
}
} // fin else
break;
case "param_" :
if ($field=="param_allloc") {
$param_user_allloc="
\n" ;
} else {
$param_user.="
" ;
$param_user.=" $msg[$field]
" ;
}
break ;
case "value_" :
switch ($field) {
case "value_deflt_fonction" :
$flist=new marc_list('function');
$f=$flist->table[$field_values[$i]];
$value_user.="
";
break;
case "value_deflt_lang" :
$llist=new marc_list('lang');
$l=$llist->table[$field_values[$i]];
$value_user.="
";
break;
case "value_deflt_relation" :
case "value_deflt_relation_serial" :
case "value_deflt_relation_bulletin" :
case "value_deflt_relation_analysis" :
$value_user.="
$msg[$field] :
\n
";
$liste_type_relation_down=new marc_list("relationtypedown");
$liste_type_relation_up=new marc_list("relationtypeup");
$liste_type_relation_both=array();
foreach($liste_type_relation_up->table as $key_up=>$val_up){
foreach($liste_type_relation_down->table as $key_down=>$val_down){
if($val_up==$val_down){
$liste_type_relation_both[$key_down]=$val_down;
unset($liste_type_relation_down->table[$key_down]);
unset($liste_type_relation_up->table[$key_up]);
}
}
}
$value_user.="
";
foreach($liste_type_relation_up->table as $key=>$val){
if($key.'-up'==$field_values[$i]){
$value_user.=''.$val.' ';
}else{
$value_user.=''.$val.' ';
}
}
$value_user.="
";
foreach($liste_type_relation_down->table as $key=>$val){
if($key.'-down'==$field_values[$i]){
$value_user.=''.$val.' ';
}else{
$value_user.=''.$val.' ';
}
}
$value_user.="
";
foreach($liste_type_relation_both as $key=>$val){
if($key.'-down'==$field_values[$i]){
$value_user.=''.$val.' ';
}else{
$value_user.=''.$val.' ';
}
}
$value_user.="
";
$value_user.="
";
break;
default :
$value_user.="
";
break;
}
break ;
case "deflt2" :
if ($field=="deflt2docs_location") {
// localisation des lecteurs
$deflt_table = substr($field,6);
$requete="select * from ".$deflt_table." order by 2";
$resultat_liste=mysql_query($requete,$dbh);
$nb_liste=mysql_num_rows($resultat_liste);
if ($nb_liste==0) {
$deflt_user.="" ;
} else {
$deflt_user.="
".
$msg[$field]." :
\n";
$deflt_user.= "
";
$j=0;
while ($j<$nb_liste) {
$liste_values = mysql_fetch_row ( $resultat_liste );
$deflt_user.="".$liste_values[1]." \n" ;
$j++;
}
$deflt_user.="
!!param_allloc!!
\n" ;
}
} else {
$deflt_table = substr($field,6);
$requete="select * from ".$deflt_table." order by 2 ";
$resultat_liste=mysql_query($requete,$dbh);
$nb_liste=mysql_numrows($resultat_liste);
if ($nb_liste==0) {
$deflt_user.="" ;
} else {
$deflt_user.="
".
$msg[$field]." :
\n";
$deflt_user.= "
";
$j=0;
while ($j<$nb_liste) {
$liste_values = mysql_fetch_row ( $resultat_liste );
$deflt_user.="".$liste_values[1]." \n" ;
$j++;
}
$deflt_user.="
\n" ;
}
}
break;
case "xmlta_" :
switch($field) {
case "xmlta_indexation_lang" :
$langues = new XMLlist("$include_path/messages/languages.xml");
$langues->analyser();
$clang = $langues->table;
$combo = "
";
if(!$field_values[$i]) $combo .= "-- ";
else $combo .= "-- ";
while(list($cle, $value) = each($clang)) {
// arabe seulement si on est en utf-8
if (($charset != 'utf-8' and $user_lang != 'ar') or ($charset == 'utf-8')) {
if(strcmp($cle, $field_values[$i]) != 0) $combo .= "$value ($cle) ";
else $combo .= "$value ($cle) ";
}
}
$combo .= " ";
$deflt_user.="
".
$msg[$field]." :
\n";
$deflt_user.= "
$combo
\n" ;
break;
case "xmlta_doctype_serial" :
$deflt_user.="
".
$msg[$field]." :
\n";
$deflt_user.= "
";
$select_doc = new marc_select("doctype", "form_".$field, $field_values[$i], "");
$deflt_user.= $select_doc->display ;
$deflt_user.="
\n" ;
break;
case "xmlta_doctype_bulletin" :
case "xmlta_doctype_analysis" :
$deflt_user.="
".
$msg[$field]." :
\n";
$deflt_user.= "
";
$select_doc = new marc_select("doctype", "form_".$field, $field_values[$i], "","0",$msg[$field."_parent"]);
$deflt_user.= $select_doc->display ;
$deflt_user.="
\n" ;
break;
default :
$deflt_table = substr($field,6);
$deflt_user.="
".
$msg[$field]." :
\n";
$deflt_user.= "
";
$select_doc = new marc_select("$deflt_table", "form_".$field, $field_values[$i], "");
$deflt_user.= $select_doc->display ;
$deflt_user.="
\n" ;
break;
}
case "deflt3" :
$q='';
$t=array();
switch($field) {
case "deflt3bibli":
$q="select 0,'".addslashes($msg['deflt3none'])."' union ";
$q.="select id_entite, raison_sociale from entites where type_entite='1' order by 2 ";
break;
case "deflt3exercice":
$q="select 0,'".addslashes($msg['deflt3none'])."' union ";
$q.="select id_exercice, libelle from exercices order by 2 ";
break;
case "deflt3rubrique":
$q="select 0,'".addslashes($msg['deflt3none'])."' union ";
$q.="select id_rubrique, concat(budgets.libelle,':',rubriques.libelle) from rubriques join budgets on num_budget=id_budget order by 2 ";
break;
case "deflt3dev_statut":
$t=actes::getStatelist(TYP_ACT_DEV);
break;
case "deflt3cde_statut":
$t=actes::getStatelist(TYP_ACT_CDE);
break;
case "deflt3liv_statut":
$t=actes::getStatelist(TYP_ACT_LIV);
break;
case "deflt3fac_statut":
$t=actes::getStatelist(TYP_ACT_FAC);
break;
case "deflt3sug_statut":
$m=new suggestions_map();
$t=$m->getStateList();
break;
case 'deflt3lgstatcde':
case 'deflt3lgstatdev':
$q=lgstat::getList('QUERY');
break;
case 'deflt3receptsugstat':
$m=new suggestions_map();
$t=$m->getStateList('ORDERED',TRUE);
break;
}
if($q) {
$r=mysql_query($q, $dbh) or die ("
".mysql_error()."
".$q."
");
$nb=mysql_num_rows($r);
while($row=mysql_fetch_row($r)) {
$t[$row[0]]=$row[1];
}
}
if (count($t)) {
$deflt3user.="
".$msg[$field]." :
\n";
$deflt3user.= "
";
foreach($t as $k=>$v) {
$deflt3user.="".htmlentities($v, ENT_QUOTES, $charset)." \n" ;
}
$deflt3user.="
\n";
}
break;
case "speci_" :
$speci_func = substr($field, 6);
eval('$speci_user.= get_'.$speci_func.'($PMBuserid, $field_values, $i, \'account_form\');');
break;
default :
break ;
}
$i++;
}
$param_default="
$param_user
".str_replace("!!param_allloc!!",$param_user_allloc,$deflt_user)."
$value_user";
if ($speci_user || $deflt3user) {
$param_default.= "
";
$param_default.=$deflt3user;
$param_default.=$speci_user;
$param_default.= "
";
}
$account_form = str_replace('!!all_user_param!!', $param_default, $account_form);
// fin gestion des paramètres personalisés du user
$account_form = str_replace('!!combo_user_style!!', make_user_style_combo($stylesheet), $account_form);
$account_form = str_replace('!!combo_user_lang!!', make_user_lang_combo($user_params->user_lang), $account_form);
$account_form = str_replace('!!nb_per_page_search!!', $user_params->nb_per_page_search, $account_form);
$account_form = str_replace('!!nb_per_page_select!!', $user_params->nb_per_page_select, $account_form);
$account_form = str_replace('!!nb_per_page_gestion!!', $user_params->nb_per_page_gestion, $account_form);
print $account_form;
} else {
// code de mise à jour
// constitution des variables MySQL
// mise à jour de la date d'update
$names[] = 'last_updated_dt';
$values[] = "'".today()."'";
$names[] = 'user_lang';
$values[] = "'$user_lang'";
if ($form_pwd) {
$names[] = 'pwd';
$values[] = "password('$form_pwd')";
$names[] = 'user_digest';
$values[]= "'".md5(SESSlogin.":".md5($pmb_url_base).":".$form_pwd)."'";
}
if($form_nb_per_page_search >= 1) {
$names[] = 'nb_per_page_search';
$values[] = "'$form_nb_per_page_search'";
}
if($form_nb_per_page_select >= 1) {
$names[] = 'nb_per_page_select';
$values[] = "'$form_nb_per_page_select'";
}
if($form_nb_per_page_gestion >= 1) {
$names[] = 'nb_per_page_gestion';
$values[] = "'$form_nb_per_page_gestion'";
}
if(strcmp($form_style, $stylesheet)) {
$names[] .= 'deflt_styles';
$values[] .= "'$form_style'";
}
/* insérer ici la maj des param et deflt */
//maj thesaurus par defaut en session
if ($form_deflt_thesaurus) thesaurus::setSessionThesaurusId($form_deflt_thesaurus);
$requete_param = "SELECT * FROM users WHERE userid='$PMBuserid' LIMIT 1 ";
$res_param = mysql_query($requete_param, $dbh);
$field_values = mysql_fetch_row ( $res_param );
$i = 0;
while ($i < mysql_num_fields($res_param)) {
$field = mysql_field_name($res_param, $i) ;
$field_deb = substr($field,0,6);
switch ($field_deb) {
case "deflt_" :
if ($field == "deflt_styles") {
$dummy[$i+8]=$field."='".$form_style."'";
} elseif ($field == "deflt_docs_section") {
$formlocid="f_ex_section".$form_deflt_docs_location ;
$dummy[$i+8]=$field."='".$$formlocid."'";
} else {
$var_form = "form_".$field;
$dummy[$i+8]=$field."='".$$var_form."'";
}
break;
case "deflt2" :
$var_form = "form_".$field;
$dummy[$i+8]=$field."='".$$var_form."'";
break ;
case "param_" :
$var_form = "form_".$field;
$dummy[$i+8]=$field."='".$$var_form."'";
break ;
case "value_" :
$var_form = "form_".$field;
$dummy[$i+8]=$field."='".$$var_form."'";
break ;
case "xmlta_" :
$var_form = "form_".$field;
$dummy[$i+8]=$field."='".$$var_form."'";
break ;
case "deflt3" :
$var_form = "form_".$field;
$dummy[$i+8]=$field."='".$$var_form."'";
break ;
case "speci_" :
$speci_func = substr($field, 6);
eval('$dummy[$i+8].= set_'.$speci_func.'();');
break;
default :
break ;
}
$i++;
}
if(!empty($dummy)) {
$set = join($dummy, ", ");
$set = " , ".$set ;
} else $set = "" ;
if(sizeof($names) == sizeof($values)) {
while(list($cle, $valeur) = each($names)) {
$n_values ? $n_values .= ", $valeur=${values[$cle]}" : $n_values = "$valeur=${values[$cle]}";
}
$requete = "UPDATE users SET $n_values $set , last_updated_dt=curdate() WHERE username='".SESSlogin."' ";
$result = @mysql_query($requete, $dbh);
if($result) {
$loc = "index.php" ;
if (SESSrights & ADMINISTRATION_AUTH)
$loc="admin.php";
if (SESSrights & EDIT_AUTH)
$loc="edit.php";
if (SESSrights & AUTORITES_AUTH)
$loc="autorites.php";
if (SESSrights & CATALOGAGE_AUTH)
$loc="catalog.php";
if (SESSrights & CIRCULATION_AUTH)
$loc="circ.php";
print $msg["937"]." ";
} else {
// c'est parti en vrac : erreur MySQL
warning($msg["281"], $msg["936"]);
}
}
}
print "
";
print $account_layout_end;
print $extra;
print $extra_info;
print $footer;
mysql_close($dbh);