Merge branch 'install_master' of https://git.in.moodle.com/amosbot/moodle-install
[moodle.git] / mod / assign / index.php
blob1151ddf36549acd708a444cd753549a4b2a3742f
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * Displays information about all the assignment modules in the requested course
20 * @package mod_assign
21 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 require_once("../../config.php");
26 require_once($CFG->dirroot.'/mod/assign/locallib.php');
27 // For this type of page this is the course id.
28 $id = required_param('id', PARAM_INT);
30 $course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
31 require_login($course);
32 $PAGE->set_url('/mod/assign/index.php', array('id' => $id));
33 $PAGE->set_pagelayout('incourse');
35 \mod_assign\event\course_module_instance_list_viewed::create_from_course($course)->trigger();
37 // Print the header.
38 $strplural = get_string("modulenameplural", "assign");
39 $PAGE->navbar->add($strplural);
40 $PAGE->set_title($strplural);
41 $PAGE->set_heading($course->fullname);
42 echo $OUTPUT->header();
43 echo $OUTPUT->heading(format_string($strplural));
45 $context = context_course::instance($course->id);
47 require_capability('mod/assign:view', $context);
49 $assign = new assign($context, null, $course);
51 // Get the assign to render the page.
52 echo $assign->view('viewcourseindex');