aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2004-02-08 08:10:28 +0000
committerChad Little <clittle@users.sourceforge.net>2004-02-08 08:10:28 +0000
commitb4b1947362e1b6d92ce23b44b626ebbaabb401b4 (patch)
treecff0fd68e15e3fb6defa818473dff79e47d11b8d
parentf05a34e21a46cf60223e1f8bccd58e0a6e7b0248 (diff)
downloadphpicalendar-b4b1947362e1b6d92ce23b44b626ebbaabb401b4.tar.gz
phpicalendar-b4b1947362e1b6d92ce23b44b626ebbaabb401b4.tar.bz2
phpicalendar-b4b1947362e1b6d92ce23b44b626ebbaabb401b4.zip
Continued work on week.tpl. Allday is now wired. Replaced all ereg's on
tempate with preg to increase template speed.
-rw-r--r--functions/template.php102
-rw-r--r--templates/default/day.tpl4
-rw-r--r--templates/default/default.css10
-rw-r--r--templates/default/week.tpl86
-rw-r--r--week.php2
5 files changed, 143 insertions, 61 deletions
diff --git a/functions/template.php b/functions/template.php
index 882ecf9..acd5d8d 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -12,9 +12,6 @@ class Page {
$events_week++;
$dayofmonth = strtotime ($key);
$dayofmonth = localizeDate ($dateFormat_day, $dayofmonth);
- echo "<tr><td width=\"10\"><img src=\"images/spacer.gif\" width=\"10\" height=\"1\" alt=\" \"></td>\n";
- echo "<td align=\"left\" colspan=\"2\"><font class=\"V12\"><b>$dayofmonth</b></font></td></tr>";
- echo "<tr><td colspan=\"3\"><img src=\"images/spacer.gif\" width=\"1\" height=\"5\" alt=\" \"></td></tr>\n";
// Pull out each day
foreach ($val as $new_val) {
@@ -51,8 +48,81 @@ 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;
+
+ 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);
+ preg_match("!<\!-- loop alldaysofweek on -->(.*)<\!-- loop allday on -->!is", $this->page, $match2);
+ preg_match("!<\!-- loop allday off -->(.*)<\!-- loop alldaysofweek off -->!is", $this->page, $match3);
+ $loop_ad = trim($match1[1]);
+ $loop_begin = trim($match2[1]);
+ $loop_end = trim($match3[1]);
+ foreach ($weekarray as $key => $get_date) {
+ $replace = $loop_begin;
+ if (is_array($master_array[$get_date]['-1'])) {
+ foreach ($master_array[$get_date]['-1'] as $allday) {
+ $event_calno = $allday['calnumber'];
+ $event_calna = $allday['calname'];
+ $event_url = $allday['url'];
+ if ($event_calno < 1) $event_calno=1;
+ if ($event_calno > 7) $event_calno=7;
+ $event = openevent($event_calna, '', '', $allday, 1, 11, '<span class="V9W">', '</span>', 'psf', $event_url);
+ $loop_tmp = str_replace('{EVENT}', $event, $loop_ad);
+ $loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp);
+ $replace .= $loop_tmp;
+ }
+ }
+ $replace .= $loop_end;
+ $weekreplace .= $replace;
+ }
+ $this->page = preg_replace('!<\!-- loop alldaysofweek on -->(.*)<\!-- loop alldaysofweek off -->!is', $weekreplace, $this->page);
+
+ // Replaces the daysofweek
+ preg_match("!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!is", $this->page, $match1);
+ $loop_dof = trim($match1[1]);
+ $start_wt = strtotime(dateOfWeek($getdate, $week_start_day));
+ $start_day = strtotime($week_start_day);
+ for ($i=0; $i<7; $i++) {
+ $day_num = date("w", $start_day);
+ $daylink = date('Ymd', $start_wt);
+ if ($current_view == 'day') {
+ $weekday = $daysofweek_lang[$day_num];
+ } else {
+ $weekday = localizeDate($dateFormat_week_list, strtotime($daylink));
+ }
+
+ if ($daylink == $getdate) {
+ $row1 = 'rowToday';
+ $row2 = 'rowOn';
+ $row3 = 'rowToday';
+ } else {
+ $row1 = 'rowOff';
+ $row2 = 'rowOn';
+ $row3 = 'rowOff';
+ }
+ $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);
+ $weekday_loop .= $loop_tmp;
+ }
+ $this->page = preg_replace('!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!is', $weekday_loop, $this->page);
+
+
+ }
+
function draw_day($template_p) {
- global $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day;
+ global $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view;
// Replaces the allday events
$replace = '';
@@ -71,7 +141,7 @@ class Page {
$replace .= $loop_tmp;
}
}
- $this->page = ereg_replace('<!-- loop allday on -->(.*)<!-- loop allday off -->', $replace, $this->page);
+ $this->page = preg_replace('!<\!-- loop allday on -->(.*)<\!-- loop allday off -->!is', $replace, $this->page);
// Replaces the daysofweek
preg_match("!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!is", $this->page, $match1);
@@ -80,8 +150,12 @@ class Page {
$start_day = strtotime($week_start_day);
for ($i=0; $i<7; $i++) {
$day_num = date("w", $start_day);
- $weekday = $daysofweek_lang[$day_num];
$daylink = date('Ymd', $start_wt);
+ if ($current_view == 'day') {
+ $weekday = $daysofweek_lang[$day_num];
+ } else {
+ $weekday = localizeDate($dateFormat_week_list, strtotime($daylink));
+ }
if ($daylink == $getdate) {
$row1 = 'rowToday';
$row2 = 'rowOn';
@@ -100,7 +174,7 @@ class Page {
$loop_tmp = str_replace('{ROW3}', $row3, $loop_tmp);
$weekday_loop .= $loop_tmp;
}
- $this->page = ereg_replace('<!-- loop daysofweek on -->(.*)<!-- loop daysofweek off -->', $weekday_loop, $this->page);
+ $this->page = preg_replace('!<\!-- loop daysofweek on -->(.*)<\!-- loop daysofweek off -->!is', $weekday_loop, $this->page);
}
@@ -139,12 +213,12 @@ class Page {
}
}
- $this->page = ereg_replace('<!-- switch t_allday on -->(.*)<!-- switch t_allday off -->', $replace_ad, $this->page);
- $this->page = ereg_replace('<!-- switch t_event on -->(.*)<!-- switch t_event off -->', $replace_e, $this->page);
+ $this->page = preg_replace('!<\!-- switch t_allday on -->(.*)<\!-- switch t_allday off -->!is', $replace_ad, $this->page);
+ $this->page = preg_replace('!<\!-- switch t_event on -->(.*)<\!-- switch t_event off -->!is', $replace_e, $this->page);
} else {
- $this->page = ereg_replace('<!-- switch tomorrows_events on -->(.*)<!-- switch tomorrows_events off -->', '', $this->page);
+ $this->page = preg_replace('!<\!-- switch tomorrows_events on -->(.*)<\!-- switch tomorrows_events off -->!is', '', $this->page);
}
}
@@ -203,7 +277,7 @@ class Page {
$nugget2 .= $nugget1;
}
}
- $this->page = ereg_replace('<!-- switch show_completed on -->(.*)<!-- switch show_normal off -->', $nugget2, $this->page);
+ $this->page = preg_replace('!<\!-- switch show_completed on -->(.*)<\!-- switch show_normal off -->!is', $nugget2, $this->page);
}
}
}
@@ -328,7 +402,7 @@ class Page {
} while ($whole_month == TRUE);
$return = preg_replace('!<\!-- loop weekday on -->(.*)<\!-- loop weekday off -->!is', $weekday_loop, $template_p);
- $return = ereg_replace('<!-- loop monthweeks on -->(.*)<!-- loop monthweeks off -->', $middle, $return);
+ $return = preg_replace('!<\!-- loop monthweeks on -->(.*)<\!-- loop monthweeks off -->!is', $middle, $return);
$return = str_replace('{MONTH_TITLE}', $month_title, $return);
$return = str_replace('{CAL}', $cal, $return);
@@ -385,7 +459,7 @@ class Page {
unset ($switch);
} while ($this_month == $check_month);
- $this->page = ereg_replace('<!-- loop showbottomevents_odd on -->(.*)<!-- loop showbottomevents_even off -->', $middle, $this->page);
+ $this->page = preg_replace('!<\!-- loop showbottomevents_odd on -->(.*)<\!-- loop showbottomevents_even off -->!is', $middle, $this->page);
}
@@ -413,7 +487,7 @@ class Page {
// This removes any unfilled tags
if (!$data) {
- $this->page = ereg_replace('<!-- switch ' . $tag . ' on -->(.*)<!-- switch ' . $tag . ' off -->', '', $this->page);
+ $this->page = preg_replace('!<\!-- switch ' . $tag . ' on -->(.*)<\!-- switch ' . $tag . ' off -->!is', '', $this->page);
}
// This replaces any tags
diff --git a/templates/default/day.tpl b/templates/default/day.tpl
index e2a3142..e2c214e 100644
--- a/templates/default/day.tpl
+++ b/templates/default/day.tpl
@@ -24,9 +24,9 @@
</tr>
<tr>
<td colspan="2">
- <table width="100%" border="0" cellspacing="1" cellpadding="2">
+ <table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
- <td align="left" valign="top" width="20" class="rowOff" onmouseover="this.className='rowOn'" onmouseout="this.className='rowOff'" onclick="window.location.href='day.php?cal={CAL}&amp;getdate={PREV_DAY}'">
+ <td align="left" valign="top" width="20" class="rowOff2" onmouseover="this.className='rowOn2'" onmouseout="this.className='rowOff2'" onclick="window.location.href='day.php?cal={CAL}&amp;getdate={PREV_DAY}'">
<span class="V12"><a class="psf" href="day.php?cal={CAL}&amp;getdate={PREV_DAY}">&laquo;</a></span>
</td>
<!-- loop daysofweek on -->
diff --git a/templates/default/default.css b/templates/default/default.css
index 63b499d..40e7afe 100644
--- a/templates/default/default.css
+++ b/templates/default/default.css
@@ -15,9 +15,11 @@ table, td {font: 11px Verdana, Arial, sans-serif; color: #000;}
.alldaybg_6 {background: url(images/allday_6.gif) repeat-x; height: 19px; padding-top: 5px; text-align: center;}
.alldaybg_7 {background: url(images/allday_7.gif) repeat-x; height: 19px; padding-top: 5px; text-align: center;}
-.rowOn { background-color: #cfc; }
-.rowOff { background-color: #E1E8F1; }
-.rowToday { background-color: #cff; }
+.rowOn { background-color: #cfc; border-top: 1px solid #fff; border-left: 1px solid #fff; }
+.rowOn2 { background-color: #cfc; border-top: 1px solid #fff; }
+.rowOff { background-color: #E1E8F1; border-top: 1px solid #fff; border-left: 1px solid #fff; }
+.rowOff2 { background-color: #E1E8F1; border-top: 1px solid #fff; border-left: }
+.rowToday { background-color: #cff; border-top: 1px solid #fff; border-left: 1px solid #fff; }
@@ -92,7 +94,7 @@ a.ps3 { text-decoration: none; }
a.ps3:link { color: #000000; background-color: transparent; }
a.ps3:visited { color: #000000; background-color: transparent; }
a.ps3:active { color: #000000; background-color: transparent; }
-a.ps3:hover { color: #000000; background-color: transparent; text-decoration: underline;}
+a.ps3:hover { color: #000000; background-color: transparent; }
/* Body attributes */
diff --git a/templates/default/week.tpl b/templates/default/week.tpl
index 3fa2114..3d9eba7 100644
--- a/templates/default/week.tpl
+++ b/templates/default/week.tpl
@@ -30,124 +30,130 @@
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B">
<tr>
<td align="center" valign="top">
- <table width="100%" border="0" cellspacing="0" cellpadding="2">
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
- <td align="left" valign="top" width="30" class="rowOff" onmouseover="this.className='rowOn'" onmouseout="this.className='rowOff'" onclick="window.location.href='week.php?cal={CAL}&amp;getdate={PREV_WEEKK}'">
- <span class="V12">&nbsp;&nbsp;<a class="psf" href="week.php?cal={CAL}&amp;getdate={PREV_WEEK}">&laquo;</a></span>
+ <td align="left" valign="top" width="15" class="rowOff2" onmouseover="this.className='rowOn2'" onmouseout="this.className='rowOff2'" onclick="window.location.href='week.php?cal={CAL}&amp;getdate={PREV_WEEK}'">
+ <div class="V12">&nbsp;<a class="psf" href="week.php?cal={CAL}&amp;getdate={PREV_WEEK}">&laquo;</a></div>
</td>
- <td align="right" valign="top" width="30" class="rowOff" onmouseover="this.className='rowOn'" onmouseout="this.className='rowOff'" onclick="window.location.href='week.php?cal={CAL}&amp;getdate={NEXT_WEEK}'">
- <span class="V12"><a class="psf" href="week.php?cal={CAL}&amp;getdate={NEXT_WEEK}">&raquo;</a>&nbsp;&nbsp;</span>
+ <td align="left" valign="top" width="15" class="rowOff" onmouseover="this.className='rowOn'" onmouseout="this.className='rowOff'" onclick="window.location.href='week.php?cal={CAL}&amp;getdate={PREV_DAY}'">
+ <div class="V12">&nbsp;<a class="psf" href="week.php?cal={CAL}&amp;getdate={PREV_DAY}">&lsaquo;</a></div>
+ </td>
+ <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_DAY}'">
+ <div class="V12"><a class="psf" href="week.php?cal={CAL}&amp;getdate={NEXT_DAY}">&rsaquo;</a>&nbsp;</div>
+ </td>
+ <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>
<!-- loop daysofweek on -->
- <td width="80" align="center" class="{ROW1}" onmouseover="this.className='{ROW2}'" onmouseout="this.className='{ROW3}'" onclick="window.location.href='day.php?cal={CAL}&amp;getdate={DAYLINK}'">
- <a class="psf" href="day.php?cal={CAL}&amp;getdate={DAYLINK}"><span class="V9">{DAY}</span></a>
+ <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}'">
+ <a class="ps3" href="week.php?cal={CAL}&amp;getdate={DAYLINK}"><span class="V9BOLD">{DAY}</span></a>
</td>
<!-- loop daysofweek off -->
</tr>
- <tr>
- <td width="60" class="rowOff" colspan="2">
+ <tr valign="top">
+ <td width="60" class="rowOff2" colspan="4">
<!-- loop alldaysofweek on -->
- <td>
+ <td width="80" class="rowOff">
<!-- loop allday on -->
<div class="alldaybg_{CALNO}">
- {EVENT}
+ <b>{EVENT}</b>
</div>
<!-- loop allday off -->
</td>
<!-- loop alldaysofweek off -->
</tr>
<tr>
- <td rowspan="4" align="center" valign="top" width="60" class="timeborder" colspan="2">
+ <td colspan="4" rowspan="4" align="center" valign="top" width="60" class="timeborder">
8:00 AM
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80" colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80" colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80" colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80" colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
</tr>
<tr>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
</tr>
<tr>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
</tr>
<tr>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
- <td bgcolor="#ffffff" colspan="1" class="weekborder">
+ <td width="80"colspan="1" class="weekborder">
&nbsp;
</td>
</tr>
diff --git a/week.php b/week.php
index 88f4bd6..a9c42f9 100644
--- a/week.php
+++ b/week.php
@@ -70,7 +70,7 @@ $page->replace_tags(array(
'style_select' => $style_select
));
-$page->draw_day($this->page);
+$page->draw_week($this->page);
$page->tomorrows_events($this->page);
$page->get_vtodo($this->page);

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