function modifier($u_login, $tab_checkbox_sem_imp, $tab_checkbox_sem_p, $onglet, $DEBUG = FALSE) { $PHP_SELF = $_SERVER['PHP_SELF']; $session = session_id(); // recup du tableau des types de conges (seulement les conges) $tab_type_conges = recup_tableau_types_conges($DEBUG); // recup du tableau des types de conges (seulement les conges) if ($_SESSION['config']['gestion_conges_exceptionnels']) { $tab_type_conges_exceptionnels = recup_tableau_types_conges_exceptionnels($DEBUG); } // Récupération des informations $tab_user = recup_infos_du_user($u_login, "", $DEBUG); /********************/ /* Etat utilisateur */ /********************/ echo '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=' . $onglet . '&u_login_to_update=' . $u_login . '" method="POST">'; // AFFICHAGE TABLEAU DES INFOS echo "<table class=\"table table-hover table-responsive table-condensed table-striped\">\n"; echo "<thead>\n"; echo "<tr>\n"; echo "<th>" . _('divers_nom_maj_1') . "</th>\n"; echo "<th>" . _('divers_prenom_maj_1') . "</th>\n"; echo "<th>" . _('divers_login_maj_1') . "</th>\n"; echo "<th>" . _('divers_quotite_maj_1') . "</th>\n"; echo "<th>" . _('admin_users_is_resp') . "</th>\n"; echo "<th>" . _('admin_users_resp_login') . "</th>\n"; echo "<th>" . _('admin_users_is_admin') . "</th>\n"; echo "<th>" . _('admin_users_is_hr') . "</th>\n"; echo "<th>" . _('admin_users_is_active') . "</th>\n"; echo "<th>" . _('admin_users_see_all') . "</th>\n"; if ($_SESSION['config']['where_to_find_user_email'] == "dbconges") { echo "<th>" . _('admin_users_mail') . "</th>\n"; } echo "</tr>\n"; echo "</thead>\n"; echo "<tbody>\n"; // AFICHAGE DE LA LIGNE DES VALEURS ACTUELLES A MOFIDIER echo "<tr>\n"; echo "<td>" . $tab_user['nom'] . "</td>\n"; echo "<td>" . $tab_user['prenom'] . "</td>\n"; echo "<td>" . $tab_user['login'] . "</td>\n"; echo "<td>" . $tab_user['quotite'] . "</td>\n"; echo "<td>" . $tab_user['is_resp'] . "</td>\n"; echo "<td>" . $tab_user['resp_login'] . "</td>\n"; echo "<td>" . $tab_user['is_admin'] . "</td>\n"; echo "<td>" . $tab_user['is_hr'] . "</td>\n"; echo "<td>" . $tab_user['is_active'] . "</td>\n"; echo "<td>" . $tab_user['see_all'] . "</td>\n"; if ($_SESSION['config']['where_to_find_user_email'] == "dbconges") { echo "<td>" . $tab_user['email'] . "</td>\n"; } echo "</tr>\n"; // contruction des champs de saisie $text_login = "******"form-control\" type=\"text\" name=\"new_login\" size=\"10\" maxlength=\"98\" value=\"" . $tab_user['login'] . "\">"; $text_nom = "<input class=\"form-control\" type=\"text\" name=\"new_nom\" size=\"10\" maxlength=\"30\" value=\"" . $tab_user['nom'] . "\">"; $text_prenom = "<input class=\"form-control\" type=\"text\" name=\"new_prenom\" size=\"10\" maxlength=\"30\" value=\"" . $tab_user['prenom'] . "\">"; $text_quotite = "<input class=\"form-control\" type=\"text\" name=\"new_quotite\" size=\"3\" maxlength=\"3\" value=\"" . $tab_user['quotite'] . "\">"; if ($tab_user['is_resp'] == "Y") { $text_is_resp = "<select class=\"form-control\" name=\"new_is_resp\" id=\"is_resp_id\" ><option value=\"Y\">Y</option><option value=\"N\">N</option></select>"; } else { $text_is_resp = "<select class=\"form-control\" name=\"new_is_resp\" id=\"is_resp_id\" ><option value=\"N\">N</option><option value=\"Y\">Y</option></select>"; } if ($tab_user['is_admin'] == "Y") { $text_is_admin = "<select class=\"form-control\" name=\"new_is_admin\" ><option value=\"Y\">Y</option><option value=\"N\">N</option></select>"; } else { $text_is_admin = "<select class=\"form-control\" name=\"new_is_admin\" ><option value=\"N\">N</option><option value=\"Y\">Y</option></select>"; } if ($tab_user['is_hr'] == "Y") { $text_is_hr = "<select class=\"form-control\" name=\"new_is_hr\" ><option value=\"Y\">Y</option><option value=\"N\">N</option></select>"; } else { $text_is_hr = "<select class=\"form-control\" name=\"new_is_hr\" ><option value=\"N\">N</option><option value=\"Y\">Y</option></select>"; } if ($tab_user['is_active'] == "Y") { $text_is_active = "<select class=\"form-control\" name=\"new_is_active\" ><option value=\"Y\">Y</option><option value=\"N\">N</option></select>"; } else { $text_is_active = "<select class=\"form-control\" name=\"new_is_active\" ><option value=\"N\">N</option><option value=\"Y\">Y</option></select>"; } if ($tab_user['see_all'] == "Y") { $text_see_all = "<select class=\"form-control\" name=\"new_see_all\" ><option value=\"Y\">Y</option><option value=\"N\">N</option></select>"; } else { $text_see_all = "<select class=\"form-control\" name=\"new_see_all\" ><option value=\"N\">N</option><option value=\"Y\">Y</option></select>"; } if ($_SESSION['config']['where_to_find_user_email'] == "dbconges") { $text_email = "<input class=\"form-control\" type=\"text\" name=\"new_email\" size=\"10\" maxlength=\"99\" value=\"" . $tab_user['email'] . "\">"; } $text_resp_login = "******"form-control\" name=\"new_resp_login\" id=\"resp_login_id\" >"; // construction des options du SELECT pour new_resp_login $sql2 = "SELECT u_login, u_nom, u_prenom FROM conges_users WHERE u_is_resp = \"Y\" ORDER BY u_nom,u_prenom"; $ReqLog2 = SQL::query($sql2); while ($resultat2 = $ReqLog2->fetch_array()) { if ($resultat2["u_login"] == $tab_user['resp_login']) { $text_resp_login = $text_resp_login . "<option value=\"" . $resultat2["u_login"] . "\" selected>" . $resultat2["u_nom"] . " " . $resultat2["u_prenom"] . "</option>"; } else { $text_resp_login = $text_resp_login . "<option value=\"" . $resultat2["u_login"] . "\">" . $resultat2["u_nom"] . " " . $resultat2["u_prenom"] . "</option>"; } } $text_resp_login = $text_resp_login . "</select>"; // AFFICHAGE ligne de saisie echo "<tr class=\"update-line\">\n"; echo "<td>{$text_nom}</td>\n"; echo "<td>{$text_prenom}</td>\n"; echo "<td>{$text_login}</td>\n"; echo "<td>{$text_quotite}</td>\n"; echo "<td>{$text_is_resp}</td>\n"; echo "<td>{$text_resp_login}</td>\n"; echo "<td>{$text_is_admin}</td>\n"; echo "<td>{$text_is_hr}</td>\n"; echo "<td>{$text_is_active}</td>\n"; echo "<td>{$text_see_all}</td>\n"; if ($_SESSION['config']['where_to_find_user_email'] == "dbconges") { echo "<td>{$text_email}</td>\n"; } echo "</tr>\n"; echo "</tbody>\n"; echo "</table><br>\n\n"; echo "<hr/>\n"; // AFFICHAGE TABLEAU DES conges annuels et soldes echo "<table class=\"table table-hover table-responsive table-condensed table-striped\" >\n"; echo "<thead>\n"; echo "<tr>\n"; echo "<th></th>\n"; echo "<th colspan=\"2\">" . _('admin_modif_nb_jours_an') . " </th>\n"; echo "<th colspan=\"2\">" . _('divers_solde') . "</th>\n"; if ($_SESSION['config']['autorise_reliquats_exercice']) { echo "<th colspan=\"2\">" . _('divers_reliquat') . "</th>\n"; } echo "</tr>\n"; echo "</thead>\n"; echo "<tbody>\n"; $i = true; foreach ($tab_type_conges as $id_type_cong => $libelle) { echo '<tr class="' . ($i ? 'i' : 'p') . '">'; echo "<td>{$libelle}</td>\n"; // jours / an if (isset($tab_user['conges'][$libelle])) { echo "<td>" . $tab_user['conges'][$libelle]['nb_an'] . "</td>\n"; $text_jours_an = "<input class=\"form-control\" type=\"text\" name=\"tab_new_jours_an[{$id_type_cong}]\" size=\"5\" maxlength=\"5\" value=\"" . $tab_user['conges'][$libelle]['nb_an'] . "\">"; } else { echo "<td>0</td>\n"; $text_jours_an = '<input class=\\"form-control\\" type="text" name="tab_new_jours_an[' . $id_type_cong . ']" size="5" maxlength="5" value="0">'; } echo "<td>{$text_jours_an}</td>\n"; // solde if (isset($tab_user['conges'][$libelle])) { echo "<td>" . $tab_user['conges'][$libelle]['solde'] . "</td>\n"; $text_solde_jours = "<input class=\"form-control\" type=\"text\" name=\"tab_new_solde[{$id_type_cong}]\" size=\"5\" maxlength=\"5\" value=\"" . $tab_user['conges'][$libelle]['solde'] . "\">"; } else { echo "<td>0</td>\n"; $text_solde_jours = '<input class=\\"form-control\\" type="text" name="tab_new_solde[' . $id_type_cong . ']" size="5" maxlength="5" value="0">'; } echo "<td>{$text_solde_jours}</td>\n"; // reliquat // si on ne les utilise pas, on initialise qd meme le tableau (<input type=\"hidden\") ... if ($_SESSION['config']['autorise_reliquats_exercice']) { if (isset($tab_user['conges'][$libelle])) { echo "<td>" . $tab_user['conges'][$libelle]['reliquat'] . "</td>\n"; $text_reliquats_jours = "<input class=\"form-control\" type=\"text\" name=\"tab_new_reliquat[{$id_type_cong}]\" size=\"5\" maxlength=\"5\" value=\"" . $tab_user['conges'][$libelle]['reliquat'] . "\">"; } else { echo "<td>0</td>\n"; $text_reliquats_jours = '<input class=\\"form-control\\" type="text" name="tab_new_reliquat[' . $id_type_cong . ']" size="5" maxlength="5" value="0">'; } echo "<td>{$text_reliquats_jours}</td>\n"; } else { echo "<input type=\"hidden\" name=\"tab_new_reliquat[{$id_type_cong}]\" value=\"0\">"; } echo "</tr>\n"; $i = !$i; } // recup du tableau des types de conges (seulement les conges) if ($_SESSION['config']['gestion_conges_exceptionnels']) { foreach ($tab_type_conges_exceptionnels as $id_type_cong_exp => $libelle) { echo '<tr class="' . ($i ? 'i' : 'p') . '">'; echo "<td>{$libelle}</td>\n"; // jours / an echo "<td>0</td>\n"; echo "<td>0</td>\n"; // solde echo "<td>" . $tab_user['conges'][$libelle]['solde'] . "</td>\n"; $text_solde_jours = "<input class=\"form-control\" type=\"text\" name=\"tab_new_solde[{$id_type_cong_exp}]\" size=\"5\" maxlength=\"5\" value=\"" . $tab_user['conges'][$libelle]['solde'] . "\">"; echo "<td>{$text_solde_jours}</td>\n"; // reliquat // si on ne les utilise pas, on initialise qd meme le tableau (<input type=\"hidden\") ... if ($_SESSION['config']['autorise_reliquats_exercice']) { echo "<td>" . $tab_user['conges'][$libelle]['reliquat'] . "</td>\n"; $text_reliquats_jours = "<input class=\"form-control\" type=\"text\" name=\"tab_new_reliquat[{$id_type_cong_exp}]\" size=\"5\" maxlength=\"5\" value=\"" . $tab_user['conges'][$libelle]['reliquat'] . "\">"; echo "<td>{$text_reliquats_jours}</td>\n"; } else { echo "<input type=\"hidden\" name=\"tab_new_reliquat[{$id_type_cong_exp}]\" value=\"0\">"; } echo "</tr>\n"; $i = !$i; } } echo "</tbody>\n"; echo "</table><br>\n\n"; echo "<hr/>\n"; /*********************************************************/ // saisie des jours d'abscence RTT ou temps partiel: saisie_jours_absence_temps_partiel($u_login, $DEBUG); echo "<hr/>\n"; echo "<input class=\"btn btn-success\" type=\"submit\" value=\"" . _('form_submit') . "\">\n"; echo "<a class=\"btn\" href=\"admin_index.php?session={$session}&onglet=admin-users\">" . _('form_cancel') . "</a>\n"; echo "</form>\n"; }
function affiche_formulaire_ajout_user(&$tab_new_user, &$tab_new_jours_an, &$tab_new_solde, $onglet, $DEBUG = FALSE) { $PHP_SELF = $_SERVER['PHP_SELF']; $session = session_id(); // recup du tableau des types de conges (seulement les conges) $tab_type_conges = recup_tableau_types_conges($DEBUG); // 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($DEBUG); } if ($DEBUG) { echo "tab_type_conges = <br>\n"; print_r($tab_type_conges); echo "<br>\n"; } /*********************/ /* Ajout Utilisateur */ /*********************/ // TITRE echo "<h1>" . _('admin_new_users_titre') . "</h1>\n"; echo '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=' . $onglet . '" method="POST">'; /****************************************/ // tableau des infos de user echo "<table class=\"table table-hover table-responsive table-condensed table-striped\" >\n"; echo "<thead>\n"; echo "<tr>\n"; if ($_SESSION['config']['export_users_from_ldap']) { echo "<th>" . _('divers_nom_maj_1') . " " . _('divers_prenom_maj_1') . "</th>\n"; } else { echo "<th>" . _('divers_login_maj_1') . "</th>\n"; echo "<th>" . _('divers_nom_maj_1') . "</th>\n"; echo "<th>" . _('divers_prenom_maj_1') . "</th>\n"; } echo "<th>" . _('divers_quotite_maj_1') . "</th>\n"; echo "<th>" . _('admin_new_users_is_resp') . "</th>\n"; echo "<th>" . _('divers_responsable_maj_1') . "</th>\n"; echo "<th>" . _('admin_new_users_is_admin') . "</th>\n"; echo "<th>" . _('admin_new_users_is_hr') . "</th>\n"; echo "<th>" . _('admin_new_users_see_all') . "</th>\n"; if (!$_SESSION['config']['export_users_from_ldap']) { echo "<th>" . _('admin_users_mail') . "</th>\n"; } if ($_SESSION['config']['how_to_connect_user'] == "dbconges") { echo "<th>" . _('admin_new_users_password') . "</th>\n"; echo "<th>" . _('admin_new_users_password') . "</th>\n"; } echo "</tr>\n"; echo "</thead>\n"; echo "<tbody>\n"; $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>"; $sql2 = "SELECT u_login, u_nom, u_prenom FROM conges_users WHERE u_is_resp = \"Y\" ORDER BY u_nom, u_prenom"; $ReqLog2 = 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 echo "<tr class=\"update-line\">\n"; // 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(); recup_users_from_ldap($tab_ldap, $tab_login, $DEBUG); // 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"; echo "<td>{$lst_users}</td>\n"; } else { echo "<td>{$text_login}</td>\n"; echo "<td>{$text_nom}</td>\n"; echo "<td>{$text_prenom}</td>\n"; } echo "<td>{$text_quotite}</td>\n"; echo "<td>{$text_is_resp}</td>\n"; echo "<td>{$text_resp_login}</td>\n"; echo "<td>{$text_is_admin}</td>\n"; echo "<td>{$text_is_hr}</td>\n"; echo "<td>{$text_see_all}</td>\n"; if (!$_SESSION['config']['export_users_from_ldap']) { echo "<td>{$text_email}</td>\n"; } if ($_SESSION['config']['how_to_connect_user'] == "dbconges") { echo "<td>{$text_password1}</td>\n"; echo "<td>{$text_password2}</td>\n"; } echo "</tr>\n"; echo "</tbody>\n"; echo "</table>\n"; echo "<br>\n"; /****************************************/ //tableau des conges annuels et soldes echo "<table class=\"table table-hover table-responsive table-condensed table-striped\" >\n"; // ligne de titres echo "<thead>\n"; echo "<tr>\n"; echo "<th></th>\n"; echo "<th>" . _('admin_new_users_nb_par_an') . "</th>\n"; echo "<th>" . _('divers_solde') . "</th>\n"; echo "</tr>\n"; echo "</thead>\n"; echo "<tbody>\n"; $i = true; // ligne de saisie des valeurs foreach ($tab_type_conges as $id_type_cong => $libelle) { echo '<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}\">"; echo "<td>{$libelle}</td>\n"; echo "<td>{$text_jours_an}</td>\n"; echo "<td>{$text_solde_jours}</td>\n"; echo "</tr>\n"; $i = !$i; } if ($_SESSION['config']['gestion_conges_exceptionnels']) { foreach ($tab_type_conges_exceptionnels as $id_type_cong => $libelle) { echo '<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}\">"; echo "<td>{$libelle}</td>\n"; echo "<td>{$text_jours_an}</td>\n"; echo "<td>{$text_solde_jours}</td>\n"; echo "</tr>\n"; $i = !$i; } } echo "</tbody>\n"; echo "</table>\n"; echo "<br>\n\n"; // saisie de la grille des jours d'abscence ARTT ou temps partiel: saisie_jours_absence_temps_partiel($tab_new_user['login'], $DEBUG); // si gestion des groupes : affichage des groupe pour y affecter le user if ($_SESSION['config']['gestion_groupes']) { echo "<br>\n"; affiche_tableau_affectation_user_groupes("", $DEBUG); } echo "<hr>\n"; echo "<input type=\"hidden\" name=\"saisie_user\" value=\"ok\">\n"; echo "<input class=\"btn btn-success\" type=\"submit\" value=\"" . _('form_submit') . "\">\n"; echo "<a class=\"btn\" href=\"{$PHP_SELF}?session={$session}\">" . _('form_cancel') . "</a>\n"; echo "</form>\n"; }