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


PHP calendar_show_event_type函数代码示例

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


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

示例1: calendar_set_filters

/**
 * Returns the courses to load events for, the
 *
 * @param array $courseeventsfrom An array of courses to load calendar events for
 * @param bool $ignorefilters specify the use of filters, false is set as default
 * @return array An array of courses, groups, and user to load calendar events for based upon filters
 */
function calendar_set_filters(array $courseeventsfrom, $ignorefilters = false)
{
    global $USER, $CFG, $DB;
    // For backwards compatability we have to check whether the courses array contains
    // just id's in which case we need to load course objects.
    $coursestoload = array();
    foreach ($courseeventsfrom as $id => $something) {
        if (!is_object($something)) {
            $coursestoload[] = $id;
            unset($courseeventsfrom[$id]);
        }
    }
    if (!empty($coursestoload)) {
        // TODO remove this in 2.2
        debugging('calendar_set_filters now preferes an array of course objects with preloaded contexts', DEBUG_DEVELOPER);
        $courseeventsfrom = array_merge($courseeventsfrom, $DB->get_records_list('course', 'id', $coursestoload));
    }
    $courses = array();
    $user = false;
    $group = false;
    // capabilities that allow seeing group events from all groups
    // TODO: rewrite so that moodle/calendar:manageentries is not necessary here
    $allgroupscaps = array('moodle/site:accessallgroups', 'moodle/calendar:manageentries');
    $isloggedin = isloggedin();
    if ($ignorefilters || calendar_show_event_type(CALENDAR_EVENT_COURSE)) {
        $courses = array_keys($courseeventsfrom);
    }
    if ($ignorefilters || calendar_show_event_type(CALENDAR_EVENT_GLOBAL)) {
        $courses[] = SITEID;
    }
    $courses = array_unique($courses);
    sort($courses);
    if (!empty($courses) && in_array(SITEID, $courses)) {
        // Sort courses for consistent colour highlighting
        // Effectively ignoring SITEID as setting as last course id
        $key = array_search(SITEID, $courses);
        unset($courses[$key]);
        $courses[] = SITEID;
    }
    if ($ignorefilters || $isloggedin && calendar_show_event_type(CALENDAR_EVENT_USER)) {
        $user = $USER->id;
    }
    if (!empty($courseeventsfrom) && (calendar_show_event_type(CALENDAR_EVENT_GROUP) || $ignorefilters)) {
        if (count($courseeventsfrom) == 1) {
            $course = reset($courseeventsfrom);
            if (has_any_capability($allgroupscaps, context_course::instance($course->id))) {
                $coursegroups = groups_get_all_groups($course->id, 0, 0, 'g.id');
                $group = array_keys($coursegroups);
            }
        }
        if ($group === false) {
            if (!empty($CFG->calendar_adminseesall) && has_any_capability($allgroupscaps, context_system::instance())) {
                $group = true;
            } else {
                if ($isloggedin) {
                    $groupids = array();
                    // We already have the courses to examine in $courses
                    // For each course...
                    foreach ($courseeventsfrom as $courseid => $course) {
                        // If the user is an editing teacher in there,
                        if (!empty($USER->groupmember[$course->id])) {
                            // We've already cached the users groups for this course so we can just use that
                            $groupids = array_merge($groupids, $USER->groupmember[$course->id]);
                        } else {
                            if ($course->groupmode != NOGROUPS || !$course->groupmodeforce) {
                                // If this course has groups, show events from all of those related to the current user
                                $coursegroups = groups_get_user_groups($course->id, $USER->id);
                                $groupids = array_merge($groupids, $coursegroups['0']);
                            }
                        }
                    }
                    if (!empty($groupids)) {
                        $group = $groupids;
                    }
                }
            }
        }
    }
    if (empty($courses)) {
        $courses = false;
    }
    return array($courses, $group, $user);
}
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:90,代码来源:lib.php

