Пример #1
0
    if (isset($_GET['show_all'])) {
        $showTest->options['random_pool'] = false;
        $showTest->options['onebyone'] = 0;
    }
    if (isset($_GET['preview_correct']) && $_SESSION['s_lesson_user_type'] != 'student') {
        $showTest->preview_correct = true;
    }
    if (isset($_GET['print'])) {
        $testString = $showTest->toHTML($showTest->toHTMLQuickForm(), false, true);
    } else {
        $testString = $showTest->toHTML($showTest->toHTMLQuickForm(), false);
    }
    $smarty->assign("T_TEST", $testString);
} else {
    $test = new EfrontTest($currentUnit['id'], true);
    $status = $test->getStatus($currentUser, $_GET['show_solved_test']);
    $form = new HTML_QuickForm("test_form", "post", basename($_SERVER['PHP_SELF']) . '?view_unit=' . $_GET['view_unit'], "", 'onsubmit = "$(\'submit_test\').disabled=true;"', true);
    switch ($status['status']) {
        case 'incomplete':
            //$test -> getQuestionsRandomTest(true);
            if (!($testInstance = unserialize($status['completedTest']['test']))) {
                throw new EfrontTestException(_TESTCORRUPTEDASKRESETEXECUTION, EfrontTestException::CORRUPTED_TEST);
            }
            if ($testInstance->time['pause'] && isset($_GET['resume'])) {
                $testInstance->time['pause'] = 0;
                $testInstance->time['resume'] = time();
                //unset($testInstance -> currentQuestion);
                $testInstance->save();
            }
            $remainingTime = $testInstance->options['duration'] - $testInstance->time['spent'] - (time() - $testInstance->time['resume']);
            $nocache = false;
Пример #2
0
    /**
     * Print HTML version of test, along with header information
     *
     * This function enhances the toHTMLQuickForm() output, in that it adds
     * a header with test information to the HTML code.
     * <br/>Example:
     * <code>
     * $result = eF_getTableData("completed_tests", "*", "id=32");
     * $showTest = unserialize($result[0]['test']);
     * $testString = $showTest -> toHTMLQuickForm(new HTML_Quickform(), false, true);
     * $url = basename($_SERVER['PHP_SELF']).'?ctg=tests';
     * $testString = $showTest -> toHTMLSolved($testString, true);
     * echo $testString;
     * </code>
     *
     * @param string $testString The test's HTML code, produced by toHTMLQuickForm()
     * @param boolean $editHandles Whether to display update score and feedback handles
     * @return string The HTML code of the test
     * @since 3.5.2
     * @access public
     * @see EfrontTest :: toHTMLQuickForm()
     */
    public function toHTMLSolved($testString, $editHandles = false, $isFeedback = false)
    {
        //      if (!$url) {
        $url = htmlspecialchars_decode(basename($_SERVER['PHP_SELF']) . '?' . http_build_query($_GET));
        //$_SERVER['QUERY_STRING'];
        //      }
        $parentTest = new EfrontTest($this->test['id']);
        $currentStatus = $parentTest->getStatus($this->completedTest['login']);
        //Get the current test status, to check whether the student is undergoing the test right now
        $status = $parentTest->getStatus($this->completedTest['login'], $this->completedTest['id'], true);
        //Get the completed tests status
        $potentialScore = $this->getPotentialScore();
        //Get the potential score for the test, taking into account pending questions
        $str = '
        <table class = "doneTestHeader">
            <tr><td id = "doneTestImage">';
        if ($this->test['mastery_score'] && ($status['status'] == 'failed' || $status['status'] == 'pending')) {
            if ($potentialScore < $this->test['mastery_score']) {
                $str .= '
                    <img src = "images/32x32/close.png"  title = "' . _FAILED . '" alt = "' . _FAILED . '" id = "statusImage" />';
                $completeMessage = '<span class = "failure" id = "statusMessage">' . _FAILED . '</span>';
            } else {
                $str .= '
                    <img src = "images/32x32/exclamation.png"  title = "' . _OUTCOMEPENDING . '" alt = "' . _OUTCOMEPENDING . '" id = "statusImage" />';
                $completeMessage = '<span class = "pending" id = "statusMessage">' . _OUTCOMEPENDING . '</span>';
            }
        } else {
            $str .= '
                <img src = "images/32x32/success.png" title = "' . _PASSED . '" alt = "' . _PASSED . '" id = "statusImage"  />';
            if ($this->test['mastery_score'] && $status['status'] == 'passed') {
                $completeMessage = '<span class = "success" id = "statusMessage">' . _PASSED . '</span>';
            }
        }
        /*
                $durationString = '';
                if ($this -> options['duration']) {
                    $duration  = eF_convertIntervalToTime($this -> options['duration']);
                    $durationString .= _HASMAXIMUMDURATION.' ';
                    $duration['hours']   ? $durationString .= $duration['hours'].'h '             : null;
                    $duration['minutes'] ? $durationString .= $duration['minutes'].'&#039; '      : null;
                    $duration['seconds'] ? $durationString .= $duration['seconds'].'&#039;&#039;' : null;
                    $durationString .= '.';
                }
        */
        $timeSpent = eF_convertIntervalToTime($this->time['spent']);
        $completedString = ' ' . _ANDUSERDIDITIN . ' ';
        $timeSpent['hours'] ? $completedString .= $timeSpent['hours'] . _HOURSSHORTHAND : null;
        $timeSpent['minutes'] ? $completedString .= $timeSpent['minutes'] . _MINUTESSHORTHAND . ' ' : null;
        $timeSpent['seconds'] ? $completedString .= $timeSpent['seconds'] . _SECONDSSHORTHAND : null;
        if ($status['timesDone'] > 1 && $this->options['maintain_history'] !== '0') {
            $jumpString = '
                ' . _JUMPTOEXECUTION . ':
                <select  style = "vertical-align:middle" onchange = "location.toString().match(/show_solved_test/) ? location = location.toString().replace(/show_solved_test=\\d+/, \'show_solved_test=\'+this.options[this.selectedIndex].value) : location = location + \'&show_solved_test=\'+this.options[this.selectedIndex].value">';
            foreach ($status['testIds'] as $count => $testId) {
                $jumpString .= '<option value = "' . $testId . '" ' . ($this->completedTest['id'] == $testId ? "selected" : "") . '>#' . ($count + 1) . ' - ' . formatTimestamp($status['timestamps'][$count], 'time') . ' ' . ($status['correctPrevious'][$count] ? _TESTREDONE : null) . '</option>';
            }
            $jumpString .= '</select>';
        }
        $editHandlesString = '';
        if ($status['lastTest'] && ($status['timesLeft'] > 0 || $status['timesLeft'] === false)) {
            if (!$editHandles) {
                $editHandlesString .= '
                        <span id = "redoLink">
                            <img src = "images/16x16/undo.png" alt = "' . _USERREDOTEST . '" title = "' . _USERREDOTEST . '" border = "0" style = "vertical-align:middle">
                            <a href = "javascript:void(0)" id="redoLinkHref" onclick = "redoTest(this)" style = "vertical-align:middle">' . _USERREDOTEST . '</a></span>';
            }
        }
        if (G_VERSIONTYPE != 'community') {
            #cpp#ifndef COMMUNITY
            if ($status['lastTest'] && ($status['timesLeft'] > 0 || $status['timesLeft'] === false) && $currentStatus['completedTest']['score'] != 100 && $parentTest->options['redo_wrong'] == 1) {
                if (!$editHandles && $this->options['maintain_history'] !== '0') {
                    $editHandlesString .= '
							<span id = "redoWrongLink">
								<img src = "images/16x16/undo.png" alt = "' . _USERREDOWRONG . '" title = "' . _USERREDOWRONG . '" border = "0" style = "vertical-align:middle">
								<a href = "javascript:void(0)" id="redoWrongLinkHref" onclick = "redoWrongTest(this)" style = "vertical-align:middle">' . _USERREDOWRONG . '</a></span>';
                }
            }
        }
        #cpp#endif
        if ($this->options['maintain_history'] !== '0') {
            $editHandlesString .= '
                        <span>
                            <img src = "images/16x16/arrow_right.png" alt = "' . _TESTANALYSIS . '" title = "' . _TESTANALYSIS . '" border = "0" style = "vertical-align:middle">
                            <a href = "' . $url . '&test_analysis=1" id="testAnalysisLinkHref" style = "vertical-align:middle">' . _TESTANALYSIS . '</a></span>';
        }
        if ($editHandles) {
            if ($status['lastTest']) {
                $editHandlesString .= '
                        <span id = "redoLink">
                            <img src = "images/16x16/undo.png" alt = "' . _ALLOWUSERREDOTEST . '" title = "' . _ALLOWUSERREDOTEST . '" border = "0" style = "vertical-align:middle">
                            <a href = "javascript:void(0)" id="redoLinkHref" onclick = "redoTest(this)" style = "vertical-align:middle">' . _ALLOWUSERREDOTEST . '</a></span>';
            }
            if ($this->completedTest['feedback']) {
                $editHandlesString .= '
                            <span>
                                <img src = "images/16x16/edit.png" alt = "' . _EDITFEEDBACK . '" title = "' . _EDITFEEDBACK . '" border = "0" style = "vertical-align:middle">
                                <a href = "javascript:void(0)" onclick = "$(\'test_feedback_div\').toggle();$(\'edit_test_feedback_div\').toggle()" style = "vertical-align:middle">' . _EDITFEEDBACK . '</a></span>';
            } else {
                $editHandlesString .= '
                            <span>
                                <img src = "images/16x16/add.png" alt = "' . _ADDFEEDBACK . '" title = "' . _ADDFEEDBACK . '" border = "0" style = "vertical-align:middle">
                                <a href = "javascript:void(0)" onclick = "$(\'test_feedback_div\').toggle();$(\'edit_test_feedback_div\').toggle()" style = "vertical-align:middle">' . _ADDFEEDBACK . '</a></span>';
            }
            $editHandlesString .= '
                            <span>
                                <img src = "images/16x16/printer.png" alt = "' . _PRINT . '" title = "' . _PRINT . '" border = "0" style = "vertical-align:middle">
                                <a id = "printLink" href = "' . $url . '&print=1&popup=1" target = "POPUP_FRAME" onclick = "eF_js_showDivPopup(event, \'' . _PRINT . '\', 2)" style = "vertical-align:middle">' . _PRINT . '</a></span>
            				<span>
                                <img src = "images/16x16/error_delete.png" alt = "' . _RESETTESTSTATUS . '" title = "' . _RESETTESTSTATUS . '" border = "0" style = "vertical-align:middle">
                                <a id = "deleteLink" href = "javascript:void(0)" onclick = "if (confirm(\'' . _IRREVERSIBLEACTIONAREYOUSURE . '\')) {deleteDoneTest(this)}" style = "vertical-align:middle">' . _RESETTESTSTATUS . '</a></span>
                            <span>
                                <img src = "images/16x16/error_delete.png" alt = "' . _RESETALLTESTSSTATUS . '" title = "' . _RESETALLTESTSSTATUS . '" border = "0" style = "vertical-align:middle">
                                <a id = "deleteLink" href = "javascript:void(0)" onclick = "if (confirm(\'' . _IRREVERSIBLEACTIONAREYOUSURE . '\')) {deleteDoneTest(this, true)}" style = "vertical-align:middle">' . _RESETALLTESTSSTATUS . '</a></span>';
        }
        $str .= '
                </td>
                <td>
                    <table class = "doneTestInfo">
                        <tr><td>' . $jumpString . '</td></tr>
                        <tr><td>' . ($isFeedback ? _FEEDBACKSTARTEDAT : _TESTSTARTEDAT) . ' ' . formatTimestamp($this->time['start'], 'time') . ' ' . _ANDCOMPLETEDAT . ' ' . formatTimestamp($this->time['end'], 'time') . '. ' . $completedString . '.</td></tr>';
        if (!$isFeedback) {
            $str .= '<tr><td>
                                ' . _THETESTISDONE . ' ' . $status['timesDone'] . ' ' . _TIMES . '
                                ' . ($this->options['redoable'] ? _ANDCANBEDONE . ' ' . ($status['timesLeft'] > 0 ? $status['timesLeft'] : 0) . ' ' . _TIMESMORE : '') . '
                            </td></tr>';
        }
        if ($currentStatus['status'] == 'incomplete') {
            $unsolvedTest = unserialize($currentStatus['completedTest']['test']);
            $str .= '
                        <tr><td style = "font-weight:bold">' . _THEUSERUNDERGOINGTESTSTARTEDAT . ':&nbsp;' . formatTimestamp($unsolvedTest->time['start'], 'time') . '</td></tr>';
        }
        if (!$isFeedback) {
            $str .= '
							<tr><td>
									<span style = "vertical-align:middle">' . _TESTSCOREIS . ':&nbsp;</span>';
            if ($editHandles) {
                $str .= '
									<span style = "font-weight:bold" id = "test_score_span">
										<span id = "test_score"  style = "vertical-align:middle">' . formatScore($this->completedTest['score']) . '%&nbsp;</span>' . ($potentialScore != $this->completedTest['score'] ? '<span style = "vertical-align:middle" id = "potential_score">- ' . $potentialScore . '%</span>' : null) . '
										<a href = "javascript:void(0)" onclick = "$(\'test_score_span\').hide();$(\'edit_test_score_span\').show();">
											<img src = "images/16x16/edit.png" alt = "' . _CHANGESCORE . '" title = "' . _CHANGESCORE . '" border = "0" style = "vertical-align:middle"/>
										</a>
									</span>
									<span id = "edit_test_score_span" style = "display:none">
										<input type = "text" name = "edit_test_score" id = "edit_test_score" value = "' . formatScore($this->completedTest['score']) . '" style = "vertical-align:middle"/>
										<a href = "javascript:void(0)" onclick = "editScore(this)">
											<img src = "images/16x16/success.png" alt = "' . _SUBMIT . '" title = "' . _SUBMIT . '" border = "0"  style = "vertical-align:middle"/>
										</a>
										<a href = "javascript:void(0)" onclick = "$(\'test_score_span\').show();$(\'edit_test_score_span\').hide();">
											<img src = "images/16x16/error_delete.png" alt = "' . _CANCEL . '" title = "' . _CANCEL . '" border = "0"  style = "vertical-align:middle"/>
										</a>
									</span>';
            } else {
                $str .= '
									<span id = "test_score" style = "vertical-align:middle">' . formatScore($this->completedTest['score']) . '%&nbsp;</span>' . ($potentialScore != $this->completedTest['score'] ? '<span style = "vertical-align:middle">- ' . $potentialScore . '%</span>' : null);
            }
            $str .= '
								&nbsp;' . $completeMessage . '</td></tr>
							<tr><td><div class = "headerTools">' . $editHandlesString . '</div></td></tr>
							<tr><td>';
        }
        $str .= '
                            <div id = "test_feedback_div" ' . ($this->completedTest['feedback'] ? 'class = "feedback_test"' : '') . ' >
                                <span id = "test_feedback">' . $this->completedTest['feedback'] . '</span>
                            </div>
                            <div id = "edit_test_feedback_div" style = "display:none;">
                                <textarea id = "edit_test_feedback" style = "vertical-align:middle;width:90%;height:50px">' . $this->completedTest['feedback'] . '</textarea>
                                <a href = "javascript:void(0)" onclick = "editFeedback(this)" style = "vertical-align:middle">
                                    <img src = "images/16x16/success.png" alt = "' . _SUBMIT . '" title = "' . _SUBMIT . '" border = "0" style = "vertical-align:middle" />
                                </a>
                                <a href = "javascript:void(0)" onclick = "$(\'test_feedback_div\').toggle();$(\'edit_test_feedback_div\').toggle()">
                                    <img src = "images/16x16/error_delete.png" alt = "' . _CANCEL . '" title = "' . _CANCEL . '" border = "0" style = "vertical-align:middle" />
                                </a>
                            </div>
                        </td></tr>';
        $str .= '
                    </table>
                    </td></tr>
                </table>
        <table style = "width:100%">
            <tr><td>' . $testString . '</td></tr>
        </table>
        <script>
            function redoTest(el) {
                Element.extend(el);
                url = "' . preg_replace("/&show_solved_test=\\d+/", "", $url) . '&ajax=1&redo_test=' . $status['lastTest'] . '";
                if ($("redo_progress_img")) {
                    $("redo_progress_img").writeAttribute("src", "images/others/progress1.gif").show();
                } else {
                    el.up().insert(new Element("img", {id:"redo_progress_img", src:"images/others/progress1.gif"}).setStyle({verticalAlign:"middle", borderWidth:"0px"}));
                }

                new Ajax.Request(url, {
                    method:"get",
                    asynchronous:true,
                    onFailure: function (transport) {
                        $("redo_progress_img").writeAttribute({src:"images/16x16/error_delete.png", title:transport.responseText}).hide();
                        new Effect.Appear($("redo_progress_img"));
                        window.setTimeout(\'Effect.Fade("redo_progress_img")\', 10000);
                    },
                    onSuccess: function (transport) {
                        $("redo_progress_img").hide().setAttribute("src", "images/16x16/success.png");
                        new Effect.Appear($("redo_progress_img"));
                        window.setTimeout(\'Effect.Fade("redo_progress_img")\', 2500);
                        ' . ($editHandles ? 'window.setTimeout(\'Effect.Fade("redoLink")\', 2500);' : 'window.setTimeout(\'Effect.Fade("redoLink");location="' . preg_replace(array("/&show_solved_test=\\d+/", "/&new_lesson_id=\\d+/", "/&ctg=content/"), "", $url) . '"\', 1000);') . '
                    }
                });
            }


			function redoWrongTest(el) {
                Element.extend(el);
                url = "' . preg_replace("/&show_solved_test=\\d+/", "", $url) . '&ajax=1&redo_wrong_test=' . $status['lastTest'] . '";
                if ($("redo_progress_img")) {
                    $("redo_progress_img").writeAttribute("src", "images/others/progress1.gif").show();
                } else {
                    el.up().insert(new Element("img", {id:"redo_progress_img", src:"images/others/progress1.gif"}).setStyle({verticalAlign:"middle", borderWidth:"0px"}));
                }

                new Ajax.Request(url, {
                    method:"get",
                    asynchronous:true,
                    onFailure: function (transport) {
                        $("redo_progress_img").writeAttribute({src:"images/16x16/error_delete.png", title:transport.responseText}).hide();
                        new Effect.Appear($("redo_progress_img"));
                        window.setTimeout(\'Effect.Fade("redo_progress_img")\', 10000);
                    },
                    onSuccess: function (transport) {
                        $("redo_progress_img").hide().setAttribute("src", "images/16x16/success.png");
                        new Effect.Appear($("redo_progress_img"));
                        window.setTimeout(\'Effect.Fade("redo_progress_img")\', 2500);
                        ' . ($editHandles ? 'window.setTimeout(\'Effect.Fade("redoWrongLink")\', 2500);' : 'window.setTimeout(\'Effect.Fade("redoWrongLink");location="' . preg_replace(array("/&show_solved_test=\\d+/", "/&new_lesson_id=\\d+/", "/&ctg=content/"), "", $url) . '"\', 1000);') . '
                    }
                });
            }



        </script>';
        if ($editHandles) {
            $str .= '
        <script>
            function deleteDoneTest(el, all) {
                Element.extend(el);
                if (all) {
                    url = "' . $url . '&ajax=1&delete_done_test=' . $this->completedTest['id'] . '&all=1";
                } else {
                    url = "' . $url . '&ajax=1&delete_done_test=' . $this->completedTest['id'] . '";
                }

                if ($("progress_img")) {
                    $("progress_img").writeAttribute("src", "images/others/progress1.gif").show();
                } else {
                    el.up().insert(new Element("img", {id:"progress_img", src:"images/others/progress1.gif"}).setStyle({verticalAlign:"middle", borderWidth:"0px"}));
                }
                new Ajax.Request(url, {
                    method:"get",
                    asynchronous:true,
                    onFailure: function (transport) {
                        $("progress_img").writeAttribute({src:"images/16x16/error_delete.png", title:transport.responseText}).hide();
                        new Effect.Appear($("progress_img"));
                        window.setTimeout(\'Effect.Fade("progress_img")\', 10000);
                    },
                    onSuccess: function (transport) {
                    	if (window.location.toString().match("show_solved_test")) {
                        	window.location = "' . basename($_SERVER['PHP_SELF']) . '?ctg=tests&test_results=' . $this->test['id'] . '";
                        } else {
                        	parent.location.reload();
                        }
                    }
                });
            }

            function editScore(el) {
                Element.extend(el);
                url = "' . $url . '&ajax=1&test_score=" + $("edit_test_score").value;

                if ($("progress_img")) {
                    $("progress_img").writeAttribute("src", "images/others/progress1.gif").show();
                } else {
                    el.up().insert(new Element("img", {id:"progress_img", src:"images/others/progress1.gif"}).setStyle({verticalAlign:"middle", borderWidth:"0px"}));
                }

                new Ajax.Request(url, {
                    method:"get",
                    asynchronous:true,
                    onFailure: function (transport) {
                        $("progress_img").writeAttribute({src:"images/16x16/error_delete.png", title:transport.responseText}).hide();
                        new Effect.Appear($("progress_img"));
                        window.setTimeout(\'Effect.Fade("progress_img")\', 10000);
                    },
                    onSuccess: function (transport) {
                        $("test_score").update($("edit_test_score").value + "%&nbsp;");
                        $("test_score_span").show();
                        $("edit_test_score_span").hide();
                        if (transport.responseText == "passed") {
                             $("statusMessage").update("' . _PASSED . '").className = "success";
                             setImageSrc($("statusImage"), 32, "success");
                             //$("statusImage").src = "images/32x32/success.png";
                        } else if (transport.responseText == "failed") {
                            $("statusMessage").update("' . _FAILED . '").className = "failure";
                            //$("statusImage").src = "images/32x32/close.png";
                            setImageSrc($("statusImage"), 32, "close");
                        } else if (transport.responseText == "pending") {
                            $("statusMessage").update("' . _OUTCOMEPENDING . '").className = "pending";
                            //$("statusImage").src = "images/32x32/exclamation.png";
                            setImageSrc($("statusImage"), 32, "exclamation");
                        }
                        $("progress_img").hide();
                    }
                });
            }
            function editFeedback(el) {
                Element.extend(el);
                url = "' . $url . '&ajax=1&test_feedback=" + encodeURIComponent($("edit_test_feedback").value);

                if ($("progress_img")) {
                    $("progress_img").writeAttribute("src", "images/others/progress1.gif").show();
                } else {
                    el.up().insert(new Element("img", {id:"progress_img", src:"images/others/progress1.gif"}).setStyle({verticalAlign:"middle", borderWidth:"0px"}));
                }

                new Ajax.Request(url, {
                    method:"get",
                    asynchronous:true,
                    onFailure: function (transport) {
                        $("progress_img").writeAttribute({src:"images/16x16/error_delete.png", title:transport.responseText}).hide();
                        new Effect.Appear($("progress_img"));
                        window.setTimeout(\'Effect.Fade("progress_img")\', 10000);
                    },
                    onSuccess: function (transport) {
                        $("test_feedback").update(transport.responseText);
                        transport.responseText ? $("test_feedback_div").toggle().className = "feedback_test" : $("test_feedback_div").toggle().className = "";
                        $("edit_test_feedback_div").toggle();
                        $("progress_img").hide().setAttribute("src", "images/16x16/success.png");
                        new Effect.Appear($("progress_img"));
                        window.setTimeout(\'Effect.Fade("progress_img")\', 2500);
                    }
                });
            }
            function editQuestionScore(el, id) {
                Element.extend(el);
                url = "' . $url . '&ajax=1&question=" + id + "&question_score=" + $("edit_question_" + id + "_score").value;

                if ($("progress_img_"+id)) {
                    $("progress_img_"+id).writeAttribute("src", "images/others/progress1.gif").show();
                } else {
                    el.up().insert(new Element("img", {id:"progress_img_"+id, src:"images/others/progress1.gif"}).setStyle({verticalAlign:"middle", borderWidth:"0px"}));
                }

                new Ajax.Request(url, {
                    method:"get",
                    asynchronous:true,
                    onFailure: function (transport) {
                        $("progress_img_"+id).writeAttribute({src:"images/16x16/error_delete.png", title:transport.responseText}).hide();
                        new Effect.Appear($("progress_img_"+id));
                        window.setTimeout(\'Effect.Fade("progress_img_"+id)\', 10000);
                    },
                    onSuccess: function (transport) {
                        $("question_" + id + "_score").update($("edit_question_" + id + "_score").value + "%&nbsp;");
                        $("question_" + id + "_score_coefficient").update($("edit_question_" + id + "_score").value);
                        $("test_score").update(transport.responseText.evalJSON().score + "%&nbsp;");
                        $("edit_test_score").value = transport.responseText.evalJSON().score;
                        $("question_" + id + "_scoreInTest").update(transport.responseText.evalJSON().scoreInTest[id]);
                        $("question_" + id + "_score_span").show();
                        $("edit_question_" + id + "_score_span").hide();
                        $("question_" + id + "_pending").hide();
                        if (transport.responseText.evalJSON().status == "passed") {
                             $("statusMessage").update("' . _PASSED . '").className = "success";
                             $("statusImage").src = "images/32x32/success.png";
                        } else if (transport.responseText.evalJSON().status == "failed") {
                            $("statusMessage").update("' . _FAILED . '").className = "failure";
                            $("statusImage").src = "images/32x32/close.png";
                        }
                        $("progress_img_"+id).hide();
                    }
                });
            }
            function editQuestionFeedback(el, id) {
                Element.extend(el);
                url = "' . $url . '&ajax=1&question=" + id + "&question_feedback=" + encodeURIComponent($("edit_question_"+id+"_feedback").value);

                if ($("progress_img_"+id)) {
                    $("progress_img_"+id).writeAttribute("src", "images/others/progress1.gif").show();
                } else {
                    el.up().insert(new Element("img", {id:"progress_img_"+id, src:"images/others/progress1.gif"}).setStyle({verticalAlign:"middle", borderWidth:"0px"}));
                }

                new Ajax.Request(url, {
                    method:"get",
                    asynchronous:true,
                    onFailure: function (transport) {
                        $("progress_img_"+id).writeAttribute({src:"images/16x16/error_delete.png", title:transport.responseText}).hide();
                        new Effect.Appear($("progress_img_"+id));
                        window.setTimeout(\'Effect.Fade("progress_img_"+id)\', 10000);
                    },
                    onSuccess: function (transport) {
                        $("question_" + id + "_feedback").update(transport.responseText);
                        transport.responseText ? $("question_" + id + "_feedback_div").toggle().className = "feedback_test" : $("question_" + id + "_feedback_div").toggle().className = "";
                        $("edit_question_" + id + "_feedback_div").toggle();
                        $("progress_img_"+id).hide().setAttribute("src", "images/16x16/success.png");
                        new Effect.Appear($("progress_img_"+id));
                        window.setTimeout(\'Effect.Fade("progress_img_"+id)\', 2500);
                    }
                });
            }
        </script>';
        }
        return $str;
    }