~ubuntu-branches/ubuntu/jaunty/moodle/jaunty

« back to all changes in this revision

Viewing changes to blocks/calendar_upcoming/block_calendar_upcoming.php

  • Committer: Bazaar Package Importer
  • Author(s): Jordan Mantha, Matt Oquist
  • Date: 2009-02-25 15:16:22 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090225151622-0ekt1liwhv2obfza
Tags: 1.9.4.dfsg-0ubuntu1
* Merge with Debian git (Closes LP: #322961, #239481, #334611):
  - use Ubuntu's smarty lib directory for linking
  - use internal yui library 
  - add update-notifier support back in

[Matt Oquist]
  * renamed prerm script
  * significantly rewrote postinst and other maintainer scripts to improve
    user experience and package maintainability
    (Closes LP: #225662, #325450, #327843, #303078, #234609)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP //$Id: block_calendar_upcoming.php,v 1.26.6.1 2007/05/06 04:26:37 martinlanghoff Exp $
 
1
<?PHP //$Id: block_calendar_upcoming.php,v 1.27.2.3 2008/04/17 19:19:11 skodak Exp $
2
2
 
3
3
class block_calendar_upcoming extends block_base {
4
4
    function init() {
5
5
        $this->title = get_string('upcomingevents', 'calendar');
6
 
        $this->version = 2004052600;
 
6
        $this->version = 2007101509;
7
7
    }
8
8
 
9
9
    function get_content() {
16
16
        if ($this->content !== NULL) {
17
17
            return $this->content;
18
18
        }
19
 
        // Initialize the session variables
20
 
        calendar_session_vars();
 
19
        // Reset the session variables
 
20
        calendar_session_vars($COURSE);
21
21
        $this->content = new stdClass;
22
22
        $this->content->text = '';
23
23
 
42
42
            if ($courseshown == SITEID) {
43
43
                // Being displayed at site level. This will cause the filter to fall back to auto-detecting
44
44
                // the list of courses it will be grabbing events from.
45
 
                $filtercourse = NULL;
 
45
                $filtercourse    = NULL;
 
46
                $groupeventsfrom = NULL;
 
47
                $SESSION->cal_courses_shown = calendar_get_default_courses(true);
 
48
                calendar_set_referring_course(0);
46
49
            } else {
47
50
                // Forcibly filter events to include only those from the particular course we are in.
48
 
                $filtercourse = array($courseshown => 1);
 
51
                $filtercourse    = array($courseshown => $COURSE);
 
52
                $groupeventsfrom = array($courseshown => 1);
49
53
            }
50
54
        }
51
55
 
55
59
        // Be VERY careful with the format for default courses arguments!
56
60
        // Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions.
57
61
 
58
 
        calendar_set_filters($courses, $group, $user, $filtercourse, $filtercourse, false);
 
62
        calendar_set_filters($courses, $group, $user, $filtercourse, $groupeventsfrom, false);
59
63
        $events = calendar_get_upcoming($courses, $group, $user, 
60
64
                                        get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), 
61
65
                                        get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));