New features implemented:

* Configurable defaults for the calendar upcoming events lookahead and
   maximum upcoming events displayed (bug #1623)

 * Configurable setting for which days of the week are treated as weekend
   (bug #1919)

 * Configurable setting for which day starts the week (the admin can now set
   this as the default for new users and guests without messing with language
   packs) (no butracker issue)
This commit is contained in:
defacer 2004-12-16 18:49:57 +00:00
parent 54598fb04e
commit bb4a2e85c0
7 changed files with 106 additions and 14 deletions

View file

@ -26,7 +26,6 @@
print_heading($strcalendarsettings);
/// If data submitted, process and store
if(confirm_sesskey() && $form = data_submitted()) {
@ -49,8 +48,43 @@
}
set_config('calendar_dstforusers', $preset);
}
if(isset($form->startwday)) {
$startwday = intval($form->startwday);
if($startwday >= 0 && $startwday <= 6) {
set_config('calendar_startwday', $startwday);
}
}
if(isset($form->weekend)) {
if(is_array($form->weekend)) {
// Creating a packed bitfield; look at /calendar/lib.php if you can't figure it out
$bitfield = 0;
foreach($form->weekend as $day) {
$bitfield |= (1 << (intval($day) % 7));
}
if($bitfield > 0) {
set_config('calendar_weekend', $bitfield);
}
}
}
if(isset($form->lookahead)) {
$lookahead = intval($form->lookahead);
if($lookahead > 0) {
set_config('calendar_lookahead', $lookahead);
}
}
if(isset($form->maxevents)) {
$maxevents = intval($form->maxevents);
if($maxevents > 0) {
set_config('calendar_maxevents', $maxevents);
}
}
}
// Include the calendar library AFTER modifying the data, so we read the latest values
require_once('../calendar/lib.php');
// Populate some variables we 're going to need in calendar.html
$presets = get_records('dst_preset');
if(!empty($presets)) {
foreach($presets as $id => $preset) {
@ -58,7 +92,17 @@
}
}
/// Main display starts here
$weekdays = array(
0 => get_string('sunday', 'calendar'),
1 => get_string('monday', 'calendar'),
2 => get_string('tuesday', 'calendar'),
3 => get_string('wednesday', 'calendar'),
4 => get_string('thursday', 'calendar'),
5 => get_string('friday', 'calendar'),
6 => get_string('saturday', 'calendar')
);
// Main display starts here
print_simple_box_start('center', '100%', $THEME->cellheading);
include('./calendar.html');