aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2004-05-16 04:13:28 +0000
committerChad Little <clittle@users.sourceforge.net>2004-05-16 04:13:28 +0000
commit8102e20b3c38f4164d902f02b2c9823f917c8cec (patch)
treefdd892f8248f708d5ee0896eb817b57cc0a3aaa1
parent8767e4b66fffb6010646f92a77b267e5e254d2d0 (diff)
downloadphpicalendar-8102e20b3c38f4164d902f02b2c9823f917c8cec.tar.gz
phpicalendar-8102e20b3c38f4164d902f02b2c9823f917c8cec.tar.bz2
phpicalendar-8102e20b3c38f4164d902f02b2c9823f917c8cec.zip
Fixed week template, streamlined CSS.
-rw-r--r--functions/template.php82
-rw-r--r--templates/default/default.css30
-rw-r--r--templates/default/week.tpl13
3 files changed, 65 insertions, 60 deletions
diff --git a/functions/template.php b/functions/template.php
index 3c2eefe..561787b 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -61,13 +61,32 @@ class Page {
}
function draw_week($template_p) {
- global $start_week_time, $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength;
+ global $start_week_time, $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $timeFormat_small;
+
+ // Figure out colspans
+ $dayborder = 0;
+ $thisdate = $start_week_time;
+ $swt = $start_week_time;
+ for ($i=0;$i<7;$i++) {
+ $thisday = date("Ymd", $thisdate);
+ $nbrGridCols[$thisday] = 1;
+ if (isset($master_array[$thisday])) {
+ foreach($master_array[($thisday)] as $ovlKey => $ovlValue) {
+ if ($ovlKey != "-1") {
+ foreach($ovlValue as $ovl2Value) {
+ $nbrGridCols[($thisday)] = kgv($nbrGridCols[($thisday)], ($ovl2Value["event_overlap"] + 1));
+ }
+ }
+ }
+ }
+ $thisdate = ($thisdate + (25 * 60 * 60));
+ }
for ($i=0; $i<7; $i++) {
$thisdate = date ('Ymd', $start_week_time);
$weekarray[$i] = $thisdate;
$start_week_time = strtotime('+1 day', $start_week_time);
- }
+ }
// Replaces the allday events
preg_match("!<\!-- loop allday on -->(.*)<\!-- loop allday off -->!is", $this->page, $match1);
@@ -77,7 +96,9 @@ class Page {
$loop_begin = trim($match2[1]);
$loop_end = trim($match3[1]);
foreach ($weekarray as $key => $get_date) {
- $replace = $loop_begin;
+ $replace = $loop_begin;
+ $colspan = 'colspan="'.$nbrGridCols[$get_date].'"';
+ $replace = str_replace('{COLSPAN}', $colspan, $replace);
if (is_array($master_array[$get_date]['-1'])) {
foreach ($master_array[$get_date]['-1'] as $allday) {
$event_calno = $allday['calnumber'];
@@ -121,32 +142,15 @@ class Page {
}
$start_day = strtotime("+1 day", $start_day);
$start_wt = strtotime("+1 day", $start_wt);
- $loop_tmp = str_replace('{DAY}', $weekday, $loop_dof);
- $loop_tmp = str_replace('{DAYLINK}', $daylink, $loop_tmp);
- $loop_tmp = str_replace('{ROW1}', $row1, $loop_tmp);
- $loop_tmp = str_replace('{ROW2}', $row2, $loop_tmp);
- $loop_tmp = str_replace('{ROW3}', $row3, $loop_tmp);
+ $colspan = 'colspan="'.$nbrGridCols[$daylink].'"';
+ $search = array('{DAY}', '{DAYLINK}', '{ROW1}', '{ROW2}', '{ROW3}', '{COLSPAN}');
+ $replace = array($weekday, $daylink, $row1, $row2, $row3, $colspan);
+ $loop_tmp = str_replace($search, $replace, $loop_dof);
$weekday_loop .= $loop_tmp;
}
$this->page = preg_replace('!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!is', $weekday_loop, $this->page);
// Build the body
- $dayborder = 0;
- $thisdate = $start_week_time;
- for ($i=0;$i<7;$i++) {
- $thisday = date("Ymd", $thisdate);
- $nbrGridCols[$thisday] = 1;
- if (isset($master_array[$thisday])) {
- foreach($master_array[($thisday)] as $ovlKey => $ovlValue) {
- if ($ovlKey != "-1") {
- foreach($ovlValue as $ovl2Value) {
- $nbrGridCols[($thisday)] = kgv($nbrGridCols[($thisday)], ($ovl2Value["event_overlap"] + 1));
- }
- }
- }
- }
- $thisdate = ($thisdate + (25 * 60 * 60));
- }
preg_match("!<\!-- loop row on -->(.*)<\!-- loop row off -->!is", $this->page, $match2);
preg_match("!<\!-- loop event on -->(.*)<\!-- loop event off -->!is", $this->page, $match3);
$loop_hours = trim($match2[1]);
@@ -158,7 +162,7 @@ class Page {
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
- $thisdate = $start_week_time;
+ $thisdate = $swt;
for ($i=0;$i<7;$i++) {
$thisday = date("Ymd", $thisdate);
$event_length[$thisday] = array ();
@@ -173,21 +177,20 @@ class Page {
if (ereg("([0-9]{1,2}):00", $key)) {
$weekdisplay .= '<tr>';
- $weekdisplay .= '<td rowspan="' . (60 / $gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>';
+ $weekdisplay .= '<td colspan="4" rowspan="' . (60 / $gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>';
$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength . '"></td>';
} elseif ($cal_time == $day_start) {
$size_tmp = 60 - (int)substr($cal_time,2,2);
$weekdisplay .= '<tr>';
- $weekdisplay .= '<td rowspan="' . ($size_tmp / $gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>';
+ $weekdisplay .= '<td colspan="4" rowspan="' . ($size_tmp / $gridLength) . '" align="center" valign="top" width="60" class="timeborder">'.$key.'</td>';
$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength . '"></td>';
} else {
-
$weekdisplay .= '<tr>';
$weekdisplay .= '<td bgcolor="#a1a5a9" width="1" height="' . $gridLength . '"></td>';
}
// initialize $thisdate again
- $thisdate = $start_week_time;
+ $thisdate = $swt;
// loop this part 7 times, one for each day
for ($week_loop=0; $week_loop<7; $week_loop++) {
@@ -240,7 +243,9 @@ class Page {
$dayborder = 0;
}
- $weekdisplay .= "<td colspan=\"" . $nbrGridCols[$thisday] . "\" $class>&nbsp;</td>\n";
+ $drawWidth = 1;
+ $colspan_width = round((80 / $nbrGridCols[$thisday]) * $drawWidth);
+ $weekdisplay .= "<td width=\"$colspan_width\" colspan=\"" . $nbrGridCols[$thisday] . "\" $class>&nbsp;</td>\n";
} else {
$emptyWidth = $nbrGridCols[$thisday];
@@ -252,7 +257,7 @@ class Page {
case "begin":
$event_length[$thisday][$i]["state"] = "started";
$event_start = $this_time_arr[($event_length[$thisday][$i]["key"])]["start_unixtime"];
- $event_start = date ($timeFormat, $event_start);
+ $event_start = date ($timeFormat_small, $event_start);
$event_calno = $this_time_arr[($event_length[$thisday][$i]['key'])]['calnumber'];
$event_status = strtolower($this_time_arr[($event_length[$thisday][$i]['key'])]['status']);
if ($event_calno < 1) $event_calno = 1;
@@ -260,7 +265,8 @@ class Page {
if ($event_status != '') {
$confirmed = '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
}
- $weekdisplay .= '<td rowspan="' . $event_length[$thisday][$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n";
+ $colspan_width = round((80 / $nbrGridCols[$thisday]) * $drawWidth);
+ $weekdisplay .= '<td width="'.$colspan_width.'" rowspan="' . $event_length[$thisday][$i]['length'] . '" colspan="' . $drawWidth . '" align="left" valign="top" class="eventbg2_'.$event_calno.'">'."\n";
$event_end = $this_time_arr[($event_length[$thisday][$i]["key"])]["end_unixtime"];
if (isset($this_time_arr[($event_length[$thisday][$i]["key"])]['display_end'])) $event_end = strtotime ($this_time_arr[($event_length[$thisday][$i]["key"])]['display_end']);
@@ -356,11 +362,9 @@ class Page {
}
$start_day = strtotime("+1 day", $start_day);
$start_wt = strtotime("+1 day", $start_wt);
- $loop_tmp = str_replace('{DAY}', $weekday, $loop_dof);
- $loop_tmp = str_replace('{DAYLINK}', $daylink, $loop_tmp);
- $loop_tmp = str_replace('{ROW1}', $row1, $loop_tmp);
- $loop_tmp = str_replace('{ROW2}', $row2, $loop_tmp);
- $loop_tmp = str_replace('{ROW3}', $row3, $loop_tmp);
+ $search = array('{DAY}', '{DAYLINK}', '{ROW1}', '{ROW2}', '{ROW3}');
+ $replace = array($weekday, $daylink, $row1, $row2, $row3);
+ $loop_tmp = str_replace($search, $replace, $loop_dof);
$weekday_loop .= $loop_tmp;
}
$this->page = preg_replace('!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!is', $weekday_loop, $this->page);
@@ -526,7 +530,7 @@ class Page {
}
function tomorrows_events() {
- global $template, $getdate, $master_array, $next_day, $timeFormat;
+ global $template, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines;
preg_match("!<\!-- switch t_allday on -->(.*)<\!-- switch t_allday off -->!is", $this->page, $match1);
preg_match("!<\!-- switch t_event on -->(.*)<\!-- switch t_event off -->!is", $this->page, $match2);
@@ -571,7 +575,7 @@ class Page {
}
function get_vtodo() {
- global $template, $getdate, $master_array, $next_day, $timeFormat;
+ global $template, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines;
preg_match("!<\!-- switch show_completed on -->(.*)<\!-- switch show_completed off -->!is", $this->page, $match1);
preg_match("!<\!-- switch show_important on -->(.*)<\!-- switch show_important off -->!is", $this->page, $match2);
diff --git a/templates/default/default.css b/templates/default/default.css
index 8d8eab5..584c6e8 100644
--- a/templates/default/default.css
+++ b/templates/default/default.css
@@ -82,30 +82,30 @@ table, td {font: 11px Verdana, Arial, sans-serif; color: #000;}
/* Link colors and attributes */
/* This is the main link style */
a.psf { text-decoration: none; }
-a.psf:link { color: #0066FF; background-color: transparent; }
-a.psf:visited { color: #0066FF; background-color: transparent; }
-a.psf:active { color: #3366CC; background-color: transparent; }
-a.psf:hover { color: #000099; background-color: transparent; }
+a.psf:link { color: #0066FF; }
+a.psf:visited { color: #0066FF; }
+a.psf:active { color: #3366CC; }
+a.psf:hover { color: #000099; text-decoration: underline; }
/* This is the link style for the mini-cals */
a.ps2 { text-decoration: underline; }
-a.ps2:link { color: #0066FF; background-color: transparent; }
-a.ps2:visited { color: #0066FF; background-color: transparent; }
-a.ps2:active { color: #3366CC; background-color: transparent; }
-a.ps2:hover { color: #000099; background-color: transparent; }
+a.ps2:link { color: #0066FF; }
+a.ps2:visited { color: #0066FF; }
+a.ps2:active { color: #3366CC; }
+a.ps2:hover { color: #000099; }
/* This is the link style for year months */
a.ps3 { text-decoration: none; }
-a.ps3:link { color: #000; background-color: transparent; }
-a.ps3:visited { color: #000; background-color: transparent; }
-a.ps3:active { color: #000; background-color: transparent; }
-a.ps3:hover { color: #000; background-color: transparent; }
+a.ps3:link { color: #000; }
+a.ps3:visited { color: #000; }
+a.ps3:active { color: #000; }
+a.ps3:hover { color: #000; text-decoration: underline; }
/* This is the link style for events */
a.ps { text-decoration: none; }
-a.ps:link { color: #fff; background-color: transparent; }
-a.ps:visited { color: #fff; background-color: transparent; }
-a.ps:active { color: #fff; background-color: transparent; }
+a.ps:link { color: #fff; }
+a.ps:visited { color: #fff; }
+a.ps:active { color: #fff; }
a.ps:hover { color: #fff; text-decoration: underline; }
/* Body attributes */
diff --git a/templates/default/week.tpl b/templates/default/week.tpl
index 40f6096..6323dbd 100644
--- a/templates/default/week.tpl
+++ b/templates/default/week.tpl
@@ -44,26 +44,27 @@
<td align="right" valign="top" width="15" class="rowOff" onmouseover="this.className='rowOn'" onmouseout="this.className='rowOff'" onclick="window.location.href='week.php?cal={CAL}&amp;getdate={NEXT_WEEK}'">
<div class="V12"><a class="psf" href="week.php?cal={CAL}&amp;getdate={NEXT_WEEK}">&raquo;</a>&nbsp;</div>
</td>
+ <td width="1"></td>
<!-- loop daysofweek on -->
- <td width="80" align="center" class="{ROW1}" onmouseover="this.className='{ROW2}'" onmouseout="this.className='{ROW3}'" onclick="window.location.href='week.php?cal={CAL}&amp;getdate={DAYLINK}'">
+ <td width="80" {COLSPAN} align="center" class="{ROW1}" onmouseover="this.className='{ROW2}'" onmouseout="this.className='{ROW3}'" onclick="window.location.href='week.php?cal={CAL}&amp;getdate={DAYLINK}'">
<a class="ps3" href="day.php?cal={CAL}&amp;getdate={DAYLINK}"><span class="V9BOLD">{DAY}</span></a>
</td>
<!-- loop daysofweek off -->
</tr>
<tr valign="top">
- <td width="60" class="rowOff2" colspan="4">
+ <td width="60" class="rowOff2" colspan="4"><img src="images/spacer.gif" width="60" height="1" alt=" " /></td>
+ <td width="1"></td>
<!-- loop alldaysofweek on -->
- <td width="80" class="rowOff">
+ <td width="80" {COLSPAN} class="rowOff">
<!-- loop allday on -->
<div class="alldaybg_{CALNO}">
<b>{EVENT}</b>
+ <img src="images/spacer.gif" width="80" height="1" alt=" " />
</div>
<!-- loop allday off -->
</td>
<!-- loop alldaysofweek off -->
</tr>
- </table>
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
<!-- loop row on -->
<tr>
<td rowspan="4" align="center" valign="top" width="60" class="timeborder">9:00 AM</td>
@@ -105,7 +106,7 @@
</table>
</td>
<td width="10">
- <img src="images/spacer.gif" width="10" height="1" alt=" ">
+ <img src="images/spacer.gif" width="10" height="1" alt=" " />
</td>
<td width="170" valign="top">
{SIDEBAR}

© 2014-2024 Faster IT GmbH | imprint | privacy policy