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


PHP stats_get_time_options函数代码示例

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


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

示例1: report_stats_timeoptions

function report_stats_timeoptions($mode)
{
    global $CFG, $DB;
    if ($mode == STATS_MODE_DETAILED) {
        $earliestday = $DB->get_field_sql('SELECT timeend FROM {stats_user_daily} ORDER BY timeend');
        $earliestweek = $DB->get_field_sql('SELECT timeend FROM {stats_user_weekly} ORDER BY timeend');
        $earliestmonth = $DB->get_field_sql('SELECT timeend FROM {stats_user_monthly} ORDER BY timeend');
    } else {
        $earliestday = $DB->get_field_sql('SELECT timeend FROM {stats_daily} ORDER BY timeend');
        $earliestweek = $DB->get_field_sql('SELECT timeend FROM {stats_weekly} ORDER BY timeend');
        $earliestmonth = $DB->get_field_sql('SELECT timeend FROM {stats_monthly} ORDER BY timeend');
    }
    if (empty($earliestday)) {
        $earliestday = time();
    }
    if (empty($earliestweek)) {
        $earliestweek = time();
    }
    if (empty($earliestmonth)) {
        $earliestmonth = time();
    }
    $now = stats_get_base_daily();
    $lastweekend = stats_get_base_weekly();
    $lastmonthend = stats_get_base_monthly();
    return stats_get_time_options($now, $lastweekend, $lastmonthend, $earliestday, $earliestweek, $earliestmonth);
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:26,代码来源:lib.php

示例2: report_stats_timeoptions

function report_stats_timeoptions($mode)
{
    global $CFG;
    $tableprefix = $CFG->prefix . 'stats_';
    if ($mode == STATS_MODE_DETAILED) {
        $tableprefix = $CFG->prefix . 'stats_user_';
    }
    $earliestday = get_field_sql('SELECT timeend FROM ' . $tableprefix . 'daily ORDER BY timeend');
    $earliestweek = get_field_sql('SELECT timeend FROM ' . $tableprefix . 'weekly ORDER BY timeend');
    $earliestmonth = get_field_sql('SELECT timeend FROM ' . $tableprefix . 'monthly ORDER BY timeend');
    if (empty($earliestday)) {
        $earliestday = time();
    }
    if (empty($earliestweek)) {
        $earliestweek = time();
    }
    if (empty($earliestmonth)) {
        $earliestmonth = time();
    }
    $now = stats_get_base_daily();
    $lastweekend = stats_get_base_weekly();
    $lastmonthend = stats_get_base_monthly();
    return stats_get_time_options($now, $lastweekend, $lastmonthend, $earliestday, $earliestweek, $earliestmonth);
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:24,代码来源:lib.php

示例3: get_field_sql

 $earliestday = get_field_sql('SELECT timeend FROM ' . $CFG->prefix . 'stats_user_daily ORDER BY timeend');
 $earliestweek = get_field_sql('SELECT timeend FROM ' . $CFG->prefix . 'stats_user_weekly ORDER BY timeend');
 $earliestmonth = get_field_sql('SELECT timeend FROM ' . $CFG->prefix . 'stats_user_monthly ORDER BY timeend');
 if (empty($earliestday)) {
     $earliestday = time();
 }
 if (empty($earliestweek)) {
     $earliestweek = time();
 }
 if (empty($earliestmonth)) {
     $earliestmonth = time();
 }
 $now = stats_get_base_daily();
 $lastweekend = stats_get_base_weekly();
 $lastmonthend = stats_get_base_monthly();
 $timeoptions = stats_get_time_options($now, $lastweekend, $lastmonthend, $earliestday, $earliestweek, $earliestmonth);
 if (empty($timeoptions)) {
     print_error('nostatstodisplay', '', $CFG->wwwroot . '/course/user.php?id=' . $course->id . '&user=' . $user->id . '&mode=outline');
 }
 // use the earliest.
 $time = array_pop(array_keys($timeoptions));
 $param = stats_get_parameters($time, STATS_REPORT_USER_VIEW, $course->id, STATS_MODE_DETAILED);
 $param->table = 'user_' . $param->table;
 $sql = 'SELECT timeend,' . $param->fields . ' FROM ' . $CFG->prefix . 'stats_' . $param->table . ' WHERE ' . ($course->id == SITEID ? '' : ' courseid = ' . $course->id . ' AND ') . ' userid = ' . $user->id . ' AND timeend >= ' . $param->timeafter . $param->extras . ' ORDER BY timeend DESC';
 $stats = get_records_sql($sql);
 if (empty($stats)) {
     print_error('nostatstodisplay', '', $CFG->wwwroot . '/course/user.php?id=' . $course->id . '&user=' . $user->id . '&mode=outline');
 }
 // MDL-10818, do not display broken graph when user has no permission to view graph
 if ($myreports or has_capability('coursereport/stats:view', $coursecontext)) {
     echo '<center><img src="' . $CFG->wwwroot . '/course/report/stats/graph.php?mode=' . STATS_MODE_DETAILED . '&course=' . $course->id . '&time=' . $time . '&report=' . STATS_REPORT_USER_VIEW . '&userid=' . $user->id . '" alt="' . get_string('statisticsgraph') . '" /></center>';
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:user.php


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