|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 class block_course_summary extends block_base { 00004 function init() { 00005 $this->title = get_string('pluginname', 'block_course_summary'); 00006 } 00007 00008 function specialization() { 00009 if($this->page->pagetype == PAGE_COURSE_VIEW && $this->page->course->id != SITEID) { 00010 $this->title = get_string('coursesummary', 'block_course_summary'); 00011 } 00012 } 00013 00014 function get_content() { 00015 global $CFG, $OUTPUT; 00016 00017 require_once($CFG->libdir . '/filelib.php'); 00018 00019 if($this->content !== NULL) { 00020 return $this->content; 00021 } 00022 00023 if (empty($this->instance)) { 00024 return ''; 00025 } 00026 00027 $this->content = new stdClass(); 00028 $options = new stdClass(); 00029 $options->noclean = true; // Don't clean Javascripts etc 00030 $options->overflowdiv = true; 00031 $context = get_context_instance(CONTEXT_COURSE, $this->page->course->id); 00032 $this->page->course->summary = file_rewrite_pluginfile_urls($this->page->course->summary, 'pluginfile.php', $context->id, 'course', 'summary', NULL); 00033 $this->content->text = format_text($this->page->course->summary, $this->page->course->summaryformat, $options); 00034 if ($this->page->user_is_editing()) { 00035 if($this->page->course->id == SITEID) { 00036 $editpage = $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=frontpagesettings'; 00037 } else { 00038 $editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->page->course->id; 00039 } 00040 $this->content->text .= "<div class=\"editbutton\"><a href=\"$editpage\"><img src=\"" . $OUTPUT->pix_url('t/edit') . "\" alt=\"".get_string('edit')."\" /></a></div>"; 00041 } 00042 $this->content->footer = ''; 00043 00044 return $this->content; 00045 } 00046 00047 function hide_header() { 00048 return true; 00049 } 00050 00051 function preferred_width() { 00052 return 210; 00053 } 00054 00055 } 00056 00057