mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
calendar MDL-22887 Output is now through a renderer, all pages have navigation, and now uses true pretend blocks.
This commit is contained in:
parent
de832702ad
commit
36dc3b7104
18 changed files with 1058 additions and 939 deletions
|
@ -74,8 +74,8 @@ if ($mon !== 0) {
|
|||
if ($yr !== 0) {
|
||||
$url->param('cal_y', $yr);
|
||||
}
|
||||
if ($course !== 0) {
|
||||
$url->param('course', $course);
|
||||
if ($course !== NULL) {
|
||||
$url->param('course', $course->id);
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
|
||||
|
@ -98,6 +98,10 @@ if (!empty($courseid) && $course->id != SITEID) {
|
|||
$PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php', array('id'=>$course->id)));
|
||||
}
|
||||
|
||||
$calendar = new calendar_information($day, $mon, $yr);
|
||||
$calendar->courseid = $courseid;
|
||||
|
||||
|
||||
if(!checkdate($mon, $day, $yr)) {
|
||||
$day = intval($now['mday']);
|
||||
$mon = intval($now['mon']);
|
||||
|
@ -107,16 +111,16 @@ $time = make_timestamp($yr, $mon, $day);
|
|||
|
||||
if (!isloggedin() or isguestuser()) {
|
||||
$defaultcourses = calendar_get_default_courses();
|
||||
calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
|
||||
calendar_set_filters($calendar->courses, $calendar->groups, $calendar->users, $defaultcourses, $defaultcourses);
|
||||
} else {
|
||||
calendar_set_filters($courses, $groups, $users);
|
||||
calendar_set_filters($calendar->courses, $calendar->groups, $calendar->users);
|
||||
}
|
||||
|
||||
$strcalendar = get_string('calendar', 'calendar');
|
||||
$prefsbutton = calendar_preferences_button();
|
||||
|
||||
// Print title and header
|
||||
$link = calendar_get_link_href(CALENDAR_URL.'view.php?view=upcoming&course='.$courseid.'&',
|
||||
$link = calendar_get_link_href(CALENDAR_URL.'view.php?view=upcoming&course='.$calendar->courseid.'&',
|
||||
$now['mday'], $now['mon'], $now['year']);
|
||||
$PAGE->navbar->add(get_string('calendar', 'calendar'), new moodle_url($link));
|
||||
$PAGE->navbar->add($pagetitle);
|
||||
|
@ -125,26 +129,20 @@ $PAGE->set_title($site->shortname.': '.$strcalendar.': '.$pagetitle);
|
|||
$PAGE->set_heading($COURSE->fullname);
|
||||
$PAGE->set_button($prefsbutton);
|
||||
$PAGE->set_focuscontrol('pw_all');
|
||||
$PAGE->set_pagelayout('standard');
|
||||
|
||||
$renderer = $PAGE->get_renderer('core_calendar');
|
||||
$calendar->add_sidecalendar_blocks($renderer);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Layout the whole page as three big columns.
|
||||
echo '<table class="calendarlayout">';
|
||||
echo '<tr>';
|
||||
|
||||
// START: Main column
|
||||
|
||||
echo '<td class="maincalendar">';
|
||||
|
||||
$username = $USER->username;
|
||||
$usernameencoded = urlencode($USER->username);
|
||||
$authtoken = sha1($USER->username . $USER->password . $CFG->calendar_exportsalt);
|
||||
|
||||
echo $renderer->start_layout();
|
||||
switch($action) {
|
||||
case 'advanced':
|
||||
break;
|
||||
case '':
|
||||
default:
|
||||
$username = $USER->username;
|
||||
$authtoken = sha1($USER->username . $USER->password . $CFG->calendar_exportsalt);
|
||||
// Let's populate some vars to let "common tasks" be somewhat smart...
|
||||
// If today it's weekend, give the "next week" option
|
||||
$allownextweek = CALENDAR_WEEKEND & (1 << $now['wday']);
|
||||
|
@ -152,37 +150,7 @@ switch($action) {
|
|||
$allownextmonth = calendar_days_in_month($now['mon'], $now['year']) - $now['mday'] < 7;
|
||||
// If today it's weekend but tomorrow it isn't, do NOT give the "this week" option
|
||||
$allowthisweek = !((CALENDAR_WEEKEND & (1 << $now['wday'])) && !(CALENDAR_WEEKEND & (1 << (($now['wday'] + 1) % 7))));
|
||||
echo '<div class="header">' . get_string('export', 'calendar') . '</div>';
|
||||
include('export_basic.html');
|
||||
echo $renderer->basic_export_form($allowthisweek, $allownextweek, $allownextmonth, $username, $authtoken);
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo '</td>';
|
||||
|
||||
// END: Main column
|
||||
|
||||
// START: Last column (3-month display)
|
||||
echo '<td class="sidecalendar">';
|
||||
echo '<div class="header">'.get_string('monthlyview', 'calendar').'</div>';
|
||||
|
||||
list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
|
||||
list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
|
||||
$getvars = 'cal_d='.$day.'&cal_m='.$mon.'&cal_y='.$yr; // For filtering
|
||||
|
||||
echo '<div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('id' => $courseid, 'm' => $prevmon, 'y' => $prevyr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
|
||||
echo '</div><div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('id' => $courseid, 'm' => $mon, 'y' => $yr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $mon, $yr);
|
||||
echo '</div><div class="minicalendarblock">';
|
||||
echo calendar_top_controls('display', array('id' => $courseid, 'm' => $nextmon, 'y' => $nextyr));
|
||||
echo calendar_get_mini($courses, $groups, $users, $nextmon, $nextyr);
|
||||
echo '</div>';
|
||||
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr></table>';
|
||||
|
||||
echo $renderer->complete_layout();
|
||||
echo $OUTPUT->footer();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue