Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]
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 external information about a course 19 * @package core_course 20 * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com 21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 */ 23 24 require_once("../config.php"); 25 require_once ("lib.php"); 26 27 $id = optional_param('id', false, PARAM_INT); // Course id 28 $name = optional_param('name', false, PARAM_RAW); // Course short name 29 30 if (!$id and !$name) { 31 print_error("unspecifycourseid"); 32 } 33 34 if ($name) { 35 if (!$course = $DB->get_record("course", array("shortname"=>$name))) { 36 print_error("invalidshortname"); 37 } 38 } else { 39 if (!$course = $DB->get_record("course", array("id"=>$id))) { 40 print_error("invalidcourseid"); 41 } 42 } 43 44 $site = get_site(); 45 46 if ($CFG->forcelogin) { 47 require_login(); 48 } 49 50 $context = context_course::instance($course->id); 51 if (!core_course_category::can_view_course_info($course) && !is_enrolled($context, null, '', true)) { 52 print_error('cannotviewcategory', '', $CFG->wwwroot .'/'); 53 } 54 55 $PAGE->set_course($course); 56 $PAGE->set_pagelayout('incourse'); 57 $PAGE->set_url('/course/info.php', array('id' => $course->id)); 58 $PAGE->set_title(get_string("summaryof", "", $course->fullname)); 59 $PAGE->set_heading(get_string('courseinfo')); 60 $PAGE->navbar->add(get_string('summary')); 61 62 echo $OUTPUT->header(); 63 64 // print enrol info 65 if ($texts = enrol_get_course_description_texts($course)) { 66 echo $OUTPUT->box_start('generalbox icons'); 67 echo implode($texts); 68 echo $OUTPUT->box_end(); 69 } 70 71 $courserenderer = $PAGE->get_renderer('core', 'course'); 72 echo $courserenderer->course_info_box($course); 73 74 echo "<br />"; 75 76 // Trigger event, course information viewed. 77 $eventparams = array('context' => $context, 'objectid' => $course->id); 78 $event = \core\event\course_information_viewed::create($eventparams); 79 $event->trigger(); 80 81 echo $OUTPUT->footer(); 82 83
title
Description
Body
title
Description
Body
title
Description
Body
title
Body