diff --git a/report/courseoverview/db/access.php b/report/courseoverview/db/access.php
index 7cbd1ba8ef0..4607139e2ed 100644
--- a/report/courseoverview/db/access.php
+++ b/report/courseoverview/db/access.php
@@ -1,27 +1,27 @@
.
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+/**
+ * Report capabilities
+ *
+ * @package report
+ * @subpackage courseoverview
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
$capabilities = array(
diff --git a/report/courseoverview/index.php b/report/courseoverview/index.php
index 78203b43dd5..04faf7c99dc 100644
--- a/report/courseoverview/index.php
+++ b/report/courseoverview/index.php
@@ -1,122 +1,145 @@
.
- require_once('../../config.php');
- require_once($CFG->dirroot.'/lib/statslib.php');
- require_once($CFG->libdir.'/adminlib.php');
+/**
+ * Course overview report
+ *
+ * @package report
+ * @subpackage courseoverview
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
- $report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
- $time = optional_param('time', 0, PARAM_INT);
- $numcourses = optional_param('numcourses', 20, PARAM_INT);
+require_once('../../config.php');
+require_once($CFG->dirroot.'/lib/statslib.php');
+require_once($CFG->libdir.'/adminlib.php');
- if (empty($CFG->enablestats)) {
- if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
- redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
- } else {
- print_error('statsdisable');
- }
+$report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
+$time = optional_param('time', 0, PARAM_INT);
+$numcourses = optional_param('numcourses', 20, PARAM_INT);
+
+if (empty($CFG->enablestats)) {
+ if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
+ redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
+ } else {
+ print_error('statsdisable');
+ }
+}
+
+admin_externalpage_setup('reportcourseoverview');
+echo $OUTPUT->header();
+
+$course = get_site();
+stats_check_uptodate($course->id);
+
+$strreports = get_string('reports');
+$strcourseoverview = get_string('courseoverview');
+
+$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
+
+$earliestday = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_daily}');
+$earliestweek = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_weekly}');
+$earliestmonth = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_monthly}');
+
+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', 'error', $CFG->wwwroot.'/course/view.php?id='.$course->id);
+}
+
+echo '
';
+
+echo $OUTPUT->heading($reportoptions[$report]);
+
+
+if (!empty($report) && !empty($time)) {
+ $param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
+ if (!empty($param->sql)) {
+ $sql = $param->sql;
+ } else {
+ $sql = "SELECT courseid,".$param->fields."
+ FROM {".'stats_'.$param->table."}
+ WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0
+ GROUP BY courseid
+ $param->extras
+ ORDER BY $param->orderby";
}
- admin_externalpage_setup('reportcourseoverview');
- echo $OUTPUT->header();
+ $courses = $DB->get_records_sql($sql, $param->params, 0, $numcourses);
- $course = get_site();
- stats_check_uptodate($course->id);
+ if (empty($courses)) {
+ echo $OUTPUT->notification(get_string('statsnodata'));
+ echo '';
- $strreports = get_string('reports');
- $strcourseoverview = get_string('courseoverview');
-
- $reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
-
- $earliestday = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_daily}');
- $earliestweek = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_weekly}');
- $earliestmonth = $DB->get_field_sql('SELECT MIN(timeend) FROM {stats_monthly}');
-
- 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', 'error', $CFG->wwwroot.'/course/view.php?id='.$course->id);
- }
-
- echo '';
-
- echo $OUTPUT->heading($reportoptions[$report]);
-
-
- if (!empty($report) && !empty($time)) {
- $param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
- if (!empty($param->sql)) {
- $sql = $param->sql;
+ } else {
+ if (empty($CFG->gdversion)) {
+ echo '(' . get_string("gdneed") .')
';
} else {
- $sql = "SELECT courseid,".$param->fields."
- FROM {".'stats_'.$param->table."}
- WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0
- GROUP BY courseid
- $param->extras
- ORDER BY $param->orderby";
+ echo '';
}
- $courses = $DB->get_records_sql($sql, $param->params, 0, $numcourses);
-
- if (empty($courses)) {
- echo $OUTPUT->notification(get_string('statsnodata'));
- echo '';
-
- } else {
- if (empty($CFG->gdversion)) {
- echo '(' . get_string("gdneed") .')
';
- } else {
- echo '';
- }
-
- $table = new html_table();
- $table->align = array('left','center','center','center');
- $table->head = array(get_string('course'),$param->line1);
- if (!empty($param->line2)) {
- $table->head[] = $param->line2;
- }
- if (!empty($param->line3)) {
- $table->head[] = $param->line3;
- }
-
- foreach ($courses as $c) {
- $a = array();
- $a[] = ''.$DB->get_field('course', 'shortname', array('id'=>$c->courseid)).'';
-
- $a[] = $c->line1;
- if (isset($c->line2)) {
- $a[] = $c->line2;
- }
- if (isset($c->line3)) {
- $a[] = round($c->line3,2);
- }
- $table->data[] = $a;
- }
- echo html_writer::table($table);
+ $table = new html_table();
+ $table->align = array('left','center','center','center');
+ $table->head = array(get_string('course'),$param->line1);
+ if (!empty($param->line2)) {
+ $table->head[] = $param->line2;
}
+ if (!empty($param->line3)) {
+ $table->head[] = $param->line3;
+ }
+
+ foreach ($courses as $c) {
+ $a = array();
+ $a[] = ''.$DB->get_field('course', 'shortname', array('id'=>$c->courseid)).'';
+
+ $a[] = $c->line1;
+ if (isset($c->line2)) {
+ $a[] = $c->line2;
+ }
+ if (isset($c->line3)) {
+ $a[] = round($c->line3,2);
+ }
+ $table->data[] = $a;
+ }
+ echo html_writer::table($table);
}
- echo $OUTPUT->footer();
+}
+echo $OUTPUT->footer();
diff --git a/report/courseoverview/lang/en/report_courseoverview.php b/report/courseoverview/lang/en/report_courseoverview.php
index 5615967d208..8928a86e629 100644
--- a/report/courseoverview/lang/en/report_courseoverview.php
+++ b/report/courseoverview/lang/en/report_courseoverview.php
@@ -1,5 +1,4 @@
.
/**
- * Strings for component 'report_courseoverview', language 'en', branch 'MOODLE_20_STABLE'
+ * Strings for component 'report_courseoverview'.
*
- * @package report_courseoverview
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package report
+ * @subpackage courseoverview
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['courseoverview:view'] = 'View course overview report';
diff --git a/report/courseoverview/reportsgraph.php b/report/courseoverview/reportsgraph.php
index 519322eacf9..78142d1a2dc 100644
--- a/report/courseoverview/reportsgraph.php
+++ b/report/courseoverview/reportsgraph.php
@@ -1,57 +1,80 @@
.
- require_once('../../config.php');
- require_once($CFG->dirroot.'/lib/statslib.php');
- require_once($CFG->dirroot.'/lib/graphlib.php');
+/**
+ * Graph
+ *
+ * @package report
+ * @subpackage courseoverview
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
- $report = required_param('report', PARAM_INT);
- $time = required_param('time', PARAM_INT);
- $numcourses = required_param('numcourses', PARAM_INT);
+require_once('../../config.php');
+require_once($CFG->dirroot.'/lib/statslib.php');
+require_once($CFG->dirroot.'/lib/graphlib.php');
- require_login();
+$report = required_param('report', PARAM_INT);
+$time = required_param('time', PARAM_INT);
+$numcourses = required_param('numcourses', PARAM_INT);
- require_capability('report/courseoverview:view', get_context_instance(CONTEXT_SYSTEM));
+require_login();
- stats_check_uptodate();
+require_capability('report/courseoverview:view', get_context_instance(CONTEXT_SYSTEM));
- $param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
+stats_check_uptodate();
- if (!empty($param->sql)) {
- $sql = $param->sql;
- } else {
- $sql = "SELECT courseid, $param->fields
- FROM {".'stats_'.$param->table."}
- WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0
- GROUP BY courseid
- $param->extras
- ORDER BY $param->orderby";
- }
+$param = stats_get_parameters($time,$report,SITEID,STATS_MODE_RANKED);
- $courses = $DB->get_records_sql($sql, $param->params, 0, $numcourses);
+if (!empty($param->sql)) {
+ $sql = $param->sql;
+} else {
+ $sql = "SELECT courseid, $param->fields
+ FROM {".'stats_'.$param->table."}
+ WHERE timeend >= $param->timeafter AND stattype = 'activity' AND roleid = 0
+ GROUP BY courseid
+ $param->extras
+ ORDER BY $param->orderby";
+}
- if (empty($courses)) {
- $PAGE->set_url('/report/courseoverview/index.php');
- print_error('statsnodata', 'error', $PAGE->url->out());
- }
+$courses = $DB->get_records_sql($sql, $param->params, 0, $numcourses);
+
+if (empty($courses)) {
+ $PAGE->set_url('/report/courseoverview/index.php');
+ print_error('statsnodata', 'error', $PAGE->url->out());
+}
- $graph = new graph(750,400);
+$graph = new graph(750,400);
- $graph->parameter['legend'] = 'outside-right';
- $graph->parameter['legend_size'] = 10;
- $graph->parameter['x_axis_angle'] = 90;
- $graph->parameter['title'] = false; // moodle will do a nicer job.
- $graph->y_tick_labels = null;
- $graph->offset_relation = null;
- if ($report != STATS_REPORT_ACTIVE_COURSES) {
- $graph->parameter['y_decimal_left'] = 2;
- }
+$graph->parameter['legend'] = 'outside-right';
+$graph->parameter['legend_size'] = 10;
+$graph->parameter['x_axis_angle'] = 90;
+$graph->parameter['title'] = false; // moodle will do a nicer job.
+$graph->y_tick_labels = null;
+$graph->offset_relation = null;
+if ($report != STATS_REPORT_ACTIVE_COURSES) {
+ $graph->parameter['y_decimal_left'] = 2;
+}
- foreach ($courses as $c) {
- $graph->x_data[] = $DB->get_field('course', 'shortname', array('id'=>$c->courseid));
- $graph->y_data['bar1'][] = $c->{$param->graphline};
- }
- $graph->y_order = array('bar1');
- $graph->y_format['bar1'] = array('colour' => 'blue','bar' => 'fill','legend' => $param->{$param->graphline});
+foreach ($courses as $c) {
+ $graph->x_data[] = $DB->get_field('course', 'shortname', array('id'=>$c->courseid));
+ $graph->y_data['bar1'][] = $c->{$param->graphline};
+}
+$graph->y_order = array('bar1');
+$graph->y_format['bar1'] = array('colour' => 'blue','bar' => 'fill','legend' => $param->{$param->graphline});
- $graph->draw_stack();
+$graph->draw_stack();
diff --git a/report/courseoverview/settings.php b/report/courseoverview/settings.php
index 81ff9715432..e952338296a 100644
--- a/report/courseoverview/settings.php
+++ b/report/courseoverview/settings.php
@@ -1,4 +1,27 @@
.
+
+/**
+ * Report settings
+ *
+ * @package report
+ * @subpackage courseoverview
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
defined('MOODLE_INTERNAL') || die;
diff --git a/report/courseoverview/version.php b/report/courseoverview/version.php
index a2be4bb557a..e44c248c59a 100644
--- a/report/courseoverview/version.php
+++ b/report/courseoverview/version.php
@@ -1,27 +1,30 @@
-.
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+/**
+ * Version info
+ *
+ * @package report
+ * @subpackage courseoverview
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
-$plugin->version = 2010090501;
-$plugin->requires = 2010090501;
+defined('MOODLE_INTERNAL') || die;
+
+$plugin->version = 2011110200; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2011102700.01; // Requires this Moodle version
+$plugin->component = 'report_courseoverview'; // Full name of the plugin (used for diagnostics)