2009-11-01 12:00:47 +00:00
|
|
|
<?php
|
2004-04-18 23:20:53 +00:00
|
|
|
|
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');
|
2008-03-03 11:43:32 +00:00
|
|
|
$this->version = 2007101509;
|
2004-05-28 10:53:54 +00:00
|
|
|
}
|
|
|
|
|
2004-10-19 21:04:28 +00:00
|
|
|
function specialization() {
|
2009-05-06 09:28:26 +00:00
|
|
|
if($this->page->pagetype == PAGE_COURSE_VIEW && $this->page->course->id != 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() {
|
2009-07-02 10:06:39 +00:00
|
|
|
global $CFG, $OUTPUT;
|
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 '';
|
|
|
|
}
|
|
|
|
|
2008-01-24 20:33:50 +00:00
|
|
|
$this->content = new object();
|
|
|
|
$options = new object();
|
2004-09-03 03:39:50 +00:00
|
|
|
$options->noclean = true; // Don't clean Javascripts etc
|
2009-11-04 06:14:06 +00:00
|
|
|
$context = get_context_instance(CONTEXT_COURSE, $this->page->course->id);
|
|
|
|
$this->page->course->summary = file_rewrite_pluginfile_urls($this->page->course->summary, 'pluginfile.php', $context->id, 'course_summary', $this->page->course->id);
|
|
|
|
$this->content->text = format_text($this->page->course->summary, $this->page->course->summaryformat, $options);
|
2009-05-06 09:28:26 +00:00
|
|
|
if ($this->page->user_is_editing()) {
|
|
|
|
if($this->page->course->id == SITEID) {
|
2007-02-14 21:04:05 +00:00
|
|
|
$editpage = $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=frontpagesettings';
|
2004-07-29 22:16:53 +00:00
|
|
|
} else {
|
2009-05-06 09:28:26 +00:00
|
|
|
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->page->course->id;
|
2004-07-29 22:16:53 +00:00
|
|
|
}
|
2009-12-16 21:50:45 +00:00
|
|
|
$this->content->text .= "<div class=\"editbutton\"><a href=\"$editpage\"><img src=\"" . $OUTPUT->pix_url('t/edit') . "\" alt=\"".get_string('edit')."\" /></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
|
|
|
}
|
|
|
|
|
2009-11-01 12:00:47 +00:00
|
|
|
|