Skip to content

Commit

Permalink
correctifs : bugs d'affichage et de calcul (entête flottant et heure …
Browse files Browse the repository at this point in the history
…de fin pour des réservations longues)
  • Loading branch information
ynaessens committed Oct 16, 2018
1 parent c3a2e80 commit afa5536
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 54 deletions.
24 changes: 10 additions & 14 deletions day.php
Expand Up @@ -3,7 +3,7 @@
* day.php
* Permet l'affichage de la page d'accueil lorsque l'on est en mode d'affichage "jour".
* Ce script fait partie de l'application GRR
* Dernière modification : $Date: 2018-10-02 19:00$
* Dernière modification : $Date: 2018-10-14 18:00$
* @author Laurent Delineau & JeromeB & Yan Naessens
* @copyright Copyright 2003-2018 Team DEVOME - JeromeB
* @link http://www.gnu.org/licenses/licenses.html
Expand Down Expand Up @@ -68,15 +68,9 @@
else
$type_session = "with_session";
// autres initialisations
if (@file_exists('./admin_access_area.php')){
$adm = 1;
$racine = "../";
$racineAd = "./";
}else{
$adm = 0;
$racine = "./";
$racineAd = "./admin/";
}
$adm = 0;
$racine = "./";
$racineAd = "./admin/";
// pour le traitement des modules
include $racine."/include/hook.class.php";

