aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hu <jimhu@users.sourceforge.net>2008-12-24 21:09:31 +0000
committerJim Hu <jimhu@users.sourceforge.net>2008-12-24 21:09:31 +0000
commite58e043a9ed5862427c2f3e72fd5e34b61043368 (patch)
treef3bc50691609151291411517666411a6eab345ac
parentdc5600eaf6d6e66a65c8fe84e98c862db28510a1 (diff)
downloadphpicalendar-e58e043a9ed5862427c2f3e72fd5e34b61043368.zip
phpicalendar-e58e043a9ed5862427c2f3e72fd5e34b61043368.tar.gz
phpicalendar-e58e043a9ed5862427c2f3e72fd5e34b61043368.tar.bz2
add day_end option to preferences
-rw-r--r--config.inc.php2
-rw-r--r--functions/init/configs.php1
-rw-r--r--functions/init/date_range.php4
-rw-r--r--functions/parse/recur_functions.php1
-rw-r--r--languages/english.inc.php1
-rw-r--r--preferences.php25
-rw-r--r--templates/default/preferences.tpl5
7 files changed, 32 insertions, 7 deletions
diff --git a/config.inc.php b/config.inc.php
index a7cc6b0..78532e4 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -10,7 +10,7 @@ $configs = array(
# 'timezone' => 'US/Central',
# 'allow_admin' => 'yes',
# 'allow_login' => 'yes',
-# 'allow_preferences' => 'yes',
+ 'allow_preferences' => 'yes',
# 'show_search' => 'yes',
# 'show_todos' => 'no',
# 'cookie_uri' => ''
diff --git a/functions/init/configs.php b/functions/init/configs.php
index 38714e1..5d5a9c9 100644
--- a/functions/init/configs.php
+++ b/functions/init/configs.php
@@ -22,6 +22,7 @@ if (isset($_COOKIE[$cookie_name]) && !isset($_POST['unset'])) {
}
if (isset($phpicalendar['cookie_startday'])) $phpiCal_config->setProperty('week_start_day', $phpicalendar['cookie_startday']);
if (isset($phpicalendar['cookie_time'])) $phpiCal_config->setProperty('day_start', $phpicalendar['cookie_time']);
+ if (isset($phpicalendar['cookie_endtime'])) $phpiCal_config->setProperty('day_end', $phpicalendar['cookie_endtime']);
}
# language support
diff --git a/functions/init/date_range.php b/functions/init/date_range.php
index c74b1dc..a4579db 100644
--- a/functions/init/date_range.php
+++ b/functions/init/date_range.php
@@ -33,6 +33,10 @@ switch ($current_view){
$mArray_begin = mktime (0,0,0,$start_month,1,($start_year));
$mArray_end = mktime (0,0,0,$end_month,31,($end_year));
break;
+ case 'preferences':
+ $mArray_begin = time();
+ $mArray_end = time();
+ break;
default:
$mArray_begin = mktime (0,0,0,12,21,($this_year - 1));
$mArray_end = mktime (0,0,0,1,31,($this_year + 1));
diff --git a/functions/parse/recur_functions.php b/functions/parse/recur_functions.php
index c0ea88f..e45f4aa 100644
--- a/functions/parse/recur_functions.php
+++ b/functions/parse/recur_functions.php
@@ -1,5 +1,4 @@
<?php
-
/* from the std
BYxxx rule parts modify the recurrence in some manner. BYxxx rule
diff --git a/languages/english.inc.php b/languages/english.inc.php
index 1376761..0194c88 100644
--- a/languages/english.inc.php
+++ b/languages/english.inc.php
@@ -68,6 +68,7 @@ $lang['l_select_lang'] = 'Select your default language';
$lang['l_select_cal'] = 'Select your default calendar';
$lang['l_select_view'] = 'Select your default view';
$lang['l_select_time'] = 'Select your default start time';
+$lang['l_select_endtime'] = 'Select your default end time';
$lang['l_select_day'] = 'Select your default start day of week';
$lang['l_select_style'] = 'Select your default style';
$lang['l_set_prefs'] = 'Set preferences';
diff --git a/preferences.php b/preferences.php
index 5bfaad3..118a3b7 100644
--- a/preferences.php
+++ b/preferences.php
@@ -1,7 +1,7 @@
<?php
define('BASE','./');
$current_view = 'preferences';
-require_once(BASE.'functions/ical_parser.php');
+require_once(BASE.'functions/init.inc.php');
require_once(BASE.'functions/template.php');
$display_date = $lang['l_preferences'];
@@ -29,17 +29,18 @@ if ($action == 'setcookie') {
$cookie_style = $_POST['cookie_style'];
$cookie_startday = $_POST['cookie_startday'];
$cookie_time = $_POST['cookie_time'];
+ $cookie_endtime = $_POST['cookie_endtime'];
$cookie_unset = @$_POST['unset'];
- $the_cookie = array ("cookie_language" => "$cookie_language", "cookie_calendar" => "$cookie_calendar", "cookie_view" => "$cookie_view", "cookie_startday" => "$cookie_startday", "cookie_style" => "$cookie_style", "cookie_time" => "$cookie_time", "cookie_cpath"=>"$cookie_cpath");
+ $the_cookie = array ("cookie_language" => "$cookie_language", "cookie_calendar" => "$cookie_calendar", "cookie_view" => "$cookie_view", "cookie_startday" => "$cookie_startday", "cookie_style" => "$cookie_style", "cookie_time" => "$cookie_time","cookie_endtime" => "$cookie_endtime", "cookie_cpath"=>"$cookie_cpath");
$the_cookie = serialize($the_cookie);
if ($cookie_unset) {
setcookie("$cookie_name","$the_cookie",time()-(60*60*24*7) ,"/","$phpiCal_config->cookie_uri",0);
} else {
setcookie("$cookie_name","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$phpiCal_config->cookie_uri",0);
if (isset($_POST['cookie_view']))
- $default_view = $_POST['cookie_view'];
+ $phpiCal_config->default_view = $_POST['cookie_view'];
if (isset($_POST['cookie_style']) && is_dir(BASE.'templates/'.$_POST['cookie_style'].'/'))
- $template = $_POST['cookie_style'];
+ $phpiCal_config->template = $_POST['cookie_style'];
if (isset($_POST['cookie_language']) && is_file(BASE.'languages/'.strtolower($_POST['cookie_language']).'.inc.php'))
include(BASE.'languages/'.strtolower($_POST['cookie_language']).'.inc.php');
}
@@ -56,6 +57,7 @@ if (isset($_COOKIE[$cookie_name])) {
$cookie_style = $phpicalendar['cookie_style'];
$cookie_startday = $phpicalendar['cookie_startday'];
$cookie_time = $phpicalendar['cookie_time'];
+ $cookie_endtime = $phpicalendar['cookie_endtime'];
if ($cookie_unset) {
unset ($cookie_language, $cookie_calendar, $cookie_view, $cookie_style,$cookie_startday);
}
@@ -69,6 +71,7 @@ if ((!isset($_COOKIE[$cookie_name])) || ($cookie_unset)) {
$cookie_style = $phpiCal_config->template;
$cookie_startday = $phpiCal_config->week_start_day;
$cookie_time = $phpiCal_config->day_start;
+ $cookie_endtime = $phpiCal_config->day_end;
}
if ($action == 'setcookie') {
@@ -108,7 +111,7 @@ $view_select .= ($phpiCal_config->default_view == 'month') ? '<option value="
// select for time
$time_select = '';
-for ($i = 000; $i <= 1200; $i += 100) {
+for ($i = 000; $i <= 2400; $i += 100) {
$s = sprintf("%04d", $i);
$time_select .= '<option value="'.$s.'"';
if ($s == $cookie_time) {
@@ -117,6 +120,16 @@ for ($i = 000; $i <= 1200; $i += 100) {
$time_select .= ">$s</option>\n";
}
+$endtime_select = '';
+for ($i = 000; $i <= 2400; $i += 100) {
+ $s = sprintf("%04d", $i);
+ $endtime_select .= '<option value="'.$s.'"';
+ if ($s == $cookie_endtime) {
+ $endtime_select .= ' selected="selected"';
+ }
+ $endtime_select .= ">$s</option>\n";
+}
+
// select for day of week
$i=0;
$startday_select = '';
@@ -169,6 +182,7 @@ $page->replace_tags(array(
'calendar_select' => $calendar_select,
'view_select' => $view_select,
'time_select' => $time_select,
+ 'endtime_select' => $endtime_select,
'startday_select' => $startday_select,
'style_select' => $style_select,
'display_date' => $lang['l_preferences'],
@@ -179,6 +193,7 @@ $page->replace_tags(array(
'l_select_lang' => $lang['l_select_lang'],
'l_select_view' => $lang['l_select_view'],
'l_select_time' => $lang['l_select_time'],
+ 'l_select_endtime' => $lang['l_select_endtime'],
'l_select_day' => $lang['l_select_day'],
'l_select_cal' => $lang['l_select_cal'],
'l_select_style' => $lang['l_select_style'],
diff --git a/templates/default/preferences.tpl b/templates/default/preferences.tpl
index 9b395f8..8de7307 100644
--- a/templates/default/preferences.tpl
+++ b/templates/default/preferences.tpl
@@ -59,6 +59,11 @@
<td><select name="cookie_time" class="query_style">{TIME_SELECT}</select></td>
</tr>
<tr align="left" valign="top">
+ <td nowrap="nowrap">{L_SELECT_ENDTIME}:</td>
+ <td><img src="images/spacer.gif" alt=" " width="20" height="1" border="0" /></td>
+ <td><select name="cookie_endtime" class="query_style">{ENDTIME_SELECT}</select></td>
+ </tr>
+ <tr align="left" valign="top">
<td nowrap="nowrap">{L_SELECT_DAY}:</td>
<td><img src="images/spacer.gif" alt=" " width="20" height="1" border="0" /></td>
<td><select name="cookie_startday" class="query_style">{STARTDAY_SELECT}</select></td>

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