diff --git a/mod/quiz/accessrules.php b/mod/quiz/accessrules.php index e7eeb711fe4..c7f7d07d585 100644 --- a/mod/quiz/accessrules.php +++ b/mod/quiz/accessrules.php @@ -224,7 +224,7 @@ class quiz_access_manager { $url = $this->_quizobj->view_url(); if ($this->securewindow_required($canpreview)) { print_header(); - print_box_start(); + echo $OUTPUT->box_start(); if ($message) { echo '
' . $message . '
' . get_string('windowclosing', 'quiz') . '
'; $delay = 5; @@ -232,7 +232,7 @@ class quiz_access_manager { echo '' . get_string('pleaseclose', 'quiz') . '
'; $delay = 0; } - print_box_end(); + echo $OUTPUT->box_end(); $PAGE->requires->js_function_call('quiz_secure_window.close', array($url, $delay)); echo $OUTPUT->footer(); die(); @@ -624,9 +624,9 @@ class password_access_rule extends quiz_access_rule_base { } if (trim(strip_tags($this->_quiz->intro))) { $cm = get_coursemodule_from_id('quiz', $this->_quiz->id); - $output .= print_box(format_module_intro('quiz', $this->_quiz, $cm->id), 'generalbox', 'intro', true); + $output .= $OUTPUT->box(format_module_intro('quiz', $this->_quiz, $cm->id), 'generalbox', 'intro'); } - $output .= print_box_start('generalbox', 'passwordbox', true); + $output .= $OUTPUT->box_start('generalbox', 'passwordbox'); /// If they have previously tried and failed to enter a password, tell them it was wrong. if (!empty($enteredpassword)) { @@ -650,7 +650,7 @@ class password_access_rule extends quiz_access_rule_base { $output .= "\n"; /// Finish page. - $output .= print_box_end(true); + $output .= $OUTPUT->box_end(); /// return or display form. if ($return) { diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index c9d0e09a2ed..35758a54c0a 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -13,7 +13,7 @@ require_once(dirname(__FILE__) . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); -/// Look for old-style URLs, such as may be in the logs, and redirect them to startattemtp.php +/// Look for old-style URLs, such as may be in the logs, and redirect them to startattemtp.php if ($id = optional_param('id', 0, PARAM_INTEGER)) { redirect($CFG->wwwroot . '/mod/quiz/startattempt.php?cmid=' . $id . '&sesskey=' . sesskey()); } else if ($qid = optional_param('q', 0, PARAM_INTEGER)) { @@ -108,10 +108,10 @@ /// Inform teachers of any restrictions that would apply to students at this point. if ($messages) { - print_box_start('quizaccessnotices'); + echo $OUTPUT->box_start('quizaccessnotices'); echo $OUTPUT->heading(get_string('accessnoticesheader', 'quiz'), 3); $accessmanager->print_messages($messages); - print_box_end(); + echo $OUTPUT->box_end(); } } diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php index 7a9367dc090..bf546cf643a 100644 --- a/mod/quiz/edit.php +++ b/mod/quiz/edit.php @@ -542,7 +542,7 @@ if ($quiz->shufflequestions) { $notifystrings[] = get_string('shufflequestionsselected', 'quiz', $updatelink); } if (!empty($notifystrings)) { - print_box('' . implode('
', $notifystrings) . '
', 'statusdisplay'); + echo $OUTPUT->box('' . implode('
', $notifystrings) . '
', 'statusdisplay'); } if ($quiz_reordertool) { diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index e092004e478..6076e687846 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -1064,7 +1064,7 @@ class quiz_question_bank_view extends question_bank_view { public function display($tabname, $page, $perpage, $sortorder, $sortorderdecoded, $cat, $recurse, $showhidden, $showquestiontext) { - + global $OUTPUT; if ($this->process_actions_needing_ui()) { return; } @@ -1075,7 +1075,7 @@ class quiz_question_bank_view extends question_bank_view { } $this->print_category_info($category); - print_box_start('generalbox questionbank'); + echo $OUTPUT->box_start('generalbox questionbank'); $this->display_category_form($this->contexts->having_one_edit_tab_cap($tabname), $this->baseurl, $cat); @@ -1086,16 +1086,17 @@ class quiz_question_bank_view extends question_bank_view { $this->contexts->having_cap('moodle/question:add')); $this->display_options($recurse, $showhidden, $showquestiontext); - print_box_end(); + echo $OUTPUT->box_end(); } protected function print_choose_category_message($categoryandcontext) { - print_box_start('generalbox questionbank'); + global $OUTPUT; + echo $OUTPUT->box_start('generalbox questionbank'); $this->display_category_form($this->contexts->having_one_edit_tab_cap('edit'), $this->baseurl, $categoryandcontext); echo ""; print_string('selectcategoryabove', 'quiz'); echo "
"; - print_box_end(); + echo $OUTPUT->box_end(); } protected function print_category_info($category) { @@ -1200,4 +1201,4 @@ function quiz_print_status_bar($quiz) { \ No newline at end of file +?> diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 95d93213935..88577b52d36 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -238,7 +238,7 @@ function quiz_user_outline($course, $user, $mod, $quiz) { } /** - * Is this a graded quiz? If this method returns true, you can assume that + * Is this a graded quiz? If this method returns true, you can assume that * $quiz->grade and $quiz->sumgrades are non-zero (for example, if you want to * divide by them). * @@ -434,7 +434,7 @@ function quiz_update_grades($quiz, $userid=0, $nullifnone=true) { quiz_grade_item_update($quiz); } } - + /** * Update all grades in gradebook. * @@ -480,7 +480,7 @@ function quiz_upgrade_grades() { * @return int 0 if ok, error code otherwise */ function quiz_grade_item_update($quiz, $grades=NULL) { - global $CFG; + global $CFG, $OUTPUT; if (!function_exists('grade_update')) { //workaround for buggy PHP versions require_once($CFG->libdir.'/gradelib.php'); } @@ -538,13 +538,13 @@ function quiz_grade_item_update($quiz, $grades=NULL) { $message = get_string('gradeitemislocked', 'grades'); $back_link = $CFG->wwwroot . '/mod/quiz/report.php?q=' . $quiz->id . '&mode=overview'; $regrade_link = qualified_me() . '&confirm_regrade=1'; - print_box_start('generalbox', 'notice'); + echo $OUTPUT->box_start('generalbox', 'notice'); echo ''. $message .'
'; echo ''; - print_box_end(); + echo $OUTPUT->box_end(); return GRADE_UPDATE_ITEM_LOCKED; } @@ -1146,7 +1146,7 @@ function quiz_question_list_instances($questionid) { /** * Implementation of the function for printing the form elements that control * whether the course reset functionality affects the quiz. - * + * * @param $mform form passed by reference */ function quiz_reset_course_form_definition(&$mform) { diff --git a/mod/quiz/report/statistics/report.php b/mod/quiz/report/statistics/report.php index c359c3d499c..383e8cdbdc2 100644 --- a/mod/quiz/report/statistics/report.php +++ b/mod/quiz/report/statistics/report.php @@ -13,7 +13,7 @@ require_once($CFG->dirroot.'/mod/quiz/report/statistics/statistics_form.php'); require_once($CFG->dirroot.'/mod/quiz/report/statistics/statistics_table.php'); class quiz_statistics_report extends quiz_default_report { - + /** * @var object instance of table class used for main questions stats table. */ @@ -36,14 +36,14 @@ class quiz_statistics_report extends quiz_default_report { $pageoptions['id'] = $cm->id; $pageoptions['q'] = $quiz->id; $pageoptions['mode'] = 'statistics'; - + $questions = quiz_report_load_questions($quiz); // Load the question type specific information if (!get_question_options($questions)) { print_error('cannotloadquestion', 'question'); } - + $reporturl = new moodle_url($CFG->wwwroot.'/mod/quiz/report.php', $pageoptions); $mform = new mod_quiz_report_statistics($reporturl); @@ -60,7 +60,7 @@ class quiz_statistics_report extends quiz_default_report { /// find out current groups mode $currentgroup = groups_get_activity_group($cm, true); - + $nostudentsingroup = false;//true if a group is selected and their is noeone in it. if (!empty($currentgroup)) { @@ -72,7 +72,7 @@ class quiz_statistics_report extends quiz_default_report { } else { $groupstudents = array(); } - + if ($recalculate){ if ($todelete = $DB->get_records_menu('quiz_statistics', array('quizid' => $quiz->id, 'groupid'=> (int)$currentgroup, 'allattempts'=>$useallattempts))){ list($todeletesql, $todeleteparams) = $DB->get_in_or_equal(array_keys($todelete)); @@ -88,8 +88,8 @@ class quiz_statistics_report extends quiz_default_report { } redirect($reporturl); } - - + + $this->table = new quiz_report_statistics_table(); $filename = "$course->shortname-".format_string($quiz->name,true); $this->table->is_downloading($download, $filename, get_string('quizstructureanalysis', 'quiz_statistics')); @@ -114,7 +114,7 @@ class quiz_statistics_report extends quiz_default_report { $mform->display(); } - list($quizstats, $questions, $subquestions, $s, $usingattemptsstring) + list($quizstats, $questions, $subquestions, $s, $usingattemptsstring) = $this->quiz_questions_stats($quiz, $currentgroup, $nostudentsingroup, $useallattempts, $groupstudents, $questions); @@ -126,7 +126,7 @@ class quiz_statistics_report extends quiz_default_report { if ($s){ $this->table->setup($quiz, $cm->id, $reporturl, $s); } - + if (!$qid){//main page $this->output_quiz_info_table($course, $cm, $quiz, $quizstats, $usingattemptsstring, $currentgroup, $groupstudents, $useallattempts, $download, $reporturl, $everything); $this->output_quiz_structure_analysis_table($s, $questions, $subquestions); @@ -170,7 +170,7 @@ class quiz_statistics_report extends quiz_default_report { } return true; } - + function sort_response_details($detail1, $detail2){ if ($detail1->credit == $detail2->credit){ return strcmp($detail1->answer, $detail2->answer); @@ -184,31 +184,31 @@ class quiz_statistics_report extends quiz_default_report { return ($answer1->rcount > $answer2->rcount)? -1 : 1; } } - + function output_individual_question_data($quiz, $question, $reporturl, $quizstats){ - global $CFG, $DB, $QTYPES; + global $CFG, $DB, $QTYPES, $OUTPUT; require_once($CFG->dirroot.'/mod/quiz/report/statistics/statistics_question_table.php'); $this->qtable = new quiz_report_statistics_question_table($question->id); $downloadtype = $this->table->is_downloading(); if (!$this->table->is_downloading()){ $datumfromtable = $this->table->format_row($question); - + $questioninfotable = new object(); $questioninfotable->align = array('center', 'center'); $questioninfotable->width = '60%'; $questioninfotable->class = 'generaltable titlesleft'; - + $questioninfotable->data = array(); $questioninfotable->data[] = array(get_string('modulename', 'quiz'), $quiz->name); $questioninfotable->data[] = array(get_string('questionname', 'quiz_statistics'), $question->name.' '.$datumfromtable['actions']); $questioninfotable->data[] = array(get_string('questiontype', 'quiz_statistics'), $datumfromtable['icon'].' '.get_string($question->qtype,'quiz').' '.$datumfromtable['icon']); $questioninfotable->data[] = array(get_string('positions', 'quiz_statistics'), $question->_stats->positions); - + $questionstatstable = new object(); $questionstatstable->align = array('center', 'center'); $questionstatstable->width = '60%'; $questionstatstable->class = 'generaltable titlesleft'; - + unset($datumfromtable['number']); unset($datumfromtable['icon']); $actions = $datumfromtable['actions']; @@ -227,12 +227,12 @@ class quiz_statistics_report extends quiz_default_report { } echo $OUTPUT->heading(get_string('questioninformation', 'quiz_statistics')); print_table($questioninfotable); - - print_box(format_text($question->questiontext, $question->questiontextformat).$actions, 'boxaligncenter generalbox boxwidthnormal mdl-align'); - + + echo $OUTPUT->box(format_text($question->questiontext, $question->questiontextformat).$actions, 'boxaligncenter generalbox boxwidthnormal mdl-align'); + echo $OUTPUT->heading(get_string('questionstatistics', 'quiz_statistics')); print_table($questionstatstable); - + } else { $this->qtable->export_class_instance($this->table->export_class_instance()); $questiontabletitle = !empty($question->number)?'('.$question->number.') ':''; @@ -253,7 +253,7 @@ class quiz_statistics_report extends quiz_default_report { if ($this->table->is_downloading()){ $exportclass->output_headers($this->qtable->headers); } - + $responses = $DB->get_records('quiz_question_response_stats', array('quizstatisticsid' => $quizstats->id, 'questionid' => $question->id), 'credit DESC, subqid ASC, aid ASC, rcount DESC'); $responses = quiz_report_index_by_keys($responses, array('subqid', 'aid'), false); foreach ($responses as $subqid => $response){ @@ -278,12 +278,12 @@ class quiz_statistics_report extends quiz_default_report { uasort($tresponsesforsubq, array('quiz_statistics_report', 'sort_response_details')); foreach ($tresponsesforsubq as $aid => $teacherresponse){ $teacherresponserow = new object(); - $teacherresponserow->response = $teacherresponse->answer; + $teacherresponserow->response = $teacherresponse->answer; $teacherresponserow->rcount = 0; $teacherresponserow->subq = $subq; $teacherresponserow->credit = $teacherresponse->credit; if (isset($responses[$subqid][$aid])){ - $singleanswer = count($responses[$subqid][$aid])==1 && + $singleanswer = count($responses[$subqid][$aid])==1 && ($responses[$subqid][$aid][0]->response == $teacherresponserow->response); if (!$singleanswer && $qhaswildcards){ $this->qtable->add_separator(); @@ -319,10 +319,10 @@ class quiz_statistics_report extends quiz_default_report { if (!$this->table->is_downloading()){ $url = $reporturl->out(); $text = get_string('backtoquizreport', 'quiz_statistics'); - print_box("$text", 'boxaligncenter generalbox boxwidthnormal mdl-align'); + echo $OUTPUT->box("$text", 'boxaligncenter generalbox boxwidthnormal mdl-align'); } } - + function output_quiz_structure_analysis_table($s, $questions, $subquestions){ global $OUTPUT; if ($s){ @@ -343,7 +343,7 @@ class quiz_statistics_report extends quiz_default_report { $this->table->finish_output(!$this->table->is_downloading()); } } - + function output_quiz_info_table($course, $cm, $quiz, $quizstats, $usingattemptsstring, $currentgroup, $groupstudents, $useallattempts, $download, $reporturl, $everything){ global $DB, $OUTPUT; @@ -408,11 +408,11 @@ class quiz_statistics_report extends quiz_default_report { if (!$a->count = $DB->count_records_sql($sql, array('time'=>$quizstats->timemodified)+$qaparams)){ $a->count = 0; } - $quizinformationtablehtml .= print_box_start('boxaligncenter generalbox boxwidthnormal mdl-align', '', true); + $quizinformationtablehtml .= $OUTPUT->box_start('boxaligncenter generalbox boxwidthnormal mdl-align'); $quizinformationtablehtml .= get_string('lastcalculated', 'quiz_statistics', $a); $quizinformationtablehtml .= print_single_button($reporturl->out(true), $reporturl->params()+array('recalculate'=>1), get_string('recalculatenow', 'quiz_statistics'), 'post', '', true); - $quizinformationtablehtml .= print_box_end(true); + $quizinformationtablehtml .= $OUTPUT->box_end(); } $downloadoptions = $this->table->get_download_menu(); $quizinformationtablehtml .= '