Expand Down Expand Up @@ -128,9 +122,9 @@
{
$start_t = max(round_t_down($row['1'], $resolution, $am7), $am7);
$end_t = min(round_t_up($row['2'], $resolution, $am7) - $resolution, $pm7);
$cellules[$row['4']] = ($end_t - $start_t) / $resolution + 1;
$cellules[$row['4']] = ($end_t - $start_t) / $resolution + 1; // à vérifier YN le 14/10/18
$compteur[$row['4']] = 0;
for ($t = $start_t; $t <= $end_t; $t += $resolution)
for ($t = $start_t; $t <= $end_t; $t += $resolution) // à vérifier YN le 14/10/18
{
$today[$row['0']][$t]["id"] = $row['4'];
$today[$row['0']][$t]["color"] = $row['5'];
Expand Down Expand Up @@ -362,7 +356,7 @@
echo "<tbody>";
$tab_ligne = 3;
$iii = 0;
for ($t = $am7; $t <= $pm7; $t += $resolution)
for ($t = $am7; $t < $pm7; $t += $resolution)
{
echo '<tr>'.PHP_EOL;
if ($iii % 2 == 1)
Expand Down Expand Up @@ -488,7 +482,9 @@
$clef = $row['3'];
$courrier = $row['4'];
if ($enable_periods != 'y') {
echo '<br/>',date('H:i', max($am7,$start_time)),get_vocab("to"),date('H:i', min($pm7,$end_time)),'<br/>';
$heure_fin = date('H:i',min($pm7,$end_time));
if ($heure_fin == '00:00') {$heure_fin = '24:00';}
echo '<br/>',date('H:i', max($am7,$start_time)),get_vocab("to"),$heure_fin,'<br/>';
}
if ($type_name != -1)
echo $type_name;
Expand Down
34 changes: 16 additions & 18 deletions include/functions.inc.php
Expand Up @@ -2,7 +2,7 @@
/**
* include/functions.inc.php
* fichier Bibliothèque de fonctions de GRR
* Dernière modification : $Date: 2018-10-08 16:30$
* Dernière modification : $Date: 2018-10-16 10:50$
* @author JeromeB & Laurent Delineau & Marc-Henri PAMISEUX & Yan Naessens
* @copyright Copyright 2003-2018 Team DEVOME - JeromeB
* @link http://www.gnu.org/licenses/licenses.html
Expand Down Expand Up @@ -1717,7 +1717,10 @@ function affiche_heure_creneau($t,$resolution)
$hour_min_format = "H:i";
else
$hour_min_format = "h:ia";
return date($hour_min_format,$t) ." - ".date($hour_min_format, $t + $resolution);
$heure_debut = date($hour_min_format,$t);
$heure_fin = date($hour_min_format, $t + $resolution);
if ($heure_fin == "00:00") $heure_fin = "24:00";
return $heure_debut." - ".$heure_fin;
}

function hour_min_format()
Expand Down Expand Up @@ -3845,26 +3848,24 @@ function get_planning_area_values($id_area)
else
$display_day[$i] = 0;
}
// Créneaux basés sur les intitulés
if ($row_[7] == 'y')
if ($row_[7] == 'y') // Créneaux basés sur les intitulés
{
$resolution = 60;
$morningstarts = 12;
$eveningends = 12;
$sql_periode = grr_sql_query("SELECT nom_periode FROM ".TABLE_PREFIX."_area_periodes where id_area='".$id_area."'");
$eveningends_minutes = grr_sql_count($sql_periode) - 1;
$i = 0;
while ($i < grr_sql_count($sql_periode))
while ($i <= $eveningends_minutes)
{
$periods_name[$i] = grr_sql_query1("SELECT nom_periode FROM ".TABLE_PREFIX."_area_periodes where id_area='".$id_area."' and num_periode= '".$i."'");
$i++;
}
$enable_periods = "y";
$weekstarts = $row_[5];
$twentyfourhour_format = $row_[6];
// Créneaux basés sur le temps
}
else
else // Créneaux basés sur le temps
{
if ($row_[0] != 'y')
{
Expand Down Expand Up @@ -4595,33 +4596,29 @@ function jQuery_TimePicker($typeTime, $start_hour, $start_min,$dureepardefaultse
else
$minute = date("m");


if ($typeTime == 'end_'){
$dureepardefautmin = $dureepardefaultsec/60;

if ($dureepardefautmin == 60){
$ajout = 1;
$hour = $_GET['hour'] + $ajout;
$minute ="00";
}

if ($dureepardefautmin < 60){
$hour = $_GET['hour'];
$minute =$dureepardefautmin;
}

if ($dureepardefautmin > 60){
$dureepardefautheure = $dureepardefautmin/60;
if (($dureepardefautheure % 60)!=0){
$hour = $_GET['hour']+ $dureepardefautheure;
$dureepardefautheure = $dureepardefautmin/60;
// if (($dureepardefautheure % 60)!=0){
// $hour = $_GET['hour']+ $dureepardefautheure;
$hour = ($_GET['hour']+ $dureepardefautheure)%24; // Modulo 24
$hour = str_pad($hour, 2, 0, STR_PAD_LEFT); // Affichage heure sur 2 digits
if ($_GET['minute'] == 30){
$minute =30;
}else{
$minute = "00";
};
}
// }
}
};

Expand Down Expand Up @@ -5146,8 +5143,8 @@ function pageHead2($title, $page = "with_session")
$a .= '<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>'.PHP_EOL;
$a .= '<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>'.PHP_EOL;
$a .= '<script type="text/javascript" src="js/html2canvas.js"></script>'.PHP_EOL;
$a .= '<script type="text/javascript" src="js/menu.js"></script>'.PHP_EOL;
$a .= '<script type="text/javascript" src="js/jquery.floatThead.min.js"></script>'.PHP_EOL;
$a .= '<script type="text/javascript" src="js/menu.js"></script>'.PHP_EOL;
$a .= '<script type="text/javascript" src="js/planning2Thead.js"></script>'.PHP_EOL;
$a .= '<script type="text/javascript" src="js/jspdf.min.js"></script>'.PHP_EOL;
$a .= '<script type="text/javascript" src="js/pdf.js" ></script>'.PHP_EOL;
Expand Down Expand Up @@ -5342,6 +5339,7 @@ function pageHeader2($day = '', $month = '', $year = '', $type_session = 'with_s
// echo '</table>'.PHP_EOL;
echo '</div>'.PHP_EOL;
echo '<a id="open" class="open" href="#"><span class="glyphicon glyphicon-arrow-up"><span class="glyphicon glyphicon-arrow-down"></span></span></a>'.PHP_EOL;
// echo '<a href="#" onClick="menuHaut()"><span class="glyphicon glyphicon-arrow-up"><span class="glyphicon glyphicon-arrow-down"></span></span></a>'.PHP_EOL;
// echo '</div>'.PHP_EOL;
}
}
Expand Down
17 changes: 17 additions & 0 deletions js/functions.js
Expand Up @@ -440,3 +440,20 @@ function afficheMenuGauche(mode){
$('.floatthead').floatThead('reflow');
}
}
/*
function menuHaut(){
var e=$("div#panel").is(":hidden");
if(e)
{
/*$("div#panel").show("slow");
document.getElementById("panel").style.display = "inline-block";
$('.floatthead').floatThead('reflow');
}
else
{
/* $("div#panel").hide("slow");
document.getElementById("panel").style.display = "none";
$('.floatthead').floatThead('reflow');
}
setCookie("open",e,365)
}*/
42 changes: 41 additions & 1 deletion js/menu.js
@@ -1 +1,41 @@
function setCookie(e,t,n){var r=new Date;r.setDate(r.getDate()+n);var i=escape(t)+(n==null?"":"; expires="+r.toUTCString());document.cookie=e+"="+i}function getCookie(e){var t,n,r,i=document.cookie.split(";");for(t=0;t<i.length;t++){n=i[t].substr(0,i[t].indexOf("="));r=i[t].substr(i[t].indexOf("=")+1);n=n.replace(/^\s+|\s+$/g,"");if(n==e){return unescape(r)}}}$(document).ready(function(){$("#open").click(function(){var e=$("div#panel").is(":hidden");if(e)$("div#panel").show("slow");else $("div#panel").hide("slow");setCookie("open",e,365)});var e=getCookie("open");if(e=="true"){$("div#panel").show()}else{$("div#panel").hide()}})
function setCookie(e,t,n){
var r=new Date;
r.setDate(r.getDate()+n);
var i=escape(t)+(n==null?"":"; expires="+r.toUTCString());
document.cookie=e+"="+i
}
function getCookie(e){
var t,n,r,i=document.cookie.split(";");
for(t=0;t<i.length;t++){
n=i[t].substr(0,i[t].indexOf("="));
r=i[t].substr(i[t].indexOf("=")+1);
n=n.replace(/^\s+|\s+$/g,"");
if(n==e){
return unescape(r)}
}
}
$(document).ready(function(){
$("#open").click(function(){
var e=$("div#panel").is(":hidden");
if(e)
{
$("div#panel").show();
$('.floatthead').floatThead('reflow')
}
else
{
$("div#panel").hide();
$('.floatthead').floatThead('reflow')
}
setCookie("open",e,365)
});
var e=getCookie("open");
if(e=="true"){
$("div#panel").show();
$('.floatthead').floatThead('reflow');
}
else{
$("div#panel").hide();
$('.floatthead').floatThead('reflow');
}
})
2 changes: 1 addition & 1 deletion js/planning2Thead.js
@@ -1,3 +1,3 @@
$(document).ready(function(){
$('.floatthead').floatThead();
$('.floatthead').floatThead({scrollContainer:true});
});
33 changes: 13 additions & 20 deletions week.php
Expand Up @@ -3,7 +3,7 @@
* week.php
* Permet l'affichage de la page d'accueil lorsque l'on est en mode d'affichage "semaine".
* Ce script fait partie de l'application GRR
* Dernière modification : $Date: 2018-10-02 19:00$
* Dernière modification : $Date: 2018-10-14 19:00$
* @author Laurent Delineau & JeromeB & Yan Naessens
* @copyright Copyright 2003-2018 Team DEVOME - JeromeB
* @link http://www.gnu.org/licenses/licenses.html
Expand Down Expand Up @@ -67,17 +67,11 @@
else
$type_session = "with_session";
// autres initialisations
if (@file_exists('./admin_access_area.php')){
$adm = 1;
$racine = "../";
$racineAd = "./";
}else{
$adm = 0;
$racine = "./";
$racineAd = "./admin/";
}
$adm = 0;
$racine = "./";
$racineAd = "./admin/";
// pour le traitement des modules
include $racine."/include/hook.class.php";
include "./include/hook.class.php";

if (!($desactive_VerifNomPrenomUser))
$desactive_VerifNomPrenomUser = 'n';
Expand Down Expand Up @@ -138,8 +132,6 @@
for($h=0; $h<3600; $h+=$this_area_resolution) {
$minutesFinCrenaux[] = date('i', $h);
}
// le titre du planning
// echo '<div class="titre_planning_week"> '.PHP_EOL;
if (($this_room_name_des) && ($this_room_name_des != "-1"))
$this_room_name_des = " (".$this_room_name_des.")";
else
Expand Down Expand Up @@ -192,7 +184,7 @@
$sql = "SELECT start_time, end_time, type, name, id, beneficiaire, statut_entry, description, option_reservation, moderate, beneficiaire_ext
FROM ".TABLE_PREFIX."_entry
WHERE room_id=$room
AND start_time < ".($week_end + $this_area_resolution)." AND end_time > $week_start ORDER BY start_time";
AND start_time < ".$week_end." AND end_time > $week_start ORDER BY start_time";
if ($enable_periods == 'y')
{
$first_slot = 0;
Expand All @@ -201,7 +193,7 @@
else
{
$first_slot = $morningstarts * 3600 / $resolution;
$last_slot = ($eveningends * 3600 + $eveningends_minutes * 60) / $resolution;
$last_slot = ($eveningends * 3600 + $eveningends_minutes * 60) / $resolution -1;
}
if ($debug_flag)
echo "<br />DEBUG: query=$sql <br />first_slot=$first_slot - last_slot=$last_slot\n";
Expand Down Expand Up @@ -253,15 +245,15 @@
if (date("d", $t) == $firstday) // Premier jour de réservation, Hdebut = Heure debut résa / Hfin = heure fin de journée / duree = (nb bloc d'une journée - nb bloc vides)
{
$d[$weekday][$slot]["horaireDebut"] = $t;
$d[$weekday][$slot]["horaireFin"] = mktime($eveningends, $eveningends_minutes+$this_area_resolution/60, 0, date('m',$t), date('d',$t), date('Y',$t));
$d[$weekday][$slot]["duree"] = (mktime($eveningends, $eveningends_minutes+$this_area_resolution/60, 0, date('m',$t), date('d',$t), date('Y',$t))-$t)/$this_area_resolution;
$d[$weekday][$slot]["horaireFin"] = mktime($eveningends, $eveningends_minutes, 0, date('m',$t), date('d',$t), date('Y',$t));
$d[$weekday][$slot]["duree"] = (mktime($eveningends, $eveningends_minutes, 0, date('m',$t), date('d',$t), date('Y',$t))-$t)/$this_area_resolution;
}
// Les jours entre les deux , Hdebut = Heure debut journée/ Hfin = heure fin journée / duree = ( h fin journée - h debut journée) * nb bloc pr 1h )
else
{
$d[$weekday][$slot]["horaireDebut"] = mktime($morningstarts, 0, 0, date('m',$t), date('d',$t), date('Y',$t));
$d[$weekday][$slot]["horaireFin"] = mktime($eveningends, $eveningends_minutes+$this_area_resolution/60, 0, date('m',$t), date('d',$t), date('Y',$t));
$d[$weekday][$slot]["duree"] = (($eveningends+1-$morningstarts)*$heigthSlotHoure);
$d[$weekday][$slot]["horaireFin"] = mktime($eveningends, $eveningends_minutes, 0, date('m',$t), date('d',$t), date('Y',$t));
$d[$weekday][$slot]["duree"] = (($eveningends+$eveningends_minutes/60-$morningstarts)*$heigthSlotHoure);
}
}
else // fin de réservation ne dépassant pas la fin de la journée ou dernière journée
Expand Down Expand Up @@ -499,7 +491,8 @@
$num_week_day = $weekstarts;
$k = $day_week;
$i = $time;
for ($t = $week_start; $t <= $week_end; $t += 86400)

for ($t = $week_start; $t < $week_end; $t += 86400)
{
$num_day = strftime("%d", $t);
$month_actuel = strftime("%m", $t);
Expand Down

0 comments on commit afa5536

Please sign in to comment.