Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / course / info.php
blob267d9dc3555e0bd713b63b6bca371a5dd022ad25
1 <?php // $Id$
3 /// Displays external information about a course
5 require_once("../config.php");
6 require_once("lib.php");
8 $id = optional_param('id', false, PARAM_INT); // Course id
9 $name = optional_param('name', false, PARAM_RAW); // Course short name
11 if (!$id and !$name) {
12 error("Must specify course id or short name");
15 if ($name) {
16 if (! $course = get_record("course", "shortname", $name) ) {
17 error("That's an invalid short course name");
19 } else {
20 if (! $course = get_record("course", "id", $id) ) {
21 error("That's an invalid course id");
25 $site = get_site();
27 if ($CFG->forcelogin) {
28 require_login();
31 print_header(get_string("summaryof", "", $course->fullname));
33 print_heading(format_string($course->fullname) . '<br />(' . format_string($course->shortname) . ')');
35 if ($course->guest || $course->password) {
36 print_box_start('generalbox icons');
37 if ($course->guest) {
38 $strallowguests = get_string('allowguests');
39 echo "<div><img alt=\"\" class=\"icon guest\" src=\"$CFG->pixpath/i/guest.gif\" />&nbsp;$strallowguests</div>";
41 if ($course->password) {
42 $strrequireskey = get_string('requireskey');
43 echo "<div><img alt=\"\" class=\"icon key\" src=\"$CFG->pixpath/i/key.gif\" />&nbsp;$strrequireskey</div>";
45 print_box_end();
49 print_box_start('generalbox info');
51 echo filter_text(text_to_html($course->summary),$course->id);
53 $context = get_context_instance(CONTEXT_COURSE, $course->id);
54 if ($managerroles = get_config('', 'coursemanager')) {
55 $coursemanagerroles = split(',', $managerroles);
56 foreach ($coursemanagerroles as $roleid) {
57 $role = get_record('role','id',$roleid);
58 if ($users = get_role_users($roleid, $context, true, '', 'u.lastname ASC', true)) {
59 foreach ($users as $teacher) {
60 $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
61 $namesarray[] = format_string($role->name).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
62 $teacher->id.'&amp;course='.SITEID.'">'.$fullname.'</a>';
67 if (!empty($namesarray)) {
68 echo "<ul class=\"teachers\">\n<li>";
69 echo implode('</li><li>', $namesarray);
70 echo "</li></ul>";
74 require_once("$CFG->dirroot/enrol/enrol.class.php");
75 $enrol = enrolment_factory::factory($course->enrol);
76 echo $enrol->get_access_icons($course);
78 print_box_end();
80 echo "<br />";
82 close_window_button();
84 print_footer();