示例2: filter_selection_table

 /**
  * Displays a filter selection table
  *
  * @param calendar_information $calendar
  * @return string
  */
 protected function filter_selection_table(calendar_information $calendar, moodle_url $returnurl = null)
 {
     global $SESSION;
     if ($returnurl === null) {
         $returnurl = $this->page->url;
     }
     $output = html_writer::start_tag('div', array('class' => 'filters'));
     $output .= html_writer::start_tag('table');
     $output .= html_writer::start_tag('tr');
     // Global events
     $link = new moodle_url(CALENDAR_URL . 'set.php', array('var' => 'showglobal', 'return' => base64_encode($returnurl->out(false)), 'sesskey' => sesskey()));
     if (calendar_show_event_type(CALENDAR_EVENT_GLOBAL)) {
         $output .= html_writer::tag('td', '', array('class' => 'calendar_event_global', 'style' => 'width:8px;'));
         $output .= html_writer::tag('td', html_writer::tag('strong', get_string('globalevents', 'calendar')) . ' ' . get_string('shown', 'calendar') . ' (' . html_writer::link($link, get_string('clickhide', 'calendar')) . ')');
     } else {
         $output .= html_writer::tag('td', '', array('style' => 'width:8px;'));
         $output .= html_writer::tag('td', html_writer::tag('strong', get_string('globalevents', 'calendar')) . ' ' . get_string('hidden', 'calendar') . ' (' . html_writer::link($link, get_string('clickshow', 'calendar')) . ')');
     }
     // Course events
     $link = new moodle_url(CALENDAR_URL . 'set.php', array('var' => 'showcourses', 'return' => base64_encode($returnurl->out(false)), 'sesskey' => sesskey()));
     if (calendar_show_event_type(CALENDAR_EVENT_COURSE)) {
         $output .= html_writer::tag('td', '', array('class' => 'calendar_event_course', 'style' => 'width:8px;'));
         $output .= html_writer::tag('td', html_writer::tag('strong', get_string('courseevents', 'calendar')) . ' ' . get_string('shown', 'calendar') . ' (' . html_writer::link($link, get_string('clickhide', 'calendar')) . ')');
     } else {
         $output .= html_writer::tag('td', '', array('style' => 'width:8px;'));
         $output .= html_writer::tag('td', html_writer::tag('strong', get_string('courseevents', 'calendar')) . ' ' . get_string('hidden', 'calendar') . ' (' . html_writer::link($link, get_string('clickshow', 'calendar')) . ')');
     }
     $output .= html_writer::end_tag('tr');
     if (isloggedin() && !isguestuser()) {
         $output .= html_writer::start_tag('tr');
         // Group events
         $link = new moodle_url(CALENDAR_URL . 'set.php', array('var' => 'showgroups', 'return' => base64_encode($returnurl->out(false)), 'sesskey' => sesskey()));
         if (calendar_show_event_type(CALENDAR_EVENT_GROUP)) {
             $output .= html_writer::tag('td', '', array('class' => 'calendar_event_group', 'style' => 'width:8px;'));
             $output .= html_writer::tag('td', html_writer::tag('strong', get_string('groupevents', 'calendar')) . ' ' . get_string('shown', 'calendar') . ' (' . html_writer::link($link, get_string('clickhide', 'calendar')) . ')');
         } else {
             $output .= html_writer::tag('td', '', array('style' => 'width:8px;'));
             $output .= html_writer::tag('td', html_writer::tag('strong', get_string('groupevents', 'calendar')) . ' ' . get_string('hidden', 'calendar') . ' (' . html_writer::link($link, get_string('clickshow', 'calendar')) . ')');
         }
         // User events
         $link = new moodle_url(CALENDAR_URL . 'set.php', array('var' => 'showuser', 'return' => base64_encode($returnurl->out(false)), 'sesskey' => sesskey()));
         if (calendar_show_event_type(CALENDAR_EVENT_USER)) {
             $output .= html_writer::tag('td', '', array('class' => 'calendar_event_user', 'style' => 'width:8px;'));
             $output .= html_writer::tag('td', html_writer::tag('strong', get_string('userevents', 'calendar')) . ' ' . get_string('shown', 'calendar') . ' (' . html_writer::link($link, get_string('clickhide', 'calendar')) . ')');
         } else {
             $output .= html_writer::tag('td', '', array('style' => 'width:8px;'));
             $output .= html_writer::tag('td', html_writer::tag('strong', get_string('userevents', 'calendar')) . ' ' . get_string('hidden', 'calendar') . ' (' . html_writer::link($link, get_string('clickshow', 'calendar')) . ')');
         }
         $output .= html_writer::end_tag('tr');
     }
     $output .= html_writer::end_tag('table');
     $output .= html_writer::end_tag('div');
     return $output;
 }
开发者ID:rosenclever,项目名称:moodle,代码行数:60,代码来源:renderer.php


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