fix some Hebrew strings
[moodle.git] / mod / quiz / report / analysis / report.php
Content-type: text/html Official Moodle git projects - moodle.git/blame - mod/quiz/report/analysis/report.php


500 - Internal Server Error

Malformed UTF-8 character (fatal) at (eval 5) line 1, <$fd> line 255.
CommitLineData
0fc59399 1<?php // $Id$
0fc59399 2/// Item analysis displays a table of quiz questions and their performance
3
0fc59399 4 require_once($CFG->libdir.'/tablelib.php');
5
0fc59399 6/// Item analysis displays a table of quiz questions and their performance
7
8class quiz_report extends quiz_default_report {
9
10 function display($quiz, $cm, $course) { /// This function just displays the report
0fc59399 11 global $CFG, $SESSION, $db, $QUIZ_QTYPES;
9f701b4c 12 $strnoquiz = get_string('noquiz','quiz');
0fc59399 13 $strnoattempts = get_string('noattempts','quiz');
0fc59399 14
15 if (!$quiz->questions) {
083fc55c 16 $this->print_header_and_tabs($cm, $course, $quiz, $reportmode="analysis");
0fc59399 17 print_heading($strnoattempts);
18 return true;
19 }
39395fd6 20
0fc59399 21 /// Check to see if groups are being used in this quiz
22 if ($groupmode = groupmode($course, $cm)) { // Groups are being used
23 $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id&amp;mode=overview");
24 } else {
25 $currentgroup = false;
26 }
27
43f14820 28 /// Get all users: students
0fc59399 29 if ($currentgroup) {
1b6fe500 30 $users = get_group_students($currentgroup);
0fc59399 31 }
32 else {
1b6fe500 33 $users = get_course_students($course->id);
0fc59399 34 }
35
36 if(empty($users)) {
083fc55c 37 $this->print_header_and_tabs($cm, $course, $quiz, $reportmode="analysis");
0fc59399 38 print_heading($strnoattempts);
39 return true;
40 }
41
7bbe08a2 42 // set Table and Analysis stats options
0fc59399 43 if(!isset($SESSION->quiz_analysis_table)) {
43f14820 44 $SESSION->quiz_analysis_table = array('attemptselection' => 0, 'lowmarklimit' => 0, 'pagesize' => 10);
0fc59399 45 }
46
47 foreach($SESSION->quiz_analysis_table as $option => $value) {
48 $urlparam = optional_param($option, NULL);
49 if($urlparam === NULL) {
50 $$option = $value;
51 }
52 else {
53 $$option = $SESSION->quiz_analysis_table[$option] = $urlparam;
54 }
55 }
56
57 $scorelimit = $quiz->grade * $lowmarklimit/ 100;
58
a472ce59 59 // ULPGC ecastro DEBUG this is here to allow for different SQL to select attempts
0fc59399 60 switch ($attemptselection) {
61 case QUIZ_ALLATTEMPTS :
62 $limit = '';
63 $group = '';
64 break;
65 case QUIZ_HIGHESTATTEMPT :
66 $limit = ', max(qa.sumgrades) ';
67 $group = ' GROUP BY qa.userid ';
68 break;
69 case QUIZ_FIRSTATTEMPT :
70 $limit = ', min(qa.timemodified) ';
71 $group = ' GROUP BY qa.userid ';
72 break;
73 case QUIZ_LASTATTEMPT :
74 $limit = ', max(qa.timemodified) ';
75 $group = ' GROUP BY qa.userid ';
76 break;
77 }
78
79 $select = 'SELECT qa.* '.$limit;
80 $sql = 'FROM '.$CFG->prefix.'user u '.
81 'LEFT JOIN '.$CFG->prefix.'quiz_attempts qa ON u.id = qa.userid '.
0fc59399 82 'WHERE u.id IN ('.implode(',', array_keys($users)).') AND ( qa.quiz = '.$quiz->id.') '. // ULPGC ecastro
83 ' AND ( qa.sumgrades >= '.$scorelimit.' ) ';
84