[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/course/ -> info.php (source)

   1  <?php
   2  
   3  /// Displays external information about a course
   4  
   5      require_once("../config.php");
   6      require_once ("lib.php");
   7  
   8      $id   = optional_param('id', false, PARAM_INT); // Course id
   9      $name = optional_param('name', false, PARAM_RAW); // Course short name
  10  
  11      if (!$id and !$name) {
  12          print_error("unspecifycourseid");
  13      }
  14  
  15      if ($name) {
  16          if (!$course = $DB->get_record("course", array("shortname"=>$name))) {
  17              print_error("invalidshortname");
  18          }
  19      } else {
  20          if (!$course = $DB->get_record("course", array("id"=>$id))) {
  21              print_error("invalidcourseid");
  22          }
  23      }
  24  
  25      $site = get_site();
  26  
  27      if ($CFG->forcelogin) {
  28          require_login();
  29      }
  30  
  31      $context = context_course::instance($course->id);
  32      if (!$course->visible and !has_capability('moodle/course:viewhiddencourses', $context)) {
  33          print_error('coursehidden', '', $CFG->wwwroot .'/');
  34      }
  35  
  36      $PAGE->set_course($course);
  37      $PAGE->set_pagelayout('incourse');
  38      $PAGE->set_url('/course/info.php', array('id' => $course->id));
  39      $PAGE->set_title(get_string("summaryof", "", $course->fullname));
  40      $PAGE->set_heading(get_string('courseinfo'));
  41      $PAGE->navbar->add(get_string('summary'));
  42  
  43      echo $OUTPUT->header();
  44  
  45      // print enrol info
  46      if ($texts = enrol_get_course_description_texts($course)) {
  47          echo $OUTPUT->box_start('generalbox icons');
  48          echo implode($texts);
  49          echo $OUTPUT->box_end();
  50      }
  51  
  52      $courserenderer = $PAGE->get_renderer('core', 'course');
  53      echo $courserenderer->course_info_box($course);
  54  
  55      echo "<br />";
  56  
  57      echo $OUTPUT->footer();
  58  
  59  


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1