Skip to content

Commit

Permalink
Jours cycles => Passage sous twig
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeDevome committed Nov 20, 2018
1 parent c6b2dae commit c5f4533
Show file tree
Hide file tree
Showing 18 changed files with 484 additions and 309 deletions.
38 changes: 0 additions & 38 deletions admin/admin_calend_jour_cycle.php

This file was deleted.

2 changes: 1 addition & 1 deletion admin/admin_col_gauche.php
Expand Up @@ -64,7 +64,7 @@ function afficheLienNiveau2($nomSection,$image,$liste,$iN2)
if ((authGetUserLevel(getUserName(), -1, 'area') >= 6) && (Settings::get('show_holidays') == 'Oui'))
afficheLienNiveau1('admin_calend_vacances_feries', 'fa fa-calendar-minus-o', 1);
if ((authGetUserLevel(getUserName(), -1, 'area') >= 6) && (Settings::get("jours_cycles_actif") == "Oui"))
afficheLienNiveau1('admin_calend_jour_cycle', 'fa fa-repeat', 1);
afficheLienNiveau1('admin_calend_jour_cycle1', 'fa fa-repeat', 1);


if ((authGetUserLevel(getUserName(), -1, 'area') >= 6) && (Settings::get("module_multisite") == "Oui"))
Expand Down
100 changes: 0 additions & 100 deletions admin/admin_config_calend1.php

This file was deleted.

57 changes: 57 additions & 0 deletions admin/controleurs/admin_calend_jour_cycle1.php
@@ -0,0 +1,57 @@
<?php
/**
* admin_config_calend1.php
* Interface permettant à l'administrateur la configuration des paramètres pour le module Jours Cycles
* Ce script fait partie de l'application GRR
* Dernière modification : $Date: 2017-12-16 14:00$
* @author Laurent Delineau & JeromeB
* @copyright Copyright 2003-2018 Team DEVOME - JeromeB
* @link http://www.gnu.org/licenses/licenses.html
*
* This file is part of GRR.
*
* GRR 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
* (at your option) any later version.
*/


// Affichage du tableau de choix des sous-configuration
$grr_script_name = "admin_calend_jour_cycle1.php";

// Met à jour dans la BD le nombre de jours par cycle
if (isset($_GET['nombreJours']))
{
if (!Settings::set("nombre_jours_Jours_Cycles", $_GET['nombreJours']))
echo "Erreur lors de l'enregistrement de nombre_jours_Jours_Cycles ! <br />";
}
// Met à jour dans la BD le premier jour du premier cycle
if (isset($_GET['jourDebut']))
{
if (!Settings::set("jour_debut_Jours_Cycles", $_GET['jourDebut']))
echo "Erreur lors de l'enregistrement de jour_debut_Jours_Cycles ! <br />";
}

$AllSettings = Settings::getAll();
//
// Configurations du nombre de jours par Jours/Cycles et du premier jour du premier Jours/Cycles
//******************************
//
get_vocab_admin("titre_config_Jours_Cycles");

get_vocab_admin("admin_config_calend1");
get_vocab_admin("admin_config_calend2");
get_vocab_admin("admin_config_calend3");

get_vocab_admin("explication_Jours_Cycles1");
get_vocab_admin("explication_Jours_Cycles2");

get_vocab_admin("nombre_jours_Jours_Cycles");
get_vocab_admin("debut_Jours_Cycles");

get_vocab_admin("save");


echo $twig->render('admin_calend_jour_cycle1.twig', array('liensMenu' => $menuAdminT, 'liensMenuN2' => $menuAdminTN2, 'trad' => $trad, 'settings' => $AllSettings));
?>
Expand Up @@ -16,18 +16,31 @@
* (at your option) any later version.
*/

$grr_script_name = "admin_config_calend2.php";
$back = '';
if (isset($_SERVER['HTTP_REFERER']))
$back = htmlspecialchars($_SERVER['HTTP_REFERER']);
$grr_script_name = "admin_calend_jour_cycle2.php";

check_access(6, $back);
# print the page header
print_header("", "", "", $type="with_session");
// Affichage de la colonne de gauche
include "admin_col_gauche.php";
// Affichage du tableau de choix des sous-configuration pour les Jours/Cycles (Créer et voir calendrier Jours/Cycle)
include "../include/admin_calend_jour_cycle.inc.php";
echo "<h3>".get_vocab('calendrier_jours/cycles')."</h3>";

get_vocab_admin("titre_config_Jours_Cycles");

get_vocab_admin("admin_config_calend1");
get_vocab_admin("admin_config_calend2");
get_vocab_admin("admin_config_calend3");

get_vocab_admin("les_journees_cochees_sont_valides");
get_vocab_admin("nombre_jours_Jours_Cycles");
get_vocab_admin("debut_Jours_Cycles");
get_vocab_admin("uncheck_all_the");

get_vocab_admin("check_all_the");
get_vocab_admin("deux_points");
get_vocab_admin("uncheck_all_");

get_vocab_admin("deux_points");
get_vocab_admin("save");

