2009-11-04 08:11:02 +00:00
|
|
|
<?php
|
2012-04-27 13:11:35 +08:00
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2007-11-13 17:16:54 +00:00
|
|
|
/**
|
2012-04-27 13:11:35 +08:00
|
|
|
* Weeks course format. Display the whole course as "weeks" made of modules.
|
2007-11-13 17:16:54 +00:00
|
|
|
*
|
2012-04-27 13:11:35 +08:00
|
|
|
* @package format_weeks
|
|
|
|
* @copyright 2006 The Open University
|
2007-11-13 17:16:54 +00:00
|
|
|
* @author N.D.Freear@open.ac.uk, and others.
|
2012-04-27 13:11:35 +08:00
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
2007-11-13 17:16:54 +00:00
|
|
|
*/
|
2001-11-22 06:23:56 +00:00
|
|
|
|
2010-10-13 20:17:56 +00:00
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
|
2012-04-27 13:11:35 +08:00
|
|
|
require_once($CFG->libdir.'/filelib.php');
|
|
|
|
require_once($CFG->libdir.'/completionlib.php');
|
2010-10-13 20:17:56 +00:00
|
|
|
|
2012-04-27 13:11:35 +08:00
|
|
|
// Horrible backwards compatible parameter aliasing..
|
|
|
|
if ($week = optional_param('week', 0, PARAM_INT)) {
|
|
|
|
$url = $PAGE->url;
|
|
|
|
$url->param('section', $week);
|
|
|
|
debugging('Outdated week param passed to course/view.php', DEBUG_DEVELOPER);
|
|
|
|
redirect($url);
|
|
|
|
}
|
|
|
|
// End backwards-compatible aliasing..
|
2010-10-13 20:17:56 +00:00
|
|
|
|
2012-09-25 14:29:04 +08:00
|
|
|
// make sure all sections are created
|
2012-10-11 15:08:17 +08:00
|
|
|
$course = course_get_format($course)->get_course();
|
2012-10-08 10:36:01 +08:00
|
|
|
course_create_sections_if_missing($course, range(0, $course->numsections));
|
2012-09-25 14:29:04 +08:00
|
|
|
|
2012-04-27 13:11:35 +08:00
|
|
|
$renderer = $PAGE->get_renderer('format_weeks');
|
2003-06-14 12:17:13 +00:00
|
|
|
|
2012-08-10 13:49:53 +08:00
|
|
|
if (!empty($displaysection)) {
|
2012-09-25 14:29:04 +08:00
|
|
|
$renderer->print_single_section_page($course, null, null, null, null, $displaysection);
|
2012-04-27 13:11:35 +08:00
|
|
|
} else {
|
2012-09-25 14:29:04 +08:00
|
|
|
$renderer->print_multiple_section_page($course, null, null, null, null);
|
2012-04-27 13:11:35 +08:00
|
|
|
}
|
2012-04-27 15:01:02 +01:00
|
|
|
|
2012-04-27 13:11:35 +08:00
|
|
|
$PAGE->requires->js('/course/format/weeks/format.js');
|