Пример #1
0
function recup_infos_all_users_du_hr($login, $DEBUG = FALSE)
{
    $tab = array();
    $list_groupes_double_validation = get_list_groupes_double_valid($DEBUG);
    if ($DEBUG) {
        echo "list_groupes_double_validation :<br>\n";
        print_r($list_groupes_double_validation);
        echo "<br><br>\n";
    }
    //$sql = "SELECT u_login FROM conges_users WHERE u_login!='conges' AND u_login!='admin' ORDER BY u_login";
    $sql1 = "SELECT u_login FROM conges_users WHERE u_login!='conges' AND u_login!='admin' ORDER BY u_nom";
    $ReqLog = SQL::query($sql1);
    while ($resultat = $ReqLog->fetch_array()) {
        $tab_user = array();
        $sql_login = $resultat["u_login"];
        $tab[$sql_login] = recup_infos_du_user($sql_login, $list_groupes_double_validation, $DEBUG);
    }
    return $tab;
}
Пример #2
0
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";
}
Пример #3
0
function recup_infos_all_users_du_grand_resp($login)
{
    $tab = array();
    $list_groups_double_valid = get_list_groupes_double_valid_du_grand_resp($login);
    if ($list_groups_double_valid != "") {
        // recup de la liste des users des groupes de la liste $list_groups_double_valid
        $sql_users = 'SELECT DISTINCT(gu_login) FROM conges_groupe_users, conges_users WHERE gu_gid IN (' . \includes\SQL::quote($list_groups_double_valid) . ') AND gu_login=u_login ORDER BY u_nom;';
        $ReqLog_users = \includes\SQL::query($sql_users);
        $list_all_users_dbl_valid = "";
        while ($resultat_users = $ReqLog_users->fetch_array()) {
            $current_login = $resultat_users["gu_login"];
            if ($list_all_users_dbl_valid == "") {
                $list_all_users_dbl_valid = "'{$current_login}'";
            } else {
                $list_all_users_dbl_valid = $list_all_users_dbl_valid . ", '{$current_login}'";
            }
        }
        if ($list_all_users_dbl_valid != "") {
            $tab_users_du_resp = explode(",", $list_all_users_dbl_valid);
            foreach ($tab_users_du_resp as $current_login) {
                $current_login = trim($current_login);
                $current_login = trim($current_login, "\\'");
                // on enleve les qote qui on été ajouté lors de la creation de la liste
                $tab[$current_login] = recup_infos_du_user($current_login, $list_groups_double_valid);
            }
        }
    }
    return $tab;
}
Пример #4
0
function affichage($user_login,  $year_affichage, $year_calendrier_saisie_debut, $mois_calendrier_saisie_debut, $year_calendrier_saisie_fin, $mois_calendrier_saisie_fin, $tri_date,  $DEBUG)
{
    $PHP_SELF=$_SERVER['PHP_SELF']; ;
    $session=session_id();

    // on initialise le tableau global des jours fériés s'il ne l'est pas déjà :
    if(!isset($_SESSION["tab_j_feries"]))
    {
        init_tab_jours_feries();
        //print_r($GLOBALS["tab_j_feries"]);   // verif DEBUG
    }

    /********************/
    /* Récupération des informations sur le user : */
    /********************/
    $list_group_dbl_valid_du_resp = get_list_groupes_double_valid_du_resp($_SESSION['userlogin'],  $DEBUG);
    $tab_user=array();
    $tab_user = recup_infos_du_user($user_login, $list_group_dbl_valid_du_resp,  $DEBUG);
    if( $DEBUG ) { echo"tab_user =<br>\n"; print_r($tab_user); echo "<br>\n"; }

    $list_all_users_du_resp=get_list_all_users_du_resp($_SESSION['userlogin'],  $DEBUG);
    if( $DEBUG ) { echo"list_all_users_du_resp = $list_all_users_du_resp<br>\n"; }

    // recup des grd resp du user
    $tab_grd_resp=array();
    if($_SESSION['config']['double_validation_conges'])
    {
        get_tab_grd_resp_du_user($user_login, $tab_grd_resp,  $DEBUG);
        if( $DEBUG ) { echo"tab_grd_resp =<br>\n"; print_r($tab_grd_resp); echo "<br>\n"; }
    }

    /********************/
    /* Titre */
    /********************/
    echo "<h2>". _('resp_traite_user_titre') ." ".$tab_user['prenom']." ".$tab_user['nom'].".</h2>\n\n";


    /********************/
    /* Bilan des Conges */
    /********************/
    // AFFICHAGE TABLEAU
    // affichage du tableau récapitulatif des solde de congés d'un user
    affiche_tableau_bilan_conges_user($user_login);
    echo "<br><br>\n";

    /*************************/
    /* SAISIE NOUVEAU CONGES */
    /*************************/
    // dans le cas ou les users ne peuvent pas saisir de demande, le responsable saisi les congès :
    if( !$_SESSION['config']['user_saisie_demande'] || $_SESSION['config']['resp_saisie_mission'] )
    {

        // si les mois et année ne sont pas renseignés, on prend ceux du jour
        if($year_calendrier_saisie_debut==0)
            $year_calendrier_saisie_debut=date("Y");
        if($mois_calendrier_saisie_debut==0)
            $mois_calendrier_saisie_debut=date("m");
        if($year_calendrier_saisie_fin==0)
            $year_calendrier_saisie_fin=date("Y");
        if($mois_calendrier_saisie_fin==0)
            $mois_calendrier_saisie_fin=date("m");
        if( $DEBUG ) { echo "$mois_calendrier_saisie_debut  $year_calendrier_saisie_debut  -  $mois_calendrier_saisie_fin  $year_calendrier_saisie_fin<br>\n"; }

        echo "<H3>". _('resp_traite_user_new_conges') ."</H3>\n\n";

        //affiche le formulaire de saisie d'une nouvelle demande de conges ou d'un  nouveau conges
        $onglet = "traite_user";
        saisie_nouveau_conges($user_login, $year_calendrier_saisie_debut, $mois_calendrier_saisie_debut, $year_calendrier_saisie_fin, $mois_calendrier_saisie_fin, $onglet);

        echo "<hr align=\"center\" size=\"2\" width=\"90%\"> \n";
    }

    /*********************/
    /* Etat des Demandes */
    /*********************/
    if($_SESSION['config']['user_saisie_demande'])
    {
        //verif si le user est bien un user du resp (et pas seulement du grand resp)
        if(strstr($list_all_users_du_resp, "'$user_login'")!=FALSE)
        {
            echo "<h3>". _('resp_traite_user_etat_demandes') ."</h3>\n";

            //affiche l'état des demandes du user (avec le formulaire pour le responsable)
            affiche_etat_demande_user_for_resp($user_login, $tab_user, $tab_grd_resp,  $DEBUG);

            echo "<hr align=\"center\" size=\"2\" width=\"90%\"> \n";
        }
    }

    /*********************/
    /* Etat des Demandes en attente de 2ieme validation */
    /*********************/
    if($_SESSION['config']['double_validation_conges'])
    {
        /*******************************/
        /* verif si le resp est grand_responsable pour ce user*/

        if(in_array($_SESSION['userlogin'], $tab_grd_resp)) // si resp_login est dans le tableau
        {
            echo "<h3>". _('resp_traite_user_etat_demandes_2_valid') ."</h3>\n";

            //affiche l'état des demande en attente de 2ieme valid du user (avec le formulaire pour le responsable)
            affiche_etat_demande_2_valid_user_for_resp($user_login,  $DEBUG);

            echo "<hr align=\"center\" size=\"2\" width=\"90%\"> \n";
        }
    }

    /*******************/
    /* Etat des Conges */
    /*******************/
    echo "<h3>". _('resp_traite_user_etat_conges') ."</h3>\n";

    //affiche l'état des conges du user (avec le formulaire pour le responsable)
    affiche_etat_conges_user_for_resp($user_login,  $year_affichage, $tri_date, $onglet, $DEBUG);

    //echo "<hr align=\"center\" size=\"2\" width=\"90%\"> \n";


    echo "<td valign=\"middle\">\n";
    echo "</td></tr></table>\n";
    echo "<center>\n";

}
Пример #5
0
 public static function affichage($user_login, $year_affichage, $year_calendrier_saisie_debut, $mois_calendrier_saisie_debut, $year_calendrier_saisie_fin, $mois_calendrier_saisie_fin, $tri_date)
 {
     $PHP_SELF = $_SERVER['PHP_SELF'];
     $session = session_id();
     $return = '';
     // on initialise le tableau global des jours fériés s'il ne l'est pas déjà :
     if (!isset($_SESSION["tab_j_feries"])) {
         init_tab_jours_feries();
     }
     /********************/
     /* Récupération des informations sur le user : */
     /********************/
     $list_group_dbl_valid_du_resp = get_list_groupes_double_valid_du_resp($_SESSION['userlogin']);
     $tab_user = array();
     $tab_user = recup_infos_du_user($user_login, $list_group_dbl_valid_du_resp);
     $list_all_users_du_resp = get_list_all_users_du_resp($_SESSION['userlogin']);
     // recup des grd resp du user
     $tab_grd_resp = array();
     if ($_SESSION['config']['double_validation_conges']) {
         get_tab_grd_resp_du_user($user_login, $tab_grd_resp);
     }
     include_once ROOT_PATH . 'fonctions_javascript.php';
     /********************/
     /* Titre */
     /********************/
     $return .= '<h1>' . $tab_user['prenom'] . ' ' . $tab_user['nom'] . '</h1>';
     /********************/
     /* Bilan des Conges */
     /********************/
     // AFFICHAGE TABLEAU
     // affichage du tableau récapitulatif des solde de congés d'un user
     $return .= affiche_tableau_bilan_conges_user($user_login);
     $return .= '<hr/>';
     /*************************/
     /* SAISIE NOUVEAU CONGES */
     /*************************/
     // dans le cas ou les users ne peuvent pas saisir de demande, le responsable saisi les congès :
     if (!$_SESSION['config']['user_saisie_demande'] || $_SESSION['config']['resp_saisie_mission']) {
         // si les mois et année ne sont pas renseignés, on prend ceux du jour
         if ($year_calendrier_saisie_debut == 0) {
             $year_calendrier_saisie_debut = date("Y");
         }
         if ($mois_calendrier_saisie_debut == 0) {
             $mois_calendrier_saisie_debut = date("m");
         }
         if ($year_calendrier_saisie_fin == 0) {
             $year_calendrier_saisie_fin = date("Y");
         }
         if ($mois_calendrier_saisie_fin == 0) {
             $mois_calendrier_saisie_fin = date("m");
         }
         $return .= '<h2>' . _('resp_traite_user_new_conges') . '</h2>';
         //affiche le formulaire de saisie d'une nouvelle demande de conges ou d'un  nouveau conges
         $onglet = "traite_user";
         $return .= saisie_nouveau_conges2($user_login, $year_calendrier_saisie_debut, $mois_calendrier_saisie_debut, $year_calendrier_saisie_fin, $mois_calendrier_saisie_fin, $onglet);
         $return .= '<hr/>';
     }
     /*********************/
     /* Etat des Demandes */
     /*********************/
     if ($_SESSION['config']['user_saisie_demande']) {
         //verif si le user est bien un user du resp (et pas seulement du grand resp)
         if (strstr($list_all_users_du_resp, "'{$user_login}'") != FALSE) {
             $return .= '<h2>' . _('resp_traite_user_etat_demandes') . '</h2>';
             //affiche l'état des demandes du user (avec le formulaire pour le responsable)
             $return .= \responsable\Fonctions::affiche_etat_demande_user_for_resp($user_login, $tab_user, $tab_grd_resp);
             $return .= '<hr/>';
         }
     }
     /*********************/
     /* Etat des Demandes en attente de 2ieme validation */
     /*********************/
     if ($_SESSION['config']['double_validation_conges']) {
         /*******************************/
         /* verif si le resp est grand_responsable pour ce user*/
         if (in_array($_SESSION['userlogin'], $tab_grd_resp)) {
             $return .= '<h2>' . _('resp_traite_user_etat_demandes_2_valid') . '</h2>';
             //affiche l'état des demande en attente de 2ieme valid du user (avec le formulaire pour le responsable)
             $return .= \responsable\Fonctions::affiche_etat_demande_2_valid_user_for_resp($user_login);
             $return .= '<hr/>';
         }
     }
     /*******************/
     /* Etat des Conges */
     /*******************/
     //affiche l'état des conges du user (avec le formulaire pour le responsable)
     $onglet = "traite_user";
     $return .= \responsable\Fonctions::affiche_etat_conges_user_for_resp($user_login, $year_affichage, $tri_date, $onglet);
     return $return;
 }