//
// Enregistrement
//
if (isset($_POST['record']) && ($_POST['record'] == 'yes'))
{
// On vide la table
Expand All @@ -41,7 +54,7 @@
$year = strftime("%Y", Settings::get("begin_bookings"));
$day = 1;
// Pour aller chercher le Jour cycle qui débutera le premier cycle de jours
$m = Settings::get("jour_debut_Jours/Cycles");
$m = Settings::get("jour_debut_Jours_Cycles");
while ($n <= $end_bookings)
{
$daysInMonth = getDaysInMonth($month, $year);
Expand All @@ -60,7 +73,13 @@
if ($res)
{
for ($i = 0; ($row = grr_sql_row($res, $i)); $i++)
$result += grrDelEntryInConflict($row[0], $starttime, $endtime, 0, 0, 1);
{
$grrDelEntryInConflict = grrDelEntryInConflict($row[0], $starttime, $endtime, 0, 0, 1);
if( !is_numeric($grrDelEntryInConflict) )
$grrDelEntryInConflict = 0;

$result += $grrDelEntryInConflict;
}
}
// On enregistre la valeur
$m = cree_calendrier_date_valide($n,$m);
Expand All @@ -75,47 +94,40 @@
}
}
}
echo "<p>".get_vocab("les_journees_cochees_sont_valides").get_vocab("deux_points");
echo "<br />* ".get_vocab("nombre_jours_Jours/Cycles").get_vocab("deux_points").Settings::get("nombre_jours_Jours/Cycles");
echo "<br />* ".get_vocab("debut_Jours/Cycles").get_vocab("deux_points").Settings::get("jour_debut_Jours/Cycles");
echo "<br /><br />".get_vocab("explication_Jours_Cycles2")."</p>";
echo "<table cellpadding=\"3\">\n";

//
// Affichage
//
$basetime = mktime(12, 0, 0, 6, 11 + $weekstarts, 2000);
for ($i = 0; $i < 7; $i++)
{
$show = $basetime + ($i * 24 * 60 * 60);
$lday = utf8_strftime('%A',$show);
echo "<tr>\n";
echo "<td><span class='small'><a href='admin_calend_jour_cycle.php' onclick=\"setCheckboxesGrr(document.getElementById('formulaire'), true, '$lday' ); return false;\">".get_vocab("check_all_the").$lday."s</a></span></td>\n";
echo "<td><span class='small'><a href='admin_calend_jour_cycle.php' onclick=\"setCheckboxesGrr(document.getElementById('formulaire'), false, '$lday' ); return false;\">".get_vocab("uncheck_all_the").$lday."s</a></span></td>\n";
echo "</tr>\n";
$jourssemaines[] = utf8_strftime('%A',$show);
}
echo "<tr>\n<td><span class='small'><a href='admin_calend_jour_cycle.php' onclick=\"setCheckboxesGrr(document.getElementById('formulaire'), false, 'all'); return false;\">".get_vocab("uncheck_all_")."</a></span></td>\n";
echo "<td></td></tr>\n";
echo "</table>\n";
echo "<form action=\"admin_calend_jour_cycle.php?page_calend=2\" method=\"post\" id=\"formulaire\">\n";
echo "<table cellspacing=\"20\">\n";

$n = Settings::get("begin_bookings");
$end_bookings = Settings::get("end_bookings");
$debligne = 1;
$month = strftime("%m", Settings::get("begin_bookings"));
$year = strftime("%Y", Settings::get("begin_bookings"));
$inc = 0;
$trad['dCalendrier'] = "";

while ($n <= $end_bookings)
{
if ($debligne == 1)
{
echo "<tr>\n";
$trad['dCalendrier'] .= "<tr>\n";
$inc = 0;
$debligne = 0;
}
$inc++;
echo "<td>\n";
echo cal($month, $year, 1);
echo "</td>";
$trad['dCalendrier'] .= "<td>\n";
$trad['dCalendrier'] .= cal($month, $year, 1);
$trad['dCalendrier'] .= "</td>";
if ($inc == 3)
{
echo "</tr>";
$trad['dCalendrier'] .= "</tr>";
$debligne = 1;
}
$month++;
Expand All @@ -131,17 +143,11 @@
$k=$inc;
while ($k < 3)
{
echo "<td> </td>\n";
$trad['dCalendrier'] .= "<td> </td>\n";
$k++;
} // while
echo "</tr>";
}
$trad['dCalendrier'] .= "</tr>";
}
echo "</table>";
echo "<div id=\"fixe\" style=\"text-align:center;\"><input type=\"submit\" onclick=\"return confirmlink(this, '".AddSlashes(get_vocab("avertissement_effacement"))."', '".get_vocab("admin_config_calend1.php")."')\" name=\"ok\" value=\"".get_vocab("save")."\" /></div>\n";
echo "<div><input type=\"hidden\" name=\"record\" value=\"yes\" /></div>\n";
echo "</form>";
// fin de l'affichage de la colonne de droite
echo "</td></tr></table>";
?>
</body>
</html>

echo $twig->render('admin_calend_jour_cycle2.twig', array('liensMenu' => $menuAdminT, 'liensMenuN2' => $menuAdminTN2, 'trad' => $trad, 'settings' => $AllSettings, 'jourssemaines' => $jourssemaines));
?>

0 comments on commit c5f4533

Please sign in to comment.