diff options
author | Chad Little <clittle@users.sourceforge.net> | 2004-02-01 02:20:05 +0000 |
---|---|---|
committer | Chad Little <clittle@users.sourceforge.net> | 2004-02-01 02:20:05 +0000 |
commit | acf7bbae2c2bf83f913c88f8a7a7659c7f6c2d15 (patch) | |
tree | b1809b5de92d46fb5385c2541a2fac23053ee078 | |
parent | 9577dad4f3940246d3c1b89c5b5b41c7a34f874f (diff) | |
download | phpicalendar-acf7bbae2c2bf83f913c88f8a7a7659c7f6c2d15.tar.gz phpicalendar-acf7bbae2c2bf83f913c88f8a7a7659c7f6c2d15.tar.bz2 phpicalendar-acf7bbae2c2bf83f913c88f8a7a7659c7f6c2d15.zip |
Year templating is working.
-rw-r--r-- | functions/template.php | 61 | ||||
-rw-r--r-- | templates/default/month_large.tpl | 12 | ||||
-rw-r--r-- | templates/default/month_medium.tpl | 27 | ||||
-rw-r--r-- | templates/default/year.tpl | 18 | ||||
-rw-r--r-- | year.php | 3 |
5 files changed, 75 insertions, 46 deletions
diff --git a/functions/template.php b/functions/template.php index 12450af..52fc408 100644 --- a/functions/template.php +++ b/functions/template.php @@ -6,15 +6,15 @@ class Page { var $page; - function draw_month($template, $offset = '+0', $type) { - global $getdate, $master_array, $this_year, $this_month, $dateFormat_month, $week_start_day, $cal, $minical_view, $daysofweekreallyshort_lang, $daysofweek_lang, $timeFormat_small, $timeFormat; - preg_match("!<\!-- loop weekday on -->(.*)<\!-- loop weekday off -->!is", $template, $match1); - preg_match("!<\!-- loop monthdays on -->(.*)<\!-- loop monthdays off -->!is", $template, $match2); - preg_match("!<\!-- switch notthismonth on -->(.*)<\!-- switch notthismonth off -->!is", $template, $match3); - preg_match("!<\!-- switch istoday on -->(.*)<\!-- switch istoday off -->!is", $template, $match4); - preg_match("!<\!-- switch ismonth on -->(.*)<\!-- switch ismonth off -->!is", $template, $match5); - preg_match("!<\!-- loop monthweeks on -->(.*)<\!-- loop monthdays on -->!is", $template, $match6); - preg_match("!<\!-- loop monthdays off -->(.*)<\!-- loop monthweeks off -->!is", $template, $match7); + function draw_month($template_p, $offset = '+0', $type) { + global $template, $getdate, $master_array, $this_year, $this_month, $dateFormat_month, $week_start_day, $cal, $minical_view, $daysofweekreallyshort_lang, $daysofweekshort_lang, $daysofweek_lang, $timeFormat_small, $timeFormat; + preg_match("!<\!-- loop weekday on -->(.*)<\!-- loop weekday off -->!is", $template_p, $match1); + preg_match("!<\!-- loop monthdays on -->(.*)<\!-- loop monthdays off -->!is", $template_p, $match2); + preg_match("!<\!-- switch notthismonth on -->(.*)<\!-- switch notthismonth off -->!is", $template_p, $match3); + preg_match("!<\!-- switch istoday on -->(.*)<\!-- switch istoday off -->!is", $template_p, $match4); + preg_match("!<\!-- switch ismonth on -->(.*)<\!-- switch ismonth off -->!is", $template_p, $match5); + preg_match("!<\!-- loop monthweeks on -->(.*)<\!-- loop monthdays on -->!is", $template_p, $match6); + preg_match("!<\!-- loop monthdays off -->(.*)<\!-- loop monthweeks off -->!is", $template_p, $match7); $loop_wd = trim($match1[1]); $loop_md = trim($match2[1]); @@ -24,10 +24,16 @@ class Page { $startweek = trim($match6[1]); $endweek = trim($match7[1]); - $fake_getdate_time = strtotime($this_year.'-'.$this_month.'-15'); - $fake_getdate_time = strtotime("$offset month", $fake_getdate_time); + if ($type != 'medium') { + $fake_getdate_time = strtotime($this_year.'-'.$this_month.'-15'); + $fake_getdate_time = strtotime("$offset month", $fake_getdate_time); + } else { + $fake_getdate_time = strtotime($this_year.'-'.$offset.'-15'); + } + $start_day = strtotime($week_start_day); $month_title = localizeDate ($dateFormat_month, $fake_getdate_time); + if ($type == 'small') { $langtype = $daysofweekreallyshort_lang; } elseif ($type == 'medium') { @@ -76,9 +82,9 @@ class Page { $event_url = $val['url']; if (!isset($val['event_start'])) { if ($type == 'large') { - $switch['ALLDAY'] .= '<div align="left" class="V10">'; - $switch['ALLDAY'] .= openevent($event_calna, '', '', $val, $month_event_lines, 15, '', '', 'psf', $event_url); - $switch['ALLDAY'] .= '</div>'; + $switch['ALLDAY'] .= openevent($event_calna, '', '', $val, $month_event_lines, 15, '', '', 'psf', $event_url).'<br>'; + } else { + $switch['ALLDAY'] .= '<img src="templates/'.$template.'/images/allday_dot.gif" alt=" " width="11" height="10" border="0">'; } } else { $event_start = $val['start_unixtime']; @@ -87,9 +93,9 @@ class Page { $start2 = date($timeFormat_small, $val['start_unixtime']); $event_end = date($timeFormat, @strtotime ($event_end)); if ($type == 'large') { - $switch['EVENT'] .= '<div align="left" class="V9">'; - $switch['EVENT'] .= openevent($event_calna, $event_start, $event_end, $val, $month_event_lines, 10, "$start2 ", '', 'ps3', $event_url); - $switch['EVENT'] .= '</div>'; + $switch['EVENT'] .= openevent($event_calna, $event_start, $event_end, $val, $month_event_lines, 10, "$start2 ", '', 'ps3', $event_url).'<br>'; + } else { + $switch['EVENT'] = '<img src="templates/'.$template.'/images/event_dot.gif" alt=" " width="11" height="10" border="0">'; } } } @@ -97,6 +103,9 @@ class Page { } } + $switch['EVENT'] = (isset($switch['EVENT'])) ? $switch['EVENT'] : ''; + $switch['ALLDAY'] = (isset($switch['ALLDAY'])) ? $switch['ALLDAY'] : ''; + #print_r($switch); foreach ($switch as $tag => $data) { @@ -114,7 +123,7 @@ class Page { } } while ($whole_month == TRUE); - $return = preg_replace('!<\!-- loop weekday on -->(.*)<\!-- loop weekday off -->!is', $weekday_loop, $template); + $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 = str_replace('{MONTH_TITLE}', $month_title, $return); @@ -172,7 +181,19 @@ class Page { } } - // Small month builder + // Medium month builder + preg_match_all ('!(\{MONTH_MEDIUM\|[0-9][0-9]\})!is', $this->page, $match); + if (sizeof($match) > 0) { + $template_file = $this->parse('templates/'.$template.'/month_medium.tpl'); + foreach ($match[1] as $key => $val) { + $offset = str_replace('}', '', $val); + $offset = str_replace('{MONTH_MEDIUM|', '', $offset); + $data = $this->draw_month($template_file, $offset, 'medium'); + $this->page = str_replace($val, $data, $this->page); + } + } + + // Large month builder preg_match_all ('!(\{MONTH_LARGE\|[+|-][0-9]\})!is', $this->page, $match); if (sizeof($match) > 0) { $template_file = $this->parse('templates/'.$template.'/month_large.tpl'); @@ -183,6 +204,8 @@ class Page { $this->page = str_replace($val, $data, $this->page); } } + + // Replace any languages foreach ($lang as $tag => $data) { $this->page = str_replace('{' . strtoupper($tag) . '}', $data, $this->page); } diff --git a/templates/default/month_large.tpl b/templates/default/month_large.tpl index 0d02c56..d2c507e 100644 --- a/templates/default/month_large.tpl +++ b/templates/default/month_large.tpl @@ -16,8 +16,8 @@ <div align="right"> <a class="psf" href="day.php?cal={CAL}&getdate={DAYLINK}"><font class="G10G">{DAY}</font></a> </div> - {ALLDAY} - {EVENT} + <div align="left" class="V10">{ALLDAY}</div> + <div align="left" class="V9">{EVENT}</div> </td> <!-- switch notthismonth off --> <!-- switch istoday on --> @@ -25,8 +25,8 @@ <div align="right"> <a class="psf" href="day.php?cal={CAL}&getdate={DAYLINK}">{DAY}</a> </div> - {ALLDAY} - {EVENT} + <div align="left" class="V10">{ALLDAY}</div> + <div align="left" class="V9">{EVENT}</div> </td> <!-- switch istoday off --> <!-- switch ismonth on --> @@ -34,8 +34,8 @@ <div align="right"> <a class="psf" href="day.php?cal={CAL}&getdate={DAYLINK}">{DAY}</a> </div> - {ALLDAY} - {EVENT} + <div align="left" class="V10">{ALLDAY}</div> + <div align="left" class="V9">{EVENT}</div> </td> <!-- switch ismonth off --> <!-- loop monthdays off --> diff --git a/templates/default/month_medium.tpl b/templates/default/month_medium.tpl index 9039f12..231252e 100644 --- a/templates/default/month_medium.tpl +++ b/templates/default/month_medium.tpl @@ -1,6 +1,6 @@ <table border="0" width="210" cellspacing="0" cellpadding="0" class="calborder"> <tr> - <td align="center" class="sideback"><div style="height: 20px; margin-top: 3px;" class="G10BOLD"><a class="ps3" href="month.php?cal={CAL}&getdate={MONTH_DATE}">{MONTH_TITLE}</a></div></td> + <td align="center" class="sideback"><div style="height: 16px; margin-top: 3px;" class="G10BOLD"><a class="ps3" href="month.php?cal={CAL}&getdate={MONTH_DATE}">{MONTH_TITLE}</a></div></td> </tr> <tr> <td> @@ -8,29 +8,34 @@ <tr> <!-- loop weekday on --> <td width="30" height="14" class="dateback" align="center"><font class="V9BOLD">{LOOP_WEEKDAY}</font></td> - <!-- loop weekday on --> + <!-- loop weekday off --> </tr> <!-- loop monthweeks on --> <tr height="30"> <!-- loop monthdays on --> <!-- switch notthismonth on --> <td width="30" height="30" align="right" valign="top" class="monthoff" onmouseover="this.style.backgroundColor="#DDDDDD"" onmouseout="this.style.backgroundColor="#F2F2F2"" onclick="window.location.href='day.php?cal=all_calendars_combined971&getdate=20031228'"> - <a class="psf" href="day.php?cal={CAL}&getdate={DAYLINK}"><font class="V9G">28</font></a> + <div align="right" valign="top" class="V9"><a class="psf" href="day.php?cal={CAL}&getdate={DAYLINK}">{DAY}</a></div> </td> <!-- switch notthismonth off --> - <!-- switch ismonth on --> + <!-- switch istoday on --> <td width="30" height="30" align="right" valign="top" class="monthreg" onmouseover="this.style.backgroundColor="#DDDDDD"" onmouseout="this.style.backgroundColor="#FFFFFF"" onclick="window.location.href='day.php?cal=all_calendars_combined971&getdate=20040101'"> - <div align="right" valign="top" class="V9"> + <div align="right" valign="top" class="V9"><a class="psf" href="day.php?cal={CAL}&getdate={DAYLINK}">{DAY}</a></div> <div align="center" valign="top"> - <!-- switch allday on --> - <img src="styles/silver/allday_dot.gif" alt=" " width="11" height="10" border="0"> - <!-- switch allday off --> - <!-- switch event on --> - <img src="styles/silver/event_dot.gif" alt=" " width="11" height="10" border="0"> - <!-- switch event off --> + {ALLDAY} + {EVENT} </div> </td> + <!-- switch istoday off --> <!-- switch ismonth on --> + <td width="30" height="30" align="right" valign="top" class="monthreg" onmouseover="this.style.backgroundColor="#DDDDDD"" onmouseout="this.style.backgroundColor="#FFFFFF"" onclick="window.location.href='day.php?cal=all_calendars_combined971&getdate=20040101'"> + <div align="right" valign="top" class="V9"><a class="psf" href="day.php?cal={CAL}&getdate={DAYLINK}">{DAY}</a></div> + <div align="center" valign="top"> + {ALLDAY} + {EVENT} + </div> + </td> + <!-- switch ismonth off --> <!-- loop monthdays off --> </tr> <!-- loop monthweeks off --> diff --git a/templates/default/year.tpl b/templates/default/year.tpl index b69e338..f297cde 100644 --- a/templates/default/year.tpl +++ b/templates/default/year.tpl @@ -42,19 +42,19 @@ <table border="0" width="670" cellspacing="0" cellpadding="0"> <tr> <td width="210" valign="top" align="left"> - {MONTH_MEDIUM|1} + {MONTH_MEDIUM|01} </td> <td width="20"> <img src="images/spacer.gif" width="20" height="1" alt=" "> </td> <td width="210" valign="top" align="left"> - {MONTH_MEDIUM|2} + {MONTH_MEDIUM|02} </td> <td width="20"> <img src="images/spacer.gif" width="20" height="1" alt=" "> </td> <td width="210" valign="top" align="left"> - {MONTH_MEDIUM|3} + {MONTH_MEDIUM|03} </td> </tr> <tr> @@ -64,19 +64,19 @@ </tr> <tr> <td width="210" valign="top" align="left"> - {MONTH_MEDIUM|4} + {MONTH_MEDIUM|04} </td> <td width="20"> <img src="images/spacer.gif" width="20" height="1" alt=" "> </td> <td width="210" valign="top" align="left"> - {MONTH_MEDIUM|5} + {MONTH_MEDIUM|05} </td> <td width="20"> <img src="images/spacer.gif" width="20" height="1" alt=" "> </td> <td width="210" valign="top" align="left"> - {MONTH_MEDIUM|6} + {MONTH_MEDIUM|06} </td> </tr> <tr> @@ -86,19 +86,19 @@ </tr> <tr> <td width="210" valign="top" align="left"> - {MONTH_MEDIUM|7} + {MONTH_MEDIUM|07} </td> <td width="20"> <img src="images/spacer.gif" width="20" height="1" alt=" "> </td> <td width="210" valign="top" align="left"> - {MONTH_MEDIUM|8} + {MONTH_MEDIUM|08} </td> <td width="20"> <img src="images/spacer.gif" width="20" height="1" alt=" "> </td> <td width="210" valign="top" align="left"> - {MONTH_MEDIUM|9} + {MONTH_MEDIUM|09} </td> </tr> <tr> @@ -8,7 +8,7 @@ $current_view = 'year'; ereg ("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2); $this_day = $day_array2[3]; $this_month = $day_array2[2]; -$this_year = $day_array2[1]. '01'. '01'; +$this_year = $day_array2[1]; $display_date = $day_array2[1]; $unix_time = strtotime($getdate); @@ -36,6 +36,7 @@ $page->replace_tags(array( 'rss_available' => '', 'rss_valid' => '', 'todo_available' => '', + 'event_js' => '', 'show_search' => '', 'next_month' => $next_month, 'prev_month' => $prev_month, |