aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2004-01-30 06:15:24 +0000
committerChad Little <clittle@users.sourceforge.net>2004-01-30 06:15:24 +0000
commite97ade7b2fc669793200aaa63eccf642fc5302a2 (patch)
treeb1e651a0ead6c53c56c5bc056830bafa85f27831
parent93650f0d9811512ded7c21cd7a0a67b3cc14b732 (diff)
downloadphpicalendar-e97ade7b2fc669793200aaa63eccf642fc5302a2.tar.gz
phpicalendar-e97ade7b2fc669793200aaa63eccf642fc5302a2.tar.bz2
phpicalendar-e97ade7b2fc669793200aaa63eccf642fc5302a2.zip
Work continues on month.php and templates.
-rw-r--r--functions/template.php28
-rw-r--r--month.php197
-rw-r--r--templates/default/calendar_nav.tpl46
-rw-r--r--templates/default/default.css2
-rw-r--r--templates/default/month.tpl64
5 files changed, 67 insertions, 270 deletions
diff --git a/functions/template.php b/functions/template.php
index c791eca..46a563f 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -1,7 +1,7 @@
<?php
-function draw_month($template, $offset = '+0') {
- global $getdate, $this_year, $this_month, $dateFormat_month, $week_start_day, $cal, $minical_view, $daysofweekreallyshort_lang;
+function draw_month($template, $offset = '+0', $type) {
+ global $getdate, $this_year, $this_month, $dateFormat_month, $week_start_day, $cal, $minical_view, $daysofweekreallyshort_lang, $daysofweek_lang;
ob_start();
include($template);
$template = ob_get_contents();
@@ -25,10 +25,17 @@ function draw_month($template, $offset = '+0') {
$fake_getdate_time = strtotime("$offset month", $fake_getdate_time);
$start_day = strtotime($week_start_day);
$month_title = localizeDate ($dateFormat_month, $fake_getdate_time);
+ if ($type == 'small') {
+ $type = $daysofweekreallyshort_lang;
+ } elseif ($type == 'medium') {
+ $type = $daysofweekshort_lang;
+ } elseif ($type == 'large') {
+ $type = $daysofweek_lang;
+ }
for ($i=0; $i<7; $i++) {
$day_num = date("w", $start_day);
- $weekday = $daysofweekreallyshort_lang[$day_num];
+ $weekday = $type[$day_num];
$start_day = strtotime("+1 day", $start_day);
$loop_tmp = str_replace('{LOOP_WEEKDAY}', $weekday, $loop_wd);
$weekday_loop .= $loop_tmp;
@@ -120,13 +127,26 @@ class Page {
function output() {
global $template;
+ // Small month builder
preg_match_all ('!(\{MONTH_SMALL\|[+|-][0-9]\})!is', $this->page, $match);
if (sizeof($match) > 0) {
foreach ($match[1] as $key => $val) {
$template_file = 'templates/'.$template.'/month_small.tpl';
$offset = str_replace('}', '', $val);
$offset = str_replace('{MONTH_SMALL|', '', $offset);
- $data = draw_month($template_file, $offset);
+ $data = draw_month($template_file, $offset, 'small');
+ $this->page = str_replace($val, $data, $this->page);
+ }
+ }
+
+ // Small month builder
+ preg_match_all ('!(\{MONTH_LARGE\|[+|-][0-9]\})!is', $this->page, $match);
+ if (sizeof($match) > 0) {
+ foreach ($match[1] as $key => $val) {
+ $template_file = 'templates/'.$template.'/month_large.tpl';
+ $offset = str_replace('}', '', $val);
+ $offset = str_replace('{MONTH_LARGE|', '', $offset);
+ $data = draw_month($template_file, $offset, 'large');
$this->page = str_replace($val, $data, $this->page);
}
}
diff --git a/month.php b/month.php
index 456f840..0cee7f2 100644
--- a/month.php
+++ b/month.php
@@ -39,7 +39,10 @@ $thisday2 = localizeDate($dateFormat_week_list, $unix_time);
$num_of_events2 = 0;
// select for calendars
-$list_icals = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED));
+$list_icals = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED));
+$list_years = list_years();
+$list_months = list_months();
+$list_weeks = list_weeks();
$page = new Page(BASE.'templates/'.$template.'/month.tpl');
@@ -57,11 +60,14 @@ $page->replace_tags(array(
'rss_available' => '',
'rss_valid' => '',
'todo_available' => '',
+ 'show_search' => '',
'next_month' => $next_month,
'prev_month' => $prev_month,
'show_goto' => '',
'list_icals' => $list_icals,
- 'startday_select' => $startday_select,
+ 'list_years' => $list_years,
+ 'list_months' => $list_months,
+ 'list_weeks' => $list_weeks,
'style_select' => $style_select,
'message' => $message
@@ -71,190 +77,3 @@ $page->replace_langs($lang);
$page->output();
-?>
-<center>
-<table width="735" border="0" cellspacing="0" cellpadding="0" class="calborder">
- <tr>
- <td align="center" valign="middle" bgcolor="white">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="left" width="120" class="navback">&nbsp;</td>
- <td class="navback">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="right" width="40%" class="navback"><?php echo "<a class=\"psf\" href=\"month.php?cal=$cal&amp;getdate=$prev_month\"><img src=\"styles/$style_sheet/left_day.gif\" alt=\"[$last_month_lang]\" border=\"0\" align=\"right\"></a>"; ?></td>
- <td align="center" width="20%" class="navback" nowrap valign="middle"><font class="H20"><?php echo $display_date; ?></font></td>
- <td align="left" width="40%" class="navback"><?php echo "<a class=\"psf\" href=\"month.php?cal=$cal&amp;getdate=$next_month\"><img src=\"styles/$style_sheet/right_day.gif\" alt=\"[$next_month_lang]\" border=\"0\" align=\"left\"></a>"; ?></td>
- </tr>
- </table>
- </td>
- <td align="right" width="120" class="navback">
- <table width="120" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><?php echo '<a class="psf" href="day.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/day_on.gif" alt="'.$day_view_lang.'" border="0"></a></td>'; ?>
- <td><?php echo '<a class="psf" href="week.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/week_on.gif" alt="'.$week_view_lang.'" border="0"></a></td>'; ?>
- <td><?php echo '<a class="psf" href="month.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/month_on.gif" alt="'.$month_view_lang.'" border="0"></a></td>'; ?>
- <td><?php echo '<a class="psf" href="year.php?cal='.$cal.'&amp;getdate='.$getdate.'"><img src="styles/'.$style_sheet.'/year_on.gif" alt="'.$year_view_lang.'" border="0"></a></td>'; ?>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td align="center" valign="top">
- <table width="100%" border="0" cellspacing="1" cellpadding="2" class="monthback">
- <tr>
- <?php
- // loops through 7 times, starts with $week_start_day
- $start_day = strtotime($week_start_day);
- for ($i=0; $i<7; $i++) {
- $day_num = date("w", $start_day);
- $day = $daysofweek_lang[$day_num];
- echo '<td valign="top" width="105" height="12" class="dateback"><center class="V9BOLD">'.$day.'</center></td>';
- $start_day = strtotime("+1 day", $start_day);
- }
- ?>
- </tr>
- <tr>
- <?php
- $sunday = strtotime("$start_month_day");
- $i = 0;
- $whole_month = TRUE;
- do {
- $day = date ("j", $sunday);
- $daylink = date ("Ymd", $sunday);
- $check_month = date ("m", $sunday);
- if ($check_month != $this_month) {
- $day = '<font class="G10G">'.$day.'</font>';
- $bgclass = 'class="monthoff"';
- } else {
- if ($today_today == $daylink) {
- $bgclass = 'class="monthon"';
- } else {
- $bgclass = 'class="monthreg"';
- }
- }
- if ($i == 0) echo '<tr height="105">';
- if (isset($master_array[("$daylink")])) {
- echo '<td valign="top" align="left" '.$bgclass.' width="105" height="105">';
- echo '<div align="right"><font class="G10"><a class="psf" href="day.php?cal='.$cal.'&amp;getdate='.$daylink.'">'.$day.'</a></font></div>';
- echo '<div align="left">';
- if ($master_array[("$daylink")]) {
- foreach ($master_array[("$daylink")] as $event_times) {
- foreach ($event_times as $val) {
- $num_of_events2++;
- $event_calno = $val['calnumber'];
- $event_calna = $val['calname'];
- $event_url = $val['url'];
- if (!isset($val["event_start"])) {
- echo '<div align="center" class="V10">';
- openevent($event_calna, '', '', $val, $month_event_lines, 15, '<i>', '</i>', 'psf', $event_url);
- echo '</div>';
- } else {
- echo '<div align="left" class="V9">&nbsp;';
- $event_start = @$val["start_unixtime"];
- $event_end = @$val["event_end"];
- if (isset($val['display_end'])) $event_end = $val['display_end'];
- $event_star = date($timeFormat, $event_start);
- $start2 = date($timeFormat_small, $event_start);
- $event_end = date($timeFormat, @strtotime ("$event_end"));
- openevent($event_calna, $event_star, $event_end, $val, $month_event_lines, 10, "$start2 ", '', 'ps3', $event_url);
- echo '</div>';
- }
- }
- }
- }
- echo '</div>';
- echo '</td>';
- } else {
- echo '<td align="center" valign="top" '.$bgclass.' width="105" height="105">';
- echo '<div align="right"><font class="G10"><a class="psf" href="day.php?cal='.$cal.'&amp;getdate='.$daylink.'">'.$day.'</a></font></div>';
- echo '</td>';
- }
- $sunday = strtotime("+1 day", $sunday);
- $i++;
- if ($i == 7) {
- echo '</tr>';
- $i = 0;
- $checkagain = date ("m", $sunday);
- if ($checkagain != $this_month) $whole_month = FALSE;
- }
- } while ($whole_month == TRUE);
- ?>
- </table>
- </td>
- </tr>
-</table>
-<?php include (BASE.'includes/calendar_nav.php'); ?>
-<?php if (($this_months_events == "yes") && ($num_of_events2 > 0)) { ?>
-<br>
- <table width="737" border="0" cellspacing="0" cellpadding="3" class="calborder">
- <tr>
- <td colspan="3" align="center" class="sideback" nowrap><div style="height: 16px;" class="G10BOLD"><?php echo "$this_months_lang"; ?></div></td>
- </tr>
- <?php
- $first_time = TRUE;
- // Iterate the entire master array
- foreach($master_array as $key => $val) {
-
- // Pull out only this months
- ereg ("([0-9]{6})([0-9]{2})", $key, $regs);
- if ($regs[1] == $parse_month) {
- $dayofmonth = strtotime ($key);
- $dayofmonth = localizeDate ($dateFormat_week_list, $dayofmonth);
- $i = 0;
- if ($today_today == $key) {
- $fontclass="G10BOLD";
- } else {
- $fontclass="G10B";
- }
-
- // Pull out each day
- foreach ($val as $new_val) {
-
- // Pull out each time
- foreach ($new_val as $new_key2 => $new_val2) {
- $event_calno = $new_val2['calnumber'];
- $event_calna = $new_val2['calname'];
- $event_url = $new_val2['url'];
-
- if ($new_val2["event_text"]) {
- if (isset($new_val2["event_start"])) {
- $event_start = $new_val2["start_unixtime"];
- $event_end = $new_val2["event_end"];
- if (isset($new_val2['display_end'])) $event_end = $new_val2['display_end'];
- $event_start = date ($timeFormat, $event_start);
- $event_end = date ($timeFormat, strtotime ("$event_end"));
- $event_start2 = $event_start;
- } else {
- $event_start = "$all_day_lang";
- $event_start2 = '';
- $event_end = '';
- }
-
- echo "<tr align=\"left\" valign=\"top\">\n";
- echo "<td width =\"155\" class=\"$fontclass\" nowrap><a class=\"psf\" href=\"day.php?cal=$cal&amp;getdate=$key\">$dayofmonth</a> <font class=\"V9G\">($event_start)</font></td>\n";
- if ($first_time == TRUE) {
- echo "<td width=\"5\" class=\"montheventline\" rowspan=\"$num_of_events2\"></td>";
- $first_time = FALSE;
- }
- echo "<td>\n";
- openevent($event_calna, $event_start, $event_end, $new_val2, 0, 65, '<font class="G10B">', '</font>', 'psf', $event_url);
- echo "</td>\n";
- echo "</tr>\n";
- }
-
- }
- }
- }
- }
-
- ?>
- </table>
-<?php } ?>
-</center>
-<?php include (BASE.'includes/footer.inc.php'); ?>
-
-
diff --git a/templates/default/calendar_nav.tpl b/templates/default/calendar_nav.tpl
index 8ac5386..e0cfa47 100644
--- a/templates/default/calendar_nav.tpl
+++ b/templates/default/calendar_nav.tpl
@@ -7,25 +7,33 @@
<table border="0" width="330" cellspacing="0" cellpadding="0">
<tr>
<td width="160" valign="top">
- <div style="padding: 5px;">
- <form style="margin-bottom:0;" action="day.php" method="GET">
- <select name="action" class="query_style" onChange="window.location=(this.options[this.selectedIndex].value">{LIST_ICALS}</select><br>
- {LIST_YEARS}<br>
- {LIST_MONTHS}<br>
- {LIST_WEEKS}<br>
- <br>
- </form>
- <!-- switch show_search on -->
- {SEARCH_BOX}
- <!-- switch show_search off -->
- <!-- switch show_goto on -->
- <form style="margin-bottom:0;" action="day.php" method="GET">
- <input type="hidden" name="cal" value="{URL_CAL}">
- <input type="text" style="width:160px; font-size:10px" name="jumpto_day">
- <input type="submit" value="Go">
- </form>
- <!-- switch show_goto off -->
- </div>
+ <table width="170" border="0" cellpadding="3" cellspacing="0" class="calborder">
+ <tr height="20">
+ <td align="center" class="sideback"><b>{L_JUMP_TO}</b></td>
+ </tr>
+ <tr>
+ <td>
+ <div style="padding: 5px;">
+ <form style="margin-bottom:0;" action="day.php" method="GET">
+ <select name="action" class="query_style" onChange="window.location=(this.options[this.selectedIndex].value">{LIST_ICALS}</select><br>
+ <select name="action" class="query_style" onChange="window.location=(this.options[this.selectedIndex].value">{LIST_YEARS}</select><br>
+ <select name="action" class="query_style" onChange="window.location=(this.options[this.selectedIndex].value">{LIST_MONTHS}</select><br>
+ <select name="action" class="query_style" onChange="window.location=(this.options[this.selectedIndex].value">{LIST_WEEKS}</select><br>
+ </form>
+ <!-- switch show_search on -->
+ {SEARCH_BOX}
+ <!-- switch show_search off -->
+ <!-- switch show_goto on -->
+ <form style="margin-bottom:0;" action="day.php" method="GET">
+ <input type="hidden" name="cal" value="{URL_CAL}">
+ <input type="text" style="width:160px; font-size:10px" name="jumpto_day">
+ <input type="submit" value="Go">
+ </form>
+ <!-- switch show_goto off -->
+ </div>
+ </td>
+ </tr>
+ </table>
</td>
<td>
<img src="images/spacer.gif" width="20" height="1" alt=" ">
diff --git a/templates/default/default.css b/templates/default/default.css
index 876ed3e..9a1c328 100644
--- a/templates/default/default.css
+++ b/templates/default/default.css
@@ -1,5 +1,7 @@
/* Style sheet for the silver calendar (default) */
+table, td {font: 11px Verdana, Arial, sans-serif; color: #000;}
+
.eventborder { background-image: url(images/day_title.gif); border: 1px #006699 solid; }
.eventbg { background-color: #6699CC; }
diff --git a/templates/default/month.tpl b/templates/default/month.tpl
index b0aba24..be0135c 100644
--- a/templates/default/month.tpl
+++ b/templates/default/month.tpl
@@ -10,7 +10,7 @@
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" width="40%" class="navback"><a class="psf" href="month.php?cal={CAL}&amp;getdate={PREV_MONTH}"><img src="templates/{TEMPLATE}/images/left_day.gif" alt="{L_PREV}" border="0" align="right"></a></td>
- <td align="center" width="20%" class="navback" nowrap valign="middle"><font class="H20">{MONTH_TITLE}</font></td>
+ <td align="center" width="20%" class="navback" nowrap valign="middle"><font class="H20">{DISPLAY_DATE}</font></td>
<td align="left" width="40%" class="navback"><a class="psf" href="month.php?cal={CAL}&amp;getdate={NEXT_MONTH}"><img src="templates/{TEMPLATE}/images/right_day.gif" alt="{L_NEXT}" border="0" align="left"></a></td>
</tr>
</table>
@@ -22,74 +22,21 @@
<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="year.php?cal={CAL}&amp;getdate={GETDATE}"><img src="templates/{TEMPLATE}/images/year_on.gif" alt="{L_YEAR}" border="0"></a></td>
- </tr>
+ </tr>
</table>
</td>
</tr>
</table>
</td>
- </tr>
- <tr>
- <td align="center" valign="top">
- <table width="100%" border="0" cellspacing="1" cellpadding="2" class="monthback">
- <tr>
- <!-- loop weekday on -->
- <td valign="top" width="105" height="12" class="dateback">
- <center class="V9BOLD">
- {LOOP_WEEKDAY}
- </center>
- </td>
- <!-- loop weekday off -->
- </tr>
- <!-- loop monthweeks on -->
- <tr height="105">
- <!-- switch notthismonth on -->
- <td valign="top" align="left" class="monthoff" width="105" height="105">
- <div align="right">
- <font class="G10"><a class="psf" href="day.php?cal={CAL}&amp;getdate={DAYLINK}"><font class="G10G">{DAY}</font></a></font>
- </div>
- <div align="left">
- <div align="left" class="V9">
- &nbsp; {JS_OPEN_EVENT} <a class="ps3" href="#" onclick="openEventWindow({EVENT_NUMBER}); return false;">{EVENT_TITLE}</a>
- </div>
- </div>
- </td>
- <!-- switch notthismonth off -->
- <!-- switch isevent on -->
- <td valign="top" align="left" class="monthreg" width="105" height="105">
- <div align="right">
- <font class="G10"><a class="psf" href="day.php?cal={CAL}&amp;getdate={DAYLINK}">{DAY}</a></font>
- </div>
- <div align="left">
- <div align="left" class="V9">
- &nbsp; {JS_OPEN_EVENT} <a class="ps3" href="#" onclick="openEventWindow({EVENT_NUMBER}); return false;">{EVENT_TITLE}</a>
- </div>
- </div>
- </td>
- <!-- switch isevent off -->
- <!-- switch notevent on -->
- <td valign="top" align="left" class="monthreg" width="105" height="105">
- <div align="right">
- <font class="G10"><a class="psf" href="day.php?cal={CAL}&amp;getdate={DAYLINK}">{DAY}</a></font>
- </div>
- <div align="left">
- <div align="left" class="V9">
- &nbsp; {JS_OPEN_EVENT} <a class="ps3" href="#" onclick="openEventWindow({EVENT_NUMBER}); return false;">{EVENT_TITLE}</a>
- </div>
- </div>
- </td>
- <!-- switch notevent off -->
- </tr>
- <!-- loop monthweeks off -->
- </table>
- </td>
- </tr>
+ </tr>
</table>
+ {MONTH_LARGE|+0}
<br>
{CALENDAR_NAV}
<!-- switch showbottom on -->
<br>
<table width="737" border="0" cellspacing="0" cellpadding="3" class="calborder">
+ <!-- loop showbottomevents on -->
<tr>
<td colspan="3" align="center" class="sideback" nowrap>
<div style="height: 16px;" class="G10BOLD">
@@ -106,6 +53,7 @@
{JS_OPENEVENT}<a class="psf" href="#" onclick="openEventWindow({EVENT_NUMBER}); return false;"><font class="G10B">{EVENT_TEXT}</font></a>
</td>
</tr>
+ <!-- loop showbottomevents off -->
</table>
<!-- switch showbottom off -->
</center>

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