From: nicolasconnault Date: Tue, 18 Aug 2009 05:19:00 +0000 (+0000) Subject: MDL-19822 Upgraded calls to helpbutton, print_simple_box* and notify X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=fef8f84e4b66d3b0f6d8ea304d7a44b628754c28;p=moodle.git MDL-19822 Upgraded calls to helpbutton, print_simple_box* and notify --- diff --git a/question/backuplib.php b/question/backuplib.php index 9e36aae957..876ea34349 100644 --- a/question/backuplib.php +++ b/question/backuplib.php @@ -480,7 +480,7 @@ } function question_insert_site_file_names($course, $backup_unique_code){ - global $QTYPES, $CFG, $DB; + global $QTYPES, $CFG, $DB, $OUTPUT; $status = true; $questionids = question_ids_by_backup ($backup_unique_code); $urls = array(); @@ -501,7 +501,7 @@ $inserturl->path = $url; $status = $status && $DB->insert_record('backup_files', $inserturl); } else { - notify(get_string('linkedfiledoesntexist', 'question', $url)); + echo $OUTPUT->notification(get_string('linkedfiledoesntexist', 'question', $url)); } } return $status; diff --git a/question/editlib.php b/question/editlib.php index d022ca61a8..b0dd53e61e 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -1140,7 +1140,7 @@ class question_bank_view { if (!$category = $DB->get_record('question_categories', array('id' => $categoryid, 'contextid' => $contextid))) { echo $OUTPUT->box_start('generalbox questionbank'); - notify('Category not found!'); + echo $OUTPUT->notification('Category not found!'); echo $OUTPUT->box_end(); return false; } @@ -1910,12 +1910,12 @@ function print_qtype_to_add_option($qtype, $localizedname) { * @param boolean $disabled if true, the button will be disabled. */ function create_new_question_button($categoryid, $params, $caption, $tooltip = '', $disabled = false) { - global $CFG, $PAGE; + global $CFG, $PAGE, $OUTPUT; static $choiceformprinted = false; $params['category'] = $categoryid; print_single_button($CFG->wwwroot . '/question/addquestion.php', $params, $caption,'get', '', false, $tooltip, $disabled); - helpbutton('types', get_string('createnewquestion', 'question'), 'question'); + echo $OUTPUT->help_icon(moodle_help_icon::make('types', get_string('createnewquestion', 'question'), 'question')); $PAGE->requires->yui_lib('dragdrop'); $PAGE->requires->yui_lib('container'); if (!$choiceformprinted) { diff --git a/question/export.php b/question/export.php index 8d0f70e8dd..84729baf53 100644 --- a/question/export.php +++ b/question/export.php @@ -122,7 +122,7 @@ $PAGE->requires->js_function_call('document.location.replace', array($efile))->after_delay(1); } - print_continue('edit.php?' . $thispageurl->get_query_string()); + echo $OUTPUT->continue_button('edit.php?' . $thispageurl->get_query_string()); echo $OUTPUT->footer(); exit; } diff --git a/question/format.php b/question/format.php index 5108c509e2..1356844ca2 100644 --- a/question/format.php +++ b/question/format.php @@ -216,30 +216,30 @@ class qformat_default { * @return boolean success */ function importprocess() { - global $USER, $DB; + global $USER, $DB, $OUTPUT; // reset the timer in case file upload was slow @set_time_limit(); // STAGE 1: Parse the file - notify( get_string('parsingquestions','quiz') ); + echo $OUTPUT->notification( get_string('parsingquestions','quiz') ); if (! $lines = $this->readdata($this->filename)) { - notify( get_string('cannotread','quiz') ); + echo $OUTPUT->notification( get_string('cannotread','quiz') ); return false; } if (! $questions = $this->readquestions($lines)) { // Extract all the questions - notify( get_string('noquestionsinfile','quiz') ); + echo $OUTPUT->notification( get_string('noquestionsinfile','quiz') ); return false; } // STAGE 2: Write data to database - notify( get_string('importingquestions','quiz',$this->count_questions($questions)) ); + echo $OUTPUT->notification( get_string('importingquestions','quiz',$this->count_questions($questions)) ); // check for errors before we continue if ($this->stoponerror and ($this->importerrors>0)) { - notify( get_string('importparseerror','quiz') ); + echo $OUTPUT->notification( get_string('importparseerror','quiz') ); return true; } @@ -265,7 +265,7 @@ class qformat_default { } } if (!$answersvalid) { - notify(get_string('matcherror', 'quiz')); + echo $OUTPUT->notification(get_string('matcherror', 'quiz')); ++$gradeerrors; continue; } @@ -324,12 +324,12 @@ class qformat_default { ->save_question_options($question); if (!empty($result->error)) { - notify($result->error); + echo $OUTPUT->notification($result->error); return false; } if (!empty($result->notice)) { - notify($result->notice); + echo $OUTPUT->notification($result->notice); return true; } @@ -641,7 +641,7 @@ class qformat_default { * @return boolean success */ function exportprocess() { - global $CFG; + global $CFG, $OUTPUT; // create a directory for the exports (if not already existing) if (! $export_dir = make_upload_directory($this->question_get_export_dir())) { @@ -657,7 +657,7 @@ class qformat_default { $questions = $this->questions; } - notify( get_string('exportingquestions','quiz') ); + echo $OUTPUT->notification( get_string('exportingquestions','quiz') ); $count = 0; // results are first written into string (and then to a file) diff --git a/question/format/gift/format.php b/question/format/gift/format.php index c246dceee4..bb3bc13c81 100755 --- a/question/format/gift/format.php +++ b/question/format/gift/format.php @@ -528,7 +528,7 @@ function repchar( $text, $format=0 ) { } function writequestion( $question ) { - global $QTYPES; + global $QTYPES, $OUTPUT; // turns question into string // question reflects database fields for general question and specific to type @@ -648,7 +648,7 @@ function writequestion( $question ) { } else { $expout .= "Question type $question->qtype is not supported\n"; - notify( get_string('nohandler', 'qformat_gift', $QTYPES[$question->qtype]->local_name()) ); + echo $OUTPUT->notification( get_string('nohandler', 'qformat_gift', $QTYPES[$question->qtype]->local_name()) ); } } // add empty line to delimit questions diff --git a/question/format/qti_two/format.php b/question/format/qti_two/format.php index e3fc297ba0..a5dfa597c8 100644 --- a/question/format/qti_two/format.php +++ b/question/format/qti_two/format.php @@ -235,7 +235,7 @@ function handle_questions_media(&$questions, $path, $courseid) { */ function exportprocess() { - global $CFG; + global $CFG, $OUTPUT; $courseid = $this->course->id; // create a directory for the exports (if not already existing) @@ -247,7 +247,7 @@ function handle_questions_media(&$questions, $path, $courseid) { // get the questions (from database) in this category $questions = get_questions_category( $this->category ); - notify("Exporting ".count($questions)." questions."); + echo $OUTPUT->notification("Exporting ".count($questions)." questions."); $count = 0; // create the imsmanifest file @@ -256,7 +256,7 @@ function handle_questions_media(&$questions, $path, $courseid) { // copy files used by the main questions to the export directory $result = $this->handle_questions_media($questions, $path, $courseid); if ($result !== true) { - notify(implode("
", $result)); + echo $OUTPUT->notification(implode("
", $result)); } $manifestquestions = $this->objects_to_array($questions); diff --git a/question/format/xhtml/format.php b/question/format/xhtml/format.php index 62e924cbd8..5e89e2798a 100755 --- a/question/format/xhtml/format.php +++ b/question/format/xhtml/format.php @@ -19,6 +19,7 @@ function repchar( $text ) { } function writequestion( $question ) { + global $OUTPUT; // turns question into string // question reflects database fields for general question and specific to type @@ -108,7 +109,7 @@ function writequestion( $question ) { $expout .= "\n"; break; default: - notify("No handler for qtype $question->qtype for GIFT export" ); + echo $OUTPUT->notification("No handler for qtype $question->qtype for GIFT export" ); } // close off div $expout .= "\n\n\n"; diff --git a/question/format/xml/format.php b/question/format/xml/format.php index 3d3af94696..0d69e44f77 100755 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -227,6 +227,7 @@ class qformat_xml extends qformat_default { */ function import_truefalse( $question ) { // get common parts + global $OUTPUT; $qo = $this->import_headers( $question ); // 'header' parts particular to true/false @@ -263,7 +264,7 @@ class qformat_xml extends qformat_default { $a = new stdClass; $a->questiontext = $qo->questiontext; $a->answer = get_string($qo->answer ? 'true' : 'false', 'quiz'); - notify(get_string('truefalseimporterror', 'quiz', $a)); + echo $OUTPUT->notification(get_string('truefalseimporterror', 'quiz', $a)); } return $qo; } @@ -772,7 +773,7 @@ class qformat_xml extends qformat_default { * @return string xml segment */ function writequestion( $question ) { - global $CFG,$QTYPES; + global $CFG,$QTYPES, $OUTPUT; // initial string; $expout = ""; @@ -1013,7 +1014,7 @@ class qformat_xml extends qformat_default { default: // try support by optional plugin if (!$data = $this->try_exporting_using_qtypes( $question->qtype, $question )) { - notify( get_string( 'unsupportedexport','qformat_xml',$QTYPES[$question->qtype]->local_name() ) ); + echo $OUTPUT->notification( get_string( 'unsupportedexport','qformat_xml',$QTYPES[$question->qtype]->local_name() ) ); } $expout .= $data; } diff --git a/question/import.php b/question/import.php index 7009f71069..f2897453fb 100644 --- a/question/import.php +++ b/question/import.php @@ -151,7 +151,7 @@ } echo "
"; - print_continue("edit.php?".($thispageurl->get_query_string(array('category'=>"{$qformat->category->id},{$qformat->category->contextid}")))); + echo $OUTPUT->continue_button("edit.php?".($thispageurl->get_query_string(array('category'=>"{$qformat->category->id},{$qformat->category->contextid}")))); echo $OUTPUT->footer(); exit; } diff --git a/question/question.php b/question/question.php index d1d30c0723..66bde3577c 100644 --- a/question/question.php +++ b/question/question.php @@ -213,7 +213,7 @@ if ($mform->is_cancelled()){ if (($QTYPES[$question->qtype]->finished_edit_wizard($fromform)) || $movecontext){ if ($inpopup) { - notify(get_string('changessaved'), ''); + echo $OUTPUT->notification(get_string('changessaved'), ''); close_window(3); } else { $nexturl = new moodle_url($returnurl); diff --git a/question/type/calculated/questiontype.php b/question/type/calculated/questiontype.php index cb4a73d719..bce8c961f2 100644 --- a/question/type/calculated/questiontype.php +++ b/question/type/calculated/questiontype.php @@ -28,7 +28,7 @@ class question_calculated_qtype extends default_questiontype { function get_question_options(&$question) { // First get the datasets and default options - global $CFG, $DB; + global $CFG, $DB, $OUTPUT; if (!$question->options->answers = $DB->get_records_sql( "SELECT a.*, c.tolerance, c.tolerancetype, c.correctanswerlength, c.correctanswerformat " . "FROM {question_answers} a, " . @@ -36,7 +36,7 @@ class question_calculated_qtype extends default_questiontype { "WHERE a.question = ? " . "AND a.id = c.answer ". "ORDER BY a.id ASC", array($question->id))) { - notify('Error: Missing question answer for calculated question ' . $question->id . '!'); + echo $OUTPUT->notification('Error: Missing question answer for calculated question ' . $question->id . '!'); return false; } @@ -267,9 +267,10 @@ class question_calculated_qtype extends default_questiontype { } function restore_session_and_responses(&$question, &$state) { + global $OUTPUT; if (!preg_match('~^dataset([0-9]+)[^-]*-(.*)$~', $state->responses[''], $regs)) { - notify ("Wrongly formatted raw response answer " . + echo $OUTPUT->notification("Wrongly formatted raw response answer " . "{$state->responses['']}! Could not restore session for " . " question #{$question->id}."); $state->options->datasetitem = 1; @@ -834,7 +835,7 @@ class question_calculated_qtype extends default_questiontype { . $form->calclength[$key+1]; break; default: - notify("Unexpected distribution ".$form->calcdistribution[$key+1]); + echo $OUTPUT->notification("Unexpected distribution ".$form->calcdistribution[$key+1]); } } } diff --git a/question/type/match/questiontype.php b/question/type/match/questiontype.php index 73957b50c8..8b8ddd6496 100644 --- a/question/type/match/questiontype.php +++ b/question/type/match/questiontype.php @@ -106,9 +106,9 @@ class question_match_qtype extends default_questiontype { } function create_session_and_responses(&$question, &$state, $cmoptions, $attempt) { - global $DB; + global $DB, $OUTPUT; if (!$state->options->subquestions = $DB->get_records('question_match_sub', array('question' => $question->id), 'id ASC')) { - notify('Error: Missing subquestions!'); + echo $OUTPUT->notification('Error: Missing subquestions!'); return false; } @@ -135,11 +135,11 @@ class question_match_qtype extends default_questiontype { } function restore_session_and_responses(&$question, &$state) { - global $DB; + global $DB, $OUTPUT; static $subquestions = array(); if (!isset($subquestions[$question->id])){ if (!$subquestions[$question->id] = $DB->get_records('question_match_sub', array('question' => $question->id), 'id ASC')) { - notify('Error: Missing subquestions!'); + echo $OUTPUT->notification('Error: Missing subquestions!'); return false; } } diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index 178c5e92c3..7cd6e65518 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -24,13 +24,13 @@ class embedded_cloze_qtype extends default_questiontype { } function has_wildcards_in_responses($question, $subqid) { - global $QTYPES; + global $QTYPES, $OUTPUT; foreach ($question->options->questions as $subq){ if ($subq->id == $subqid){ return $QTYPES[$subq->qtype]->has_wildcards_in_responses($subq, $subqid); } } - notify('Could not find sub question!'); + echo $OUTPUT->notification('Could not find sub question!'); return true; } @@ -39,11 +39,11 @@ class embedded_cloze_qtype extends default_questiontype { } function get_question_options(&$question) { - global $QTYPES, $DB; + global $QTYPES, $DB, $OUTPUT; // Get relevant data indexed by positionkey from the multianswers table if (!$sequence = $DB->get_field('question_multianswer', 'sequence', array('question' => $question->id))) { - notify(get_string('noquestions','qtype_multianswer',$question->name)); + echo $OUTPUT->notification(get_string('noquestions','qtype_multianswer',$question->name)); $question->options->questions['1']= ''; return true ; } @@ -65,7 +65,7 @@ class embedded_cloze_qtype extends default_questiontype { if (isset($wrappedquestions) && is_array($wrappedquestions)){ foreach ($wrappedquestions as $wrapped) { if (!$QTYPES[$wrapped->qtype]->get_question_options($wrapped)) { - notify("Unable to get options for questiontype {$wrapped->qtype} (id={$wrapped->id})"); + echo $OUTPUT->notification("Unable to get options for questiontype {$wrapped->qtype} (id={$wrapped->id})"); }else { // for wrapped questions the maxgrade is always equal to the defaultgrade, // there is no entry in the question_instances table for them @@ -76,7 +76,7 @@ class embedded_cloze_qtype extends default_questiontype { } } if ($nbvaliquestion == 0 ) { - notify(get_string('noquestions','qtype_multianswer',$question->name)); + echo $OUTPUT->notification(get_string('noquestions','qtype_multianswer',$question->name)); } return true; @@ -823,7 +823,7 @@ class embedded_cloze_qtype extends default_questiontype { } function restore_recode_answer($state, $restore) { - global $DB; + global $DB, $OUTPUT; //The answer is a comma separated list of hypen separated sequence number and answers. We may have to recode the answers $answer_field = ""; $in_first = true; @@ -842,7 +842,7 @@ class embedded_cloze_qtype extends default_questiontype { $wrappedquestionid = $sequence[$seqnum-1]; // now we can find the question if (!$wrappedquestion = $DB->get_record('question', array('id' => $wrappedquestionid))) { - notify("Can't find the subquestion $wrappedquestionid that is used as part $seqnum in cloze question $state->question"); + echo $OUTPUT->notification("Can't find the subquestion $wrappedquestionid that is used as part $seqnum in cloze question $state->question"); } // For multichoice question we need to recode the answer if ($answer and $wrappedquestion->qtype == 'multichoice') { diff --git a/question/type/multichoice/questiontype.php b/question/type/multichoice/questiontype.php index c96a7918ef..fd2712dca9 100644 --- a/question/type/multichoice/questiontype.php +++ b/question/type/multichoice/questiontype.php @@ -19,17 +19,17 @@ class question_multichoice_qtype extends default_questiontype { } function get_question_options(&$question) { - global $DB; + global $DB, $OUTPUT; // Get additional information from database // and attach it to the question object if (!$question->options = $DB->get_record('question_multichoice', array('question' => $question->id))) { - notify('Error: Missing question options for multichoice question'.$question->id.'!'); + echo $OUTPUT->notification('Error: Missing question options for multichoice question'.$question->id.'!'); return false; } list ($usql, $params) = $DB->get_in_or_equal(explode(',', $question->options->answers)); if (!$question->options->answers = $DB->get_records_select('question_answers', "id $usql", $params, 'id')) { - notify('Error: Missing question answers for multichoice question'.$question->id.'!'); + echo $OUTPUT->notification('Error: Missing question answers for multichoice question'.$question->id.'!'); return false; } diff --git a/question/type/numerical/questiontype.php b/question/type/numerical/questiontype.php index ed3cf4a84e..e1ae906fcf 100644 --- a/question/type/numerical/questiontype.php +++ b/question/type/numerical/questiontype.php @@ -39,7 +39,7 @@ class question_numerical_qtype extends question_shortanswer_qtype { // Note: question_numerical is an extension of the answer table rather than // the question table as is usually the case for qtype // specific tables. - global $CFG, $DB; + global $CFG, $DB, $OUTPUT; if (!$question->options->answers = $DB->get_records_sql( "SELECT a.*, n.tolerance " . "FROM {question_answers} a, " . @@ -47,7 +47,7 @@ class question_numerical_qtype extends question_shortanswer_qtype { "WHERE a.question = ? " . " AND a.id = n.answer " . "ORDER BY a.id ASC", array($question->id))) { - notify('Error: Missing question answer for numerical question ' . $question->id . '!'); + echo $OUTPUT->notification('Error: Missing question answer for numerical question ' . $question->id . '!'); return false; } $this->get_numerical_units($question); diff --git a/question/type/questiontype.php b/question/type/questiontype.php index abf79ef754..93b91f5f31 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -438,7 +438,7 @@ class default_questiontype { * specific information (it is passed by reference). */ function get_question_options(&$question) { - global $CFG, $DB; + global $CFG, $DB, $OUTPUT; if (!isset($question->options)) { $question->options = new object; @@ -453,7 +453,7 @@ class default_questiontype { $question->options->$field = $extra_data->$field; } } else { - notify("Failed to load question options from the table $question_extension_table for questionid " . + echo $OUTPUT->notification("Failed to load question options from the table $question_extension_table for questionid " . $question->id); return false; } @@ -467,7 +467,7 @@ class default_questiontype { FROM {question_answers} qa, {$answer_extension_table} qax WHERE qa.questionid = ? AND qax.answerid = qa.id", array($question->id)); if (!$question->options->answers) { - notify("Failed to load question answers from the table $answer_extension_table for questionid " . + echo $OUTPUT->notification("Failed to load question answers from the table $answer_extension_table for questionid " . $question->id); return false; } @@ -1244,8 +1244,8 @@ class default_questiontype { /* This default implementation prints an error and must be overridden by all question type implementations, unless the default implementation of print_question has been overridden. */ - - notify('Error: Question formulation and input controls has not' + global $OUTPUT; + echo $OUTPUT->notification('Error: Question formulation and input controls has not' .' been implemented for question type '.$this->name()); } diff --git a/question/type/random/questiontype.php b/question/type/random/questiontype.php index 0a148fe9fd..5ddcb10448 100644 --- a/question/type/random/questiontype.php +++ b/question/type/random/questiontype.php @@ -230,7 +230,7 @@ class random_qtype extends default_questiontype { /// From version 1.5 and later the question type random works like all /// the other question types in that it now only needs one response /// record per question. - global $QTYPES, $DB; + global $QTYPES, $DB, $OUTPUT; if (!preg_match('~^random([0-9]+)-(.*)$~', $state->responses[''], $answerregs)) { if (empty($state->responses[''])) { // This is the case if there weren't enough questions available in the category. @@ -241,12 +241,12 @@ class random_qtype extends default_questiontype { } // this must be an old-style state which stores only the id for the wrapped question if (!$wrappedquestion = $DB->get_record('question', array('id' => $state->responses['']))) { - notify("Can not find wrapped question {$state->responses['']}"); + echo $OUTPUT->notification("Can not find wrapped question {$state->responses['']}"); } // In the old model the actual response was stored in a separate entry in // the state table and fortunately there was only a single state per question if (!$state->responses[''] = $DB->get_field('question_states', 'answer', array('attempt' => $state->attempt, 'question' => $wrappedquestion->id))) { - notify("Wrapped state missing"); + echo $OUTPUT->notification("Wrapped state missing"); } } else { if (!$wrappedquestion = $DB->get_record('question', array('id' => $answerregs[1]))) { diff --git a/question/type/randomsamatch/questiontype.php b/question/type/randomsamatch/questiontype.php index 9c0745575d..5f9bba05f3 100644 --- a/question/type/randomsamatch/questiontype.php +++ b/question/type/randomsamatch/questiontype.php @@ -28,9 +28,9 @@ class question_randomsamatch_qtype extends question_match_qtype { } function get_question_options(&$question) { - global $DB; + global $DB, $OUTPUT; if (!$question->options = $DB->get_record('question_randomsamatch', array('question' => $question->id))) { - notify('Error: Missing question options for random short answer question '.$question->id.'!'); + echo $OUTPUT->notification('Error: Missing question options for random short answer question '.$question->id.'!'); return false; } @@ -80,7 +80,7 @@ class question_randomsamatch_qtype extends question_match_qtype { // 1. All questions that are explicitly assigned to the quiz // 2. All random questions // 3. All questions that are already chosen by an other random question - global $QTYPES; + global $QTYPES, $OUTPUT; if (!isset($cmoptions->questionsinuse)) { $cmoptions->questionsinuse = $cmoptions->questions; } @@ -111,7 +111,7 @@ class question_randomsamatch_qtype extends question_match_qtype { questions were deleted after this Random Short-Answer question was created."; } - notify($errorstr); + echo $OUTPUT->notification($errorstr); $errorstr = '' . $errorstr . ''; } @@ -171,7 +171,7 @@ class question_randomsamatch_qtype extends question_match_qtype { function restore_session_and_responses(&$question, &$state) { global $DB; - global $QTYPES; + global $QTYPES, $OUTPUT; static $wrappedquestions = array(); if (empty($state->responses[''])) { $question->questiontext = "Insufficient selection options are @@ -191,12 +191,12 @@ class question_randomsamatch_qtype extends question_match_qtype { $state->responses[$wqid] = $response[1]; if (!isset($wrappedquestions[$wqid])){ if (!$wrappedquestions[$wqid] = $DB->get_record('question', array('id' => $wqid))) { - notify("Couldn't get question (id=$wqid)!"); + echo $OUTPUT->notification("Couldn't get question (id=$wqid)!"); return false; } if (!$QTYPES[$wrappedquestions[$wqid]->qtype] ->get_question_options($wrappedquestions[$wqid])) { - notify("Couldn't get question options (id=$response[0])!"); + echo $OUTPUT->notification("Couldn't get question options (id=$response[0])!"); return false; } @@ -217,7 +217,7 @@ class question_randomsamatch_qtype extends question_match_qtype { if (!$QTYPES[$wrappedquestion->qtype] ->restore_session_and_responses($wrappedquestion, $state)) { - notify("Couldn't restore session of question (id=$response[0])!"); + echo $OUTPUT->notification("Couldn't restore session of question (id=$response[0])!"); return false; } $wrappedquestion->name_prefix = $question->name_prefix; diff --git a/question/type/truefalse/questiontype.php b/question/type/truefalse/questiontype.php index 4306ee9d81..db745801d6 100644 --- a/question/type/truefalse/questiontype.php +++ b/question/type/truefalse/questiontype.php @@ -82,16 +82,16 @@ class question_truefalse_qtype extends default_questiontype { * Loads the question type specific options for the question. */ function get_question_options(&$question) { - global $DB; + global $DB, $OUTPUT; // Get additional information from database // and attach it to the question object if (!$question->options = $DB->get_record('question_truefalse', array('question' => $question->id))) { - notify('Error: Missing question options!'); + echo $OUTPUT->notification('Error: Missing question options!'); return false; } // Load the answers if (!$question->options->answers = $DB->get_records('question_answers', array('question' => $question->id), 'id ASC')) { - notify('Error: Missing question answers for truefalse question ' . $question->id . '!'); + echo $OUTPUT->notification('Error: Missing question answers for truefalse question ' . $question->id . '!'); return false; }