public static function affiche_formulaire_ajout_user(&$tab_new_user, &$tab_new_jours_an, &$tab_new_solde, $onglet) { $PHP_SELF = $_SERVER['PHP_SELF']; $session = session_id(); $return = ''; // recup du tableau des types de conges (seulement les conges) $tab_type_conges = recup_tableau_types_conges(); // recup du tableau des types de conges exceptionnels (seulement les conges exceptionnels) if ($_SESSION['config']['gestion_conges_exceptionnels']) { $tab_type_conges_exceptionnels = recup_tableau_types_conges_exceptionnels(); } /*********************/ /* Ajout Utilisateur */ /*********************/ // TITRE $return .= '<h1>' . _('admin_new_users_titre') . '</h1>'; $return .= '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=' . $onglet . '" method="POST">'; /****************************************/ // tableau des infos de user $return .= '<table class="table table-hover table-responsive table-condensed table-striped" >'; $return .= '<thead>'; $return .= '<tr>'; if ($_SESSION['config']['export_users_from_ldap']) { $return .= '<th>' . _('divers_nom_maj_1') . ' ' . _('divers_prenom_maj_1') . '</th>'; } else { $return .= '<th>' . _('divers_login_maj_1') . '</th>'; $return .= '<th>' . _('divers_nom_maj_1') . '</th>'; $return .= '<th>' . _('divers_prenom_maj_1') . '</th>'; } $return .= '<th>' . _('divers_quotite_maj_1') . '</th>'; $return .= '<th>' . _('admin_new_users_is_resp') . '</th>'; $return .= '<th>' . _('divers_responsable_maj_1') . '</th>'; $return .= '<th>' . _('admin_new_users_is_admin') . '</th>'; $return .= '<th>' . _('admin_new_users_is_hr') . '</th>'; $return .= '<th>' . _('admin_new_users_see_all') . '</th>'; if (!$_SESSION['config']['export_users_from_ldap']) { $return .= '<th>' . _('admin_users_mail') . '</th>'; } if ($_SESSION['config']['how_to_connect_user'] == "dbconges") { $return .= '<th>' . _('admin_new_users_password') . '</th>'; $return .= '<th>' . _('admin_new_users_password') . '</th>'; } $return .= '</tr></thead><tbody>'; $text_nom = "<input class=\"form-control\" type=\"text\" name=\"new_nom\" size=\"10\" maxlength=\"30\" value=\"" . $tab_new_user['nom'] . "\">"; $text_prenom = "<input class=\"form-control\" type=\"text\" name=\"new_prenom\" size=\"10\" maxlength=\"30\" value=\"" . $tab_new_user['prenom'] . "\">"; if (!isset($tab_new_user['quotite']) || $tab_new_user['quotite'] == "") { $tab_new_user['quotite'] = 100; } $text_quotite = "<input class=\"form-control\" type=\"text\" name=\"new_quotite\" size=\"3\" maxlength=\"3\" value=\"" . $tab_new_user['quotite'] . "\">"; $text_is_resp = "<select class=\"form-control\" name=\"new_is_resp\" ><option value=\"N\">N</option><option value=\"Y\">Y</option></select>"; // PREPARATION DES OPTIONS DU SELECT du resp_login $text_resp_login = "******"form-control\" name=\"new_resp_login\" id=\"resp_login_id\" ><option value=\"no_resp\">" . _('admin_users_no_resp') . "</option>"; if ($_SESSION['config']['admin_see_all'] || $_SESSION['userlogin'] == "admin" || is_hr($_SESSION['userlogin'])) { $sql2 = "SELECT u_login, u_nom, u_prenom FROM conges_users WHERE u_is_resp = \"Y\" ORDER BY u_nom, u_prenom"; } else { $sql2 = "SELECT u_login, u_nom, u_prenom FROM conges_users WHERE u_is_resp = \"Y\" AND u_login=\"" . $_SESSION['userlogin'] . "\" ORDER BY u_nom, u_prenom"; } $ReqLog2 = \includes\SQL::query($sql2); while ($resultat2 = $ReqLog2->fetch_array()) { $current_resp_login = $resultat2["u_login"]; if ($tab_new_user['resp_login'] == $current_resp_login) { $text_resp_login = $text_resp_login . "<option value=\"{$current_resp_login}\" selected>" . $resultat2["u_nom"] . " " . $resultat2["u_prenom"] . "</option>"; } else { $text_resp_login = $text_resp_login . "<option value=\"{$current_resp_login}\">" . $resultat2["u_nom"] . " " . $resultat2["u_prenom"] . "</option>"; } } $text_resp_login = $text_resp_login . "</select>"; $text_is_admin = "<select class=\"form-control\" name=\"new_is_admin\" ><option value=\"N\">N</option><option value=\"Y\">Y</option></select>"; $text_is_hr = "<select class=\"form-control\" name=\"new_is_hr\" ><option value=\"N\">N</option><option value=\"Y\">Y</option></select>"; $text_see_all = "<select class=\"form-control\" name=\"new_see_all\" ><option value=\"N\">N</option><option value=\"Y\">Y</option></select>"; $text_email = "<input class=\"form-control\" type=\"text\" name=\"new_email\" size=\"10\" maxlength=\"99\" value=\"" . $tab_new_user['email'] . "\">"; $text_password1 = "<input class=\"form-control\" type=\"password\" name=\"new_password1\" size=\"10\" maxlength=\"15\" value=\"\" autocomplete=\"off\" >"; $text_password2 = "<input class=\"form-control\" type=\"password\" name=\"new_password2\" size=\"10\" maxlength=\"15\" value=\"\" autocomplete=\"off\" >"; $text_login = "******"form-control\" type=\"text\" name=\"new_login\" size=\"10\" maxlength=\"98\" value=\"" . $tab_new_user['login'] . "\">"; // AFFICHAGE DE LA LIGNE DE SAISIE D'UN NOUVEAU USER $return .= '<tr class="update-line">'; // Aj. D.Chabaud - Université d'Auvergne - Sept. 2005 if ($_SESSION['config']['export_users_from_ldap']) { // Récupération de la liste des utilisateurs via un ldap : // on crée 2 tableaux (1 avec les noms + prénoms, 1 avec les login) // afin de pouvoir construire une liste déroulante dans le formulaire qui suit... $tab_ldap = array(); $tab_login = array(); \admin\Fonctions::recup_users_from_ldap($tab_ldap, $tab_login); // construction de la liste des users récupérés du ldap ... array_multisort($tab_ldap, $tab_login); // on trie les utilisateurs par le nom $lst_users = "<select multiple size=9 name=new_ldap_user[]><option>------------------</option>\n"; $i = 0; foreach ($tab_login as $login) { $lst_users .= "<option value={$tab_login[$i]}>{$tab_ldap[$i]}</option>\n"; $i++; } $lst_users .= "</select>\n"; $return .= '<td>' . $lst_users . '</td>'; } else { $return .= '<td>' . $text_login . '</td>'; $return .= '<td>' . $text_nom . '</td>'; $return .= '<td>' . $text_prenom . '</td>'; } $return .= '<td>' . $text_quotite . '</td>'; $return .= '<td>' . $text_is_resp . '</td>'; $return .= '<td>' . $text_resp_login . '</td>'; $return .= '<td>' . $text_is_admin . '</td>'; $return .= '<td>' . $text_is_hr . '</td>'; $return .= '<td>' . $text_see_all . '</td>'; if (!$_SESSION['config']['export_users_from_ldap']) { $return .= '<td>' . $text_email . '</td>'; } if ($_SESSION['config']['how_to_connect_user'] == "dbconges") { $return .= '<td>' . $text_password1 . '</td>'; $return .= '<td>' . $text_password2 . '</td>'; } $return .= '</tr></tbody></table><br>'; /****************************************/ //tableau des conges annuels et soldes $return .= '<table class="table table-hover table-responsive table-condensed table-striped">'; // ligne de titres $return .= '<thead>'; $return .= '<tr>'; $return .= '<th></th>'; $return .= '<th>' . _('admin_new_users_nb_par_an') . '</th>'; $return .= '<th>' . _('divers_solde') . '</th>'; $return .= '</tr>'; $return .= '</thead>'; $return .= '<tbody>'; $i = true; // ligne de saisie des valeurs foreach ($tab_type_conges as $id_type_cong => $libelle) { $return .= '<tr class="' . ($i ? 'i' : 'p') . '">'; $value_jours_an = isset($tab_new_jours_an[$id_type_cong]) ? $tab_new_jours_an[$id_type_cong] : 0; $value_solde_jours = isset($tab_new_solde[$id_type_cong]) ? $tab_new_solde[$id_type_cong] : 0; $text_jours_an = "<input class=\"form-control\" type=\"text\" name=\"tab_new_jours_an[{$id_type_cong}]\" size=\"5\" maxlength=\"5\" value=\"{$value_jours_an}\">"; $text_solde_jours = "<input class=\"form-control\" type=\"text\" name=\"tab_new_solde[{$id_type_cong}]\" size=\"5\" maxlength=\"5\" value=\"{$value_solde_jours}\">"; $return .= '<td>' . $libelle . '</td>'; $return .= '<td>' . $text_jours_an . '</td>'; $return .= '<td>' . $text_solde_jours . '</td>'; $return .= '</tr>'; $i = !$i; } if ($_SESSION['config']['gestion_conges_exceptionnels']) { foreach ($tab_type_conges_exceptionnels as $id_type_cong => $libelle) { $return .= '<tr class="' . ($i ? 'i' : 'p') . '">'; $value_solde_jours = isset($tab_new_solde[$id_type_cong]) ? $tab_new_solde[$id_type_cong] : 0; $text_jours_an = "<input type=\"hidden\" name=\"tab_new_jours_an[{$id_type_cong}]\" size=\"5\" maxlength=\"5\" value=\"0\"> "; $text_solde_jours = "<input class=\"form-control\" type=\"text\" name=\"tab_new_solde[{$id_type_cong}]\" size=\"5\" maxlength=\"5\" value=\"{$value_solde_jours}\">"; $return .= '<td>' . $libelle . '</td>'; $return .= '<td>' . $text_jours_an . '</td>'; $return .= '<td>' . $text_solde_jours . '</td>'; $return .= '</tr>'; $i = !$i; } } $return .= '</tbody></table><br>'; // saisie de la grille des jours d'absence ARTT ou temps partiel: $return .= \admin\Fonctions::saisie_jours_absence_temps_partiel($tab_new_user['login']); // si gestion des groupes : affichage des groupe pour y affecter le user if ($_SESSION['config']['gestion_groupes']) { $return .= '<br>'; if ($_SESSION['config']['admin_see_all'] || $_SESSION['userlogin'] == "admin" || is_hr($_SESSION['userlogin'])) { $return .= \admin\Fonctions::affiche_tableau_affectation_user_groupes2(""); } else { $return .= \admin\Fonctions::affiche_tableau_affectation_user_groupes2($_SESSION['userlogin']); } } $return .= '<hr>'; $return .= '<input type="hidden" name="saisie_user" value="ok">'; $return .= '<input class="btn btn-success" type="submit" value="' . _('form_submit') . '">'; $return .= '<a class="btn" href="' . $PHP_SELF . '?session=' . $session . '">' . _('form_cancel') . '</a>'; $return .= '</form>'; return $return; }