Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/blocks/calendar_month/block_calendar_month.php
Go to the documentation of this file.
00001 <?php
00002 
00003 class block_calendar_month extends block_base {
00004     function init() {
00005         $this->title = get_string('pluginname', 'block_calendar_month');
00006     }
00007 
00008     function preferred_width() {
00009         return 210;
00010     }
00011 
00012     function get_content() {
00013         global $USER, $CFG, $SESSION;
00014         $cal_m = optional_param( 'cal_m', 0, PARAM_INT );
00015         $cal_y = optional_param( 'cal_y', 0, PARAM_INT );
00016 
00017         require_once($CFG->dirroot.'/calendar/lib.php');
00018 
00019         if ($this->content !== NULL) {
00020             return $this->content;
00021         }
00022 
00023         $this->content = new stdClass;
00024         $this->content->text = '';
00025         $this->content->footer = '';
00026 
00027         // [pj] To me it looks like this if would never be needed, but Penny added it
00028         // when committing the /my/ stuff. Reminder to discuss and learn what it's about.
00029         // It definitely needs SOME comment here!
00030         $courseid = $this->page->course->id;
00031         $issite = ($courseid == SITEID);
00032 
00033         if ($issite) {
00034             // Being displayed at site level. This will cause the filter to fall back to auto-detecting
00035             // the list of courses it will be grabbing events from.
00036             $filtercourse = calendar_get_default_courses();
00037         } else {
00038             // Forcibly filter events to include only those from the particular course we are in.
00039             $filtercourse = array($courseid => $this->page->course);
00040         }
00041 
00042         list($courses, $group, $user) = calendar_set_filters($filtercourse);
00043         if ($issite) {
00044             // For the front page
00045             $this->content->text .= calendar_top_controls('frontpage', array('id' => $courseid, 'm' => $cal_m, 'y' => $cal_y));
00046             $this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
00047             // No filters for now
00048         } else {
00049             // For any other course
00050             $this->content->text .= calendar_top_controls('course', array('id' => $courseid, 'm' => $cal_m, 'y' => $cal_y));
00051             $this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
00052             $this->content->text .= '<h3 class="eventskey">'.get_string('eventskey', 'calendar').'</h3>';
00053             $this->content->text .= '<div class="filters">'.calendar_filter_controls($this->page->url).'</div>';
00054         }
00055 
00056         return $this->content;
00057     }
00058 }
00059 
00060 
 All Data Structures Namespaces Files Functions Variables Enumerations