"MDL-12304, fix double text"
[moodle-linuxchix.git] / blocks / course_summary / block_course_summary.php
blob2846cb3fec41d911e2a8d0e2fe595417904697b4
1 <?PHP //$Id$
3 class block_course_summary extends block_base {
4 function init() {
5 $this->title = get_string('pagedescription', 'block_course_summary');
6 $this->version = 2007101509;
9 function specialization() {
10 global $COURSE;
11 if($this->instance->pagetype == PAGE_COURSE_VIEW && $COURSE->id != SITEID) {
12 $this->title = get_string('coursesummary', 'block_course_summary');
16 function get_content() {
17 global $CFG, $COURSE;
19 if($this->content !== NULL) {
20 return $this->content;
23 if (empty($this->instance)) {
24 return '';
27 $this->content = new object();
28 $options = new object();
29 $options->noclean = true; // Don't clean Javascripts etc
30 $this->content->text = format_text($COURSE->summary, FORMAT_HTML, $options);
31 if (isediting($COURSE->id)) { // ?? courseid param not there??
32 if($COURSE->id == SITEID) {
33 $editpage = $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=frontpagesettings';
34 } else {
35 $editpage = $CFG->wwwroot.'/course/edit.php?id='.$COURSE->id;
37 $this->content->text .= "<div class=\"editbutton\"><a href=\"$editpage\"><img src=\"$CFG->pixpath/t/edit.gif\" alt=\"".get_string('edit')."\" /></a></div>";
39 $this->content->footer = '';
41 return $this->content;
44 function hide_header() {
45 return true;
48 function preferred_width() {
49 return 210;