Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/course/info.php
Go to the documentation of this file.
00001 <?php
00002 
00004 
00005     require_once("../config.php");
00006     require_once("lib.php");
00007 
00008     $id   = optional_param('id', false, PARAM_INT); // Course id
00009     $name = optional_param('name', false, PARAM_RAW); // Course short name
00010 
00011     if (!$id and !$name) {
00012         print_error("unspecifycourseid");
00013     }
00014 
00015     if ($name) {
00016         if (!$course = $DB->get_record("course", array("shortname"=>$name))) {
00017             print_error("invalidshortname");
00018         }
00019     } else {
00020         if (!$course = $DB->get_record("course", array("id"=>$id))) {
00021             print_error("invalidcourseid");
00022         }
00023     }
00024 
00025     $site = get_site();
00026 
00027     if ($CFG->forcelogin) {
00028         require_login();
00029     }
00030 
00031     $context = get_context_instance(CONTEXT_COURSE, $course->id);
00032     if (!$course->visible and !has_capability('moodle/course:viewhiddencourses', $context)) {
00033         print_error('coursehidden', '', $CFG->wwwroot .'/');
00034     }
00035 
00036     $PAGE->set_context($context);
00037     $PAGE->set_pagelayout('popup');
00038     $PAGE->set_url('/course/info.php', array('id' => $course->id));
00039     $PAGE->set_title(get_string("summaryof", "", $course->fullname));
00040     $PAGE->set_heading('Course info');
00041     $PAGE->set_course($course);
00042     $PAGE->navbar->add(get_string('summary'));
00043 
00044     echo $OUTPUT->header();
00045     echo $OUTPUT->heading('<a href="view.php?id='.$course->id.'">'.format_string($course->fullname) . '</a><br />(' . format_string($course->shortname, true, array('context' => $context)) . ')');
00046 
00047     // print enrol info
00048     if ($texts = enrol_get_course_description_texts($course)) {
00049         echo $OUTPUT->box_start('generalbox icons');
00050         echo implode($texts);
00051         echo $OUTPUT->box_end();
00052     }
00053 
00054     echo $OUTPUT->box_start('generalbox info');
00055 
00056     $course->summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course', 'summary', NULL);
00057     echo format_text($course->summary, $course->summaryformat, array('overflowdiv'=>true), $course->id);
00058 
00059     if (!empty($CFG->coursecontact)) {
00060         $coursecontactroles = explode(',', $CFG->coursecontact);
00061         foreach ($coursecontactroles as $roleid) {
00062             $role = $DB->get_record('role', array('id'=>$roleid));
00063             $roleid = (int) $roleid;
00064             if ($users = get_role_users($roleid, $context, true)) {
00065                 foreach ($users as $teacher) {
00066                     $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
00067                     $namesarray[] = format_string(role_get_name($role, $context)).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
00068                                     $teacher->id.'&amp;course='.SITEID.'">'.$fullname.'</a>';
00069                 }
00070             }
00071         }
00072 
00073         if (!empty($namesarray)) {
00074             echo "<ul class=\"teachers\">\n<li>";
00075             echo implode('</li><li>', $namesarray);
00076             echo "</li></ul>";
00077         }
00078     }
00079 
00080 // TODO: print some enrol icons
00081 
00082     echo $OUTPUT->box_end();
00083 
00084     echo "<br />";
00085 
00086     echo $OUTPUT->footer();
00087 
00088 
 All Data Structures Namespaces Files Functions Variables Enumerations