[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14391] formatting
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14391] formatting |
Date: |
Tue, 17 Nov 2015 14:20:52 +0000 |
Revision: 14391
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14391
Author: sigurdne
Date: 2015-11-17 14:20:51 +0000 (Tue, 17 Nov 2015)
Log Message:
-----------
formatting
Modified Paths:
--------------
trunk/bookingfrontend/inc/class.uibuilding.inc.php
Modified: trunk/bookingfrontend/inc/class.uibuilding.inc.php
===================================================================
--- trunk/bookingfrontend/inc/class.uibuilding.inc.php 2015-11-17 00:25:34 UTC
(rev 14390)
+++ trunk/bookingfrontend/inc/class.uibuilding.inc.php 2015-11-17 14:20:51 UTC
(rev 14391)
@@ -22,27 +22,37 @@
public function information_screen()
{
- $today = new DateTime(phpgw::get_var('date', 'GET'), new
DateTimeZone('Europe/Oslo'));
+ $today = new DateTime(phpgw::get_var('date', 'string', 'GET'),
new DateTimeZone('Europe/Oslo'));
$date = $today;
+ $currentday = $today;//Sigurd: Needed?
- $building = $this->bo->read_single(phpgw::get_var('id', 'GET'));
- $start = phpgw::get_var('start', 'GET');
- $end = phpgw::get_var('end', 'GET');
- $res = phpgw::get_var('res', 'GET');
- $color = phpgw::get_var('color', 'GET');
- $fontsize = phpgw::get_var('fontsize', 'GET');
- $weekend = phpgw::get_var('weekend', 'GET');
+ $building_id = phpgw::get_var('id','int' ,'GET');
+ $building = $this->bo->read_single($building_id);
+ $start = phpgw::get_var('start', 'int', 'GET');
+ $end = phpgw::get_var('end', 'int', 'GET');
+ $res = phpgw::get_var('res', 'string', 'GET');
+ $color = phpgw::get_var('color', 'string','GET');
+ $fontsize = phpgw::get_var('fontsize', 'int', 'GET');
+ $weekend = phpgw::get_var('weekend', 'int','GET');
- if ($start != '')
+ if ($start)
+ {
$timestart = $start;
+ }
else
+ {
$timestart = 8;
+ }
- if ($end != '')
+ if ($end)
+ {
$timeend = $end;
+ }
else
+ {
$timeend = 22;
+ }
$timediff = $timeend - $timestart;
$cellwidth = 88 / ($timediff * 2);
@@ -57,15 +67,19 @@
"Sun" => "Søndag"
);
- $bookings =
$this->booking_bo->building_infoscreen_schedule(phpgw::get_var('id', 'GET'),
$date, $res);
+ $bookings =
$this->booking_bo->building_infoscreen_schedule($building_id, $date, $res);
$from = clone $date;
$from->setTime(0, 0, 0);
// Make sure $from is a monday
- if ($from->format('w') != 1) {
+ if ($from->format('w') != 1)
+ {
$from->modify('last monday');
if ($weekend == 1)
+ {
$from->modify('next Saturday');
- if ($weekend == 3) {
+ }
+ if ($weekend == 3)
+ {
$currentday = clone $date;
$currentday->setTime(0, 0, 0);
$from = $currentday;
@@ -97,16 +111,25 @@
'Sun' => array()
);
if ($weekend == 1)
+ {
$list = $list2;
+ }
elseif ($weekend == 2)
+ {
$list = $list3;
- elseif ($weekend == 3) {
+ }
+ elseif ($weekend == 3)
+ {
$day = $currentday->format('D');
$list = array($day => array());
- } else
+ }
+ else
+ {
$list = $list1;
+ }
- foreach ($list as $key => &$item) {
+ foreach ($list as $key => &$item)
+ {
$item = $bookings['results'][$key];
}
@@ -116,18 +139,24 @@
$html .= '<meta name="author" content="Bergen Kommune">';
$html .= '<style>';
$html .= 'body { font-size: 12px; padding: 0px; border-spacing: 0px;}
';
- if ($fontsize != '') {
+ if ($fontsize != '')
+ {
$html .= 'table { font-family: Tahoma, Verdana, Helvetica; width:
100%; height: 100%; margin: 0px; font-size: ' . $fontsize . 'px;
border-collapse: collapse;} ';
- } else {
+ }
+ else
+ {
$html .= 'table { font-family: Tahoma, Verdana,Helvetica; width:
100%; height: 100%; margin: 0px; font-size: 12px; border-collapse: collapse;} ';
}
$html .= 'th { text-align: left; padding: 2px 8px; border: 1px solid
black;} ';
$html .= 'td { font-weight: bold; text-align: left; padding: 4px 8px;
border: 1px solid black;} ';
$html .= 'tr.header { background-color: #333; color: white; } ';
- if ($color != '') {
+ if ($color != '')
+ {
$html .= 'td.data { background-color: #' . $color . '; } ';
- } else {
+ }
+ else
+ {
$html .= 'td.data { background-color: #ccffff; } ';
}
$html .= '</style>';
@@ -136,7 +165,8 @@
$html .= '<thead>';
$html .= '<tr>';
$html .= '<th colspan="2" style="text-align: left; width:
12%;">Bane</th>';
- while ($time < $timeend) {
+ while ($time < $timeend)
+ {
$html .= '<th colspan="1" style="width: ' . $cellwidth . '%;
text-align: left;">' . str_pad($time, 2, '0', STR_PAD_LEFT) . ':00</th>';
$html .= '<th colspan="1" style="width: ' . $cellwidth . '%;
text-align: left;">' . str_pad($time, 2, '0', STR_PAD_LEFT) . ':30</th>';
$time += 1;
@@ -147,9 +177,11 @@
$first = '';
$len = (($timeend - $timestart) * 2) + 2;
- foreach ($list as $day => $resources) {
+ foreach ($list as $day => $resources)
+ {
- if ($first != $day) {
+ if ($first != $day)
+ {
$first = $day;
$html .= '<tr class="header">';
$html .= '<td colspan="' . $len . '" width="12%">';
@@ -161,55 +193,78 @@
$from = date('d.m.Y', strtotime($from . ' 00:00:01 +1 day'));
}
- foreach ($resources as $res => $booking) {
+ foreach ($resources as $res => $booking)
+ {
$html .= '<tr>';
$html .= '<td colspan="2">';
$html .= $res;
$html .= '</td>';
$last = -1;
- foreach ($booking as $date => $value) {
+ foreach ($booking as $date => $value)
+ {
$time2 = $timestart;
$bftime = explode(':', substr($value['from_'], -8));
$bttime = explode(':', substr($value['to_'], -8));
if ($bftime[1] == 30)
+ {
$bftime = $bftime[0] + 0.5;
+ }
else
+ {
$bftime = intval($bftime[0]);
-
+ }
if ($bttime[1] == 30)
- $bttime = $bttime[0] + 0.5;
+ {
+ $bttime = $bttime[0] + 0.5;
+ }
else
- $bttime = intval($bttime[0]);
+ {
+ $bttime = intval($bttime[0]);
+ }
- while ($time2 < $timeend) {
-
- if ($bftime == $time2 && $time2 < $timeend) {
+ while ($time2 < $timeend)
+ {
+ if ($bftime == $time2 && $time2 < $timeend)
+ {
$last = $bttime;
$colspan = $value['colspan'];
- if ($bttime > $timeend) {
+ if ($bttime > $timeend)
+ {
$colspan = $value['colspan'] - ($bttime -
$timeend);
}
$testlen = 12 * $colspan;
$html .= '<td colspan="' . $colspan . '"
class="data" style="">';
if (strlen($value['name']) > $testlen)
+ {
$html .= $value['shortname'] . " ";
+ }
else
+ {
$html .= $value['name'] . " ";
+ }
$html .= '</td>';
- } elseif ($last === -1 && $bftime < $timestart &&
$bttime > $timestart) {
+ }
+ elseif ($last === -1 && $bftime
< $timestart && $bttime > $timestart)
+ {
$last = $bttime;
$colspan = ($bttime - $timestart) * 2;
$html .= '<td colspan="' . $colspan . '"
class="data" style="">';
$testlen = 12 * $colspan;
if (strlen($value['name']) > $testlen)
+ {
$html .= $value['shortname'] . " ";
+ }
else
+ {
$html .= $value['name'] . " ";
+ }
$html .= '</td>';
- } elseif ($last === -1 && $bftime != $timestart &&
$bftime < $timeend && $bftime > $timestart) {
+ }
+ elseif ($last === -1 && $bftime
!= $timestart && $bftime < $timeend && $bftime > $timestart)
+ {
$colspan = ($bftime - $timestart) * 2;
$html .= '<td colspan="' . $colspan . '">';
@@ -217,7 +272,9 @@
$html .= '</td>';
$last = $bttime;
- } elseif ($last != -1 && $bftime != $last && $time2 >
$last && $last < $bftime && $bftime < $timeend) {
+ }
+ elseif ($last != -1 && $bftime
!= $last && $time2 > $last && $last < $bftime && $bftime < $timeend)
+ {
$colspan = ($bftime - $last) * 2;
$html .= '<td colspan="' . $colspan . '">';
$html .= " ";
@@ -225,7 +282,8 @@
$last = $bttime;
}
- if ($time2 >= $timeend) {
+ if ($time2 >= $timeend)
+ {
$last = $timestart - 1;
}
$time2 += 0.5;
@@ -241,7 +299,7 @@
header('Content-type: text/html');
echo $html;
- exit;
+ $GLOBALS['phpgw']->common->phpgw_exit();
}
public function schedule()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14391] formatting,
Sigurd Nes <=