function affiche_gestion_user_groupes($choix_user, $onglet, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    echo "<H3>" . _('admin_onglet_user_groupe') . ":</H3>\n\n";
    /************************/
    /* Affichage Groupes    */
    /************************/
    /*	// Récuperation des informations :
    	$sql_u = "SELECT u_nom, u_prenom FROM conges_users WHERE u_login='******'"  ;
    	$ReqLog_u = SQL::query($sql_u);
    
    	$resultat_u = $ReqLog_u->fetch_array();
    	$sql_nom=$resultat_u["u_nom"] ;
    	$sql_prenom=$resultat_u["u_prenom"] ;
    */
    echo '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=' . $onglet . '" method="POST">';
    affiche_tableau_affectation_user_groupes($choix_user, $DEBUG);
    echo "<input type=\"hidden\" name=\"change_user_groups\" value=\"ok\">\n";
    echo "<input type=\"hidden\" name=\"choix_user\" value=\"{$choix_user}\">\n";
    echo "<input type=\"submit\" value=\"" . _('form_submit') . "\">\n";
    echo "</form>\n";
    echo "<form action=\"{$PHP_SELF}?session={$session}&onglet=admin-group-users\" method=\"POST\">\n";
    echo "<input type=\"submit\" value=\"" . _('form_annul') . "\">\n";
    echo "</form>\n";
}
Ejemplo n.º 2
0
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\"> &nbsp; ";
            $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";
}
Ejemplo n.º 3
0
function affiche_gestion_user_groupes($choix_user, $onglet, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    echo "<h1>" . _('admin_onglet_user_groupe') . "</h1>\n\n";
    /************************/
    /* Affichage Groupes    */
    /************************/
    echo '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=' . $onglet . '" method="POST">';
    affiche_tableau_affectation_user_groupes($choix_user, $DEBUG);
    echo "<hr/>\n";
    echo "<input type=\"hidden\" name=\"change_user_groups\" value=\"ok\">\n";
    echo "<input type=\"hidden\" name=\"choix_user\" value=\"{$choix_user}\">\n";
    echo "<input class=\"btn btn-success\" type=\"submit\" value=\"" . _('form_submit') . "\">\n";
    echo "<a class=\"btn\" href=\"{$PHP_SELF}?session={$session}&onglet=admin-group-users\">" . _('form_annul') . "</a>\n";
    echo "</form>\n";
}