+++ /dev/null
-
-<form method="post" action="calendar.php">
-<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
-<table class="formtable">
- <tr>
- <th>adminseesall:</th>
- <td>
- <div><?php print_string('helpadminseesall', 'admin'); ?></div>
- <p>
- <select name="adminseesallcourses">
- <option value="0" <?php if(empty($CFG->calendar_adminseesall)) echo "selected='selected'"; ?>><?php print_string('adminseesownevents', 'admin'); ?></option>
- <option value="1" <?php if(!empty($CFG->calendar_adminseesall)) echo "selected='selected'"; ?>><?php print_string('adminseesallevents', 'admin'); ?></option>
- </select>
- </p>
- </td>
- </tr>
- <tr>
- <th>startwday:</th>
- <td>
- <div><?php print_string('helpstartofweek', 'admin'); ?></div>
- <p><?php choose_from_menu($weekdays, 'startwday', empty($CFG->calendar_startwday) ? 0 : $CFG->calendar_startwday, ''); ?></p>
- </td>
- </tr>
- <tr>
- <th>weekenddays:</th>
- <td>
- <div><?php print_string('helpweekenddays', 'admin'); ?></div>
- <p>
- <span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="1" id="weekend1" <?php if(CALENDAR_WEEKEND & 2) echo 'checked="checked"'; ?> /> <label for="weekend1"><?php print_string('monday', 'calendar'); ?></label></span>
- <span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="2" id="weekend2" <?php if(CALENDAR_WEEKEND & 4) echo 'checked="checked"'; ?> /> <label for="weekend2"><?php print_string('tuesday', 'calendar'); ?></label></span>
- <span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="3" id="weekend3" <?php if(CALENDAR_WEEKEND & 8) echo 'checked="checked"'; ?> /> <label for="weekend3"><?php print_string('wednesday', 'calendar'); ?></label></span>
- <span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="4" id="weekend4" <?php if(CALENDAR_WEEKEND & 16) echo 'checked="checked"'; ?> /> <label for="weekend4"><?php print_string('thursday', 'calendar'); ?></label></span>
- <span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="5" id="weekend5" <?php if(CALENDAR_WEEKEND & 32) echo 'checked="checked"'; ?> /> <label for="weekend5"><?php print_string('friday', 'calendar'); ?></label></span>
- <br />
- <span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="6" id="weekend6" <?php if(CALENDAR_WEEKEND & 64) echo 'checked="checked"'; ?> /> <label for="weekend6"><?php print_string('saturday', 'calendar'); ?></label></span>
- <span style="white-space: nowrap;"><input type="checkbox" name="weekend[]" value="0" id="weekend0" <?php if(CALENDAR_WEEKEND & 1) echo 'checked="checked"'; ?> /> <label for="weekend0"><?php print_string('sunday', 'calendar'); ?></label></span>
- </p>
- </td>
- </tr>
- <tr>
- <th>upcoming_lookahead:</th>
- <td>
- <div><?php print_string('helpupcominglookahead', 'admin'); ?></div>
- <p><input type="text" name="lookahead" size="3" value="<?php echo CALENDAR_UPCOMING_DAYS; ?>" /></p>
- </td>
- </tr>
- <tr>
- <th>upcoming_maxevents:</th>
- <td>
- <div><?php print_string('helpupcomingmaxevents', 'admin'); ?></div>
- <p><input type="text" name="maxevents" size="3" value="<?php echo CALENDAR_UPCOMING_MAXEVENTS; ?>" /></p>
- </td>
- </tr>
- <tr>
- <td colspan="2" align="center">
- <input type="submit" value="<?php print_string('savechanges'); ?>" />
- </td>
- </tr>
-</table>
-</form>
+++ /dev/null
-<?PHP // $Id$
-
- // Allows the admin to configure calendar and date/time stuff
-
- require_once('../config.php');
- require_once($CFG->libdir.'/adminlib.php');
- $adminroot = admin_get_root();
- admin_externalpage_setup('calendar', $adminroot);
-
-
-/// Print headings
-
- admin_externalpage_print_header($adminroot);
-
- $strcalendarsettings = get_string('calendarsettings', 'admin');
- print_heading($strcalendarsettings);
-
-/// If data submitted, process and store
-
- if (($form = data_submitted()) && confirm_sesskey()) {
- if(isset($form->adminseesallcourses)) {
- set_config('calendar_adminseesall', intval($form->adminseesallcourses) != 0);
- unset($SESSION->cal_courses_shown);
- }
- 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);
- }
- }
- redirect('calendar.php', get_string('changessaved'));
- }
-
- // Include the calendar library AFTER modifying the data, so we read the latest values
- require_once($CFG->dirroot.'/calendar/lib.php');
-
-
- $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", "80%");
- include('./calendar.html');
- print_simple_box_end();
-
- admin_externalpage_print_footer($adminroot);
-
-?>