Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   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.
  13  //
  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/>.
  16  
  17  /**
  18   * Displays information about all the assignment modules in the requested course
  19   *
  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
  23   */
  24  
  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);
  29  
  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');
  34  
  35  \mod_assign\event\course_module_instance_list_viewed::create_from_course($course)->trigger();
  36  
  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));
  44  
  45  $context = context_course::instance($course->id);
  46  
  47  require_capability('mod/assign:view', $context);
  48  
  49  $assign = new assign($context, null, $course);
  50  
  51  // Get the assign to render the page.
  52  echo $assign->view('viewcourseindex');