moodle/blocks/course_summary/block_course_summary.php

52 lines
1.5 KiB
PHP
Raw Normal View History

<?PHP //$Id$
class CourseBlock_course_summary extends MoodleBlock {
function CourseBlock_course_summary ($course) {
if (empty($course->category)) { // Site level
$this->title = get_string('frontpagedescription');
} else {
$this->title = get_string('blockname','block_course_summary');
}
$this->content_type = BLOCK_TYPE_TEXT;
$this->course = $course;
$this->version = 2004052600;
}
function applicable_formats() {
return COURSE_FORMAT_WEEKS | COURSE_FORMAT_TOPICS | COURSE_FORMAT_SOCIAL | COURSE_FORMAT_SITE;
}
function get_content() {
global $CFG, $THEME;
if($this->content !== NULL) {
return $this->content;
}
$this->content = New stdClass;
$this->content->text = format_text($this->course->summary, FORMAT_HTML);
if (isediting($this->course->id)) {
2004-07-29 22:16:53 +00:00
if (empty($this->course->category)) {
2004-07-30 06:34:11 +00:00
$editpage = $CFG->wwwroot.'/admin/site.php';
2004-07-29 22:16:53 +00:00
} else {
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->course->id;
}
2004-07-30 06:34:11 +00:00
$this->content->text .= "<div align=\"right\"><a href=\"$editpage\"><img src=\"$CFG->pixpath/t/edit.gif\" /></a></div>";
}
$this->content->footer = '';
return $this->content;
}
2004-07-30 06:34:11 +00:00
function hide_header() {
return true;
}
2004-08-09 13:23:32 +00:00
function preferred_width() {
return 210;
}
}
?>