当前位置: 首页>>代码示例>>PHP>>正文


PHP calendar_set_filters函数代码示例

本文整理汇总了PHP中calendar_set_filters函数的典型用法代码示例。如果您正苦于以下问题:PHP calendar_set_filters函数的具体用法?PHP calendar_set_filters怎么用?PHP calendar_set_filters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了calendar_set_filters函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_content

 function get_content()
 {
     global $USER, $CFG, $SESSION, $COURSE;
     $cal_m = optional_param('cal_m', 0, PARAM_INT);
     $cal_y = optional_param('cal_y', 0, PARAM_INT);
     require_once $CFG->dirroot . '/calendar/lib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     // Reset the session variables
     calendar_session_vars($COURSE);
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     // [pj] To me it looks like this if would never be needed, but Penny added it
     // when committing the /my/ stuff. Reminder to discuss and learn what it's about.
     // It definitely needs SOME comment here!
     $courseshown = $COURSE->id;
     if ($courseshown == SITEID) {
         // Being displayed at site level. This will cause the filter to fall back to auto-detecting
         // the list of courses it will be grabbing events from.
         $filtercourse = NULL;
         $groupeventsfrom = NULL;
         $SESSION->cal_courses_shown = calendar_get_default_courses(true);
         calendar_set_referring_course(0);
     } else {
         // Forcibly filter events to include only those from the particular course we are in.
         $filtercourse = array($courseshown => $COURSE);
         $groupeventsfrom = array($courseshown => 1);
     }
     // We 'll need this later
     calendar_set_referring_course($courseshown);
     // MDL-9059, set to show this course when admins go into a course, then unset it.
     if ($COURSE->id != SITEID && !isset($SESSION->cal_courses_shown[$COURSE->id]) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
         $courseset = true;
         $SESSION->cal_courses_shown[$COURSE->id] = $COURSE;
     }
     // Be VERY careful with the format for default courses arguments!
     // Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions.
     calendar_set_filters($courses, $group, $user, $filtercourse, $groupeventsfrom, false);
     if ($courseshown == SITEID) {
         // For the front page
         $this->content->text .= calendar_overlib_html();
         $this->content->text .= calendar_top_controls('frontpage', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
         $this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
         // No filters for now
     } else {
         // For any other course
         $this->content->text .= calendar_overlib_html();
         $this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
         $this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
         $this->content->text .= '<h3 class="eventskey">' . get_string('eventskey', 'calendar') . '</h3>';
         $this->content->text .= '<div class="filters">' . calendar_filter_controls('course', '', $COURSE) . '</div>';
     }
     // MDL-9059, unset this so that it doesn't stay in session
     if (!empty($courseset)) {
         unset($SESSION->cal_courses_shown[$COURSE->id]);
     }
     return $this->content;
 }
开发者ID:r007,项目名称:PMoodle,代码行数:60,代码来源:block_calendar_month.php

示例2: get_content

 function get_content()
 {
     global $USER, $CFG, $SESSION, $COURSE;
     $cal_m = optional_param('cal_m', 0, PARAM_INT);
     $cal_y = optional_param('cal_y', 0, PARAM_INT);
     require_once $CFG->dirroot . '/calendar/lib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     // Reset the session variables
     calendar_session_vars($COURSE);
     $this->content = new stdClass();
     $this->content->text = '';
     if (empty($this->instance)) {
         // Overrides: use no course at all
         $courseshown = false;
         $filtercourse = array();
         $this->content->footer = '';
     } else {
         $courseshown = $COURSE->id;
         $this->content->footer = '<br /><a href="' . $CFG->wwwroot . '/calendar/view.php?view=upcoming&amp;course=' . $courseshown . '">' . get_string('gotocalendar', 'calendar') . '</a>...';
         $context = get_context_instance(CONTEXT_COURSE, $courseshown);
         if (has_capability('moodle/calendar:manageentries', $context) || has_capability('moodle/calendar:manageownentries', $context)) {
             $this->content->footer .= '<br /><a href="' . $CFG->wwwroot . '/calendar/event.php?action=new&amp;course=' . $courseshown . '">' . get_string('newevent', 'calendar') . '</a>...';
         }
         if ($courseshown == SITEID) {
             // Being displayed at site level. This will cause the filter to fall back to auto-detecting
             // the list of courses it will be grabbing events from.
             $filtercourse = NULL;
             $groupeventsfrom = NULL;
             $SESSION->cal_courses_shown = calendar_get_default_courses(true);
             calendar_set_referring_course(0);
         } else {
             // Forcibly filter events to include only those from the particular course we are in.
             $filtercourse = array($courseshown => $COURSE);
             $groupeventsfrom = array($courseshown => 1);
         }
     }
     // We 'll need this later
     calendar_set_referring_course($courseshown);
     // Be VERY careful with the format for default courses arguments!
     // Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions.
     calendar_set_filters($courses, $group, $user, $filtercourse, $groupeventsfrom, false);
     $events = calendar_get_upcoming($courses, $group, $user, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));
     if (!empty($this->instance)) {
         $this->content->text = calendar_get_sideblock_upcoming($events, 'view.php?view=day&amp;course=' . $courseshown . '&amp;');
     }
     if (empty($this->content->text)) {
         $this->content->text = '<div class="post">' . get_string('noupcomingevents', 'calendar') . '</div>';
     }
     return $this->content;
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:52,代码来源:block_calendar_upcoming.php

示例3: get_content

 function get_content()
 {
     global $USER, $CFG, $SESSION;
     $cal_m = optional_param('cal_m', 0, PARAM_INT);
     $cal_y = optional_param('cal_y', 0, PARAM_INT);
     require_once $CFG->dirroot . '/calendar/lib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $filtercourse = array();
     if (empty($this->instance)) {
         // Overrides: use no course at all
         $courseshown = false;
         $this->content->footer = '';
     } else {
         $courseshown = $this->page->course->id;
         $this->content->footer = '<div class="gotocal"><a href="' . $CFG->wwwroot . '/calendar/view.php?view=upcoming&amp;course=' . $courseshown . '">' . get_string('gotocalendar', 'calendar') . '</a>...</div>';
         $context = context_course::instance($courseshown);
         if (has_any_capability(array('moodle/calendar:manageentries', 'moodle/calendar:manageownentries'), $context)) {
             $this->content->footer .= '<div class="newevent"><a href="' . $CFG->wwwroot . '/calendar/event.php?action=new&amp;course=' . $courseshown . '">' . get_string('newevent', 'calendar') . '</a>...</div>';
         }
         if ($courseshown == SITEID) {
             // Being displayed at site level. This will cause the filter to fall back to auto-detecting
             // the list of courses it will be grabbing events from.
             $filtercourse = calendar_get_default_courses();
         } else {
             // Forcibly filter events to include only those from the particular course we are in.
             $filtercourse = array($courseshown => $this->page->course);
         }
     }
     list($courses, $group, $user) = calendar_set_filters($filtercourse);
     $defaultlookahead = CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD;
     if (isset($CFG->calendar_lookahead)) {
         $defaultlookahead = intval($CFG->calendar_lookahead);
     }
     $lookahead = get_user_preferences('calendar_lookahead', $defaultlookahead);
     $defaultmaxevents = CALENDAR_DEFAULT_UPCOMING_MAXEVENTS;
     if (isset($CFG->calendar_maxevents)) {
         $defaultmaxevents = intval($CFG->calendar_maxevents);
     }
     $maxevents = get_user_preferences('calendar_maxevents', $defaultmaxevents);
     $events = calendar_get_upcoming($courses, $group, $user, $lookahead, $maxevents);
     if (!empty($this->instance)) {
         $this->content->text = calendar_get_block_upcoming($events, 'view.php?view=day&amp;course=' . $courseshown . '&amp;');
     }
     if (empty($this->content->text)) {
         $this->content->text = '<div class="post">' . get_string('noupcomingevents', 'calendar') . '</div>';
     }
     return $this->content;
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:52,代码来源:block_calendar_upcoming.php

示例4: get_content

 /**
  * Return the content of this block.
  *
  * @return stdClass the content
  */
 public function get_content()
 {
     global $CFG;
     $calm = optional_param('cal_m', 0, PARAM_INT);
     $caly = optional_param('cal_y', 0, PARAM_INT);
     $time = optional_param('time', 0, PARAM_INT);
     require_once $CFG->dirroot . '/calendar/lib.php';
     if ($this->content !== null) {
         return $this->content;
     }
     // If a day, month and year were passed then convert it to a timestamp. If these were passed then we can assume
     // the day, month and year are passed as Gregorian, as no where in core should we be passing these values rather
     // than the time. This is done for BC.
     if (!empty($calm) && !empty($caly)) {
         $time = make_timestamp($caly, $calm, 1);
     } else {
         if (empty($time)) {
             $time = time();
         }
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     // [pj] To me it looks like this if would never be needed, but Penny added it
     // when committing the /my/ stuff. Reminder to discuss and learn what it's about.
     // It definitely needs SOME comment here!
     $courseid = $this->page->course->id;
     $issite = $courseid == SITEID;
     if ($issite) {
         // Being displayed at site level. This will cause the filter to fall back to auto-detecting
         // the list of courses it will be grabbing events from.
         $filtercourse = calendar_get_default_courses();
     } else {
         // Forcibly filter events to include only those from the particular course we are in.
         $filtercourse = array($courseid => $this->page->course);
     }
     list($courses, $group, $user) = calendar_set_filters($filtercourse);
     if ($issite) {
         // For the front page.
         $this->content->text .= calendar_get_mini($courses, $group, $user, false, false, 'frontpage', $courseid, $time);
         // No filters for now.
     } else {
         // For any other course.
         $this->content->text .= calendar_get_mini($courses, $group, $user, false, false, 'course', $courseid, $time);
         $this->content->text .= '<h3 class="eventskey">' . get_string('eventskey', 'calendar') . '</h3>';
         $this->content->text .= '<div class="filters calendar_filters">' . calendar_filter_controls($this->page->url) . '</div>';
     }
     return $this->content;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:54,代码来源:block_calendar_month.php

示例5: get_content

 function get_content()
 {
     global $USER, $CFG, $SESSION;
     $cal_m = optional_param('cal_m', 0, PARAM_INT);
     $cal_y = optional_param('cal_y', 0, PARAM_INT);
     require_once $CFG->dirroot . '/calendar/lib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     // [pj] To me it looks like this if would never be needed, but Penny added it
     // when committing the /my/ stuff. Reminder to discuss and learn what it's about.
     // It definitely needs SOME comment here!
     $courseid = $this->page->course->id;
     $issite = $courseid == SITEID;
     if ($issite) {
         // Being displayed at site level. This will cause the filter to fall back to auto-detecting
         // the list of courses it will be grabbing events from.
         $filtercourse = calendar_get_default_courses();
     } else {
         // Forcibly filter events to include only those from the particular course we are in.
         $filtercourse = array($courseid => $this->page->course);
     }
     list($courses, $group, $user) = calendar_set_filters($filtercourse);
     if ($issite) {
         // For the front page
         $this->content->text .= calendar_top_controls('frontpage', array('id' => $courseid, 'm' => $cal_m, 'y' => $cal_y));
         $this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
         // No filters for now
     } else {
         // For any other course
         $this->content->text .= calendar_top_controls('course', array('id' => $courseid, 'm' => $cal_m, 'y' => $cal_y));
         $this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
         $this->content->text .= '<h3 class="eventskey">' . get_string('eventskey', 'calendar') . '</h3>';
         $this->content->text .= '<div class="filters">' . calendar_filter_controls($this->page->url) . '</div>';
     }
     return $this->content;
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:40,代码来源:block_calendar_month.php

示例6: prepare_for_view

 /**
  * Initialize calendar information
  *
  * @param stdClass $course object
  * @param array $coursestoload An array of courses [$course->id => $course]
  * @param bool $ignorefilters options to use filter
  */
 public function prepare_for_view(stdClass $course, array $coursestoload, $ignorefilters = false)
 {
     $this->courseid = $course->id;
     $this->course = $course;
     list($courses, $group, $user) = calendar_set_filters($coursestoload, $ignorefilters);
     $this->courses = $courses;
     $this->groups = $group;
     $this->users = $user;
 }
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:16,代码来源:lib.php

示例7: use_html_editor

            echo '</div>';
        } else {
            include 'event_new.html';
            if ($usehtmleditor) {
                use_html_editor("description");
            }
        }
        break;
}
echo '</td>';
// START: Last column (3-month display)
$defaultcourses = calendar_get_default_courses();
//calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
// when adding an event you can not be a guest, so I think it's reasonalbe to ignore defaultcourses
// MDL-10353
calendar_set_filters($courses, $groups, $users);
list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
echo '<td class="sidecalendar">';
echo '<div class="sideblock">';
echo '<div class="header"><h2>' . get_string('eventskey', 'calendar') . '</h2></div>';
echo '<div class="filters">';
echo calendar_filter_controls('event', 'action=' . $action . '&amp;type=' . $eventtype . '&amp;id=' . $eventid);
echo '</div>';
echo '</div>';
echo '<div class="sideblock">';
echo '<div class="header"><h2>' . get_string('monthlyview', 'calendar') . '</h2></div>';
echo '<div class="minicalendarblock minicalendartop">';
echo calendar_top_controls('display', array('id' => $urlcourse, 'm' => $prevmon, 'y' => $prevyr));
echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
echo '</div><div class="minicalendarblock">';
开发者ID:NextEinstein,项目名称:riverhills,代码行数:31,代码来源:event.php

示例8: get_events

 function get_events($username, $start_date, $end_date, $type, $course_id)
 {
     global $USER, $DB;
     $username = utf8_decode($username);
     $username = strtolower($username);
     $user = get_complete_user_data('username', $username);
     if ($username != 'guest') {
         if ($course_id) {
             if (!($course = $DB->get_record("course", array("id" => $course_id)))) {
                 return array();
             }
             $coursestoload = array($course_id => $course);
         } else {
             $coursestoload = enrol_get_users_courses($user->id, true);
         }
     } else {
         if (!($course = $DB->get_record("course", array("id" => 1)))) {
             return array();
         }
         $coursestoload = array(1 => $course);
     }
     $ws_user = $USER;
     // save $USER var to reset it after use. It holds web service user. I don't think it is needed, but just in case...
     $USER = $user;
     $ignorefilters = false;
     list($courses, $group, $user_id_not_used) = calendar_set_filters($coursestoload, $ignorefilters);
     $USER = $ws_user;
     // reset global var
     $events = calendar_get_events($start_date, $end_date, $user->id, $group, $courses);
     $es = array();
     foreach ($events as $event) {
         // We filter user and site events here
         if ($type == 'site' && $event->eventtype != 'site') {
             continue;
         } else {
             if ($type == 'user') {
                 //  We only show events with userid set as the user
                 if ($event->userid != $user->id) {
                     continue;
                 }
             }
         }
         $e = array();
         $e['id'] = $event->id;
         $e['name'] = $event->name;
         $e['description'] = $event->description;
         $e['timestart'] = $event->timestart;
         $e['timeduration'] = $event->timeduration;
         $es[] = $e;
     }
     return $es;
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:52,代码来源:auth.php

示例9: calendar_get_default_courses

             // Being displayed at site level. This will cause the filter to fall back to auto-detecting
             // the list of courses it will be grabbing events from.
             $filtercourse    = NULL;
             $groupeventsfrom = NULL;
             $SESSION->cal_courses_shown = calendar_get_default_courses(true);
             calendar_set_referring_course(0);
 } else {
             // Forcibly filter events to include only those from the particular course we are in.
             $filtercourse    = array($courseshown => $COURSE);
             $groupeventsfrom = array($courseshown => 1);
 }
 */
 calendar_set_referring_course($courseshown);
 // Be VERY careful with the format for default courses arguments!
 // Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions.
 calendar_set_filters($courses, $group, $user, $filtercourse, $groupeventsfrom, false);
 $restrictions = '';
 $restrictions .= 'timestart + timeduration >= ' . $from_date;
 $restrictions .= ' AND timestart <= ' . $to_date;
 $restrictions .= ' AND ( (userid = ' . $USER->id . ' AND courseid = 0 AND groupid = 0)';
 $restrictions .= ' OR (groupid = 0 AND courseid IN (1,' . $courseshown . ')))';
 $restrictions .= ' AND visible = 1';
 $events = get_records_select('event', $restrictions, 'timestart');
 $return_events = array();
 foreach ($events as $event) {
     if (function_exists(calendar_add_event_metadata)) {
         calendar_add_event_metadata($event);
     }
     $new_event = array();
     $new_event["id"] = $event->id;
     $new_event["name"] = $event->name;
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:main.php

示例10: startCalendar

function startCalendar($course)
{
    $view = optional_param('view', 'upcoming', PARAM_ALPHA);
    $day = optional_param('cal_d', 0, PARAM_INT);
    $mon = optional_param('cal_m', 0, PARAM_INT);
    $yr = optional_param('cal_y', 0, PARAM_INT);
    // Initialize the session variables
    calendar_session_vars();
    //add_to_log($course->id, "course", "view", "view.php?id=$course->id", "$course->id");
    $now = usergetdate(time());
    $pagetitle = '';
    $nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL . 'view.php?view=upcoming&amp;course=' . $course->id . '&amp;', $now['mday'], $now['mon'], $now['year']);
    if (!checkdate($mon, $day, $yr)) {
        $day = intval($now['mday']);
        $mon = intval($now['mon']);
        $yr = intval($now['year']);
    }
    $time = make_timestamp($yr, $mon, $day);
    switch ($view) {
        case 'day':
            $nav .= ' -> ' . userdate($time, get_string('strftimedate'));
            $pagetitle = get_string('dayview', 'calendar');
            break;
        case 'month':
            $nav .= ' -> ' . userdate($time, get_string('strftimemonthyear'));
            $pagetitle = get_string('detailedmonthview', 'calendar');
            break;
        case 'upcoming':
            $pagetitle = get_string('upcomingevents', 'calendar');
            break;
    }
    // If a course has been supplied in the URL, change the filters to show that one
    if (!empty($course->id)) {
        if ($course = get_record('course', 'id', $course->id)) {
            if ($course->id == SITEID) {
                // If coming from the home page, show all courses
                $SESSION->cal_courses_shown = calendar_get_default_courses(true);
                calendar_set_referring_course(0);
            } else {
                // Otherwise show just this one
                $SESSION->cal_courses_shown = $course->id;
                calendar_set_referring_course($SESSION->cal_courses_shown);
            }
        }
    } else {
        $course = null;
    }
    if (empty($USER->id) or isguest()) {
        $defaultcourses = calendar_get_default_courses();
        calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
    } else {
        calendar_set_filters($courses, $groups, $users);
    }
    // Let's see if we are supposed to provide a referring course link
    // but NOT for the "main page" course
    if ($SESSION->cal_course_referer != SITEID && ($shortname = get_field('course', 'shortname', 'id', $SESSION->cal_course_referer)) !== false) {
        // If we know about the referring course, show a return link and ALSO require login!
        require_login();
        $nav = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $SESSION->cal_course_referer . '">' . $shortname . '</a> -> ' . $nav;
        if (empty($course)) {
            $course = get_record('course', 'id', $SESSION->cal_course_referer);
            // Useful to have around
        }
    }
    $strcalendar = get_string('calendar', 'calendar');
    $prefsbutton = calendar_preferences_button();
    /// Print the page header
    if ($course->category) {
        $navigation = "<a href=\"../../course/view.php?id={$course->id}\">{$course->shortname}</a> ->";
    } else {
        $navigation = '';
    }
    echo calendar_overlib_html();
    // Layout the whole page as three big columns.
    echo '<table id="calendar" style="height:100%;">';
    echo '<tr>';
    // START: Main column
    /// Print the main part of the pageecho $user;
    echo '<td class="maincalendar">';
    echo '<div class="heightcontainer">';
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:81,代码来源:calendarLib.php

示例11: moodle_url

    } else {
        if ($data->duration == 2) {
            $data->timeduration = $data->timedurationminutes * MINSECS;
        } else {
            $data->timeduration = 0;
        }
    }
    $event->update($data);
    $eventurl = new moodle_url(CALENDAR_URL . 'view.php', array('view' => 'day'));
    if (!empty($event->courseid)) {
        $eventurl->param('course', $event->courseid);
    }
    $eventurl->param('cal_d', date('j', $event->timestart));
    $eventurl->param('cal_m', date('n', $event->timestart));
    $eventurl->param('cal_y', date('Y', $event->timestart));
    $eventurl->set_anchor('event_' . $event->id);
    redirect($eventurl);
}
$PAGE->navbar->add($strcalendar, $link);
$PAGE->navbar->add($title);
$PAGE->set_title($site->shortname . ': ' . $strcalendar . ': ' . $title);
$PAGE->set_heading($COURSE->fullname);
calendar_set_filters($calendar->courses, $calendar->groups, $calendar->users);
$renderer = $PAGE->get_renderer('core_calendar');
$calendar->add_sidecalendar_blocks($renderer);
echo $OUTPUT->header();
echo $renderer->start_layout();
echo $OUTPUT->heading($title);
$mform->display();
echo $renderer->complete_layout();
echo $OUTPUT->footer();
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:31,代码来源:event.php

示例12: get_upcoming_events

 /**
  * Returns upcoming events for a course
  * 
  * @param int $id Course identifier
  */
 function get_upcoming_events($id)
 {
     global $CFG;
     $id = addslashes($id);
     $courseshown = $id;
     $filtercourse = array($courseshown => $id);
     $groupeventsfrom = array($courseshown => 1);
     $true = true;
     if ($CFG->version >= 2011070100) {
         list($courses, $group, $user) = calendar_set_filters($filtercourse, $true);
         $courses = array($id => $id);
         $events = calendar_get_upcoming($courses, true, true, CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD, CALENDAR_DEFAULT_UPCOMING_MAXEVENTS);
     } else {
         calendar_set_filters($courses, $group, $user, $filtercourse, $groupeventsfrom, true);
         $events = calendar_get_upcoming($courses, $group, $user, CALENDAR_UPCOMING_DAYS, CALENDAR_UPCOMING_MAXEVENTS);
     }
     $data = array();
     foreach ($events as $r) {
         $e['name'] = $r->name;
         $e['timestart'] = $r->timestart;
         $e['courseid'] = $r->courseid;
         $data[] = $e;
     }
     return $data;
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:30,代码来源:auth.php

示例13: optional_param

global $USER, $CFG, $SESSION;
$cal_m = optional_param('cal_m', 0, PARAM_INT);
$cal_y = optional_param('cal_y', 0, PARAM_INT);
require_once $CFG->dirroot . '/calendar/lib.php';
$filtercourse = array();
if (empty($this->instance)) {
    // Overrides: use no course at all
    $courseshown = false;
} else {
    $courseshown = $this->page->course->id;
}
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
// the list of courses it will be grabbing events from.
$filtercourse = calendar_get_default_courses();
list($courses, $group, $user) = calendar_set_filters($filtercourse);
$defaultlookahead = CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD;
if (isset($CFG->calendar_lookahead)) {
    $defaultlookahead = intval($CFG->calendar_lookahead);
}
$lookahead = get_user_preferences('calendar_lookahead', $defaultlookahead);
$defaultmaxevents = CALENDAR_DEFAULT_UPCOMING_MAXEVENTS;
if (isset($CFG->calendar_maxevents)) {
    $defaultmaxevents = intval($CFG->calendar_maxevents);
}
$maxevents = 3;
$events = calendar_get_upcoming($courses, $group, $user, $lookahead, $maxevents);
$upcomingoutput = calendar_get_block_upcoming($events, 'view.php?view=day&amp;course=' . $courseshown . '&amp;');
echo $upcomingoutput;
?>
开发者ID:roelmann,项目名称:krystle,代码行数:29,代码来源:upcoming.php


注:本文中的calendar_set_filters函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。