userid = $userid+0;
$this->fetch_data();
}
public static function get_field_selector($field, $selector) {
global $msg;
//TODO : Tester les deux points finaux du $msg
return
"
".$msg[$field]." :
".$selector."
\n";
}
public static function get_field_radio($field, $selected) {
global $msg;
return
"
".$msg[$field]."
\n
".$msg[39]."
".$msg[40]."
\n";
}
public static function get_field_checkbox($field, $checked) {
global $msg;
return
"
".$msg[$field]."
\n
\n";
}
public static function get_form($id=0, $caller='') {
global $msg, $charset;
global $base_path, $class_path, $include_path;
global $deflt_concept_scheme;
global $pmb_droits_explr_localises;
global $deflt_docs_location;
global $cms_active;
global $pmb_scan_request_activate;
global $pmb_printer_name;
//A verifier : si ce sont bien des globales
global $explr_invisible;
global $explr_visible_unmod;
global $explr_visible_mod;
global $user_lang;
$requete = "SELECT username, nom, prenom, rights, userid, user_lang, ";
$requete .="nb_per_page_search, nb_per_page_select, nb_per_page_gestion, ";
$requete .="param_popup_ticket, param_sounds, ";
$requete .="user_email, user_alert_resamail, user_alert_demandesmail, user_alert_subscribemail, user_alert_serialcircmail, user_alert_suggmail, explr_invisible, explr_visible_mod, explr_visible_unmod, grp_num FROM users WHERE userid='$id' LIMIT 1 ";
$res = pmb_mysql_query($requete);
$nbr = pmb_mysql_num_rows($res);
if ($nbr) {
$usr=pmb_mysql_fetch_object($res);
} else die ('Unknown user');
$requete_param = "SELECT * FROM users WHERE userid='$id' LIMIT 1 ";
$res_param = pmb_mysql_query($requete_param);
$field_values = pmb_mysql_fetch_row( $res_param );
$param_user="
".$msg["1500"]."
\n";
$deflt_user="
".$msg["1501"]."
\n";
$speci_user="";
$deflt3user="";
$value_user="";
$i = 0;
while ($i < pmb_mysql_num_fields($res_param)) {
$field = pmb_mysql_field_name($res_param, $i) ;
$field_deb = substr($field,0,6);
switch ($field_deb) {
case "deflt_" :
if ($field=="deflt_styles") {
$deflt_user_style=static::get_field_selector($field, make_user_style_combo($field_values[$i]));
} elseif ($field=="deflt_docs_location") {
//visibilité des exemplaires
if ($pmb_droits_explr_localises && $usr->explr_visible_mod) $where_clause_explr = "idlocation in (".$usr->explr_visible_mod.") and";
else $where_clause_explr = "";
$selector = gen_liste ("select distinct idlocation, location_libelle from docs_location, docsloc_section where $where_clause_explr num_location=idlocation order by 2 ", "idlocation", "location_libelle", 'form_'.$field, "account_calcule_section(this);", $field_values[$i], "", "","","",0);
$deflt_user .= static::get_field_selector($field, $selector);
//localisation de l'utilisateur pour le calcul de la section
$location_user_section = $field_values[$i];
} elseif ($field=="deflt_collstate_location") {
$selector = gen_liste ("select distinct idlocation, location_libelle from docs_location order by 2 ", "idlocation", "location_libelle", 'form_'.$field, "", $field_values[$i], "", "","0",$msg["all_location"],0);
$deflt_user .= static::get_field_selector($field, $selector);
} elseif ($field=="deflt_resas_location") {
$selector = gen_liste ("select distinct idlocation, location_libelle from docs_location order by 2 ", "idlocation", "location_libelle", 'form_'.$field, "", $field_values[$i], "", "","0",$msg["all_location"],0);
$deflt_user .= static::get_field_selector($field, $selector);
} elseif ($field=="deflt_docs_section") {
// calcul des sections
$selector="";
if (!$location_user_section) $location_user_section = $deflt_docs_location;
if ($pmb_droits_explr_localises && $usr->explr_visible_mod) $where_clause_explr = "where idlocation in (".$usr->explr_visible_mod.")";
else $where_clause_explr = "";
$rqtloc = "SELECT idlocation FROM docs_location $where_clause_explr order by location_libelle";
$resloc = pmb_mysql_query($rqtloc);
while ($loc=pmb_mysql_fetch_object($resloc)) {
$requete = "SELECT idsection, section_libelle FROM docs_section, docsloc_section where idsection=num_section and num_location='$loc->idlocation' order by section_libelle";
$result = pmb_mysql_query($requete);
$nbr_lignes = pmb_mysql_num_rows($result);
if ($nbr_lignes) {
if ($loc->idlocation==$location_user_section ) $selector .= "
\n";
$requete_droits_expl="select idlocation, location_libelle from docs_location order by location_libelle";
$resultat_droits_expl=pmb_mysql_query($requete_droits_expl);
$temp="";
while ($j=pmb_mysql_fetch_array($resultat_droits_expl)) {
$temp.=$j["idlocation"].",";
$visibilite_expl_user.= "
".$j["location_libelle"]." :
\n" ;
}
pmb_mysql_free_result($resultat_droits_expl);
if ((!$explr_invisible)&&(!$explr_visible_unmod)&&(!$explr_visible_mod)) {
$rqt="UPDATE users SET explr_invisible=0,explr_visible_mod=0,explr_visible_unmod='".substr($temp,0,strlen($temp)-1)."' WHERE userid=$id";
@pmb_mysql_query($rqt);
}
$deflt_user .=$visibilite_expl_user;
} //fin visibilité des exemplaires
}
$param_default="