Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/blocks/feedback/block_feedback.php
Go to the documentation of this file.
00001 <?php
00002 if (is_file($CFG->dirroot.'/mod/feedback/lib.php')) {
00003     require_once($CFG->dirroot.'/mod/feedback/lib.php');
00004     define('FEEDBACK_BLOCK_LIB_IS_OK', true);
00005 }
00006 
00007 class block_feedback extends block_base {
00008 
00009     function init() {
00010         $this->title = get_string('feedback', 'block_feedback');
00011     }
00012 
00013     function applicable_formats() {
00014         return array('site' => true, 'course' => true);
00015     }
00016 
00017     function get_content() {
00018         global $CFG, $OUTPUT;
00019 
00020         if ($this->content !== NULL) {
00021             return $this->content;
00022         }
00023 
00024         if (!defined('FEEDBACK_BLOCK_LIB_IS_OK')) {
00025             $this->content = new stdClass;
00026             $this->content->text = get_string('missing_feedback_module', 'block_feedback');
00027             $this->content->footer = '';
00028             return $this->content;
00029         }
00030 
00031         $courseid = $this->page->course->id;
00032         if ($courseid <= 0) {
00033             $courseid = SITEID;
00034         }
00035 
00036         $this->content = new stdClass;
00037         $this->content->text = '';
00038         $this->content->footer = '';
00039 
00040 
00041         if (empty($this->instance->pageid)) {
00042             $this->instance->pageid = SITEID;
00043         }
00044 
00045         if ($feedbacks = feedback_get_feedbacks_from_sitecourse_map($courseid)) {
00046             $baseurl = new moodle_url('/mod/feedback/view.php');
00047             foreach ($feedbacks as $feedback) {
00048                 $url = new moodle_url($baseurl);
00049                 $url->params(array('id'=>$feedback->cmid, 'courseid'=>$courseid));
00050                 $icon = '<img src="'.$OUTPUT->pix_url('icon', 'feedback') . '" class="icon" alt="" />&nbsp;';
00051                 $this->content->text = ' <a href="'.$url->out().'">'.$icon.$feedback->name.'</a>';
00052             }
00053         }
00054 
00055         return $this->content;
00056     }
00057 }
 All Data Structures Namespaces Files Functions Variables Enumerations