aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2004-05-16 19:39:13 +0000
committerChad Little <clittle@users.sourceforge.net>2004-05-16 19:39:13 +0000
commitb47c05d55b185ef979901f304121ac87d2abde75 (patch)
tree06004d1c3895f559b7437987f70b7a227703306b
parent65e1a82f6d7049e0acc4607e923b18f71ab4d9f4 (diff)
downloadphpicalendar-b47c05d55b185ef979901f304121ac87d2abde75.tar.gz
phpicalendar-b47c05d55b185ef979901f304121ac87d2abde75.tar.bz2
phpicalendar-b47c05d55b185ef979901f304121ac87d2abde75.zip
Print view wired for templates, XHTML valid.
-rw-r--r--functions/template.php49
-rw-r--r--print.php4
-rw-r--r--templates/default/print.tpl13
3 files changed, 42 insertions, 24 deletions
diff --git a/functions/template.php b/functions/template.php
index 6e1bf6b..1aad78e 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -17,13 +17,21 @@ class Page {
}
function draw_print($template_p) {
- global $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day;
+ global $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $printview, $dateFormat_day, $timeFormat, $week_start, $week_end, $lang;
+ preg_match("!<\!-- loop events on -->(.*)<\!-- loop events off -->!is", $this->page, $match1);
+ preg_match("!<\!-- switch some_events on -->(.*)<\!-- loop events on -->!is", $this->page, $match3);
+ $loop_event = trim($match1[1]);
+ $loop_day = trim($match3[1]);
+
foreach($master_array as $key => $val) {
ereg ("([0-9]{6})([0-9]{2})", $key, $regs);
if ((($regs[1] == $parse_month) && ($printview == "month")) || (($key == $getdate) && ($printview == "day")) || ((($key >= $week_start) && ($key <= $week_end)) && ($printview == "week"))) {
$events_week++;
$dayofmonth = strtotime ($key);
$dayofmonth = localizeDate ($dateFormat_day, $dayofmonth);
+ $events_tmp = $loop_event;
+ $day_tmp = $loop_day;
+ //echo $dayofmonth;
// Pull out each day
foreach ($val as $new_val) {
@@ -34,30 +42,39 @@ class Page {
$event_start = $new_val2["event_start"];
$event_end = $new_val2["event_end"];
if (isset($new_val2["display_end"])) $event_end = $new_val2["display_end"];
- $event_start = date ($timeFormat, strtotime ("$event_start"));
- $event_end = date ($timeFormat, strtotime ("$event_end"));
- $event_start = "$event_start - $event_end";
- if (!$new_val2["event_start"]) {
- $event_start = "$all_day_lang";
- $event_start2 = '';
- $event_end = '';
+ $event_start = date ($timeFormat, strtotime ($event_start));
+ $event_end = date ($timeFormat, strtotime ($event_end));
+ $event_start = "$event_start - $event_end";
+ if (!$new_val2["event_start"]) {
+ $event_start = $lang['l_all_day'];
+ $event_start2 = '';
+ $event_end = '';
+ }
}
- $middle = '';
-
- if ($new_val2["description"]) {
- $middle = '';
- }
- $middle = '';
+ if ($description == '') {
+ $events_tmp = preg_replace('!<\!-- switch description_events on -->(.*)<\!-- switch description_events off -->!is', '', $events_tmp);
}
+
+ $search = array('{EVENT_START}', '{EVENT_TEXT}', '{DESCRIPTION}');
+ $replace = array($event_start, $event_text, $description);
+ $events_tmp = str_replace($search, $replace, $events_tmp);
+ $some_events .= $events_tmp;
+ $events_tmp = $loop_event;
}
}
+ $day_tmp = str_replace('{DAYOFMONTH}', $dayofmonth, $day_tmp);
+ $final .= $day_tmp.$some_events;
+ unset ($day_tmp, $some_events);
}
}
if ($events_week < 1) {
- $middle = $no_events;
- }
+ $this->page = preg_replace('!<\!-- switch some_events on -->(.*)<\!-- switch some_events off -->!is', '', $this->page);
+ } else {
+ $this->page = preg_replace('!<\!-- switch some_events on -->(.*)<\!-- switch some_events off -->!is', $final, $this->page);
+ $this->page = preg_replace('!<\!-- switch no_events on -->(.*)<\!-- switch no_events off -->!is', '', $this->page);
+ }
}
function draw_week($template_p) {
diff --git a/print.php b/print.php
index 16124bb..103c715 100644
--- a/print.php
+++ b/print.php
@@ -82,9 +82,7 @@ $page->replace_tags(array(
'style_select' => $style_select
));
-$page->draw_day($this->page);
-$page->tomorrows_events($this->page);
-$page->get_vtodo($this->page);
+$page->draw_print($this->page);
$page->output();
diff --git a/templates/default/print.tpl b/templates/default/print.tpl
index f35cb90..110e350 100644
--- a/templates/default/print.tpl
+++ b/templates/default/print.tpl
@@ -10,9 +10,9 @@
<div style="padding-top: 3px;">
<table width="90" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
- <td><a class="psf" href="day.php?cal={CAL}&amp;getdate={GETDATE}"><img src="templates/{TEMPLATE}/images/day_on.gif" alt="{L_DAY}" border="0" /></a></td>
- <td><a class="psf" href="week.php?cal={CAL}&amp;getdate={GETDATE}"><img src="templates/{TEMPLATE}/images/week_on.gif" alt="{L_WEEK}" border="0" /></a></td>
- <td><a class="psf" href="month.php?cal={CAL}&amp;getdate={GETDATE}"><img src="templates/{TEMPLATE}/images/month_on.gif" alt="{L_MONTH}" border="0" /></a></td>
+ <td><a class="psf" href="print.php?cal={CAL}&amp;getdate={GETDATE}&amp;printview=day"><img src="templates/{TEMPLATE}/images/day_on.gif" alt="{L_DAY}" border="0" /></a></td>
+ <td><a class="psf" href="print.php?cal={CAL}&amp;getdate={GETDATE}&amp;printview=week"><img src="templates/{TEMPLATE}/images/week_on.gif" alt="{L_WEEK}" border="0" /></a></td>
+ <td><a class="psf" href="print.php?cal={CAL}&amp;getdate={GETDATE}&amp;printview=month"><img src="templates/{TEMPLATE}/images/month_on.gif" alt="{L_MONTH}" border="0" /></a></td>
</tr>
</table>
</div>
@@ -22,13 +22,14 @@
</td>
</tr>
<tr>
- <td colspan="3" class="dayborder"><img src="images/spacer.gif" width="1" height="5" alt=" "></td>
+ <td colspan="3" class="dayborder"><img src="images/spacer.gif" width="1" height="5" alt=" " /></td>
</tr>
<tr>
<td colspan="3">
<table border="0" cellspacing="0" cellpadding="5" width="100%">
<tr>
<td align="left" valign="top">
+ <!-- switch some_events on -->
<div class="V12"><b>{DAYOFMONTH}</b></div>
<!-- loop events on -->
<div style="padding: 6px;">
@@ -50,9 +51,10 @@
</table>
</div>
<!-- loop events off -->
+ <!-- switch some_events off -->
<!-- switch no_events on -->
- <div class="V12"><b>{L_ZERO_EVENTS}</b></div>
+ <div class="V12"><b>{L_NO_RESULTS}</b></div>
<!-- switch no_events off -->
</td>
</tr>
@@ -67,4 +69,5 @@
<td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /></td>
</tr>
</table>
+</center>
{FOOTER} \ No newline at end of file

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