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


PHP calendar_get_module_cached函数代码示例

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


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

示例1: calendar_add_event_metadata

function calendar_add_event_metadata($event)
{
    global $CFG;
    //Support multilang in event->name
    $event->name = format_string($event->name, true);
    if (!empty($event->modulename)) {
        // Activity event
        // The module name is set. I will assume that it has to be displayed, and
        // also that it is an automatically-generated event. And of course that the
        // fields for get_coursemodule_from_instance are set correctly.
        $module = calendar_get_module_cached($coursecache, $event->modulename, $event->instance);
        if ($module === false) {
            return;
        }
        $modulename = get_string('modulename', $event->modulename);
        $eventtype = get_string($event->eventtype, $event->modulename);
        $icon = $CFG->modpixpath . '/' . $event->modulename . '/icon.gif';
        $event->icon = '<img height="16" width="16" src="' . $icon . '" alt="' . $eventtype . '" title="' . $modulename . '" style="vertical-align: middle;" />';
        $event->referer = '<a href="' . $CFG->wwwroot . '/mod/' . $event->modulename . '/view.php?id=' . $module->id . '">' . $event->name . '</a>';
        $event->courselink = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $module->course . '">' . $coursecache[$module->course]->fullname . '</a>';
        $event->cmid = $module->id;
    } else {
        if ($event->courseid == SITEID) {
            // Site event
            $event->icon = '<img height="16" width="16" src="' . $CFG->pixpath . '/c/site.gif" alt="' . get_string('globalevent', 'calendar') . '" style="vertical-align: middle;" />';
            $event->cssclass = 'event_global';
        } else {
            if ($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) {
                // Course event
                calendar_get_course_cached($coursecache, $event->courseid);
                $event->icon = '<img height="16" width="16" src="' . $CFG->pixpath . '/c/course.gif" alt="' . get_string('courseevent', 'calendar') . '" style="vertical-align: middle;" />';
                $event->courselink = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $event->courseid . '">' . $coursecache[$event->courseid]->fullname . '</a>';
                $event->cssclass = 'event_course';
            } else {
                if ($event->groupid) {
                    // Group event
                    $event->icon = '<img height="16" width="16" src="' . $CFG->pixpath . '/c/group.gif" alt="' . get_string('groupevent', 'calendar') . '" style="vertical-align: middle;" />';
                    $event->cssclass = 'event_group';
                } else {
                    if ($event->userid) {
                        // User event
                        $event->icon = '<img height="16" width="16" src="' . $CFG->pixpath . '/c/user.gif" alt="' . get_string('userevent', 'calendar') . '" style="vertical-align: middle;" />';
                        $event->cssclass = 'event_user';
                    }
                }
            }
        }
    }
    return $event;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:50,代码来源:lib.php

示例2: calendar_add_event_metadata

/**
 * Add calendar event metadata
 *
 * @param stdClass $event event info
 * @return stdClass $event metadata
 */
function calendar_add_event_metadata($event)
{
    global $CFG, $OUTPUT;
    //Support multilang in event->name
    $event->name = format_string($event->name, true);
    if (!empty($event->modulename)) {
        // Activity event
        // The module name is set. I will assume that it has to be displayed, and
        // also that it is an automatically-generated event. And of course that the
        // fields for get_coursemodule_from_instance are set correctly.
        $module = calendar_get_module_cached($coursecache, $event->modulename, $event->instance);
        if ($module === false) {
            return;
        }
        $modulename = get_string('modulename', $event->modulename);
        if (get_string_manager()->string_exists($event->eventtype, $event->modulename)) {
            // will be used as alt text if the event icon
            $eventtype = get_string($event->eventtype, $event->modulename);
        } else {
            $eventtype = '';
        }
        $icon = $OUTPUT->pix_url('icon', $event->modulename) . '';
        $event->icon = '<img src="' . $icon . '" alt="' . $eventtype . '" title="' . $modulename . '" class="icon" />';
        $event->referer = '<a href="' . $CFG->wwwroot . '/mod/' . $event->modulename . '/view.php?id=' . $module->id . '">' . $event->name . '</a>';
        $event->courselink = calendar_get_courselink($module->course);
        $event->cmid = $module->id;
    } else {
        if ($event->courseid == SITEID) {
            // Site event
            $event->icon = '<img src="' . $OUTPUT->pix_url('i/siteevent') . '" alt="' . get_string('globalevent', 'calendar') . '" class="icon" />';
            $event->cssclass = 'calendar_event_global';
        } else {
            if ($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) {
                // Course event
                $event->icon = '<img src="' . $OUTPUT->pix_url('i/courseevent') . '" alt="' . get_string('courseevent', 'calendar') . '" class="icon" />';
                $event->courselink = calendar_get_courselink($event->courseid);
                $event->cssclass = 'calendar_event_course';
            } else {
                if ($event->groupid) {
                    // Group event
                    $event->icon = '<img src="' . $OUTPUT->pix_url('i/groupevent') . '" alt="' . get_string('groupevent', 'calendar') . '" class="icon" />';
                    $event->courselink = calendar_get_courselink($event->courseid);
                    $event->cssclass = 'calendar_event_group';
                } else {
                    if ($event->userid) {
                        // User event
                        $event->icon = '<img src="' . $OUTPUT->pix_url('i/userevent') . '" alt="' . get_string('userevent', 'calendar') . '" class="icon" />';
                        $event->cssclass = 'calendar_event_user';
                    }
                }
            }
        }
    }
    return $event;
}
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:61,代码来源:lib.php


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