analyser();
$clang = $langues->table;
reset($clang);
$combo = "";
return $combo;
}
// affichage de la liste lecteurs pour selection
function list_empr($cb, $empr_list, $nav_bar, $nb_total=0, $where_intitule="") {
global $empr_list_tmpl,$empr_search_cle_tmpl;
if ($cb != "") {
if ($nb_total>0) $empr_search_cle_tmpl = str_replace("", "(".$nb_total.")", $empr_search_cle_tmpl);
$empr_search_cle_tmpl = str_replace("!!cle!!", $cb, $empr_search_cle_tmpl);
$empr_search_cle_tmpl = str_replace("!!where_intitule!!", $where_intitule, $empr_search_cle_tmpl);
$empr_list_tmpl = str_replace("!!empr_search_cle_tmpl!!", $empr_search_cle_tmpl, $empr_list_tmpl);
} else {
$empr_list_tmpl = str_replace("!!empr_search_cle_tmpl!!", "", $empr_list_tmpl);
}
$empr_list_tmpl = str_replace("!!list!!", $empr_list, $empr_list_tmpl);
$empr_list_tmpl = str_replace("!!nav_bar!!", $nav_bar, $empr_list_tmpl);
print pmb_bidi($empr_list_tmpl);
}
// form de saisie cb emprunteur
function get_cb($title, $message, $title_form, $form_action, $check=0, $cb_initial="", $creation=0) {
global $empr_cb_tmpl;
global $empr_cb_tmpl_create;
global $script1;
global $script2;
global $deflt2docs_location, $pmb_lecteurs_localises, $empr_location_id, $param_allloc ;
if ($cb_initial===0) $cb_initial="" ;
if ($creation==1) $empr_cb_tmpl = $empr_cb_tmpl_create;
switch ($check) {
case '1':
// script javascript 1 : checke seulement si le champ contient des trucs
$empr_cb_tmpl = str_replace("!!script!!", $script1, $empr_cb_tmpl);
break ;
case '2':
// script javascript 2 : checke si le champ ne contient que de l'alpha
$empr_cb_tmpl = str_replace("!!script!!", $script2, $empr_cb_tmpl);
break ;
case '0':
default:
// aucun test
$empr_cb_tmpl = str_replace("!!script!!", "", $empr_cb_tmpl);
break ;
}
$empr_cb_tmpl = str_replace("!!titre_formulaire!!", $title_form, $empr_cb_tmpl);
$empr_cb_tmpl = str_replace("!!form_action!!", $form_action, $empr_cb_tmpl);
$empr_cb_tmpl = str_replace("!!title!!", $title, $empr_cb_tmpl);
$empr_cb_tmpl = str_replace("!!message!!", $message, $empr_cb_tmpl);
$empr_cb_tmpl = str_replace("!!cb_initial!!", (string)$cb_initial, $empr_cb_tmpl);
if ($pmb_lecteurs_localises) {
if ($empr_location_id) $deflt2docs_location=$empr_location_id;
elseif ($param_allloc) $deflt2docs_location=0;
$empr_cb_tmpl = str_replace("!!restrict_location!!", docs_location::gen_combo_box_empr($deflt2docs_location), $empr_cb_tmpl);
} else
$empr_cb_tmpl = str_replace("!!restrict_location!!", "", $empr_cb_tmpl);
print pmb_bidi($empr_cb_tmpl);
}
// form de saisie cb emprunteur
function get_login_empr_pret($title, $message, $title_form, $form_action, $check=0, $cb_initial="") {
global $login_empr_pret_tmpl;
global $script1;
global $script2;
if ($cb_initial===0) $cb_initial="" ;
$login_empr_pret_tmpl = str_replace("!!titre_formulaire!!", $title_form, $login_empr_pret_tmpl);
$login_empr_pret_tmpl = str_replace("!!form_action!!", $form_action, $login_empr_pret_tmpl);
$login_empr_pret_tmpl = str_replace("!!title!!", $title, $login_empr_pret_tmpl);
$login_empr_pret_tmpl = str_replace("!!message!!", $message, $login_empr_pret_tmpl);
$login_empr_pret_tmpl = str_replace("!!cb_initial!!", (string)$cb_initial, $login_empr_pret_tmpl);
print pmb_bidi($login_empr_pret_tmpl);
}
// affichage du form emprunteurs (gere modif et creation).
function show_empr_form($form_action, $form_cancel, $link, $id, $cb,$duplicate_empr_from_id="") {
global $empr_form;
global $dbh,$msg,$charset;
global $biblio_email;
global $aff_list_empr;
global $deflt2docs_location, $deflt_type_abts;
global $pmb_lecteurs_localises ;
global $pmb_gestion_abonnement,$pmb_gestion_financiere,$empr_abonnement_default_debit;
global $empr_prolong_calc_date_adhes_depassee;
global $database_window_title ;
global $lang;
global $pmb_rfid_activate, $pmb_rfid_serveur_url;
global $pmb_opac_view_activate;
global $camera_tpl, $empr_pics_folder, $empr_pics_url, $deflt_camera_empr, $photo_tpl;
global $base_path;
// si $id est fourni, il s'agit d'une modification. on recupere les donnees dans $link
if($id) {
// modification
echo window_title($database_window_title.$msg[55]);
$entete=$msg[55];
if ($pmb_rfid_activate==1 && $pmb_rfid_serveur_url) {
$script_rfid_encode="if(script_rfid_encode()==false) return false;";
} else $script_rfid_encode='';
$empr_form = str_replace("!!questionrfid!!", $script_rfid_encode, $empr_form);
$requete = "SELECT * FROM empr WHERE id_empr='$id' ";
$res = pmb_mysql_query($requete, $link);
if($res) {
$empr = pmb_mysql_fetch_object($res);
} else {
error_message( $msg[53], $msg[54], 0);
}
if (!$duplicate_empr_from_id) {
$empr_form = str_replace('!!empr_create_script_call!!','',$empr_form);
$empr_form = str_replace('!!empr_create_script_loader!!','',$empr_form);
} else {
if (file_exists($base_path.'/javascript/empr_create_script.js')) {
$empr_form = str_replace('!!empr_create_script_call!!','empr_create_script();',$empr_form);
$empr_form = str_replace('!!empr_create_script_loader!!','',$empr_form);
} else {
$empr_form = str_replace('!!empr_create_script_call!!','',$empr_form);
$empr_form = str_replace('!!empr_create_script_loader!!','',$empr_form);
}
}
} else {
// création
$empr = new stdClass();
$empr->empr_cb = '';
$empr->empr_nom = '';
$empr->empr_prenom = '';
$empr->empr_adr1 = '';
$empr->empr_adr2 = '';
$empr->empr_cp = '';
$empr->empr_ville = '';
$empr->empr_pays = '';
$empr->empr_mail = '';
$empr->empr_tel1 = '';
$empr->empr_sms = '';
$empr->empr_tel2 = '';
$empr->empr_prof = '';
$empr->empr_year = '';
$empr->empr_lang = '';
$empr->empr_login = '';
$empr->empr_msg = '';
$empr->empr_statut = '';
$empr->empr_categ = '';
$empr->empr_codestat = '';
$empr->empr_sexe = '';
$empr->empr_ldap = '';
$empr->empr_location = '';
$entete=$msg[15];
$empr_form = str_replace("!!questionrfid!!", '' , $empr_form);
if (file_exists($base_path.'/javascript/empr_create_script.js')) {
$empr_form = str_replace('!!empr_create_script_call!!','empr_create_script();',$empr_form);
$empr_form = str_replace('!!empr_create_script_loader!!','',$empr_form);
} else {
$empr_form = str_replace('!!empr_create_script_call!!','',$empr_form);
$empr_form = str_replace('!!empr_create_script_loader!!','',$empr_form);
}
}
if ($duplicate_empr_from_id) {
$empr_form = str_replace("!!id!!", "", $empr_form);
$empr_form = str_replace("!!entete!!", $msg["empr_duplicate"], $empr_form);
} else {
$empr_form = str_replace("!!id!!", $id, $empr_form);
$empr_form = str_replace("!!entete!!", $entete, $empr_form);
}
$empr_form = str_replace("!!form_action!!", $form_action, $empr_form);
if($empr_pics_folder) {
if($deflt_camera_empr) {
$camera_tpl = str_replace("!!upload_folder!!", $empr_pics_folder, $camera_tpl);
$empr_form = str_replace("!!camera!!", gen_plus('emr_camera', $msg['empr_photo_capture'], $camera_tpl, 0, "init_camera('" . $empr_pics_folder . "', '" . $empr_pics_url . "', 'f_cb', '!!num_carte!!');"), $empr_form);
} else {
$photo_tpl = str_replace("!!upload_folder!!", $empr_pics_folder, $photo_tpl);
$empr_form = str_replace("!!camera!!", gen_plus('emr_camera', $msg['empr_photo_capture'], $photo_tpl, 0, "init_camera('" . $empr_pics_folder . "', '" . $empr_pics_url . "', 'f_cb', '!!num_carte!!');"), $empr_form);
}
} else {
$empr_form = str_replace("!!camera!!", '', $empr_form);
}
if($empr->empr_cb) { //Si il y a un code lecteur
if (!$duplicate_empr_from_id) $empr_form = str_replace("!!cb!!", $empr->empr_cb, $empr_form);
else $empr_form = str_replace("!!cb!!", $cb, $empr_form);
$date_adhesion = (!$duplicate_empr_from_id ? $empr->empr_date_adhesion : date('Y-m-d'));
$empr_form = str_replace("!!adhesion!!", get_input_date('form_adhesion', 'form_adhesion', $date_adhesion), $empr_form);
if ($duplicate_empr_from_id) {
/* AJOUTER ICI LE CALCUL EN FONCTION DE LA CATEGORIE */
$rqt_empr_categ = "select duree_adhesion from empr_categ where id_categ_empr = ".$empr->empr_categ;
$res_empr_categ = pmb_mysql_query($rqt_empr_categ, $dbh);
$empr_categ = pmb_mysql_fetch_object($res_empr_categ);
//$form_adhesion=preg_replace('/-/', '', $form_adhesion);
$rqt_date = "select date_add('".$date_adhesion."', INTERVAL $empr_categ->duree_adhesion DAY) as date_expiration " ;
$resultatdate=pmb_mysql_query($rqt_date);
$resdate=pmb_mysql_fetch_object($resultatdate);
$empr->empr_date_expiration = $resdate->date_expiration;
}
$empr_form = str_replace("!!expiration!!", get_input_date('form_expiration', 'form_expiration', $empr->empr_date_expiration), $empr_form);
// ajout ici des trucs sur la relance adhésion
$empr_temp = new emprunteur($id, '', FALSE, 0) ;
$aff_relance = "";
if ($empr_temp->adhesion_renouv_proche() || $empr_temp->adhesion_depassee()) {
if ($empr_temp->adhesion_depassee()) $mess_relance = $msg['empr_date_depassee'];
else $mess_relance = $msg['empr_date_renouv_proche'];
$rqt="select duree_adhesion from empr_categ where id_categ_empr='$empr_temp->categ'";
$res_dur_adhesion = pmb_mysql_query($rqt, $dbh);
$row = pmb_mysql_fetch_row($res_dur_adhesion);
$nb_jour_adhesion_categ = $row[0];
if ($empr_prolong_calc_date_adhes_depassee && $empr_temp->adhesion_depassee()) {
$rqt_date = "select date_add(curdate(),INTERVAL 1 DAY) as nouv_date_debut,
date_add(curdate(),INTERVAL $nb_jour_adhesion_categ DAY) as nouv_date_fin ";
} else {
$rqt_date = "select date_add('$empr_temp->date_expiration',INTERVAL 1 DAY) as nouv_date_debut,
date_add('$empr_temp->date_expiration',INTERVAL $nb_jour_adhesion_categ DAY) as nouv_date_fin ";
}
$resultatdate=pmb_mysql_query($rqt_date) or die ("
$rqt_date ".pmb_mysql_error());
$resdate=pmb_mysql_fetch_object($resultatdate);
$nouv_date_debut = $resdate->nouv_date_debut ;
$nouv_date_fin = $resdate->nouv_date_fin ;
$myDate = strtotime($nouv_date_fin);
$nouv_date_debut_formatee = formatdate($nouv_date_debut) ;
$nouv_date_fin_formatee = formatdate($nouv_date_fin) ;
// on conserve la date d'adhésion initiale
if (is_firefox_min_57_version()) {
$action_prolonger = "dijit.byId('form_expiration').set('value','".$nouv_date_fin."');this.form.is_subscription_extended.value = 1;";
} else {
$action_prolonger = "document.getElementById('form_expiration').value='".$nouv_date_fin."';this.form.is_subscription_extended.value = 1;";
}
//$action_prolonger .= "let myDate = new Date(".$myDate."*1000);";
// $action_prolonger .= "updateSpan( myDate, 'form_expiration')";
$action_relance_courrier = "openPopUp('./pdf.php?pdfdoc=lettre_relance_adhesion&id_empr=$id', 'lettre'); return(false) ";
$aff_relance = "
$mess_relance
";
if ($empr_temp->mail && $biblio_email ) {
$action_relance_mail = "if (confirm('".$msg["mail_retard_confirm"]."')) {openPopUp('./mail.php?type_mail=mail_relance_adhesion&id_empr=$id', 'mail'); } return(false) ";
$aff_relance .= " ";
}
$aff_relance .= "
";
if (($pmb_gestion_financiere)&&($pmb_gestion_abonnement)) {
$aff_relance.=" ";
$aff_relance.=" ";
if ($pmb_gestion_abonnement==2) $aff_relance.="";
$aff_relance.="
";
}
}
$empr_form = str_replace("!!adhesion_proche_depassee!!", $aff_relance, $empr_form);
//Liste des types d'abonnement
$list_type_abt="";
if (($pmb_gestion_abonnement==2)&&($pmb_gestion_financiere)) {
$requete="select * from type_abts order by type_abt_libelle ";
$resultat_abt=pmb_mysql_query($requete);
$user_loc=$deflt2docs_location;
$t_type_abt=array();
while ($res_abt=pmb_mysql_fetch_object($resultat_abt)) {
$locs=explode(",",$res_abt->localisations);
$as=array_search($user_loc,$locs);
if ((($as!==false)&&($as!==null))||(!$res_abt->localisations)) {
$t_type_abt[]=$res_abt;
}
}
if (count($t_type_abt)) {
$list_type_abt="\n
\n\n
";
}
}
$empr_form = str_replace("!!typ_abonnement!!",$list_type_abt,$empr_form);
} else { // création de lecteur
$empr->empr_date_adhesion = today() ;
$empr_form = str_replace('!!cb!!',$cb,$empr_form);
$adhesion = get_input_date('form_adhesion', 'form_adhesion', $empr->empr_date_adhesion, false);
$empr_form = str_replace("!!adhesion!!", $adhesion, $empr_form);
$empr_form = str_replace("!!adhesion_proche_depassee!!", "", $empr_form);
$empr_form = str_replace("!!expiration!!", "", $empr_form);
//Liste des types d'abonnement
$list_type_abt="";
if (($pmb_gestion_abonnement==2)&&($pmb_gestion_financiere)) {
$requete="select * from type_abts";
$resultat_abt=pmb_mysql_query($requete);
$user_loc=$deflt2docs_location;
$t_type_abt=array();
while ($res_abt=pmb_mysql_fetch_object($resultat_abt)) {
$locs=explode(",",$res_abt->localisations);
$as=array_search($user_loc,$locs);
if ((($as!==false)&&($as!==null))||(!$res_abt->localisations)) {
$t_type_abt[]=$res_abt;
}
}
if (count($t_type_abt)) {
$empr->type_abt = $deflt_type_abts;
$list_type_abt="\n
\n\n
";
}
}
$empr_form = str_replace("!!typ_abonnement!!",$list_type_abt,$empr_form);
}
$empr_form = str_replace("!!nom!!", htmlentities($empr->empr_nom ,ENT_QUOTES, $charset), $empr_form);
$empr_form = str_replace("!!prenom!!", htmlentities($empr->empr_prenom ,ENT_QUOTES, $charset), $empr_form);
$empr_form = str_replace("!!adr1!!", htmlentities($empr->empr_adr1 ,ENT_QUOTES, $charset), $empr_form);
$empr_form = str_replace("!!adr2!!", htmlentities($empr->empr_adr2 ,ENT_QUOTES, $charset), $empr_form);
$empr_form = str_replace("!!cp!!", htmlentities($empr->empr_cp ,ENT_QUOTES, $charset), $empr_form);
$empr_form = str_replace("!!ville!!", htmlentities($empr->empr_ville ,ENT_QUOTES, $charset), $empr_form);
$empr_form = str_replace("!!pays!!", htmlentities($empr->empr_pays ,ENT_QUOTES, $charset), $empr_form);
$empr_form = str_replace("!!mail!!", htmlentities($empr->empr_mail ,ENT_QUOTES, $charset), $empr_form);
$empr_form = str_replace("!!tel1!!", htmlentities($empr->empr_tel1 ,ENT_QUOTES, $charset), $empr_form);
if(!$empr->empr_sms) $empr_sms_chk=''; else $empr_sms_chk="checked='checked'";
$empr_form = str_replace('!!sms!!', $empr_sms_chk, $empr_form);
$empr_form = str_replace("!!tel2!!", htmlentities($empr->empr_tel2 ,ENT_QUOTES, $charset), $empr_form);
$empr_form = str_replace("!!prof!!", htmlentities($empr->empr_prof ,ENT_QUOTES, $charset), $empr_form);
if ($empr->empr_year != 0) $empr_form = str_replace("!!year!!", htmlentities($empr->empr_year ,ENT_QUOTES, $charset), $empr_form);
else $empr_form = str_replace("!!year!!", "", $empr_form);
if (!$empr->empr_lang) $empr->empr_lang=$lang;
$empr_form = str_replace('!!combo_empr_lang!!', make_empr_lang_combo($empr->empr_lang), $empr_form);
if (!$duplicate_empr_from_id) {
$empr_form = str_replace('!!empr_login!!', $empr->empr_login, $empr_form);
$empr_form = str_replace("!!empr_msg!!", htmlentities($empr->empr_msg ,ENT_QUOTES, $charset), $empr_form);
} else {
$empr_form = str_replace('!!empr_login!!', "", $empr_form);
$empr_form = str_replace("!!empr_msg!!", "", $empr_form);
}
//Si il n'y a pas de statut, categ, codestat on prend celui définit pour l'utilisateur
if(!$empr->empr_statut){
global $deflt_empr_statut;
$empr->empr_statut=$deflt_empr_statut;
}
if(!$empr->empr_categ){
global $deflt_empr_categ;
$empr->empr_categ=$deflt_empr_categ;
}
if(!$empr->empr_codestat){
global $deflt_empr_codestat;
$empr->empr_codestat=$deflt_empr_codestat;
}
// on récupère le select catégorie
$requete = "SELECT id_categ_empr, libelle, duree_adhesion FROM empr_categ ORDER BY libelle ";
$res = pmb_mysql_query($requete, $link);
$nbr_lignes = pmb_mysql_num_rows($res);
$categ_content='';
$empr_grille_categ="';
$empr_form = str_replace("!!categ!!", $categ_content, $empr_form);
// Ajout des categories et localisations pour edition des grilles
$empr_form = str_replace("", $empr_grille_categ, $empr_form);
if ($pmb_lecteurs_localises) {
$empr_grille_location = docs_location::get_html_select(array(0),array('id'=>0,'msg'=>$msg['all_locations_empr']),array('id'=>'empr_grille_location','class'=>'saisie-20em','style'=>'display:none;', 'onChange'=>'get_pos(); expandAll(); if (inedit) move_parse_dom(relative); else initIt();'));
} else {
$empr_grille_location="";
}
$empr_form = str_replace("", $empr_grille_location, $empr_form);
$requete = "SELECT id_categ_empr, libelle, duree_adhesion FROM empr_categ ORDER BY libelle ";
$res = pmb_mysql_query($requete, $link);
$grille_categ="";
$grille_categ.="";
}
$empr_form = str_replace("!!categ!!", $categ_content, $empr_form);
// on récupère le select statut
$requete = "SELECT idstatut, statut_libelle FROM empr_statut ORDER BY statut_libelle ";
$res = pmb_mysql_query($requete, $link);
$nbr_lignes = pmb_mysql_num_rows($res);
$statut_content = "";
for($i=0; $i < $nbr_lignes; $i++) {
$row = pmb_mysql_fetch_row($res);
$statut_content .= "";
}
$empr_form = str_replace("!!statut!!", $statut_content, $empr_form);
// et le select code stat
// on récupère le select cod stat
$requete = "SELECT idcode, libelle FROM empr_codestat ORDER BY libelle ";
$res = pmb_mysql_query($requete, $link);
$nbr_lignes = pmb_mysql_num_rows($res);
$cstat_content = "";
for($i=0; $i < $nbr_lignes; $i++) {
$row = pmb_mysql_fetch_row($res);
$cstat_content .= "";
}
// mise à jour du sexe
switch($empr->empr_sexe) {
case 1:
$empr_form = str_replace("sexe_select_1", 'selected', $empr_form);
break;
case 2:
$empr_form = str_replace("sexe_select_2", 'selected', $empr_form);
break;
default:
$empr_form = str_replace("sexe_select_0", 'selected', $empr_form);
break;
}
$empr_form = preg_replace("/sexe_select_[0-2]/m", '', $empr_form);
$empr_form = str_replace("!!cstat!!", $cstat_content, $empr_form);
$empr_form = str_replace("!!groupe_ajout!!", get_groups_form($id), $empr_form);
$empr_form = str_replace('!!cancel!!',$form_cancel,$empr_form);
// ldap MaxMan
if ($empr->empr_ldap){
$form_ldap="checked" ;
}else{
$form_ldap="";
}
//$empr_form = str_replace('!!empr_password!!', $empr_password, $empr_form);
$empr_form = str_replace("!!ldap!!",$form_ldap,$empr_form);
$empr_form = str_replace('!!empr_password!!', '', $empr_form);
if (!$empr->empr_location) $empr->empr_location=$deflt2docs_location ;
if ($pmb_lecteurs_localises) {
$loc = "
!!localisation!!
";
//$loc = str_replace('!!localisation!!', docs_location::gen_combo_box_empr($empr->empr_location, 0), $loc);
$loc = str_replace('!!localisation!!', docs_location::get_html_select(array($empr->empr_location),array(),array('id'=>'empr_location_id','name'=>'empr_location_id')), $loc);
} else {
$loc = "" ;
$empr_form = str_replace('', $loc, $empr_form);
}
$empr_form = str_replace('', $loc, $empr_form);
if($pmb_opac_view_activate ){
$opac_view_tpl = "
!!opac_view!!
";
$opac_view = new opac_view(0,$id);
$opac_view_tpl=str_replace("!!opac_view!!",gen_plus("opac_view",$msg["empr_form_opac_view"],$opac_view->do_sel_list(),0),$opac_view_tpl);
} else {
$opac_view_tpl = "";
}
$empr_form = str_replace('', $opac_view_tpl, $empr_form);
//Champs persos
$p_perso=new parametres_perso("empr");
$perso_=$p_perso->show_editable_fields($id);
if (isset($perso_["FIELDS"]) && count($perso_["FIELDS"])) $perso = "" ;
else $perso="";
$class="colonne2";
if(isset($perso_["FIELDS"])) {
for ($i=0; $i";
$perso.="".$p["COMMENT_DISPLAY"]."
\n";
$perso.="";
$perso.=$p["AFF"]."
";
$perso.="";
if ($class=="colonne2") $class="colonne_suite"; else $class="colonne2";
}
}
if ($class=="colonne_suite") $perso.="
";
$perso.=$perso_["CHECK_SCRIPTS"];
$empr_form=str_replace("!!champs_perso!!",$perso,$empr_form);
$empr_form = str_replace('!!empr_notice_override!!',get_rights_form($id),$empr_form);
print pmb_bidi($empr_form);
}
//creation formulaire surcharge des droits d'accès emprunteurs-notices
function get_rights_form($empr_id=0) {
global $dbh,$charset;
global $gestion_acces_active, $gestion_acces_empr_notice, $gestion_acces_empr_docnum;
global $gestion_acces_empr_contribution_area, $gestion_acces_empr_contribution_scenario;
global $gestion_acces_contribution_moderator_empr;
global $gestion_acces_empr_cms_section, $gestion_acces_empr_cms_article;
global $class_path;
$form = '';
if (!$empr_id) return $form;
if ($gestion_acces_active==1) {
require_once($class_path.'/acces.class.php');
$ac = new acces();
$acces_list = array(
2 => $gestion_acces_empr_notice,
3 => $gestion_acces_empr_docnum,
4 => $gestion_acces_empr_contribution_area,
5 => $gestion_acces_empr_contribution_scenario,
6 => $gestion_acces_contribution_moderator_empr,
7 => $gestion_acces_empr_cms_section,
8 => $gestion_acces_empr_cms_article,
);
foreach ($acces_list as $index => $acces_active) {
if ($acces_active == 1) {
$dom = $ac->setDomain($index);
//Role utilisateur
$cur_usr_prf=$dom->getUserProfile($empr_id);
//Recuperation des droits generiques du domaine pour avoir les droits utilisateurs globaux
$global_rights = $dom->getDomainRights(0,0);
//Recuperation profils ressources
$t_r = array();
$t_r[0] = $dom->getComment('res_prf_def_lib'); //profile ressource par defaut
$q_r = $dom->loadUsedResourceProfiles();
$r_r = pmb_mysql_query($q_r, $dbh);
if (pmb_mysql_num_rows($r_r)) {
while(($row = pmb_mysql_fetch_object($r_r))) {
$t_r[$row->prf_id] = $row->prf_name;
}
}
//Recuperation des controles dependants de l'utilisateur
$t_ctl=$dom->getControls(0);
//recuperation des droits du domaine pour un utilisateur
$t_rights = $dom->get_user_rights($empr_id, $cur_usr_prf);
$r_form = "
";
if (($global_rights & 512)) {
$r_form = "
";
}
$r_form.= "
";
if (count($t_r)) {
$h_tab = "";
foreach($t_r as $k=>$v) {
$h_tab.= "".htmlentities($v, ENT_QUOTES, $charset)." | ";
}
$h_tab.="
";
$c_tab = '';
foreach($t_r as $k=>$v) {
$c_tab.= " | ";
$t_rows = "";
foreach($t_ctl as $k2=>$v2) {
$t_rows.="
|
".htmlentities($v2, ENT_QUOTES, $charset)." |
";
} else {
$t_rows.="/>
|
";
}
}
$c_tab = str_replace('', $t_rows, $c_tab);
}
$c_tab.= "";
}
$h_tab = str_replace('', $c_tab, $h_tab);;
$r_form=str_replace('', $h_tab, $r_form);
$form.= $r_form;
}
}
}
return $form;
}
function get_groups_form($empr_id=0) {
global $msg;
$empr_id += 0;
$query = "SELECT id_groupe, libelle_groupe, ifnull(empr_id,0) as inscription FROM groupe join empr_groupe on (id_groupe=groupe_id and empr_id=".$empr_id.") ORDER BY libelle_groupe";
$result = pmb_mysql_query($query);
$groups = array();
if(pmb_mysql_num_rows($result)) {
while ($row = pmb_mysql_fetch_object($result)) {
$groups[] = array('id' => $row->id_groupe, 'name' => $row->libelle_groupe);
}
}
return templates::get_display_elements_completion_field($groups, 'empr_form', 'form_groups', 'group_id', 'groups');
// return gen_liste_multiple ($query, "id_groupe", "libelle_groupe", "inscription", "form_groups[]", "", $empr_id, 0, $msg['empr_form_aucungroupe'], 0,$msg['empr_form_nogroupe'], 5) ;
}