MDL-22054 converting block name strings to pluginname
[moodle.git] / blocks / course_summary / block_course_summary.php
1 <?php
3 class block_course_summary extends block_base {
4     function init() {
5         $this->title = get_string('pluginname', 'block_course_summary');
6         $this->version = 2007101509;
7     }
9     function specialization() {
10         if($this->page->pagetype == PAGE_COURSE_VIEW && $this->page->course->id != SITEID) {
11             $this->title = get_string('coursesummary', 'block_course_summary');
12         }
13     }
15     function get_content() {
16         global $CFG, $OUTPUT;
18         if($this->content !== NULL) {
19             return $this->content;
20         }
22         if (empty($this->instance)) {
23             return '';
24         }
26         $this->content = new object();
27         $options = new object();
28         $options->noclean = true;    // Don't clean Javascripts etc
29         $context = get_context_instance(CONTEXT_COURSE, $this->page->course->id);
30         $this->page->course->summary = file_rewrite_pluginfile_urls($this->page->course->summary, 'pluginfile.php', $context->id, 'course_summary', $this->page->course->id);
31         $this->content->text = format_text($this->page->course->summary, $this->page->course->summaryformat, $options);
32         if ($this->page->user_is_editing()) {
33             if($this->page->course->id == SITEID) {
34                 $editpage = $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=frontpagesettings';
35             } else {
36                 $editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->page->course->id;
37             }
38             $this->content->text .= "<div class=\"editbutton\"><a href=\"$editpage\"><img src=\"" . $OUTPUT->pix_url('t/edit') . "\" alt=\"".get_string('edit')."\" /></a></div>";
39         }
40         $this->content->footer = '';
42         return $this->content;
43     }
45     function hide_header() {
46         return true;
47     }
49     function preferred_width() {
50         return 210;
51     }
53 }