From 1f411afd1f64c43bec17ed7caea16a5563ee2596 Mon Sep 17 00:00:00 2001 From: skodak Date: Thu, 20 Apr 2006 22:36:22 +0000 Subject: [PATCH] lots of typos fixed, graph in stats, parameter cleanup etc., somebody could cleanup the page layout of those report/xxx/mod.php files ;-) --- course/report/log/graph.php | 8 +++--- course/report/log/index.php | 24 +++++++++-------- course/report/log/lib.php | 2 +- course/report/log/live.php | 2 ++ course/report/log/mod.php | 2 +- course/report/outline/index.php | 6 ++--- course/report/outline/mod.php | 2 +- course/report/participation/index.php | 33 ++++++++++++++--------- course/report/participation/mod.php | 4 +++ course/report/stats/graph.php | 15 ++++++----- course/report/stats/index.php | 38 ++++++++++++++++----------- course/report/stats/mod.php | 2 +- 12 files changed, 80 insertions(+), 58 deletions(-) diff --git a/course/report/log/graph.php b/course/report/log/graph.php index f888b119ec..976e13f125 100644 --- a/course/report/log/graph.php +++ b/course/report/log/graph.php @@ -5,10 +5,10 @@ require_once("../../lib.php"); require_once("$CFG->libdir/graphlib.php"); - $id = required_param('id',PARAM_INT); // Course ID - $type = required_param('type'); // Graph Type - $user = optional_param('user',0,PARAM_INT); // Student ID - $date = optional_param('date'); // A time of a day (in GMT) + $id = required_param('id', PARAM_INT); // Course ID + $type = required_param('type', PARAM_FILE); // Graph Type + $user = optional_param('user', 0, PARAM_INT); // Student ID + $date = optional_param('date', 0, PARAM_INT); // A time of a day (in GMT) if (! $course = get_record("course", "id", $id)) { error("Course is misconfigured"); diff --git a/course/report/log/index.php b/course/report/log/index.php index 7649a7f803..850cc80f51 100644 --- a/course/report/log/index.php +++ b/course/report/log/index.php @@ -5,18 +5,18 @@ require_once('../../lib.php'); require_once('lib.php'); - $id = required_param('id',PARAM_INT);// Course ID - $group = optional_param('group', -1, PARAM_INT); // Group to display - $user = optional_param('user', 0, PARAM_INT); // User to display - $date = optional_param('date', 0, PARAM_CLEAN); // Date to display - $modname = optional_param('modname', ''); // course_module->id - $modid = optional_param('modid', ''); // course_module->id - $modaction = optional_param('modaction', '', PARAM_ALPHAEXT); // an action as recorded in the logs - $page = optional_param('page', '0', PARAM_INT); // which page to show - $perpage = optional_param('perpage', '100', PARAM_INT); // how many per page + $id = required_param('id', PARAM_INT);// Course ID + $group = optional_param('group', -1, PARAM_INT); // Group to display + $user = optional_param('user', 0, PARAM_INT); // User to display + $date = optional_param('date', 0, PARAM_FILE); // Date to display - number or some string + $modname = optional_param('modname', '', PARAM_CLEAN); // course_module->id + $modid = optional_param('modid', 0, PARAM_FILE); // number or 'site_errors' + $modaction = optional_param('modaction', '', PARAM_PATH); // an action as recorded in the logs + $page = optional_param('page', '0', PARAM_INT); // which page to show + $perpage = optional_param('perpage', '100', PARAM_INT); // how many per page $showcourses = optional_param('showcourses',0,PARAM_INT); // whether to show courses if we're over our limit. - $showusers = optional_param('showusers',0,PARAM_INT); // whether to show users if we're over our limit. - $chooselog = optional_param('chooselog',0,PARAM_INT); + $showusers = optional_param('showusers',0,PARAM_INT); // whether to show users if we're over our limit. + $chooselog = optional_param('chooselog',0,PARAM_INT); require_login(); @@ -34,6 +34,8 @@ } } + add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->fullname); + $strlogs = get_string('logs'); $stradministration = get_string('administration'); $strreports = get_string('reports'); diff --git a/course/report/log/lib.php b/course/report/log/lib.php index 7491f7d056..bb320956b6 100644 --- a/course/report/log/lib.php +++ b/course/report/log/lib.php @@ -1,4 +1,4 @@ -id, "course", "report live", "report/log/live.php?id=$course->id", $course->fullname); + session_write_close(); // we override the default framename so header/footer diff --git a/course/report/log/mod.php b/course/report/log/mod.php index 081e41eebe..92c7eaa26c 100644 --- a/course/report/log/mod.php +++ b/course/report/log/mod.php @@ -1,4 +1,4 @@ -id, "course", "report outline", "course.php?id=$course->id",$course->id); + add_to_log($course->id, "course", "report outline", "report/outline/index.php?id=$course->id", $course->fullname); $stractivityreport = get_string("activityreport"); $strparticipants = get_string("participants"); diff --git a/course/report/outline/mod.php b/course/report/outline/mod.php index a662720ea5..fd43012cc6 100644 --- a/course/report/outline/mod.php +++ b/course/report/outline/mod.php @@ -1,4 +1,4 @@ -id)) { print_error('mustbeteacher', '', $CFG->wwwroot.'/course/view.php?id='.$course->id); } + + add_to_log($course->id, "course", "report participation", "report/participation/index.php?id=$course->id", $course->fullname); $strparticipation = get_string('participationreport'); $strviews = get_string('views'); @@ -44,7 +46,12 @@ $strnav = "id\">$course->shortname -> id\">$strreports -> ". $strparticipation; - print_header($course->fullname.' '.$strparticipation,$strparticipation,$strnav); + print_header("$course->shortname: $strparticipation", "$course->fullname", + "id\">$course->shortname -> + id\">$strreports -> + $strparticipation"); + +// print_header($course->fullname.' '.$strparticipation,$strparticipation,$strnav); $allowedmodules = array('assignment','book','chat','choice','exercise','forum','glossary','hotpot', 'journal','lesson','questionnaire','quiz','resource','scorm', @@ -133,7 +140,7 @@ exit; } - $baseurl = $CFG->wwwroot.'/course/participation.php?id='.$course->id.'&teachers=' + $baseurl = $CFG->wwwroot.'/course/report/participation/index.php?id='.$course->id.'&teachers=' .$teachers.'&instanceid='.$instanceid.'&timefrom='.$timefrom.'&moduleid=' .$moduleid.'&action='.$action.'&perpage='.$perpage; @@ -169,7 +176,7 @@ $instanceid = array_pop(array_keys($instanceoptions)); } - echo '
'. + echo ''. ''."\n". ''."\n". ''."\n". @@ -211,7 +218,7 @@ - $sql = 'SELECT DISTINCT e.userid, u.firstname,u.lastname,u.idnumber,u.nickname,count(l.action) as count FROM ' + $sql = 'SELECT DISTINCT e.userid, u.firstname,u.lastname,u.idnumber,count(l.action) as count FROM ' . $CFG->prefix.'user_'.((!empty($teachers)) ? 'teachers' : 'students').' e ' .' JOIN '.$CFG->prefix.'user u ON u.id = e.userid LEFT JOIN '.$CFG->prefix.'log l ON e.userid = l.userid ' .' AND e.course = l.course AND l.time > '.$timefrom.' AND l.course = '.$course->id.' AND l.module = \''.$module->name.'\' ' @@ -235,7 +242,7 @@ $sql .= ' AND '.$table->get_sql_where(); //initial bar } - $sql .= ' GROUP BY e.userid,u.firstname,u.lastname,u.idnumber,u.nickname,l.userid'; + $sql .= ' GROUP BY e.userid,u.firstname,u.lastname,u.idnumber,l.userid'; if ($table->get_sql_sort()) { $sql .= ' ORDER BY '.$table->get_sql_sort(); diff --git a/course/report/participation/mod.php b/course/report/participation/mod.php index 48560054d7..a58c9511c2 100644 --- a/course/report/participation/mod.php +++ b/course/report/participation/mod.php @@ -1,5 +1,9 @@ dirroot.'/lib/statslib.php'); require_once($CFG->dirroot.'/lib/graphlib.php'); - $courseid = required_param('course',PARAM_INT); - $report = required_param('report',PARAM_INT); - $time = required_param('time',PARAM_INT); - $userid = optional_param('userid', 0, PARAM_INT); - $mode = required_param('mode',PARAM_INT); + $courseid = required_param('course', PARAM_INT); + $report = required_param('report', PARAM_INT); + $time = required_param('time', PARAM_INT); + $mode = required_param('mode', PARAM_INT); + $userid = optional_param('userid', 0, PARAM_INT); if (!$course = get_record("course","id",$courseid)) { error("That's an invalid course id"); @@ -52,6 +52,7 @@ $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; foreach ($stats as $stat) { $graph->x_data[] = userdate($stat->timeend,get_string('strftimedate'),$CFG->timezone); diff --git a/course/report/stats/index.php b/course/report/stats/index.php index 47dfc2e2b5..6f623c2434 100644 --- a/course/report/stats/index.php +++ b/course/report/stats/index.php @@ -1,4 +1,4 @@ -dirroot.'/lib/statslib.php'); @@ -7,18 +7,18 @@ 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); + $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.'/admin/reports.php?time='.$time); + redirect($CFG->wwwroot.'/'.$CFG->admin.'/report.php?time='.$time); } if (!$course = get_record("course","id",$courseid)) { @@ -36,10 +36,12 @@ 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->fullname); + stats_check_uptodate($course->id); - $strheader = get_string('stats'); - $strnav = (($course->id != SITEID) ? ''.$course->shortname.' -> ' : '').$strheader; + $strreports = get_string("reports"); + $strstats = get_string('stats'); $reportoptions = stats_get_report_options($courseid,$mode); @@ -85,13 +87,17 @@ $menu = choose_from_menu($options,'mode',$mode,'','this.form.submit();',0,true); - $menu = ''."\n" + $menu = ''."\n" .''."\n" .''."\n" .$menu."\n".'
'; - print_header($strheader,$strheader,$strnav,'','',true,' ',$menu); - echo '
'."\n" + print_header("$course->shortname: $strstats", "$course->fullname", + "id\">$course->shortname -> + id\">$strreports -> + $strstats", '','',true,' ',$menu); + + echo ''."\n" .''."\n"; $table->width = '*'; @@ -188,9 +194,9 @@ echo "(".get_string("gdneed").")"; } else { if ($mode == STATS_MODE_DETAILED) { - echo '
'; + echo '
'; } else { - echo '
'; + echo '
'; } } @@ -204,12 +210,12 @@ $table->head[] = get_string('logs'); foreach ($stats as $stat) { - $a = array(userdate($stat->timeend,get_string('strftimedate'),$CFG->timezone),$stat->line1); + $a = array(userdate($stat->timeend-(60*60*24),get_string('strftimedate'),$CFG->timezone),$stat->line1); if (isset($stat->line2)) { $a[] = $stat->line2; } if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) { - $a[] = ''.get_string('course').' ' .get_string('logs').' '; + $a[] = ''.get_string('course').' ' .get_string('logs').' '; } $table->data[] = $a; } diff --git a/course/report/stats/mod.php b/course/report/stats/mod.php index 5ace60957f..d8215d910e 100644 --- a/course/report/stats/mod.php +++ b/course/report/stats/mod.php @@ -1,4 +1,4 @@ -