aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2004-08-08 05:55:17 +0000
committerChad Little <clittle@users.sourceforge.net>2004-08-08 05:55:17 +0000
commit24757cf84fd2e4642ed68a0d48bb8ff75cc8d938 (patch)
treedaa4acf1d1e92ed71fd0ae72eaebd8414476d8f2 /functions
parent0b3393545875f1442ea270bd54ced763b6fe54ba (diff)
downloadphpicalendar-24757cf84fd2e4642ed68a0d48bb8ff75cc8d938.tar.gz
phpicalendar-24757cf84fd2e4642ed68a0d48bb8ff75cc8d938.tar.bz2
phpicalendar-24757cf84fd2e4642ed68a0d48bb8ff75cc8d938.zip
Cleaned up calendar colors and added error message for caching.
Diffstat (limited to 'functions')
-rw-r--r--functions/ical_parser.php10
-rw-r--r--functions/list_functions.php7
-rw-r--r--functions/template.php25
3 files changed, 21 insertions, 21 deletions
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 6eece29..9dd8e8f 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -1153,11 +1153,11 @@ if ($parse_file) {
// write the new master array to the file
if (isset($master_array) && is_array($master_array) && $save_parsed_cals == 'yes') {
$write_me = serialize($master_array);
- $fd = fopen($parsedcal, 'w');
- fwrite($fd, $write_me);
- fclose($fd);
- touch($parsedcal, $realcal_mtime);
- //echo 'writing file';
+ $fd = @fopen($parsedcal, 'w');
+ if ($fd == FALSE) exit(error($lang['l_error_cache'], $filename));
+ @fwrite($fd, $write_me);
+ @fclose($fd);
+ @touch($parsedcal, $realcal_mtime);
}
}
diff --git a/functions/list_functions.php b/functions/list_functions.php
index cfc1745..1927a68 100644
--- a/functions/list_functions.php
+++ b/functions/list_functions.php
@@ -11,9 +11,12 @@ function list_jumps() {
}
function list_calcolors() {
- global $template, $master_array;
+ global $template, $master_array, $unique_colors;
+ $i = 1;
foreach ($master_array['-3'] as $key => $val) {
- $return .= '<img src="templates/'.$template.'/images/monthdot_'.$key.'.gif" alt="" /> '.$val.'<br />';
+ if ($i > $unique_colors) $i = 1;
+ $return .= '<img src="templates/'.$template.'/images/monthdot_'.$i.'.gif" alt="" /> '.$val.'<br />';
+ $i++;
}
return $return;
}
diff --git a/functions/template.php b/functions/template.php
index 78ad822..f376bab 100644
--- a/functions/template.php
+++ b/functions/template.php
@@ -116,7 +116,7 @@ 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, $timeFormat_small, $day_start;
+ global $unique_colors, $start_week_time, $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $timeFormat_small, $day_start;
// Figure out colspans
$dayborder = 0;
@@ -159,8 +159,7 @@ class Page {
$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;
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
$event = openevent($event_calna, '', '', $allday, 1, 11, '', '', 'psf', $event_url);
$loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad);
$loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp);
@@ -317,8 +316,7 @@ class Page {
$event_calna = $this_time_arr[($event_length[$thisday][$i]['key'])]['calname'];
$event_url = $this_time_arr[($event_length[$thisday][$i]['key'])]['url'];
$event_status = strtolower($this_time_arr[($event_length[$thisday][$i]['key'])]['status']);
- if ($event_calno < 1) $event_calno = 1;
- if ($event_calno > 7) $event_calno = 7;
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
if ($event_status != '') {
$confirmed = '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
}
@@ -372,7 +370,7 @@ class Page {
}
function draw_day($template_p) {
- global $template, $getdate, $cal, $master_array, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $day_start;
+ global $template, $getdate, $cal, $master_array, $unique_colors, $daysofweek_lang, $week_start_day, $dateFormat_week_list, $current_view, $day_array, $timeFormat, $gridLength, $day_start;
// Replaces the allday events
$replace = '';
@@ -383,8 +381,7 @@ class Page {
$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;
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
$event = openevent($event_calna, '', '', $allday, 0, '', '', '', '', $event_url);
$loop_tmp = str_replace('{ALLDAY}', $event, $loop_ad);
$loop_tmp = str_replace('{CALNO}', $event_calno, $loop_tmp);
@@ -531,8 +528,7 @@ class Page {
$event_calno = $this_time_arr[($event_length[$i]['key'])]['calnumber'];
$event_recur = $this_time_arr[($event_length[$i]['key'])]['recur'];
$event_status = strtolower($this_time_arr[($event_length[$i]['key'])]['status']);
- if ($event_calno < 1) $event_calno = 1;
- if ($event_calno > 7) $event_calno = 7;
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
if ($event_status != '') {
$confirmed = '<img src="images/'.$event_status.'.gif" width="9" height="9" alt="" border="0" hspace="0" vspace="0" />&nbsp;';
} elseif (is_array($event_recur)) {
@@ -706,7 +702,7 @@ class Page {
}
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, $month_event_lines, $daysofweekreallyshort_lang, $daysofweekshort_lang, $daysofweek_lang, $timeFormat_small, $timeFormat;
+ global $template, $getdate, $master_array, $this_year, $this_month, $unique_colors, $dateFormat_month, $week_start_day, $cal, $minical_view, $month_event_lines, $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);
@@ -774,12 +770,13 @@ class Page {
if ($type != 'small') {
foreach ($master_array[$daylink] as $event_times) {
foreach ($event_times as $val) {
- $calno = $val['calnumber'];
+ $event_calno = $val['calnumber'];
+ if ($event_calno > $unique_colors) $event_calno = ($event_calno - $unique_colors);
$event_calna = $val['calname'];
$event_url = $val['url'];
if (!isset($val['event_start'])) {
if ($type == 'large') {
- $switch['ALLDAY'] .= '<div class="V10"><img src="templates/'.$template.'/images/monthdot_'.$calno.'.gif" alt="" width="9" height="9" border="0" />';
+ $switch['ALLDAY'] .= '<div class="V10"><img src="templates/'.$template.'/images/monthdot_'.$event_calno.'.gif" alt="" width="9" height="9" border="0" />';
$switch['ALLDAY'] .= openevent($event_calna, '', '', $val, $month_event_lines, 15, '', '', 'psf', $event_url);
$switch['ALLDAY'] .= '</div>';
} else {
@@ -792,7 +789,7 @@ class Page {
$start2 = date($timeFormat_small, $val['start_unixtime']);
$event_end = date($timeFormat, @strtotime ($event_end));
if ($type == 'large') {
- $switch['EVENT'] .= '<div class="V9"><img src="templates/'.$template.'/images/monthdot_'.$calno.'.gif" alt="" width="9" height="9" border="0" />';
+ $switch['EVENT'] .= '<div class="V9"><img src="templates/'.$template.'/images/monthdot_'.$event_calno.'.gif" alt="" width="9" height="9" border="0" />';
$switch['EVENT'] .= openevent($event_calna, $event_start, $event_end, $val, $month_event_lines, 10, "$start2 ", '', 'ps3', $event_url).'<br />';
$switch['EVENT'] .= '</div>';
} else {

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