File: mod.php

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (57 lines) | stat: -rw-r--r-- 2,358 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

    if (!defined('MOODLE_INTERNAL')) {
        die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
    }

    if (!empty($CFG->enablestats)) {
   
        $strreports = get_string('reports');
        $strcourseoverview = get_string('courseoverview');

        print_heading("$strcourseoverview:");

        require_once($CFG->dirroot.'/lib/statslib.php');

        $report     = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
        $time       = optional_param('time', 0, PARAM_INT);
        $numcourses = optional_param('numcourses', 20, PARAM_INT);

        $course = get_site();
        $statsstatus = stats_check_uptodate($course->id);

        $reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);

        $tableprefix = $CFG->prefix.'stats_';

        $earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
        $earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
        $earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');

        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);

        $table->width = '*';
        $table->align = array('left','left','left','left','left','left');
        $table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
                get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
                '<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
                '<input type="submit" value="'.get_string('view').'" />') ;

        echo '<form action="report/courseoverview/index.php" method="post">'."\n";
        print_table($table);
        echo '</form>';
        if ($statsstatus !== NULL) {
            notify ($statsstatus);
        }

    }
?>