gunnar: server/kolab-horde-fbview/kolab-horde-fbview/fbview/kronolith/lib/FBView week.php, 1.1, 1.2
cvs at kolab.org
cvs at kolab.org
Fri Jan 12 10:34:12 CET 2007
Author: gunnar
Update of /kolabrepository/server/kolab-horde-fbview/kolab-horde-fbview/fbview/kronolith/lib/FBView
In directory doto:/tmp/cvs-serv23491
Modified Files:
week.php
Log Message:
2007-01-12 Gunnar Wrobel <wrobel at pardus.de>
* week.php: Fixed the position calculation since the day is
diplayed completely and not beginning at 9. Slightly improves
kolab issue 666.
Index: week.php
===================================================================
RCS file: /kolabrepository/server/kolab-horde-fbview/kolab-horde-fbview/fbview/kronolith/lib/FBView/week.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- week.php 31 Oct 2005 11:43:18 -0000 1.1
+++ week.php 12 Jan 2007 09:34:10 -0000 1.2
@@ -69,7 +69,7 @@
$html = $template->fetch(KRONOLITH_TEMPLATES . '/fbview/header.tpl');
$hours_html = '<table width="100%" cellpadding="0" cellspacing="0" style="text-align:center"><tr>';
- $dayWidth = 100 / 7;
+ $dayWidth = 100. / 7.;
$dayWidth_str = sprintf("%F",$dayWidth);
for ($i = 0; $i < 7; $i++) {
$t = mktime(0, 0, 0, date('n', $day), date('j', $day) + $i, date('Y', $day));
@@ -185,24 +185,18 @@
function _getBlocks($member, $periods, $blockfile, $label, $extra = array())
{
$template = &new Horde_Template();
-
$count = 0.;
$blocks = '';
- $dayWidth = 100. / 7.;
+ $dayWidth = 100 / 7;
foreach ($periods as $start => $end) {
if ($start < $this->_endStamp && $end > $this->_startStamp) {
-
$start_day = floor(($start - $this->_startStamp) / (24. * 3600.));
$start_hour = intval(strftime('%H', $start));
$start_min = intval(strftime('%M', $start));
$left = $dayWidth * $start_day;
- if ($start_hour >= 9 && $start_hour < 18) {
- $left += ($start_hour - 9) * ($dayWidth / 9);
- $left += ($start_min / 60) * ($dayWidth / 9);
- } elseif ($start_hour >= 18) {
- $left += $dayWidth;
- }
+ $left += $start_hour * ($dayWidth / 24.);
+ $left += $start_min * ($dayWidth / 1440.);
$left = min(100., max(0., $left));
$end_day = floor(($end - $this->_startStamp) / (24. * 3600.));
@@ -210,22 +204,18 @@
$end_min = intval(strftime('%M', $end));
$right = $dayWidth * $end_day;
- if ($end_hour >= 9 && $end_hour < 18) {
- $right += ($end_hour - 9) * ($dayWidth / 9);
- $right += ($end_min / 60) * ($dayWidth / 9);
- } elseif ($end_hour >= 18) {
- $right += $dayWidth;
- }
+ $right += $end_hour * ($dayWidth / 24.);
+ $right += $end_min * ($dayWidth / 1440.);
$right = min(100., $right);
- if( $left == $right ) {
- // This is the minimum interval we can display
- if( $left > 0 ) {
- $left -= 1;
- } else {
- $right += 1;
- }
- }
+ if( $right - $left < 2 ) {
+ // This is the minimum interval we can display
+ if( $right < 98 ) {
+ $right += 2;
+ } else {
+ $left -= 2;
+ }
+ }
if ( ($right - $left) != 0.) {
$template->set('left', sprintf("%F",$left));
$template->set('width', sprintf("%F",$right - $left));
More information about the commits
mailing list