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);
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
if (!$course->visible and !has_capability('moodle/course:viewhiddencourses', $context)) {
|
2009-08-10 04:53:59 +00:00
|
|
|
print_error('coursehidden', '', $CFG->wwwroot .'/');
|
|
|
|
}
|
|
|
|
|
2010-05-27 01:40:11 +00:00
|
|
|
$PAGE->set_context($context);
|
|
|
|
$PAGE->set_pagelayout('course');
|
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));
|
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
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
//TODO: add enrol info
|
|
|
|
/*
|
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();
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
}*/
|
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
|
|
|
|
2010-07-03 13:37:13 +00:00
|
|
|
$course->summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course', 'summary', NULL);
|
2009-11-04 06:14:06 +00:00
|
|
|
echo format_text($course->summary, $course->summaryformat, NULL, $course->id);
|
2007-12-07 00:30:21 +00:00
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
if (!empty($CFG->coursecontact)) {
|
|
|
|
$coursecontactroles = explode(',', $CFG->coursecontact);
|
|
|
|
foreach ($coursecontactroles as $roleid) {
|
2008-06-02 08:13:24 +00:00
|
|
|
$role = $DB->get_record('role', array('id'=>$roleid));
|
2007-11-19 02:25:22 +00:00
|
|
|
$roleid = (int) $roleid;
|
2010-03-31 07:41:31 +00:00
|
|
|
if ($users = get_role_users($roleid, $context, true)) {
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
// TODO: print some enrol icons
|
2007-03-05 05:39:49 +00:00
|
|
|
|
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
|
|
|
|