From 0f423e9d64847892e997dca92fae5e72127666a8 Mon Sep 17 00:00:00 2001 From: vyshane Date: Tue, 6 Jun 2006 05:31:42 +0000 Subject: [PATCH] New admin stats report. This report module makes use of /course/report/stats/. Merged from 1.6. --- admin/report/stats/index.php | 63 ++++++++++++++++++++++++++++++++++++ admin/report/stats/mod.php | 12 +++++++ 2 files changed, 75 insertions(+) create mode 100644 admin/report/stats/index.php create mode 100644 admin/report/stats/mod.php diff --git a/admin/report/stats/index.php b/admin/report/stats/index.php new file mode 100644 index 0000000000..a8cf2eb5e3 --- /dev/null +++ b/admin/report/stats/index.php @@ -0,0 +1,63 @@ +dirroot.'/lib/statslib.php'); + require_once($CFG->dirroot.'/course/report/stats/lib.php'); + + if (empty($CFG->enablestats)) { + error("Stats is not enabled."); + } + + $courseid = required_param('course', PARAM_INT); + $report = optional_param('report', 0, PARAM_INT); + $time = optional_param('time', 0, PARAM_INT); + $mode = optional_param('mode', STATS_MODE_GENERAL, PARAM_INT); + $userid = optional_param('userid', 0, PARAM_INT); + + if ($report == STATS_REPORT_USER_LOGINS) { + $courseid = SITEID; //override + } + + if ($mode == STATS_MODE_RANKED) { + redirect($CFG->wwwroot.'/'.$CFG->admin.'/report.php?time='.$time); + } + + if (!$course = get_record("course","id",$courseid)) { + error("That's an invalid course id"); + } + + if (!empty($userid)) { + if (!$user = get_record('user','id',$userid)) { + error("That's an invalid user id"); + } + } + + require_login(); + if (!isteacher($course->id)) { + error("You need to be a teacher to use this page"); + } + + add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id); + + stats_check_uptodate($course->id); + + + $strreports = get_string("reports"); + $strstats = get_string('stats'); + + $menu = report_stats_mode_menu($course, $mode, $time); + + + $crumb = "wwwroot}/admin\">".get_string('administration')." -> + wwwroot}/admin/report.php\">$strreports -> + $strstats"; + + print_header("$course->shortname: $strstats", "$course->fullname", + $crumb, '', '', true, ' ', $menu); + + + require_once($CFG->dirroot.'/course/report/stats/report.php'); + + print_footer(); + +?> \ No newline at end of file diff --git a/admin/report/stats/mod.php b/admin/report/stats/mod.php new file mode 100644 index 0000000000..c4433a9feb --- /dev/null +++ b/admin/report/stats/mod.php @@ -0,0 +1,12 @@ +enablestats)) { + echo '

'; + echo ''.get_string('stats').''; + echo '

'; + } +?> \ No newline at end of file -- 2.39.5