Copyright (C) 2015 (Prytoegrian) Copyright (C) 2005 (cedric chauvineau) Ce programme est libre, vous pouvez le redistribuer et/ou le modifier selon les termes de la Licence Publique Générale GNU publiée par la Free Software Foundation. Ce programme est distribué car potentiellement utile, mais SANS AUCUNE GARANTIE, ni explicite ni implicite, y compris les garanties de commercialisation ou d'adaptation dans un but spécifique. Reportez-vous à la Licence Publique Générale GNU pour plus de détails. Vous devez avoir reçu une copie de la Licence Publique Générale GNU en même temps que ce programme ; si ce n'est pas le cas, écrivez à la Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, États-Unis. ************************************************************************************************* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *************************************************************************************************/ define('ROOT_PATH', ''); require_once ROOT_PATH . 'define.php'; $session = isset($_GET['session']) ? $_GET['session'] : (isset($_POST['session']) ? $_POST['session'] : session_id()); include_once ROOT_PATH . 'fonctions_conges.php'; include_once INCLUDE_PATH . 'fonction.php'; $add_css = NULL; header_menu('', 'Libertempo : ' . _('calendrier_titre'), $add_css); echo \calendrier\Fonctions::calendrierModule($session); bottom();
/** * Encapsule le comportement du module calendrier * * @param string $session * * @return void * @access public * @static */ public static function calendrierModule($session) { $return = ''; if (substr($session, 0, 9) != "phpconges") { session_start(); $_SESSION['config'] = init_config_tab(); // on initialise le tableau des variables de config if ($_SESSION['config']['consult_calendrier_sans_auth'] == FALSE) { redirect(ROOT_PATH . 'index.php'); } } else { include_once INCLUDE_PATH . 'session.php'; } $script = '<script language=javascript> function afficher(id) { el = document.getElementById(id); el.style.display = "block"; } function cacher(id) { el = document.getElementById(id); el.style.display = "none"; } </script>'; /*************************************/ // recup des parametres reçus : // SERVER $PHP_SELF = $_SERVER['PHP_SELF']; // GET / POST $selected = getpost_variable('selected'); $printable = getpost_variable('printable', 0); $year = getpost_variable('year', date("Y")); $mois = getpost_variable('mois', date("n")); $first_jour = getpost_variable('first_jour', 1); // $first_load = getpost_variable('first_load', "Y") ; $select_groupe = getpost_variable('select_groupe', 0); /*************************************/ // 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(); } // renvoit un tableau de tableau contenant les infos des types de conges et absences $tab_type_absence = recup_tableau_tout_types_abs(); // echo "<hr align=\"center\" size=\"2\" width=\"90%\"> \n"; $jour_today = date("j"); $mois_today = date("m"); $year_today = date("Y"); $timestamp_today = mktime(0, 0, 0, $mois_today, $jour_today, $year_today); $mois_timestamp = mktime(0, 0, 0, $mois, 1, $year); $nom_mois = date_fr("F", $mois_timestamp); $group_names = get_groups_name(); // AFFICHAGE PAGE $return .= '<div id="main-calendar" class="main-content">'; if ($_SESSION['config']['gestion_groupes'] && $printable != 1) { // affiche le select des groupes du user OU les groupes du resp (si user est resp) OU tous les groupes (si option de config ok) $return .= '<div class="pull-right">'; $return .= \calendrier\Fonctions::affiche_select_groupe($select_groupe, $selected, $printable, $year, $mois, $first_jour, $group_names); $return .= '</div>'; } $return .= '<h1>' . _('calendrier_titre') . '</h1>'; if ($_SESSION['config']['gestion_groupes'] && $select_groupe != 0) { $return .= '<h2>' . _('divers_groupe') . ' : <strong>' . $group_names[$select_groupe] . '</strong></h2>'; } $return .= '<hr/>'; $return .= '<h3 class="current-month">' . $nom_mois . ' ' . $year . '</h3>'; $return .= '<hr/>'; /**********************/ /* Boutons de defilement */ if ($printable != 1) { $return .= \calendrier\Fonctions::affichage_boutons_defilement($first_jour, $mois, $year, $select_groupe); } /***********************************/ /* AFFICHAGE TABLEAU (CALENDRIER) */ $return .= \calendrier\Fonctions::affichage_calendrier($year, $mois, $first_jour, $timestamp_today, $printable, $selected, $tab_type_absence, $select_groupe); /**********************/ /* Boutons de defilement */ if ($printable != 1) { $return .= '<tr>'; $return .= '<td align="center">'; $return .= \calendrier\Fonctions::affichage_boutons_defilement($first_jour, $mois, $year, $select_groupe); $return .= '</td>'; $return .= '</tr>'; } $return .= '<tr>'; $return .= '</tr>'; $return .= '</table>'; if ($printable != 1) { $return .= '<br/><a href="' . $PHP_SELF . '?session=' . $session . '&printable=1&year=' . $year . '&mois=' . $mois . '&first_jour=' . $first_jour . '&select_groupe=' . $select_groupe . '" target="_blank" method="post">'; $return .= '<i class="fa fa-print"></i>'; $return .= _('calendrier_imprimable'); $return .= '</a>'; $return .= '<br><a href="calendrier-pdf.php?session=' . $session . '&printable=1&year=' . $year . '&mois=' . $mois . '&first_jour=' . $first_jour . '&select_groupe=' . $select_groupe . '" target="_blank" method="post">'; $return .= '<img src="' . TEMPLATE_PATH . 'img/pdf_22x22_2.png" width="22" height="22" border="0" title="Version PDF">'; $return .= 'PDF'; $return .= '</a>'; } $return .= '<br><br><table cellpadding="1" class="calendar table-responsive table-bordered table-stripped">'; $return .= '<tr align="center">'; $return .= '<td bgcolor="#FFFFFF" class="cal-legende"> - </td>'; $return .= '<td class="cal-legende"> </td>'; $return .= '</tr>'; $return .= '<tr align="center">'; $return .= '<td bgcolor="#DCDCDC" class="cal-legende"> - </td>'; $return .= '<td class="cal-legende">' . _('calendrier_legende_we') . '</td>'; $return .= '</tr>'; $return .= '<tr align="center">'; $return .= '<td bgcolor="#8addf2" class="cal-legende">abs</td>'; $return .= '<td class="cal-legende">' . _('calendrier_legende_conges') . '</td>'; $return .= '</tr>'; $return .= '<tr align="center">'; $return .= '<td bgcolor="#ffc1ff" class="cal-legende">abs</td>'; $return .= '<td class="cal-legende">' . _('calendrier_legende_demande') . '</td>'; $return .= '</tr>'; $return .= '<tr align="center">'; $return .= '<td bgcolor="#ffffad" class="cal-legende"> - </td>'; $return .= '<td class="cal-legende">' . _('calendrier_legende_part_time') . '</td>'; $return .= '</tr>'; $return .= '<tr align="center">'; $return .= '<td bgcolor="#C3C3C3" class="cal-legende">abs</td>'; $return .= '<td class="cal-legende">' . _('calendrier_legende_abs') . '</td>'; $return .= '</tr>'; $return .= '<tr align="center">'; $return .= '<td bgcolor="#CEB6FF" class="cal-legende">abs</td>'; $return .= '<td class="cal-legende">' . _('divers_fermeture') . '</td>'; $return .= '</tr>'; $return .= '</table>'; $return .= '</div>'; /********************/ /* bouton retour */ /********************/ if ($printable == 1) { // appel de la fenetre d'impression directe ?> <script type="text/javascript" language="javascript1.2"> <!-- // Do print the page if (typeof(window.print) != 'undefined') { window.print(); } //--> </script> <?php } return $return; }