Пример #6
0
function export_vcal($user_login, $date_debut, $date_fin, $DEBUG = FALSE)
{
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $session = session_id();
    //inverse l'ordre de la date jj-mm-yyyy --> yyy-mm-jj
    $good_date_debut = inverse_date($date_debut, $DEBUG);
    $good_date_fin = inverse_date($date_fin, $DEBUG);
    if ($good_date_debut > $good_date_fin) {
        // si $date_debut posterieure a $date_fin
        // redirige vers page de saisie
        echo "<META HTTP-EQUIV=REFRESH CONTENT=\"0; URL={$PHP_SELF}?session={$session}&date_debut={$date_debut}&date_fin={$date_fin}&choix_format=ical\">";
    } else {
        /********************************/
        // initialisation de variables communes a ttes les periodes
        // recup des infos du user
        $tab_infos_user = recup_infos_du_user($_SESSION['userlogin'], "", $DEBUG);
        $tab_types_abs = recup_tableau_tout_types_abs($DEBUG);
        if (function_exists("date_default_timezone_get")) {
            // car date_default_timezone_get() n'existe que depuis PHP 5.1
            $DTSTAMP = date("Ymd") . date_default_timezone_get();
        } else {
            $DTSTAMP = date("Ymd") . "T142816Z";
        }
        // copier depuis un fichier ical
        /********************************/
        // affichage dans un fichier non html !
        header("content-type: application/ics");
        header("Content-disposition: filename=php_conges.ics");
        echo "BEGIN:VCALENDAR\r\n" . "PRODID:-//php_conges " . $_SESSION['config']['installed_version'] . "\r\n" . "VERSION:1.0\r\n\r\n";
        // SELECT des periodes à exporter .....
        // on prend toutes les periodes de conges qui chevauchent la periode donnée par les dates demandées
        $sql_periodes = "SELECT p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_commentaire, p_type  " . 'FROM conges_periode WHERE p_login=\'' . SQL::quote($_SESSION['userlogin']) . '\' AND p_etat=\'ok\' AND (p_date_deb>=\'' . SQL::quote($good_date_debut) . '\' AND  p_date_deb<=\'' . SQL::quote($good_date_fin) . '\') OR (p_date_fin>=\'' . SQL::quote($good_date_debut) . '\' AND p_date_fin<=\'' . SQL::quote($good_date_fin) . '\')';
        $res_periodes = SQL::query($sql_periodes);
        if ($num_periodes = $res_periodes->num_rows != 0) {
            while ($result_periodes = $res_periodes->fetch_array()) {
                $sql_date_debut = $result_periodes['p_date_deb'];
                $sql_demi_jour_deb = $result_periodes['p_demi_jour_deb'];
                $sql_date_fin = $result_periodes['p_date_fin'];
                $sql_demi_jour_fin = $result_periodes['p_demi_jour_fin'];
                $sql_type = $result_periodes['p_type'];
                // PB : les fichiers ical et vcal doivent être encodés en UTF-8, or php ne gère pas l'utf-8
                // on remplace donc les caractères spéciaux de la chaine de caractères
                $sql_comment = remplace_accents($result_periodes['p_commentaire']);
                // même problème
                $type_abs = remplace_accents($tab_types_abs[$sql_type]['libelle']);
                $tab_date_deb = explode("-", $sql_date_debut);
                $tab_date_fin = explode("-", $sql_date_fin);
                if ($sql_demi_jour_deb == "am") {
                    $DTSTART = $tab_date_deb[0] . $tab_date_deb[1] . $tab_date_deb[2] . "T000000Z";
                } else {
                    $DTSTART = $tab_date_deb[0] . $tab_date_deb[1] . $tab_date_deb[2] . "T120000Z";
                }
                // .....
                if ($sql_demi_jour_fin == "am") {
                    $DTEND = $tab_date_fin[0] . $tab_date_fin[1] . $tab_date_fin[2] . "T120000Z";
                } else {
                    $DTEND = $tab_date_fin[0] . $tab_date_fin[1] . $tab_date_fin[2] . "T235900Z";
                }
                // .....
                echo "BEGIN:VEVENT\r\n" . "DTSTART:{$DTSTART}\r\n" . "DTEND:{$DTEND}\r\n" . "CREATED:{$DTSTAMP}\r\n" . "UID:php_conges\r\n" . "SEQUENCE:1\r\n" . "LAST-MODIFIED:{$DTSTAMP}\r\n" . "X-ORGANIZER;MAILTO:" . $tab_infos_user['email'] . "\r\n";
                if ($sql_comment != "") {
                    echo "DESCRIPTION:{$sql_comment}\r\n";
                }
                echo "SUMMARY:{$type_abs}\r\n" . "CLASS:PUBLIC\r\n" . "PRIORITY:1\r\n" . "TRANSP:0\r\n" . "END:VEVENT\r\n\r\n";
            }
        }
        echo "END:VCALENDAR\r\n";
    }
}
Пример #7
0
 public static function recup_infos_all_users_du_hr($login)
 {
     $tab = array();
     $list_groupes_double_validation = get_list_groupes_double_valid();
     $sql1 = "SELECT u_login FROM conges_users WHERE u_login!='conges' AND u_login!='admin' ORDER BY u_nom";
     $ReqLog = \includes\SQL::query($sql1);
     while ($resultat = $ReqLog->fetch_array()) {
         $tab_user = array();
         $sql_login = $resultat["u_login"];
         $tab[$sql_login] = recup_infos_du_user($sql_login, $list_groupes_double_validation);
     }
     return $tab;
 }
