Automatic installer.php lang files by installer_builder (20080623)
[moodle.git] / course / info.php
blob6a93a1ffa3e3045516673938b12522dd1937c8d8
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 echo "<h3 align=\"center\">$course->fullname<br />($course->shortname)</h3>";
35 echo "<center>";
36 if ($course->guest) {
37 $strallowguests = get_string("allowguests");
38 echo "<p><font size=\"1\"><img align=\"middle\" alt=\"\" height=\"16\" width=\"16\" border=\"0\" src=\"$CFG->pixpath/i/guest.gif\" /></a>&nbsp;$strallowguests</font></p>";
40 if ($course->password) {
41 $strrequireskey = get_string("requireskey");
42 echo "<p><font size=\"1\"><img align=\"middle\" alt=\"\" height=\"16\" width=\"16\" border=\"0\" src=\"$CFG->pixpath/i/key.gif\" /></a>&nbsp;$strrequireskey</font></p>";
46 /// first find all roles that are supposed to be displayed
47 if (!empty($CFG->coursemanager)) {
48 $coursemanagerroles = split(',', $CFG->coursemanager);
49 $context = get_context_instance(CONTEXT_COURSE, $course->id);
50 foreach ($coursemanagerroles as $roleid) {
51 $role = get_record('role','id',$roleid);
52 if ($users = get_role_users($roleid, $context, true, '', 'u.lastname ASC', true)) {
53 foreach ($users as $teacher) {
54 $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
55 $namesarray[] = format_string($role->name).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
56 $teacher->id.'&amp;course='.SITEID.'">'.$fullname.'</a>';
61 if (!empty($namesarray)) {
62 echo "<div align=\"center\">";
63 echo implode('<br />', $namesarray);
64 echo "</div>";
68 echo "<br />";
70 print_simple_box_start("center", "100%");
71 echo filter_text(text_to_html($course->summary),$course->id);
73 require_once("$CFG->dirroot/enrol/enrol.class.php");
74 $enrol = enrolment_factory::factory($course->enrol);
75 echo $enrol->get_access_icons($course);
77 print_simple_box_end();
79 echo "<br />";
81 close_window_button();