2009-11-04 08:11:02 +00:00
|
|
|
<?php
|
2016-09-13 19:23:59 -04: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/>.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays external information about a course
|
|
|
|
* @package core_course
|
|
|
|
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
2003-08-11 07:48:03 +00:00
|
|
|
|
|
|
|
require_once("../config.php");
|
|
|
|
require_once("lib.php");
|
|
|
|
|
2005-11-18 10:57:36 +00:00
|
|
|
$id = optional_param('id', false, PARAM_INT); // Course id
|
|
|
|
$name = optional_param('name', false, PARAM_RAW); // Course short name
|
2003-08-11 07:48:03 +00:00
|
|
|
|
|
|
|
if (!$id and !$name) {
|
2022-04-12 09:38:41 +05:30
|
|
|
throw new \moodle_exception("unspecifycourseid");
|
2003-08-11 07:48:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($name) {
|
2008-06-01 18:17:38 +00:00
|
|
|
if (!$course = $DB->get_record("course", array("shortname"=>$name))) {
|
2022-04-12 09:38:41 +05:30
|
|
|
throw new \moodle_exception("invalidshortname");
|
2003-08-11 07:48:03 +00:00
|
|
|
}
|
|
|
|
} else {
|
2008-06-02 08:13:24 +00:00
|
|
|
if (!$course = $DB->get_record("course", array("id"=>$id))) {
|
2022-04-12 09:38:41 +05:30
|
|
|
throw new \moodle_exception("invalidcourseid");
|
2003-08-11 07:48:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$site = get_site();
|
|
|
|
|
2004-05-16 10:26:04 +00:00
|
|
|
if ($CFG->forcelogin) {
|
|
|
|
require_login();
|
|
|
|
}
|
|
|
|
|
2012-07-23 15:59:04 +08:00
|
|
|
$context = context_course::instance($course->id);
|
2018-06-21 13:34:59 +08:00
|
|
|
if (!core_course_category::can_view_course_info($course) && !is_enrolled($context, null, '', true)) {
|
2022-04-12 09:38:41 +05:30
|
|
|
throw new \moodle_exception('cannotviewcategory', '', $CFG->wwwroot .'/');
|
2009-08-10 04:53:59 +00:00
|
|
|
}
|
|
|
|
|
2013-03-28 12:20:44 +11:00
|
|
|
$PAGE->set_course($course);
|
2014-09-02 14:44:24 +12:00
|
|
|
$PAGE->set_pagelayout('incourse');
|
2010-01-16 15:39:56 +00:00
|
|
|
$PAGE->set_url('/course/info.php', array('id' => $course->id));
|
2009-09-03 08:47:24 +00:00
|
|
|
$PAGE->set_title(get_string("summaryof", "", $course->fullname));
|
2012-02-23 15:52:21 +08:00
|
|
|
$PAGE->set_heading(get_string('courseinfo'));
|
2009-09-11 07:58:09 +00:00
|
|
|
$PAGE->navbar->add(get_string('summary'));
|
|
|
|
|
2009-09-03 08:47:24 +00:00
|
|
|
echo $OUTPUT->header();
|
2003-08-11 07:48:03 +00:00
|
|
|
|
2010-08-18 09:02:05 +00:00
|
|
|
// print enrol info
|
|
|
|
if ($texts = enrol_get_course_description_texts($course)) {
|
2009-08-10 04:53:59 +00:00
|
|
|
echo $OUTPUT->box_start('generalbox icons');
|
2010-08-18 09:02:05 +00:00
|
|
|
echo implode($texts);
|
2009-08-10 04:53:59 +00:00
|
|
|
echo $OUTPUT->box_end();
|
2010-08-18 09:02:05 +00:00
|
|
|
}
|
2003-08-11 07:48:03 +00:00
|
|
|
|
2012-07-21 21:00:24 +02:00
|
|
|
$courserenderer = $PAGE->get_renderer('core', 'course');
|
|
|
|
echo $courserenderer->course_info_box($course);
|
2003-08-11 07:48:03 +00:00
|
|
|
|
|
|
|
echo "<br />";
|
|
|
|
|
2016-09-13 19:23:59 -04:00
|
|
|
// Trigger event, course information viewed.
|
|
|
|
$eventparams = array('context' => $context, 'objectid' => $course->id);
|
|
|
|
$event = \core\event\course_information_viewed::create($eventparams);
|
|
|
|
$event->trigger();
|
|
|
|
|
2009-08-06 14:10:33 +00:00
|
|
|
echo $OUTPUT->footer();
|
2003-08-11 07:48:03 +00:00
|
|
|
|
2009-11-04 08:11:02 +00:00
|
|
|
|