diff --git a/course/lib.php b/course/lib.php index 1483d83792e..948ce7f5b3b 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1814,7 +1814,7 @@ function print_groupmode_setting($form, $course=NULL) { if ($course->groupmode or (!$course->groupmodeforce)) { echo ''; echo ''.get_string('groupmode').':'; - echo ''; + echo ''; unset($choices); $choices[NOGROUPS] = get_string('groupsnone'); $choices[SEPARATEGROUPS] = get_string('groupsseparate'); @@ -1851,7 +1851,7 @@ function print_visible_setting($form, $course=NULL) { echo ''; echo ''.get_string('visibletostudents','',moodle_strtolower($course->students)).':'; - echo ''; + echo ''; unset($choices); $choices[1] = get_string('show'); $choices[0] = get_string('hide'); diff --git a/lang/en/quiz.php b/lang/en/quiz.php index b443d1b32f3..079a2cbfa84 100644 --- a/lang/en/quiz.php +++ b/lang/en/quiz.php @@ -131,6 +131,7 @@ $string['editingshortanswer'] = 'Editing a Short-Answer question'; $string['editingtruefalse'] = 'Editing a True/False question'; $string['editquestions'] = 'Edit questions'; $string['editquiz'] = 'Edit Quiz'; +$string['errormissingquestion'] = 'Error: The system is missing the question with id $a'; $string['errornotnumbers'] = 'Error - answers must be numeric'; $string['errorsdetected'] = '$a error(s) detected'; $string['event1'] = 'Autosave'; diff --git a/mod/quiz/config.html b/mod/quiz/config.html index 0c95c5aa7f7..f4b82bc5cab 100644 --- a/mod/quiz/config.html +++ b/mod/quiz/config.html @@ -390,12 +390,15 @@ if ($table_created) { echo ''; } + if ($submitbutton) { ?> " /> + + diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php index 789c065063b..5dc8463985c 100644 --- a/mod/quiz/edit.php +++ b/mod/quiz/edit.php @@ -408,7 +408,7 @@ if (self.name == 'editquestion') { if (! $cm = get_coursemodule_from_instance("quiz", $modform->instance, $course->id)) { error("Course Module ID was incorrect"); } - notify("$strattemptsexist
id\">$strviewallanswers ($usercount $strusers)"); + notify("$strattemptsexist
id\">$strviewallanswers ($usercount $strusers)"); echo "
\n"; echo "
wwwroot/mod/quiz/edit.php\">\n"; diff --git a/mod/quiz/index.php b/mod/quiz/index.php index 3752bccbd4b..e7a4d09bcf3 100644 --- a/mod/quiz/index.php +++ b/mod/quiz/index.php @@ -107,7 +107,7 @@ if ($usercount = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)')) { $attemptcount = count_records('quiz_attempts', 'quiz', $quiz->id, 'preview', 0); $strviewallreports = get_string('viewallreports', 'quiz', $attemptcount); - $gradecol = "id\">$strviewallreports ($usercount $strusers)"; + $gradecol = "id\">$strviewallreports ($usercount $strusers)"; } else { $answercount = 0; $gradecol = ""; diff --git a/mod/quiz/mod.html b/mod/quiz/mod.html index 381205112db..7a099c5ba83 100644 --- a/mod/quiz/mod.html +++ b/mod/quiz/mod.html @@ -1,35 +1,6 @@ - - - dirroot/mod/quiz/locallib.php"); /// Ensure that all form variables are initialized @@ -121,7 +92,7 @@ : - + @@ -139,7 +110,7 @@ } ?> - + intro); ?> @@ -148,7 +119,7 @@ : - + timeopen and $course->format == "weeks") { $form->timeopen = $course->startdate + (($form->section - 1) * 608400); @@ -162,7 +133,7 @@ : - + timeclose and $course->format == "weeks") { $form->timeclose = $course->startdate + (($form->section) * 608400); @@ -177,7 +148,7 @@ quiz_fix_timelimit) { ?> : - + timelimit, get_string("minutes","quiz")); helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz"); @@ -189,7 +160,7 @@ quiz_fix_questionsperpage) { ?> : - + quiz_fix_shufflequestions) { ?> : - + shufflequestions", ""); helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz"); @@ -219,7 +190,7 @@ quiz_fix_shuffleanswers) { ?> : - + shuffleanswers", ""); helpbutton("shuffleanswers", get_string("shuffleanswers","quiz"), "quiz"); @@ -231,7 +202,7 @@ quiz_fix_attempts) { ?> : - + attempts", ""); helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz"); @@ -243,7 +214,7 @@ quiz_fix_attemptonlast) { ?> : - + attemptonlast", ""); @@ -258,7 +229,7 @@ quiz_fix_grademethod) { ?> : - + grademethod", ""); helpbutton("grademethod", get_string("grademethod","quiz"), "quiz"); @@ -270,7 +241,7 @@ quiz_fix_adaptive) { ?> : - + optionflags & QUIZ_ADAPTIVE, ""); helpbutton("adaptive", get_string("adaptive","quiz"), "quiz"); @@ -282,7 +253,7 @@ quiz_fix_penaltyscheme) { ?> : - + penaltyscheme", ""); helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz"); @@ -294,7 +265,7 @@ quiz_fix_decimalpoints) { ?> : - + quiz_fix_popup) { ?> : - + popup", ""); helpbutton("popup", get_string("popup","quiz"), "quiz"); @@ -329,7 +300,7 @@ quiz_fix_password) { ?> : - + @@ -339,7 +310,7 @@ quiz_fix_subnet) { ?> : - + @@ -353,20 +324,48 @@ - - -
- : - + : + + + +
+ +
@@ -376,7 +375,7 @@ quiz_fix_timelimit) { ?> : - + timelimit, get_string("minutes","quiz")); helpbutton("timelimit", get_string("quiztimer","quiz"), "quiz"); @@ -388,7 +387,7 @@ quiz_fix_questionsperpage) { ?> : - + quiz_fix_shufflequestions) { ?> : - + shufflequestions", ""); helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz"); @@ -418,7 +417,7 @@ quiz_fix_shuffleanswers) { ?> : - + shuffleanswers", ""); helpbutton("shuffleanswers", get_string("shuffleanswers","quiz"), "quiz"); @@ -430,7 +429,7 @@ quiz_fix_attempts) { ?> : - + attempts", ""); helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz"); @@ -441,7 +440,7 @@ quiz_fix_attemptonlast) { ?> : - + attemptonlast", ""); @@ -455,7 +454,7 @@ quiz_fix_grademethod) { ?> : - + grademethod", ""); helpbutton("grademethod", get_string("grademethod","quiz"), "quiz"); @@ -467,7 +466,7 @@ quiz_fix_adaptive) { $fix = 1; ?> : - + optionflags & QUIZ_ADAPTIVE, ""); helpbutton("adaptive", get_string("adaptive","quiz"), "quiz"); @@ -479,7 +478,7 @@ quiz_fix_penaltyscheme) { $fix = 1; ?> : - + penaltyscheme", ""); helpbutton("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz"); @@ -491,7 +490,7 @@ quiz_fix_decimalpoints) { ?> : - + quiz_fix_popup) { ?> : - + popup", ""); helpbutton("popup", get_string("popup","quiz"), "quiz"); @@ -526,7 +525,7 @@ quiz_fix_password) { ?> : - + @@ -536,7 +535,7 @@ quiz_fix_subnet) { ?> : - + @@ -546,12 +545,11 @@ - +
- - - @@ -577,6 +575,4 @@
- + diff --git a/mod/quiz/report.php b/mod/quiz/report.php index fc6948fe441..90b4c070860 100644 --- a/mod/quiz/report.php +++ b/mod/quiz/report.php @@ -8,7 +8,7 @@ optional_variable($id); // Course Module ID, or optional_variable($q); // quiz ID - optional_variable($mode, "simplestat"); // Report mode + optional_variable($mode, "overview"); // Report mode if ($id) { if (! $cm = get_record("course_modules", "id", $id)) { @@ -58,26 +58,6 @@ add_to_log($course->id, "quiz", "report", "report.php?id=$cm->id", "$quiz->id", "$cm->id"); - -/* Code moved into each plugin report.php -/// Define some strings - - $strquizzes = get_string("modulenameplural", "quiz"); - $strquiz = get_string("modulename", "quiz"); - -/// Print the page header - - print_header_simple(format_string($quiz->name), "", - "id\">$strquizzes - -> ".format_string($quiz->name), - "", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); - -/// Print the tabs - - $currenttab = 'reports'; - include('tabs.php'); -*/ - /// Open the selected quiz report and display it $mode = clean_filename($mode); diff --git a/mod/quiz/report/analysis/report.php b/mod/quiz/report/analysis/report.php index d7b68fe50ee..4c4c343e03f 100644 --- a/mod/quiz/report/analysis/report.php +++ b/mod/quiz/report/analysis/report.php @@ -1,5 +1,4 @@ libdir.'/tablelib.php'); @@ -9,7 +8,7 @@ class quiz_report extends quiz_default_report { function display($quiz, $cm, $course) { /// This function just displays the report global $CFG, $SESSION, $db, $QUIZ_QTYPES; - $strnoquiz = get_string('noquiz','quiz'); + $strnoattempts = get_string('noattempts','quiz'); if (!$quiz->questions) { @@ -39,7 +38,7 @@ class quiz_report extends quiz_default_report { return true; } - // set tTable and Analysis stats options + // set Table and Analysis stats options if(!isset($SESSION->quiz_analysis_table)) { $SESSION->quiz_analysis_table = array('attemptselection' => 0, 'lowmarklimit' => 0, 'pagesize' => 10); } @@ -343,7 +342,7 @@ class quiz_report extends quiz_default_report { global $CFG, $USER; echo '
'; - echo '
'; + echo ''; echo '

'.get_string('analysisoptions', 'quiz').':

'; echo ''; echo ''; diff --git a/mod/quiz/review.php b/mod/quiz/review.php index e5490fcd1be..75335904869 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -204,6 +204,14 @@ $pagequestions = explode(',', $pagelist); $number = quiz_first_questionnumber($attempt->layout, $pagelist); foreach ($pagequestions as $i) { + if (!isset($questions[$i])) { + print_simple_box_start('center', '90%'); + echo '' . $number . '
'; + notify(get_string('errormissingquestion', 'quiz', $i)); + print_simple_box_end(); + $number++; // Just guessing that the missing question would have lenght 1 + continue; + } $options = quiz_get_reviewoptions($quiz, $attempt, $isteacher); $options->validation = QUIZ_EVENTVALIDATE === $states[$i]->event; $options->history = ($isteacher and !$attempt->preview) ? 'all' : 'graded'; diff --git a/mod/quiz/reviewquestion.php b/mod/quiz/reviewquestion.php index 500f0c35644..4484582b61f 100644 --- a/mod/quiz/reviewquestion.php +++ b/mod/quiz/reviewquestion.php @@ -32,13 +32,13 @@ if (! $attempt = get_record('quiz_attempts', 'id', $attemptid)) { error('No such attempt ID exists'); } - if (! $neweststate = get_field('quiz_newest_states', 'newest', 'attemptid', $attemptid, 'questionid', $questionid)) { + if (! $neweststateid = get_field('quiz_newest_states', 'newest', 'attemptid', $attemptid, 'questionid', $questionid)) { // newest_state not set, probably because this is an old attempt from the old quiz module code if (! $state = get_record('quiz_states', 'question', $questionid, 'attempt', $attemptid)) { error('Invalid question id'); } } else { - if (! $state = get_record('quiz_states', 'id', $neweststate->newest)) { + if (! $state = get_record('quiz_states', 'id', $neweststateid)) { error('Invalid state id'); } } @@ -95,7 +95,7 @@ echo ''; // for overlib /// Print heading - print_heading(format_string($quiz->name)); + print_heading(format_string($question->name)); $instance = get_record('quiz_question_instances', 'quiz', $quiz->id, 'question', $question->id); $question->instance = $instance->id; @@ -110,6 +110,35 @@ $options->validation = ($state->event == QUIZ_EVENTVALIDATE); $options->history = 'all'; +/// Print infobox + $table->align = array("right", "left"); + if ($attempt->userid <> $USER->id) { + // Print user picture and name + $student = get_record('user', 'id', $attempt->userid); + $picture = print_user_picture($student->id, $course->id, $student->picture, false, true); + $table->data[] = array($picture, fullname($student, true)); + } + // print quiz name + $table->data[] = array(get_string('modulename', 'quiz').':', format_string($quiz->name)); + if ($isteacher and count($attempts = get_records_select('quiz_attempts', "quiz = '$quiz->id' AND userid = '$attempt->userid'", 'attempt ASC')) > 1) { + // print list of attempts + $attemptlist = ''; + foreach ($attempts as $at) { + $attemptlist .= ($at->id == $attempt->id) + ? ''.$at->attempt.', ' + : ''.$at->attempt.', '; + } + $table->data[] = array(get_string('attempts', 'quiz').':', trim($attemptlist, ' ,')); + } + if ($state->timestamp) { + // print time stamp + $table->data[] = array(get_string("completedon", "quiz").':', userdate($state->timestamp)); + } + // Print info box unless it is empty + if ($table->data) { + print_table($table); + } + quiz_print_quiz_question($question, $state, $number, $quiz, $options); print_footer(); diff --git a/mod/quiz/styles.php b/mod/quiz/styles.php index 7c1ed82014d..42b17e85eb1 100644 --- a/mod/quiz/styles.php +++ b/mod/quiz/styles.php @@ -1,43 +1,10 @@ -.feedbacktext { - display:block; -} .quiz-report-title { text-align: center; font-weight : bold; } -body#mod-quiz-attempts table#attempts, -body#mod-quiz-attempts table#commands, -body#mod-quiz-report table#commands, -body#mod-quiz-report table#itemanalysis -{ - width: 80%; - margin: auto; -} -body#mod-quiz-attempts table#attempts { - margin: 20px auto; -} -body#mod-quiz-attempts table#attempts .header, -body#mod-quiz-attempts table#attempts .cell -{ - padding: 4px; -} -body#mod-quiz-attempts table#attempts .header .commands { - display: inline; -} -body#mod-quiz-attempts table#attempts .picture { - width: 40px; -} -body#mod-quiz-attempts table#attempts td { - border-left-width: 1px; - border-right-width: 1px; - border-left-style: solid; - border-right-style: solid; - vertical-align: bottom; -} - .grade { font-size: small; margin-top: 10pt @@ -45,29 +12,6 @@ body#mod-quiz-attempts table#attempts td { .gradingdetails { font-size: small; } -.feedbacktext { - text-align:right; -} -body#mod-quiz-attempts table#attempts .header { - text-align: left; -} -body#mod-quiz-attempts table#attempts .picture { - text-align: center !important; -} -body#mod-quiz-attempts .controls { - text-align: center; -} - - - - -body#mod-quiz-attempts table#attempts td { - border-color: #dddddd; -} -body#mod-quiz-attempts table#attempts .r1 { - background-color: #eeeeee; -} - body#mod-quiz-report table#itemanalysis { @@ -111,11 +55,3 @@ body#mod-quiz-report table#itemanalysis .qname { } - -body#mod-quiz-report .controls { - text-align: center; -} - -.editorhelptext { - font-size:0.7em; -} diff --git a/mod/quiz/tabs.php b/mod/quiz/tabs.php index 285f55e055a..c96737f987e 100644 --- a/mod/quiz/tabs.php +++ b/mod/quiz/tabs.php @@ -21,20 +21,19 @@ $inactive = array(); $row[] = new tabobject('info', "view.php?q=$quiz->id", get_string('info', 'quiz')); - $row[] = new tabobject('attempts', "attempts.php?q=$quiz->id", get_string('attempts', 'quiz')); + $row[] = new tabobject('reports', "report.php?q=$quiz->id", get_string('reports', 'quiz')); $row[] = new tabobject('preview', "attempt.php?q=$quiz->id", get_string('preview', 'quiz')); if (isteacheredit($course->id)) { $row[] = new tabobject('edit', "edit.php?quizid=$quiz->id", get_string('editquiz', 'quiz')); //$row[] = new tabobject('update', "$CFG->wwwroot/course/mod.php?update=$cm->id&sesskey=$USER->sesskey", get_string('updatethis', '', get_string('modulename', 'quiz'))); } - $row[] = new tabobject('reports', "report.php?q=$quiz->id", get_string('reports', 'quiz')); $tabs[] = $row; if ($currenttab == 'reports' and isset($mode)) { $inactive[] = 'reports'; $allreports = get_list_of_plugins("mod/quiz/report"); - $reportlist = array ('simplestat', 'fullstat'); // Standard reports we want to show first + $reportlist = array ('overview', 'regrade', 'analysis'); // Standard reports we want to show first foreach ($allreports as $report) { if (!in_array($report, $reportlist)) { diff --git a/mod/quiz/view.php b/mod/quiz/view.php index a4b5cbf0650..be4eb0a6075 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -119,7 +119,7 @@ $usercount = count_records_select('quiz_attempts', "quiz = '$quiz->id' AND preview = '0'", 'COUNT(DISTINCT userid)'); $strusers = $course->students; - notify("id\">$strviewallanswers ($usercount $strusers)"); + notify("id\">$strviewallanswers ($usercount $strusers)"); print_footer($course); exit; } diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index c723e44e40a..90960c89d61 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -1356,10 +1356,12 @@ body#mod-forum-search .introcontent { .feedbacktext { display:block; + text-align:right; } body#mod-quiz-report table#attempts, -body#mod-quiz-report table#commands +body#mod-quiz-report table#commands, +body#mod-quiz-report table#itemanalysis { width: 80%; margin: auto; @@ -1383,9 +1385,7 @@ body#mod-quiz-report table#attempts td { border-right-width: 1px; border-left-style: solid; border-right-style: solid; -} -.feedbacktext { - text-align:right; + vertical-align: bottom; } body#mod-quiz-report table#attempts .header { text-align: left;