diff --git a/local/qedatabase/db/install.php b/local/qedatabase/db/install.php index 97bc99675cd..84eb3c3bc95 100755 --- a/local/qedatabase/db/install.php +++ b/local/qedatabase/db/install.php @@ -439,7 +439,7 @@ function xmldb_local_qedatabase_install() { // Rename the question_attempts table to question_usages. $table = new xmldb_table('question_attempts'); - if (table_exists($table)) { + if ($dbman->table_exists($table)) { $dbman->rename_table($table, 'question_usages'); } @@ -530,7 +530,7 @@ function xmldb_local_qedatabase_install() { // Define table question_attempts to be created $table = new xmldb_table('question_attempts'); - if (!table_exists($table)) { + if (!$dbman->table_exists($table)) { // Adding fields to table question_attempts $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); @@ -539,7 +539,7 @@ function xmldb_local_qedatabase_install() { $table->add_field('behaviour', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null); $table->add_field('questionid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); $table->add_field('maxmark', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null); - $table->add_field('minfraction', XMLDB_TYPE_NUMBER, '12, 7', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); + $table->add_field('minfraction', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null); $table->add_field('flagged', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0'); $table->add_field('questionsummary', XMLDB_TYPE_TEXT, 'small', null, null, null, null); $table->add_field('rightanswer', XMLDB_TYPE_TEXT, 'small', null, null, null, null); @@ -566,7 +566,7 @@ function xmldb_local_qedatabase_install() { // Define table question_attempt_steps to be created $table = new xmldb_table('question_attempt_steps'); - if (!table_exists($table)) { + if (!$dbman->table_exists($table)) { // Adding fields to table question_attempt_steps $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); @@ -597,7 +597,7 @@ function xmldb_local_qedatabase_install() { // Define table question_attempt_step_data to be created $table = new xmldb_table('question_attempt_step_data'); - if (!table_exists($table)) { + if (!$dbman->table_exists($table)) { // Adding fields to table question_attempt_step_data $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); @@ -639,7 +639,7 @@ function xmldb_local_qedatabase_install() { // if ($oldversion < 2008000551) { // $table = new xmldb_table('question_states'); -// if (table_exists($table)) { +// if ($dbman->table_exists($table)) { // // First delete all data from preview attempts. // delete_records_select('question_states', // "attempt IN (SELECT uniqueid FROM {quiz_attempts} WHERE preview = 1)"); diff --git a/mod/quiz/report/statistics/db/upgrade.php b/mod/quiz/report/statistics/db/upgrade.php index 0d6795d7c58..8fe4976cddc 100644 --- a/mod/quiz/report/statistics/db/upgrade.php +++ b/mod/quiz/report/statistics/db/upgrade.php @@ -85,7 +85,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) { $table->add_field('anssubqid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null); $table->add_field('response', XMLDB_TYPE_TEXT, 'big', null, null, null, null); $table->add_field('rcount', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null); - $table->add_field('credit', XMLDB_TYPE_NUMBER, '15, 5', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null); + $table->add_field('credit', XMLDB_TYPE_NUMBER, '15, 5', null, XMLDB_NOTNULL, null, null); /// Adding keys to table quiz_question_response_stats $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); diff --git a/question/behaviour/adaptive/lang/en/qbehaviour_adaptive.php b/question/behaviour/adaptive/lang/en/qbehaviour_adaptive.php index 2de0227e0ac..c96fc121112 100644 --- a/question/behaviour/adaptive/lang/en/qbehaviour_adaptive.php +++ b/question/behaviour/adaptive/lang/en/qbehaviour_adaptive.php @@ -1,6 +1,6 @@ raw/$a->max.'; -$string['gradingdetailsadjustment'] = 'With previous penalties this gives $a->cur/$a->max.'; -$string['gradingdetailspenalty'] = 'This submission attracted a penalty of $a.'; +$string['gradingdetails'] = 'Marks for this submission: {$a->raw}/{$a->max}.'; +$string['gradingdetailsadjustment'] = 'With previous penalties this gives {$a->cur}/{$a->max}.'; +$string['gradingdetailspenalty'] = 'This submission attracted a penalty of {$a}.'; diff --git a/question/behaviour/deferredcbm/lang/en/qbehaviour_deferredcbm.php b/question/behaviour/deferredcbm/lang/en/qbehaviour_deferredcbm.php index a736727ac43..3576722d91f 100644 --- a/question/behaviour/deferredcbm/lang/en/qbehaviour_deferredcbm.php +++ b/question/behaviour/deferredcbm/lang/en/qbehaviour_deferredcbm.php @@ -5,5 +5,5 @@ $string['certainty1'] = 'Not very (less than 67%)'; $string['certainty2'] = 'Fairly (more than 67%)'; $string['certainty3'] = 'Very (more than 85%)'; $string['deferredcbm'] = 'Deferred feedback with CBM'; -$string['howcertainareyou'] = 'How certain are you? $a'; +$string['howcertainareyou'] = 'How certain are you? {$a}'; $string['markadjustment'] = 'Based on the certainty you expressed, your base mark of {$a->rawmark} was adjusted to {$a->mark}.'; diff --git a/question/behaviour/interactive/lang/en/qbehaviour_interactive.php b/question/behaviour/interactive/lang/en/qbehaviour_interactive.php index 63a34c503f8..8f876152811 100644 --- a/question/behaviour/interactive/lang/en/qbehaviour_interactive.php +++ b/question/behaviour/interactive/lang/en/qbehaviour_interactive.php @@ -2,5 +2,5 @@ $string['interactive'] = 'Interactive with multiple tries'; $string['notcomplete'] = 'Not complete'; -$string['triesremaining'] = 'Tries remaining: $a'; +$string['triesremaining'] = 'Tries remaining: {$a}'; $string['tryagain'] = 'Try again'; diff --git a/question/behaviour/interactive/renderer.php b/question/behaviour/interactive/renderer.php index b1a6c699609..cfbf1b295d5 100644 --- a/question/behaviour/interactive/renderer.php +++ b/question/behaviour/interactive/renderer.php @@ -54,8 +54,8 @@ class qbehaviour_interactive_renderer extends qbehaviour_renderer { } $output = html_writer::empty_tag('input', $attributes); if (empty($attributes['disabled'])) { - $output .= print_js_call('question_init_submit_button', - array($attributes['id'], $qa->get_slot()), true); + $this->page->requires->js_init_call('M.core_question_engine.init_submit_button', + array($attributes['id'], $qa->get_slot())); } return $output; } diff --git a/question/behaviour/rendererbase.php b/question/behaviour/rendererbase.php index 11073ea8a56..655c34de618 100644 --- a/question/behaviour/rendererbase.php +++ b/question/behaviour/rendererbase.php @@ -182,8 +182,8 @@ abstract class qbehaviour_renderer extends plugin_renderer_base { } $output = html_writer::empty_tag('input', $attributes); if (!$options->readonly) { - $output .= print_js_call('question_init_submit_button', - array($attributes['id'], $qa->get_slot()), true); + $this->page->requires->js_init_call('M.core_question_engine.init_submit_button', + array($attributes['id'], $qa->get_slot())); } return $output; } diff --git a/question/preview.js b/question/preview.js index 56d0d5880a2..511ea1c037a 100644 --- a/question/preview.js +++ b/question/preview.js @@ -30,7 +30,7 @@ M.core_question_preview = M.core_question_preview || {}; /** * Initialise JavaScript-specific parts of the question preview popup. */ -M.core_question_preview.init(Y) { +M.core_question_preview.init = function(Y) { M.core_question_engine.init_form(Y, '#responseform'); // Add a close button to the window. diff --git a/question/preview.php b/question/preview.php index 266c5b87ab3..f8d65f1281e 100644 --- a/question/preview.php +++ b/question/preview.php @@ -164,14 +164,6 @@ if (!$previewid) { $restartdisabled = ' disabled="disabled"'; } -$PAGE->requires->js_init_call('M.core_question_preview.init', null, array( - 'name' => 'core_question_preview', - 'fullpath' => '/question/preview.js', - 'requires' => array('base', 'dom', 'event-delegate', 'event-key', 'core_question_engine'), - 'strings' => array( - array('question', 'closepreview'), - ))); - // Output $title = get_string('previewquestion', 'question', format_string($question->name)); $headtags = question_engine::initialise_js() . $quba->render_question_head_html($slot); @@ -206,8 +198,12 @@ echo ''; // Display the settings form. $optionsform->display(); -echo '', "\n"; - +$PAGE->requires->js_init_call('M.core_question_preview.init', null, false, array( + 'name' => 'core_question_preview', + 'fullpath' => '/question/preview.js', + 'requires' => array('base', 'dom', 'event-delegate', 'event-key', 'core_question_engine'), + 'strings' => array( + array('closepreview', 'question'), + ))); echo $OUTPUT->footer(); diff --git a/question/todo/diffstat.txt b/question/todo/diffstat.txt index 4eb73961678..764842b7321 100644 --- a/question/todo/diffstat.txt +++ b/question/todo/diffstat.txt @@ -67,7 +67,7 @@ DONE lib/questionlib.php | 1434 ++-------- mod/quiz/accessrules.php | 828 ++++++ mod/quiz/attempt.php | 742 ++---- - mod/quiz/attempt_close_js.php | 27 - +DONE mod/quiz/attempt_close_js.php | 27 - mod/quiz/attemptlib.php | 1219 +++++++++ mod/quiz/backuplib.php | 16 +- mod/quiz/comment.php | 171 +- @@ -96,7 +96,7 @@ DONE mod/quiz/defaults.php | 12 +- mod/quiz/pix/sa.gif | Bin 74 -> 0 bytes mod/quiz/pix/tf.gif | Bin 190 -> 0 bytes mod/quiz/processattempt.php | 126 + - mod/quiz/protect_js.php | 56 - +DONE mod/quiz/protect_js.php | 56 - mod/quiz/quiz.js | 355 ++- mod/quiz/restorelib.php | 113 +- mod/quiz/restorelibpre15.php | 41 +- @@ -223,62 +223,62 @@ DONE question/behaviour/behaviourbase.php | 627 +++++ DONE question/behaviour/rendererbase.php | 200 ++ question/behaviour/adaptive/behaviour.php | 181 ++ - question/behaviour/adaptive/lang/en_utf8/qbehaviour_adaptive.php | 6 + +DONE question/behaviour/adaptive/lang/en_utf8/qbehaviour_adaptive.php | 6 + question/behaviour/adaptive/renderer.php | 98 + question/behaviour/adaptive/simpletest/testwalkthrough.php | 239 ++ question/behaviour/adaptivenopenalty/behaviour.php | 43 + - question/behaviour/adaptivenopenalty/lang/en_utf8/qbehaviour_adaptivenopenalty.php | 3 + +DONE question/behaviour/adaptivenopenalty/lang/en_utf8/qbehaviour_adaptivenopenalty.php | 3 + question/behaviour/adaptivenopenalty/renderer.php | 34 + question/behaviour/adaptivenopenalty/simpletest/testwalkthrough.php | 186 ++ question/behaviour/deferredcbm/behaviour.php | 125 + - question/behaviour/deferredcbm/lang/en_utf8/qbehaviour_deferredcbm.php | 9 + +DONE question/behaviour/deferredcbm/lang/en_utf8/qbehaviour_deferredcbm.php | 9 + question/behaviour/deferredcbm/renderer.php | 87 + question/behaviour/deferredcbm/simpletest/testwalkthrough.php | 261 ++ question/behaviour/deferredfeedback/behaviour.php | 94 + - question/behaviour/deferredfeedback/lang/en_utf8/qbehaviour_deferredfeedback.php | 3 + +DONE question/behaviour/deferredfeedback/lang/en_utf8/qbehaviour_deferredfeedback.php | 3 + question/behaviour/deferredfeedback/renderer.php | 30 + question/behaviour/deferredfeedback/simpletest/testwalkthrough.php | 205 ++ question/behaviour/immediatecbm/behaviour.php | 151 + - question/behaviour/immediatecbm/lang/en_utf8/qbehaviour_immediatecbm.php | 4 + +DONE question/behaviour/immediatecbm/lang/en_utf8/qbehaviour_immediatecbm.php | 4 + question/behaviour/immediatecbm/renderer.php | 43 + question/behaviour/immediatecbm/simpletest/testwalkthrough.php | 282 ++ question/behaviour/immediatefeedback/behaviour.php | 131 + - question/behaviour/immediatefeedback/lang/en_utf8/qbehaviour_immediatefeedback.php | 3 + +DONE question/behaviour/immediatefeedback/lang/en_utf8/qbehaviour_immediatefeedback.php | 3 + question/behaviour/immediatefeedback/renderer.php | 33 + question/behaviour/immediatefeedback/simpletest/testwalkthrough.php | 237 ++ question/behaviour/informationitem/behaviour.php | 114 + - question/behaviour/informationitem/lang/en_utf8/qbehaviour_informationitem.php | 4 + +DONE question/behaviour/informationitem/lang/en_utf8/qbehaviour_informationitem.php | 4 + question/behaviour/informationitem/renderer.php | 42 + question/behaviour/informationitem/simpletest/testwalkthrough.php | 78 + question/behaviour/interactive/behaviour.php | 232 ++ - question/behaviour/interactive/lang/en_utf8/qbehaviour_interactive.php | 6 + +DONE question/behaviour/interactive/lang/en_utf8/qbehaviour_interactive.php | 6 + question/behaviour/interactive/renderer.php | 62 + question/behaviour/interactive/interactive/simpletest/testwalkthrough.php | 470 ++++ question/behaviour/interactivecountback/behaviour.php | 91 + - question/behaviour/interactivecountback/en_utf8/qbehaviour_interactivecountback.php | 3 + +DONE question/behaviour/interactivecountback/en_utf8/qbehaviour_interactivecountback.php | 3 + question/behaviour/interactivecountback/renderer.php | 36 + question/behaviour/interactivecountback/simpletest/testwalkthrough.php | 135 + question/behaviour/manualgraded/behaviour.php | 91 + - question/behaviour/manualgraded/lang/en_utf8/qbehaviour_manualgraded.php | 3 + +DONE question/behaviour/manualgraded/lang/en_utf8/qbehaviour_manualgraded.php | 3 + question/behaviour/manualgraded/renderer.php | 31 + question/behaviour/manualgraded/simpletest/testwalkthrough.php | 259 ++ question/behaviour/missing/behaviour.php | 65 + - question/behaviour/missing/lang/en_utf8/qbehaviour_missing.php | 3 + +DONE question/behaviour/missing/lang/en_utf8/qbehaviour_missing.php | 3 + question/behaviour/missing/renderer.php | 35 + question/behaviour/missing/simpletest/testmissingbehaviour.php | 96 + question/behaviour/opaque/behaviour.php | 197 ++ - question/behaviour/opaque/lang/en_utf8/qbehaviour_opaque.php | 4 + +DONE question/behaviour/opaque/lang/en_utf8/qbehaviour_opaque.php | 4 + question/behaviour/opaque/renderer.php | 65 + question/behaviour/opaque/simpletest/testopaquebehaviour.php | 227 ++ diff --git a/question/type/calculated/lang/en/qtype_calculated.php b/question/type/calculated/lang/en/qtype_calculated.php index bd895b1da65..fdd4579baf6 100644 --- a/question/type/calculated/lang/en/qtype_calculated.php +++ b/question/type/calculated/lang/en/qtype_calculated.php @@ -61,7 +61,7 @@ $string['forceregeneration'] = 'force regeneration'; $string['forceregenerationall'] = 'forceregeneration of all wildcards'; $string['forceregenerationshared'] = 'forceregeneration of only non-shared wildcards'; $string['getnextnow'] = 'Get New \'Item to Add\' Now'; -$string['hexanotallowed'] = 'Dataset {$a->name} hexadecimal format value $a->value is not allowed' ; +$string['hexanotallowed'] = 'Dataset {$a->name} hexadecimal format value {$a->value} is not allowed' ; $string['incorrectfeedback'] = 'For any incorrect response'; $string['item(s)'] = 'item(s)'; $string['itemno'] = 'Item {$a}';