diff --git "a/D:\\Temp\\TortoiseGit\\rep7209.tmp\\report-8b8d7fc-left.php" "b/D:\\workspace\\moodle\\mod\\lesson\\report.php" index b702f0c..e48dea9 100644 --- "a/D:\\Temp\\TortoiseGit\\rep7209.tmp\\report-8b8d7fc-left.php" +++ "b/D:\\workspace\\moodle\\mod\\lesson\\report.php" @@ -28,7 +28,7 @@ require_once('../../config.php'); require_once($CFG->dirroot.'/mod/lesson/locallib.php'); $id = required_param('id', PARAM_INT); // Course Module ID -$pageid = optional_param('pageid', NULL, PARAM_INT); // Lesson Page ID +$pageid = optional_param('pageid', null, PARAM_INT); // Lesson Page ID $action = optional_param('action', 'reportoverview', PARAM_ALPHA); // action to take $nothingtodisplay = false; @@ -47,13 +47,14 @@ list($sort, $sortparams) = users_order_by_sql('u'); $params = array_merge($params, $sortparams); // TODO: Improve this. Fetching all students always is crazy! if (!empty($cm->groupingid)) { - $params["groupid"] = $cm->groupingid; + $params["groupingid"] = $cm->groupingid; $sql = "SELECT DISTINCT $ufields FROM {lesson_attempts} a INNER JOIN {user} u ON u.id = a.userid INNER JOIN {groups_members} gm ON gm.userid = u.id - INNER JOIN {groupings_groups} gg ON gm.groupid = :groupid - WHERE a.lessonid = :lessonid + INNER JOIN {groupings_groups} gg ON gm.groupid = gg.groupid + WHERE a.lessonid = :lessonid AND + gg.groupingid = :groupingid ORDER BY $sort"; } else { $sql = "SELECT DISTINCT $ufields @@ -72,7 +73,7 @@ $url = new moodle_url('/mod/lesson/report.php', array('id'=>$id)); if ($action !== 'reportoverview') { $url->param('action', $action); } -if ($pageid !== NULL) { +if ($pageid !== null) { $url->param('pageid', $pageid); } $PAGE->set_url($url); @@ -181,7 +182,7 @@ if ($action === 'delete') { $n = 0; $timestart = 0; $timeend = 0; - $usergrade = NULL; + $usergrade = null; // search for the grade record for this try. if not there, the nulls defined above will be used. foreach($grades as $grade) { @@ -225,10 +226,10 @@ if ($action === 'delete') { $numofattempts = 0; $avescore = 0; $avetime = 0; - $highscore = NULL; - $lowscore = NULL; - $hightime = NULL; - $lowtime = NULL; + $highscore = null; + $lowscore = null; + $hightime = null; + $lowtime = null; $table = new html_table(); @@ -261,7 +262,7 @@ if ($action === 'delete') { } $temp .= "id&action=reportdetail&userid=".$try['userid'].'&try='.$try['try'].'">'; - if ($try["grade"] !== NULL) { // if NULL then not done yet + if ($try["grade"] !== null) { // if null then not done yet // this is what the link does when the user has completed the try $timetotake = $try["timeend"] - $try["timestart"]; @@ -276,26 +277,26 @@ if ($action === 'delete') { // this is what the link does/looks like when the user has not completed the try $temp .= get_string("notcompleted", "lesson"); $temp .= " ".userdate($try["timestart"]).""; - $timetotake = NULL; + $timetotake = null; } // build up the attempts array $attempts[] = $temp; // run these lines for the stats only if the user finnished the lesson - if ($try["grade"] !== NULL) { + if ($try["grade"] !== null) { $numofattempts++; $avescore += $try["grade"]; $avetime += $timetotake; - if ($try["grade"] > $highscore || $highscore === NULL) { + if ($try["grade"] > $highscore || $highscore === null) { $highscore = $try["grade"]; } - if ($try["grade"] < $lowscore || $lowscore === NULL) { + if ($try["grade"] < $lowscore || $lowscore === null) { $lowscore = $try["grade"]; } - if ($timetotake > $hightime || $hightime == NULL) { + if ($timetotake > $hightime || $hightime == null) { $hightime = $timetotake; } - if ($timetotake < $lowtime || $lowtime == NULL) { + if ($timetotake < $lowtime || $lowtime == null) { $lowtime = $timetotake; } } @@ -332,26 +333,26 @@ if ($action === 'delete') { } else { $avescore = format_float($avescore/$numofattempts, 2); } - if ($avetime == NULL) { + if ($avetime == null) { $avetime = get_string("notcompleted", "lesson"); } else { $avetime = format_float($avetime/$numofattempts, 0); $avetime = format_time($avetime); } - if ($hightime == NULL) { + if ($hightime == null) { $hightime = get_string("notcompleted", "lesson"); } else { $hightime = format_time($hightime); } - if ($lowtime == NULL) { + if ($lowtime == null) { $lowtime = get_string("notcompleted", "lesson"); } else { $lowtime = format_time($lowtime); } - if ($highscore === NULL) { + if ($highscore === null) { $highscore = get_string("notcompleted", "lesson"); } - if ($lowscore === NULL) { + if ($lowscore === null) { $lowscore = get_string("notcompleted", "lesson"); } @@ -401,8 +402,8 @@ if ($action === 'delete') { $formattextdefoptions->para = false; //I'll use it widely in this page $formattextdefoptions->overflowdiv = true; - $userid = optional_param('userid', NULL, PARAM_INT); // if empty, then will display the general detailed view - $try = optional_param('try', NULL, PARAM_INT); + $userid = optional_param('userid', null, PARAM_INT); // if empty, then will display the general detailed view + $try = optional_param('try', null, PARAM_INT); $lessonpages = $lesson->load_all_pages(); foreach ($lessonpages as $lessonpage) { @@ -455,8 +456,8 @@ if ($action === 'delete') { $answerdata = new stdClass; // Set some defaults for the answer data. - $answerdata->score = NULL; - $answerdata->response = NULL; + $answerdata->score = null; + $answerdata->response = null; $answerdata->responseformat = FORMAT_PLAIN; $answerpage->title = format_string($page->title); @@ -473,7 +474,7 @@ if ($action === 'delete') { if (empty($userid)) { // there is no userid, so set these vars and display stats. $answerpage->grayout = 0; - $useranswer = NULL; + $useranswer = null; } elseif ($useranswers = $DB->get_records("lesson_attempts",array("lessonid"=>$lesson->id, "userid"=>$userid, "retry"=>$try,"pageid"=>$page->id), "timeseen")) { // get the user's answer for this page // need to find the right one @@ -488,7 +489,7 @@ if ($action === 'delete') { } else { // user did not answer this page, gray it out and set some nulls $answerpage->grayout = 1; - $useranswer = NULL; + $useranswer = null; } $i = 0; $n = 0;