Пример #8
0
 public static function export_ical($user_login)
 {
     $good_date_debut = date("Y-m-d", strtotime("-1 year"));
     $good_date_fin = date("Y-m-d", strtotime('+1 year'));
     /********************************/
     // initialisation de variables communes a ttes les periodes
     // recup des infos du user
     $tab_infos_user = recup_infos_du_user($user_login, "");
     $tab_types_abs = recup_tableau_tout_types_abs();
     /********************************/
     // affichage dans un fichier non html !
     header("content-type: application/ics");
     header("Content-disposition: filename=libertempo.ics");
     echo "BEGIN:VCALENDAR\r\n" . "PRODID:-//Libertempo \r\n" . "VERSION:2.0\r\n\r\n";
     // SELECT des periodes à exporter .....
     // on prend toutes les periodes de conges qui chevauchent la periode donnée par les dates demandées
     $sql_periodes = "SELECT p_date_deb, p_demi_jour_deb, p_date_fin, p_demi_jour_fin, p_commentaire, p_type, p_etat, p_date_demande  " . 'FROM conges_periode WHERE p_login=\'' . \includes\SQL::quote($user_login) . '\' AND ((p_date_deb>=\'' . \includes\SQL::quote($good_date_debut) . '\' AND  p_date_deb<=\'' . \includes\SQL::quote($good_date_fin) . '\') OR (p_date_fin>=\'' . \includes\SQL::quote($good_date_debut) . '\' AND p_date_fin<=\'' . \includes\SQL::quote($good_date_fin) . '\'))';
     $res_periodes = \includes\SQL::query($sql_periodes);
     if ($num_periodes = $res_periodes->num_rows != 0) {
         while ($result_periodes = $res_periodes->fetch_array()) {
             $sql_date_debut = $result_periodes['p_date_deb'];
             $sql_demi_jour_deb = $result_periodes['p_demi_jour_deb'];
             $sql_date_fin = $result_periodes['p_date_fin'];
             $sql_demi_jour_fin = $result_periodes['p_demi_jour_fin'];
             $sql_type = $result_periodes['p_type'];
             $sql_etat = $result_periodes['p_etat'];
             $sql_dateh_demande = $result_periodes['p_date_demande'];
             // PB : les fichiers ical et vcal doivent être encodés en UTF-8, or php ne gère pas l'utf-8
             // on remplace donc les caractères spéciaux de la chaine de caractères
             $sql_comment = \export\Fonctions::remplace_accents($result_periodes['p_commentaire']);
             // même problème
             $type_abs = \export\Fonctions::remplace_accents($tab_types_abs[$sql_type]['libelle']);
             //conversion format date
             $replaceThis = array('-' => '', ':' => '', ' ' => 'T');
             $sql_date_dem = str_replace(array_keys($replaceThis), $replaceThis, $sql_dateh_demande);
             $DTSTAMP = $sql_date_dem . "Z";
             $tab_date_deb = explode("-", $sql_date_debut);
             $tab_date_fin = explode("-", $sql_date_fin);
             //conversion etat demande en status
             switch ($sql_etat) {
                 case "ok":
                     $status = "CONFIRMED";
                     break;
                 case "refus":
                     $status = "CANCELLED";
                     break;
                 default:
                     $status = "TENTATIVE";
             }
             if ($sql_demi_jour_deb == "am") {
                 $DTSTART = $tab_date_deb[0] . $tab_date_deb[1] . $tab_date_deb[2] . "T070000Z";
             } else {
                 $DTSTART = $tab_date_deb[0] . $tab_date_deb[1] . $tab_date_deb[2] . "T120000Z";
             }
             // .....
             if ($sql_demi_jour_fin == "am") {
                 $DTEND = $tab_date_fin[0] . $tab_date_fin[1] . $tab_date_fin[2] . "T120000Z";
             } else {
                 $DTEND = $tab_date_fin[0] . $tab_date_fin[1] . $tab_date_fin[2] . "T210000Z";
             }
             // .....
             echo "BEGIN:VEVENT\r\n" . "DTSTAMP:{$DTSTAMP}\r\n" . "ORGANIZER:MAILTO:" . $tab_infos_user['email'] . "\r\n" . "CREATED:{$DTSTART}\r\n" . "STATUS:{$status}\r\n" . "UID:{$user_login}@Libertempo-{$sql_date_dem}\r\n";
             if ($sql_comment != "") {
                 echo "DESCRIPTION:{$sql_comment}\r\n";
             }
             echo "SUMMARY:{$type_abs}\r\n" . "CLASS:PUBLIC\r\n" . "PRIORITY:1\r\n" . "DTSTART:{$DTSTART}\r\n" . "DTEND:{$DTEND}\r\n" . "TRANSP:OPAQUE\r\n" . "END:VEVENT\r\n\r\n";
         }
     }
     echo "END:VCALENDAR\r\n";
 }