~ubuntu-branches/ubuntu/hoary/moodle/hoary

« back to all changes in this revision

Viewing changes to blocks/calendar_month/block_calendar_month.php

  • Committer: Bazaar Package Importer
  • Author(s): Isaac Clerencia
  • Date: 2004-12-29 00:49:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041229004952-gliyqzpj2w3e7clx
Tags: 1.4.3-1
* Urgency high as upstream release fixes several security bugs
* New upstream release
* Write database creation errors and warn the user about it, 
closes: #285842, #285842

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP //$Id: block_calendar_month.php,v 1.7 2004/05/24 10:38:16 defacer Exp $
 
1
<?PHP //$Id: block_calendar_month.php,v 1.11.2.3 2004/09/19 22:18:33 defacer Exp $
2
2
 
3
3
class CourseBlock_calendar_month extends MoodleBlock {
4
4
    function CourseBlock_calendar_month($course) {
5
5
        $this->title = get_string('calendar', 'calendar');
6
6
        $this->content_type = BLOCK_TYPE_TEXT;
7
7
        $this->course = $course;
8
 
        $this->version = 2004052400;
 
8
        $this->version = 2004081200;
9
9
    }
10
10
 
11
11
    function get_content() {
23
23
        $this->content->text = '';
24
24
        $this->content->footer = '';
25
25
 
26
 
        if ($this->course === NULL) {
27
 
            // Overrides: use no course at all
 
26
        if (empty($this->course)) { // Overrides: use no course at all
 
27
 
28
28
            $courseshown = false;
29
29
            $filtercourse = array();
30
30
 
31
31
        } else {
 
32
 
32
33
            $courseshown = $this->course->id;
33
 
            $filtercourse = array($courseshown => 1);
 
34
 
 
35
            if($this->course->id == SITEID) {
 
36
                // Being displayed at site level. This will cause the filter to fall back to auto-detecting
 
37
                // the list of courses it will be grabbing events from.
 
38
                $filtercourse = NULL;
 
39
            }
 
40
            else {
 
41
                // Forcibly filter events to include only those from the particular course we are in.
 
42
                $filtercourse = array($courseshown => 1);
 
43
            }
34
44
        }
35
45
 
36
46
        // We 'll need this later