2004-04-18 23:20:53 +00:00
|
|
|
<?PHP //$Id$
|
|
|
|
|
|
|
|
class CourseBlock_course_summary extends MoodleBlock {
|
|
|
|
function CourseBlock_course_summary ($course) {
|
2004-06-30 13:16:48 +00:00
|
|
|
if (empty($course->category)) { // Site level
|
|
|
|
$this->title = get_string('frontpagedescription');
|
|
|
|
} else {
|
|
|
|
$this->title = get_string('blockname','block_course_summary');
|
|
|
|
}
|
2004-04-18 23:20:53 +00:00
|
|
|
$this->content_type = BLOCK_TYPE_TEXT;
|
|
|
|
$this->course = $course;
|
2004-05-28 10:53:54 +00:00
|
|
|
$this->version = 2004052600;
|
|
|
|
}
|
|
|
|
|
|
|
|
function applicable_formats() {
|
|
|
|
return COURSE_FORMAT_WEEKS | COURSE_FORMAT_TOPICS | COURSE_FORMAT_SOCIAL | COURSE_FORMAT_SITE;
|
2004-04-18 23:20:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_content() {
|
2004-06-30 12:41:05 +00:00
|
|
|
global $CFG, $THEME;
|
2004-04-18 23:20:53 +00:00
|
|
|
|
2004-04-19 09:36:07 +00:00
|
|
|
if($this->content !== NULL) {
|
|
|
|
return $this->content;
|
|
|
|
}
|
|
|
|
|
2004-05-28 13:57:09 +00:00
|
|
|
$this->content = New stdClass;
|
2004-04-18 23:20:53 +00:00
|
|
|
$this->content->text = format_text($this->course->summary, FORMAT_HTML);
|
2004-06-30 12:41:05 +00:00
|
|
|
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>";
|
2004-06-30 12:41:05 +00:00
|
|
|
}
|
2004-05-28 10:53:54 +00:00
|
|
|
$this->content->footer = '';
|
2004-04-18 23:20:53 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2004-04-18 23:20:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|