2009-11-04 08:11:02 +00:00
|
|
|
<?php
|
2003-08-11 07:48:03 +00:00
|
|
|
|
|
|
|
/// Displays external information about a course
|
|
|
|
|
|
|
|
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) {
|
2008-05-07 06:02:51 +00:00
|
|
|
print_error("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))) {
|
2008-05-07 06:02:51 +00:00
|
|
|
print_error("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))) {
|
2008-05-07 06:02:51 +00:00
|
|
|
print_error("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();
|
|
|
|
}
|
|
|
|
|
2007-12-07 00:30:21 +00:00
|
|
|
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
2008-01-25 20:46:36 +00:00
|
|
|
if ((!course_parent_visible($course) || (! $course->visible)) && !has_capability('moodle/course:viewhiddencourses', $context)) {
|
2009-08-10 04:53:59 +00:00
|
|
|
print_error('coursehidden', '', $CFG->wwwroot .'/');
|
|
|
|
}
|
|
|
|
|
2009-09-11 07:58:09 +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));
|
2009-09-11 07:58:09 +00:00
|
|
|
$PAGE->set_heading('Course info');
|
|
|
|
$PAGE->set_course($course);
|
|
|
|
$PAGE->navbar->add(get_string('summary'));
|
|
|
|
|
2009-09-03 08:47:24 +00:00
|
|
|
echo $OUTPUT->header();
|
2009-09-11 07:58:09 +00:00
|
|
|
echo $OUTPUT->heading('<a href="view.php?id='.$course->id.'">'.format_string($course->fullname) . '</a><br />(' . format_string($course->shortname) . ')');
|
2003-08-11 07:48:03 +00:00
|
|
|
|
2007-03-05 05:36:43 +00:00
|
|
|
if ($course->guest || $course->password) {
|
2009-08-10 04:53:59 +00:00
|
|
|
echo $OUTPUT->box_start('generalbox icons');
|
2007-03-05 05:36:43 +00:00
|
|
|
if ($course->guest) {
|
|
|
|
$strallowguests = get_string('allowguests');
|
2009-12-16 21:50:45 +00:00
|
|
|
echo "<div><img alt=\"\" class=\"icon guest\" src=\"" . $OUTPUT->pix_url('i/guest') . "\" /> $strallowguests</div>";
|
2007-03-05 05:36:43 +00:00
|
|
|
}
|
|
|
|
if ($course->password) {
|
|
|
|
$strrequireskey = get_string('requireskey');
|
2009-12-16 21:50:45 +00:00
|
|
|
echo "<div><img alt=\"\" class=\"icon key\" src=\"" . $OUTPUT->pix_url('i/key') . "\" /> $strrequireskey</div>";
|
2007-03-05 05:36:43 +00:00
|
|
|
}
|
2009-08-10 04:53:59 +00:00
|
|
|
echo $OUTPUT->box_end();
|
2003-08-11 07:48:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-10 04:53:59 +00:00
|
|
|
echo $OUTPUT->box_start('generalbox info');
|
2007-03-05 05:36:43 +00:00
|
|
|
|
2009-11-04 06:14:06 +00:00
|
|
|
$course->summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course_summary', $course->id);
|
|
|
|
echo format_text($course->summary, $course->summaryformat, NULL, $course->id);
|
2007-12-07 00:30:21 +00:00
|
|
|
|
2007-03-05 05:36:43 +00:00
|
|
|
if ($managerroles = get_config('', 'coursemanager')) {
|
|
|
|
$coursemanagerroles = split(',', $managerroles);
|
|
|
|
foreach ($coursemanagerroles as $roleid) {
|
2008-06-02 08:13:24 +00:00
|
|
|
$role = $DB->get_record('role', array('id'=>$roleid));
|
2007-09-19 07:09:50 +00:00
|
|
|
$canseehidden = has_capability('moodle/role:viewhiddenassigns', $context);
|
2007-11-19 02:25:22 +00:00
|
|
|
$roleid = (int) $roleid;
|
2007-09-19 07:09:50 +00:00
|
|
|
if ($users = get_role_users($roleid, $context, true, '', 'u.lastname ASC', $canseehidden)) {
|
2007-03-05 05:36:43 +00:00
|
|
|
foreach ($users as $teacher) {
|
2009-08-10 04:53:59 +00:00
|
|
|
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
|
2008-09-01 09:41:26 +00:00
|
|
|
$namesarray[] = format_string(role_get_name($role, $context)).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
|
2007-03-05 05:36:43 +00:00
|
|
|
$teacher->id.'&course='.SITEID.'">'.$fullname.'</a>';
|
2003-08-11 07:48:03 +00:00
|
|
|
}
|
2009-08-10 04:53:59 +00:00
|
|
|
}
|
2007-03-05 05:36:43 +00:00
|
|
|
}
|
2009-08-10 04:53:59 +00:00
|
|
|
|
2007-03-05 05:36:43 +00:00
|
|
|
if (!empty($namesarray)) {
|
|
|
|
echo "<ul class=\"teachers\">\n<li>";
|
|
|
|
echo implode('</li><li>', $namesarray);
|
|
|
|
echo "</li></ul>";
|
2003-08-11 07:48:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-05 05:39:49 +00:00
|
|
|
require_once("$CFG->dirroot/enrol/enrol.class.php");
|
|
|
|
$enrol = enrolment_factory::factory($course->enrol);
|
|
|
|
echo $enrol->get_access_icons($course);
|
|
|
|
|
2009-08-10 04:53:59 +00:00
|
|
|
echo $OUTPUT->box_end();
|
2003-08-11 07:48:03 +00:00
|
|
|
|
|
|
|
echo "<br />";
|
|
|
|
|
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
|
|
|
|