• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_recent_enrolments函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_recent_enrolments

 /**
  * Returns all recent enrollments
  *
  * @todo MDL-36993 this function always return empty array
  * @return array array of entries from {user} table
  */
 protected function get_recent_enrolments()
 {
     return get_recent_enrolments($this->page->course->id, $this->get_timestart());
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:10,代码来源:block_recent_activity.php


示例2: print_recent_activity

/**
 * This function trawls through the logs looking for
 * anything new since the user's last login
 */
function print_recent_activity($course)
{
    // $course is an object
    global $CFG, $USER, $SESSION, $DB, $OUTPUT;
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    $viewfullnames = has_capability('moodle/site:viewfullnames', $context);
    $timestart = round(time() - COURSE_MAX_RECENT_PERIOD, -2);
    // better db caching for guests - 100 seconds
    if (!isguestuser()) {
        if (!empty($USER->lastcourseaccess[$course->id])) {
            if ($USER->lastcourseaccess[$course->id] > $timestart) {
                $timestart = $USER->lastcourseaccess[$course->id];
            }
        }
    }
    echo '<div class="activitydate">';
    echo get_string('activitysince', '', userdate($timestart));
    echo '</div>';
    echo '<div class="activityhead">';
    echo '<a href="' . $CFG->wwwroot . '/course/recent.php?id=' . $course->id . '">' . get_string('recentactivityreport') . '</a>';
    echo "</div>\n";
    $content = false;
    /// Firstly, have there been any new enrolments?
    $users = get_recent_enrolments($course->id, $timestart);
    //Accessibility: new users now appear in an <OL> list.
    if ($users) {
        echo '<div class="newusers">';
        echo $OUTPUT->heading(get_string("newusers") . ':', 3);
        $content = true;
        echo "<ol class=\"list\">\n";
        foreach ($users as $user) {
            $fullname = fullname($user, $viewfullnames);
            echo '<li class="name"><a href="' . "{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$course->id}\">{$fullname}</a></li>\n";
        }
        echo "</ol>\n</div>\n";
    }
    /// Next, have there been any modifications to the course structure?
    $modinfo = get_fast_modinfo($course);
    $changelist = array();
    $logs = $DB->get_records_select('log', "time > ? AND course = ? AND\n                                            module = 'course' AND\n                                            (action = 'add mod' OR action = 'update mod' OR action = 'delete mod')", array($timestart, $course->id), "id ASC");
    if ($logs) {
        $actions = array('add mod', 'update mod', 'delete mod');
        $newgones = array();
        // added and later deleted items
        foreach ($logs as $key => $log) {
            if (!in_array($log->action, $actions)) {
                continue;
            }
            $info = explode(' ', $log->info);
            // note: in most cases I replaced hardcoding of label with use of
            // $cm->has_view() but it was not possible to do this here because
            // we don't necessarily have the $cm for it
            if ($info[0] == 'label') {
                // Labels are ignored in recent activity
                continue;
            }
            if (count($info) != 2) {
                debugging("Incorrect log entry info: id = " . $log->id, DEBUG_DEVELOPER);
                continue;
            }
            $modname = $info[0];
            $instanceid = $info[1];
            if ($log->action == 'delete mod') {
                // unfortunately we do not know if the mod was visible
                if (!array_key_exists($log->info, $newgones)) {
                    $strdeleted = get_string('deletedactivity', 'moodle', get_string('modulename', $modname));
                    $changelist[$log->info] = array('operation' => 'delete', 'text' => $strdeleted);
                }
            } else {
                if (!isset($modinfo->instances[$modname][$instanceid])) {
                    if ($log->action == 'add mod') {
                        // do not display added and later deleted activities
                        $newgones[$log->info] = true;
                    }
                    continue;
                }
                $cm = $modinfo->instances[$modname][$instanceid];
                if (!$cm->uservisible) {
                    continue;
                }
                if ($log->action == 'add mod') {
                    $stradded = get_string('added', 'moodle', get_string('modulename', $modname));
                    $changelist[$log->info] = array('operation' => 'add', 'text' => "{$stradded}:<br /><a href=\"{$CFG->wwwroot}/mod/{$cm->modname}/view.php?id={$cm->id}\">" . format_string($cm->name, true) . "</a>");
                } else {
                    if ($log->action == 'update mod' and empty($changelist[$log->info])) {
                        $strupdated = get_string('updated', 'moodle', get_string('modulename', $modname));
                        $changelist[$log->info] = array('operation' => 'update', 'text' => "{$strupdated}:<br /><a href=\"{$CFG->wwwroot}/mod/{$cm->modname}/view.php?id={$cm->id}\">" . format_string($cm->name, true) . "</a>");
                    }
                }
            }
        }
    }
    if (!empty($changelist)) {
        echo $OUTPUT->heading(get_string("courseupdates") . ':', 3);
        $content = true;
        foreach ($changelist as $changeinfo => $change) {
//.........这里部分代码省略.........
开发者ID:numbas,项目名称:moodle,代码行数:101,代码来源:lib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_recommend_goods函数代码示例发布时间:2022-05-15
下一篇:
PHP get_realname函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap