/** * fix_js_WriteToInstructions * * @param xxx $str (passed by reference) * @param xxx $start * @param xxx $length */ function fix_js_WriteToInstructions(&$str, $start, $length) { $substr = substr($str, $start, $length); $search = "/(\\s*)document\\.getElementById\\('InstructionsDiv'\\)\\.innerHTML = Feedback;/"; $replace = "\\1" . "var AllDone = true;\\1" . "for (var QNum=0; QNum<State.length; QNum++){\\1" . "\tif (State[QNum]){\\1" . "\t\tif (State[QNum][0] < 0){\\1" . "\t\t\tAllDone = false;\\1" . "\t\t}\\1" . "\t}\\1" . "}\\1" . "if (AllDone) {\\1" . "\tvar obj = document.getElementById('InstructionsDiv');\\1" . "\tif (obj) {\\1" . "\t\tobj.innerHTML = Feedback;\\1" . "\t\tobj.style.display = '';\\1" . "\t}\\1" . "\tvar obj = document.getElementById('FeedbackDiv');\\1" . "\tif (obj && obj.style.display=='block') {\\1" . "\t\tvar obj = document.getElementById('FeedbackContent');\\1" . "\t\tif (obj) {\\1" . "\t\t\tFeedback = obj.innerHTML + Feedback;;\\1" . "\t\t}\\1" . "\t}\\1" . "\tFinished = true;\\1" . "\tShowMessage(Feedback);\\1" . "}"; $substr = preg_replace($search, $replace, $substr, 1); parent::fix_js_WriteToInstructions($substr, 0, strlen($substr)); $str = substr_replace($str, $substr, $start, $length); }