2004-04-18 23:20:53 +00:00
|
|
|
<?PHP //$Id$
|
|
|
|
|
2004-11-23 18:53:34 +00:00
|
|
|
class block_course_summary extends block_base {
|
2004-10-19 21:04:28 +00:00
|
|
|
function init() {
|
|
|
|
$this->title = get_string('pagedescription', 'block_course_summary');
|
2004-04-18 23:20:53 +00:00
|
|
|
$this->content_type = BLOCK_TYPE_TEXT;
|
2004-05-28 10:53:54 +00:00
|
|
|
$this->version = 2004052600;
|
|
|
|
}
|
|
|
|
|
2004-10-19 21:04:28 +00:00
|
|
|
function specialization() {
|
2005-01-31 02:18:15 +00:00
|
|
|
if($this->instance->pagetype == PAGE_COURSE_VIEW && $this->instance->pageid != SITEID) {
|
2004-10-19 21:04:28 +00:00
|
|
|
$this->title = get_string('coursesummary', 'block_course_summary');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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-10-19 21:04:28 +00:00
|
|
|
if (empty($this->instance)) {
|
2004-08-11 09:00:53 +00:00
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2004-10-19 21:04:28 +00:00
|
|
|
$course = get_record('course', 'id', $this->instance->pageid);
|
|
|
|
|
2004-05-28 13:57:09 +00:00
|
|
|
$this->content = New stdClass;
|
2004-09-03 03:39:50 +00:00
|
|
|
$options->noclean = true; // Don't clean Javascripts etc
|
2004-10-19 21:04:28 +00:00
|
|
|
$this->content->text = format_text($course->summary, FORMAT_HTML, $options);
|
|
|
|
if(isediting($this->instance->pageid)) {
|
|
|
|
if($this->instance->pageid == SITEID) {
|
2004-12-31 16:08:26 +00:00
|
|
|
$editpage = $CFG->wwwroot.'/'.$CFG->admin.'/site.php';
|
2004-07-29 22:16:53 +00:00
|
|
|
} else {
|
2004-10-19 21:04:28 +00:00
|
|
|
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->instance->pageid;
|
2004-07-29 22:16:53 +00:00
|
|
|
}
|
2004-09-16 17:13:57 +00:00
|
|
|
$this->content->text .= "<div align=\"right\"><a href=\"$editpage\"><img src=\"$CFG->pixpath/t/edit.gif\" alt=\"\" /></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
|
|
|
}
|
|
|
|
|
|
|
|
?>
|