Skip to content

Commit

Permalink
MDL-37009 Display single course info box using new course listings re…
Browse files Browse the repository at this point in the history
…nderer

Header is removed from /course/info.php because it is now part of renderer function
  • Loading branch information
marinaglancy committed Apr 1, 2013
1 parent 43e389e commit e2d70cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 34 deletions.
1 change: 0 additions & 1 deletion course/info.php
Expand Up @@ -42,7 +42,6 @@
$PAGE->navbar->add(get_string('summary'));

echo $OUTPUT->header();
echo $OUTPUT->heading('<a href="view.php?id='.$course->id.'">'.format_string($course->fullname) . '</a><br />(' . format_string($course->shortname, true, array('context' => $context)) . ')');

// print enrol info
if ($texts = enrol_get_course_description_texts($course)) {
Expand Down
37 changes: 4 additions & 33 deletions course/renderer.php
Expand Up @@ -107,45 +107,16 @@ protected function add_modchoosertoggle() {
/**
* Renders course info box.
*
* @param stdClass $course
* @param stdClass|course_in_list $course
* @return string
*/
public function course_info_box(stdClass $course) {
global $CFG;

$context = context_course::instance($course->id);

$content = '';
$content .= $this->output->box_start('generalbox info');

$summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course', 'summary', null);
$content .= format_text($summary, $course->summaryformat, array('overflowdiv'=>true), $course->id);
if (!empty($CFG->coursecontact)) {
$coursecontactroles = explode(',', $CFG->coursecontact);
foreach ($coursecontactroles as $roleid) {
if ($users = get_role_users($roleid, $context, true, '', null, false)) {
foreach ($users as $teacher) {
$role = new stdClass();
$role->id = $teacher->roleid;
$role->name = $teacher->rolename;
$role->shortname = $teacher->roleshortname;
$role->coursealias = $teacher->rolecoursealias;
$fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
$namesarray[] = role_get_name($role, $context).': <a href="'.$CFG->wwwroot.'/user/view.php?id='.
$teacher->id.'&amp;course='.SITEID.'">'.$fullname.'</a>';
}
}
}

if (!empty($namesarray)) {
$content .= "<ul class=\"teachers\">\n<li>";
$content .= implode('</li><li>', $namesarray);
$content .= "</li></ul>";
}
}

$chelper = new coursecat_helper();
$chelper->set_show_courses(self::COURSECAT_SHOW_COURSES_EXPANDED);
$content .= $this->coursecat_coursebox($chelper, $course);
$content .= $this->output->box_end();

return $content;
}

Expand Down

0 comments on commit e2d70cc

Please sign in to comment.