Output class for assessment test execution. More...
Public Member Functions | |
ilTestOutputGUI ($a_object) | |
ilSurveyExecutionGUI constructor | |
& | executeCommand () |
execute command | |
getCommand ($cmd) | |
Retrieves the ilCtrl command. | |
updateWorkingTime () | |
updates working time and stores state saveresult to see if question has to be stored or not | |
saveQuestionSolution () | |
saves the user input of a question | |
canSaveResult () | |
returns if answers can be saved | |
outIntroductionPage () | |
Creates the introduction page for a test. | |
isMaxProcessingTimeReached () | |
Checks wheather the maximum processing time is reached or not. | |
isEndingTimeReached () | |
deleteresults () | |
Output of the learners view of an existing test. | |
confirmdeleteresults () | |
Deletes the results of the current user for the active pass. | |
canceldeleteresults () | |
Cancels the deletion of the results of the current user for the active pass. | |
outShortResult ($user_question_order) | |
Shows a short result overview in courses. | |
outWorkingForm ($sequence=1, $finish=false, $test_id, $active, $postpone_allowed, $user_question_order, $directfeedback=0) | |
Creates the learners output of a question. | |
showPasswordProtectionPage () | |
Displays a password protection page when a test password is set. | |
checkPassword () | |
Check the password, a user entered for test access. | |
setAnonymousId () | |
start () | |
Start a test for the first time. | |
startTest () | |
Start a test for the first time after a redirect. | |
displayCode () | |
codeConfirmed () | |
resume () | |
Resume a test at the last position. | |
handleStartCommands () | |
Handles some form parameters on starting and resuming a test. | |
redirectQuestion () | |
calculateSequence () | |
next () | |
Go to the next question. | |
previous () | |
Go to the previous question. | |
postpone () | |
Postpone a question to the end of the test. | |
summary () | |
Show the question summary in online exams. | |
setsolved () | |
Set a question solved. | |
resetsolved () | |
Set a question unsolved. | |
directfeedback () | |
The direct feedback button was hit to show an instant feedback. | |
selectImagemapRegion () | |
Select an image map region in an image map question. | |
gotoQuestion () | |
Go to the question with the active sequence. | |
backFromSummary () | |
Go back to the last active question from the summary. | |
confirmFinish () | |
The final submission of a test was confirmed. | |
confirmFinishTest () | |
Confirmation of the tests final submission. | |
finishTest ($confirm=true) | |
Finish the test. | |
outTestPage () | |
Outputs the question of the active sequence. | |
prepareRequestVariables () | |
prepare Request variables e.g. | |
onRunObjectEnter () | |
what to when entering the run object | |
checkOnlineTestAccess () | |
check access restrictions like client ip, partipating user etc. | |
readFullSequence () | |
getNextSequenceByResult ($a_sequence) | |
getPreviousSequenceByResult ($a_sequence) | |
isTestAccessible () | |
test accessible returns true if the user can perform the test | |
isNrOfTriesReached () | |
nr of tries exceeded | |
isTestResumable () | |
resumable is when there exists a test and the restrictions (time, nr of tries etc) don't prevent an access | |
handleCancelCommand () | |
handle cancel command | |
showTestResults () | |
showTestResults returns true if the according request is set | |
outResults () | |
outResultsOverview () | |
Output of the learner overview for a varying random test. | |
passDetails () | |
Output of the learners view of an existing test pass. | |
outTestResults ($print=false, $pass=NULL) | |
Output of the learners view of an existing test. | |
outEvaluationForm () | |
show_answers () | |
Outputs all answers including the solutions for the active user. | |
showAnswersOfUser () | |
Output of the results of the active learner. | |
outShowAnswersDetails ($user_id, $isForm=false) | |
Outputs all answers including the solutions for the active user (output of the detail part). | |
maxProcessingTimeReached () | |
Outputs a message when the maximum processing time is reached. | |
confirmSubmitAnswers () | |
confirm submit results if confirm then results are submitted and the screen will be redirected to the startpage of the test public | |
outProcessingTime () | |
outTestSummary () | |
Output of the learners view of an existing test without evaluation. | |
finalSubmission () | |
outQuestionSummary () | |
Output of a summary of all test questions for test participants. | |
showMaximumAllowedUsersReachedMessage () | |
Data Fields | |
$object | |
$lng | |
$tpl | |
$ctrl | |
$ilias | |
$tree | |
$saveResult | |
$sequence | |
$cmdCtrl | |
$maxProcessingTimeReached | |
$endingTimeReached | |
Private Member Functions | |
endingTimeReached () | |
handle endingTimeReached |
Output class for assessment test execution.
The ilTestOutputGUI class creates the output for the ilObjTestGUI class when learners execute a test. This saves some heap space because the ilObjTestGUI class will be much smaller then
class.ilTestOutputGUI.php assessment
Definition at line 38 of file class.ilTestOutputGUI.php.
ilTestOutputGUI::backFromSummary | ( | ) |
Go back to the last active question from the summary.
Go back to the last active question from the summary
public
Definition at line 1054 of file class.ilTestOutputGUI.php.
{ $this->ctrl->setParameter($this, "activecommand", "back"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::calculateSequence | ( | ) |
Definition at line 853 of file class.ilTestOutputGUI.php.
References $_GET, $_SESSION, $sequence, getNextSequenceByResult(), and getPreviousSequenceByResult().
Referenced by redirectQuestion().
{ if ($this->object->getTestType() == TYPE_ONLINE_TEST) { if ($this->object->isActiveTestSubmitted()) return ""; } $sequence = $_GET["sequence"]; $questionCount = $this->object->getQuestionCount(); if ($sequence > $questionCount) $sequence = $questionCount; if (!$sequence) $sequence = 1; if (array_key_exists("save_error", $_GET)) { if ($_GET["save_error"] == 1) { return $sequence; } } switch ($_GET["activecommand"]) { case "next": if($_GET['crs_show_result']) { $sequence = $this->getNextSequenceByResult($sequence); } else { $sequence++; } break; case "previous": if($_GET['crs_show_result']) { $sequence = $this->getPreviousSequenceByResult($sequence); } else { $sequence--; } break; } if ($_GET['crs_show_result']) { if(isset($_SESSION['crs_sequence'][0])) { $sequence = max($sequence,$_SESSION['crs_sequence'][0]); } else { $sequence = max($sequence,$this->object->getFirstSequence()); } } return $sequence; }
ilTestOutputGUI::canceldeleteresults | ( | ) |
Cancels the deletion of the results of the current user for the active pass.
Cancels the deletion of the results of the current user for the active pass
public
Definition at line 257 of file class.ilTestOutputGUI.php.
{
$this->ctrl->redirect($this, "outIntroductionPage");
}
ilTestOutputGUI::canSaveResult | ( | ) |
returns if answers can be saved
Definition at line 168 of file class.ilTestOutputGUI.php.
References isEndingTimeReached(), isMaxProcessingTimeReached(), and isNrOfTriesReached().
Referenced by saveQuestionSolution().
{ return !$this->isEndingTimeReached() && !$this->isMaxProcessingTimeReached() && !$this->isNrOfTriesReached(); }
ilTestOutputGUI::checkOnlineTestAccess | ( | ) |
check access restrictions like client ip, partipating user etc.
Definition at line 1285 of file class.ilTestOutputGUI.php.
References $user, and sendInfo().
Referenced by onRunObjectEnter().
{ global $ilUser; // check if user is invited to participate $user = $this->object->getInvitedUsers($ilUser->getId()); if (!is_array ($user) || count($user)!=1) { sendInfo($this->lng->txt("user_not_invited"), true); $this->ctrl->redirectByClass("ilobjtestgui", "backToRepository"); } $user = array_pop($user); // check if client ip is set and if current remote addr is equal to stored client-ip if (strcmp($user->clientip,"")!=0 && strcmp($user->clientip,$_SERVER["REMOTE_ADDR"])!=0) { sendInfo($this->lng->txt("user_wrong_clientip"), true); $this->ctrl->redirectByClass("ilobjtestgui", "backToRepository"); } }
ilTestOutputGUI::checkPassword | ( | ) |
Check the password, a user entered for test access.
Check the password, a user entered for test access
public
Definition at line 551 of file class.ilTestOutputGUI.php.
References $_POST, $_SESSION, and sendInfo().
{ if (strcmp($this->object->getPassword(), $_POST["password"]) == 0) { global $ilUser; $ilUser->setPref("tst_password_".$this->object->getTestId(), $this->object->getPassword()); $ilUser->writePref("tst_password_".$this->object->getTestId(), $this->object->getPassword()); $active_time_id = $this->object->startWorkingTime($ilUser->id); $_SESSION["active_time_id"] = $active_time_id; $this->ctrl->redirect($this, "start"); } else { sendInfo($this->lng->txt("tst_password_entered_wrong_password"), true); $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); } }
ilTestOutputGUI::codeConfirmed | ( | ) |
Definition at line 668 of file class.ilTestOutputGUI.php.
{ $this->ctrl->setParameter($this, "activecommand", "start"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::confirmdeleteresults | ( | ) |
Deletes the results of the current user for the active pass.
Deletes the results of the current user for the active pass
public
Definition at line 241 of file class.ilTestOutputGUI.php.
References sendInfo().
{ global $ilUser; $this->object->deleteResults($ilUser->id); sendInfo($this->lng->txt("tst_confirm_delete_results_info"), true); $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); }
ilTestOutputGUI::confirmFinish | ( | ) |
The final submission of a test was confirmed.
The final submission of a test was confirmed
public
Definition at line 1067 of file class.ilTestOutputGUI.php.
References finishTest().
{ $this->finishTest(false); }
ilTestOutputGUI::confirmFinishTest | ( | ) |
Confirmation of the tests final submission.
Confirmation of the tests final submission
public
Definition at line 1079 of file class.ilTestOutputGUI.php.
Referenced by finishTest().
{ $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_finish_confirmation.html", true); $this->tpl->setVariable("FINISH_QUESTION", $this->lng->txt("tst_finish_confirmation_question")); $this->tpl->setVariable("BUTTON_CONFIRM", $this->lng->txt("tst_finish_confirm_button")); $this->tpl->setVariable("BUTTON_CANCEL", $this->lng->txt("tst_finish_confirm_cancel_button")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::confirmSubmitAnswers | ( | ) |
confirm submit results if confirm then results are submitted and the screen will be redirected to the startpage of the test public
Definition at line 2044 of file class.ilTestOutputGUI.php.
{ $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_submit_answers_confirm.html", true); $this->tpl->setCurrentBlock("adm_content"); if ($this->object->isActiveTestSubmitted()) { $this->tpl->setCurrentBlock("not_submit_allowed"); $this->tpl->setVariable("TEXT_ALREADY_SUBMITTED", $this->lng->txt("tst_already_submitted")); $this->tpl->setVariable("BTN_OK", $this->lng->txt("tst_show_answer_sheet")); } else { $this->tpl->setCurrentBlock("submit_allowed"); $this->tpl->setVariable("TEXT_CONFIRM_SUBMIT_RESULTS", $this->lng->txt("tst_confirm_submit_answers")); $this->tpl->setVariable("BTN_OK", $this->lng->txt("tst_submit_results")); } $this->tpl->setVariable("BTN_BACK", $this->lng->txt("back")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::deleteresults | ( | ) |
Output of the learners view of an existing test.
Output of the learners view of an existing test
public
Definition at line 223 of file class.ilTestOutputGUI.php.
{ $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_delete_results_confirm.html", true); $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("TEXT_CONFIRM_DELETE_RESULTS", $this->lng->txt("tst_confirm_delete_results")); $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel")); $this->tpl->setVariable("BTN_OK", $this->lng->txt("tst_delete_results")); $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this)); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::directfeedback | ( | ) |
The direct feedback button was hit to show an instant feedback.
The direct feedback button was hit to show an instant feedback
public
Definition at line 1007 of file class.ilTestOutputGUI.php.
References saveQuestionSolution().
{ $this->saveQuestionSolution(); $this->ctrl->setParameter($this, "activecommand", "directfeedback"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::displayCode | ( | ) |
Definition at line 657 of file class.ilTestOutputGUI.php.
{ $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_anonymous_code_presentation.html", true); $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("TEXT_ANONYMOUS_CODE_CREATED", $this->lng->txt("tst_access_code_created")); $this->tpl->setVariable("TEXT_ANONYMOUS_CODE", $this->object->getAccessCodeSession()); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("CONTINUE", $this->lng->txt("continue_work")); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::endingTimeReached | ( | ) | [private] |
handle endingTimeReached
Definition at line 2010 of file class.ilTestOutputGUI.php.
References ilFormat::ftimestamp2datetimeDB(), outIntroductionPage(), outResults(), outTestSummary(), and sendInfo().
Referenced by isEndingTimeReached(), and outTestPage().
{ sendInfo(sprintf($this->lng->txt("detail_ending_time_reached"), ilFormat::ftimestamp2datetimeDB($this->object->getEndingTime()))); $this->object->setActiveTestUser(1, "", true); if (!$this->object->canViewResults()) { $this->outIntroductionPage(); } else { if ($this->object->isOnlineTest()) $this->outTestSummary(); else $this->outResults(); } }
& ilTestOutputGUI::executeCommand | ( | ) |
execute command
Definition at line 77 of file class.ilTestOutputGUI.php.
References $cmd, and getCommand().
{ $cmd = $this->ctrl->getCmd(); $next_class = $this->ctrl->getNextClass($this); $this->ctrl->saveParameter($this, "sequence"); $cmd = $this->getCommand($cmd); switch($next_class) { default: $ret =& $this->$cmd(); break; } return $ret; }
ilTestOutputGUI::finalSubmission | ( | ) |
Definition at line 2371 of file class.ilTestOutputGUI.php.
References $ilias, and outIntroductionPage().
{ global $ilias, $ilUser; $this->object->setActiveTestSubmitted($ilUser->id); $ilias->auth->setIdle($ilias->ini->readVariable("session","expire"), false); $ilias->auth->setExpire(0); $this->outIntroductionPage(); }
ilTestOutputGUI::finishTest | ( | $ | confirm = true |
) |
Finish the test.
Finish the test
public
Definition at line 1096 of file class.ilTestOutputGUI.php.
References $_GET, $_SESSION, confirmFinishTest(), outIntroductionPage(), outResults(), and outTestSummary().
Referenced by confirmFinish().
{ global $ilUser; unset($_SESSION["tst_next"]); $active = $this->object->getActiveTestUser($ilUser->getId()); $actualpass = $this->object->_getPass($active->active_id); if (($confirm) && ($actualpass == $this->object->getNrOfTries() - 1)) { // show confirmation page return $this->confirmFinishTest(); } if ($this->object->getTestType() == TYPE_VARYING_RANDOMTEST) { // create a new set of random questions if more passes are allowed $maxpass = $this->object->getNrOfTries(); if (($maxpass == 0) || (($actualpass+1) < ($maxpass))) { $this->object->generateRandomQuestions($actualpass+1); } } if ($this->object->isOnlineTest() && !$this->object->isActiveTestSubmitted($ilUser->getId())) { $this->outTestSummary(); return; } $this->object->setActiveTestUser(1, "", true); //if (($this->object->getTestType() != TYPE_VARYING_RANDOMTEST) && (!$this->object->canViewResults())) if (!$this->object->canViewResults()) { $this->outIntroductionPage($maxprocessingtimereached); } else { $this->outResults(); } if($_GET['crs_show_result']) { $this->ctrl->redirectByClass("ilobjtestgui", "backToCourse"); } }
ilTestOutputGUI::getCommand | ( | $ | cmd | ) |
Retrieves the ilCtrl command.
Retrieves the ilCtrl command
public
Definition at line 100 of file class.ilTestOutputGUI.php.
References $cmd.
Referenced by executeCommand().
{ return $cmd; }
ilTestOutputGUI::getNextSequenceByResult | ( | $ | a_sequence | ) |
Definition at line 1339 of file class.ilTestOutputGUI.php.
References $_SESSION, $counter, and $sequence.
Referenced by calculateSequence().
{ if(!is_array($_SESSION['crs_sequence'])) { return 1; } $counter = 0; foreach($_SESSION['crs_sequence'] as $sequence) { if($sequence == $a_sequence) { if($_SESSION['crs_sequence'][$counter+1]) { return $_SESSION['crs_sequence'][$counter+1]; } else { return $this->object->getQuestionCount() + 1; } } ++$counter; } return $this->object->getQuestionCount() + 1; }
ilTestOutputGUI::getPreviousSequenceByResult | ( | $ | a_sequence | ) |
Definition at line 1364 of file class.ilTestOutputGUI.php.
References $_SESSION, $counter, and $sequence.
Referenced by calculateSequence().
{ if(!is_array($_SESSION['crs_sequence'])) { return 0; } $counter = 0; foreach($_SESSION['crs_sequence'] as $sequence) { if($sequence == $a_sequence) { if($_SESSION['crs_sequence'][$counter-1]) { return $_SESSION['crs_sequence'][$counter-1]; } else { return 0; } } ++$counter; } return 0; }
ilTestOutputGUI::gotoQuestion | ( | ) |
Go to the question with the active sequence.
Go to the question with the active sequence
public
Definition at line 1040 of file class.ilTestOutputGUI.php.
References $_GET.
{ $this->ctrl->setParameter($this, "sequence", $_GET["sequence"]); $this->ctrl->setParameter($this, "activecommand", "gotoquestion"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::handleCancelCommand | ( | ) |
handle cancel command
Definition at line 1429 of file class.ilTestOutputGUI.php.
References sendInfo().
Referenced by onRunObjectEnter().
{ sendInfo($this->lng->txt("test_cancelled"), true); $this->ctrl->redirectByClass("ilobjtestgui", "backToRepository"); }
ilTestOutputGUI::handleStartCommands | ( | ) |
Handles some form parameters on starting and resuming a test.
Handles some form parameters on starting and resuming a test
public
Definition at line 699 of file class.ilTestOutputGUI.php.
References $_POST, $_SESSION, and $ilias.
Referenced by resume(), and start().
{ global $ilUser; // create new time dataset and set start time if (!strlen($this->object->getPassword())) { $active_time_id = $this->object->startWorkingTime($ilUser->id); $_SESSION["active_time_id"] = $active_time_id; } if ($_POST["chb_javascript"]) { $ilUser->setPref("tst_javascript", 1); $ilUser->writePref("tst_javascript", 1); } else { $ilUser->setPref("tst_javascript", 0); $ilUser->writePref("tst_javascript", 0); } // hide previous results if ($this->object->getNrOfTries() != 1) { if ($this->object->getHidePreviousResults() != 1) { if ($_POST["chb_hide_previous_results"]) { $ilUser->setPref("tst_hide_previous_results", 1); $ilUser->writePref("tst_hide_previous_results", 1); } else { $ilUser->setPref("tst_hide_previous_results", 0); $ilUser->writePref("tst_hide_previous_results", 0); } } } if ($this->object->getTestType() == TYPE_ONLINE_TEST) { global $ilias; $ilias->auth->setIdle(0, false); } }
ilTestOutputGUI::ilTestOutputGUI | ( | $ | a_object | ) |
ilSurveyExecutionGUI constructor
The constructor takes possible arguments an creates an instance of the ilSurveyExecutionGUI object.
object | $a_object Associated ilObjSurvey class public |
Definition at line 61 of file class.ilTestOutputGUI.php.
ilTestOutputGUI::isEndingTimeReached | ( | ) |
Definition at line 207 of file class.ilTestOutputGUI.php.
References endingTimeReached().
Referenced by canSaveResult(), isTestAccessible(), and outTestPage().
{ global $ilUser; if (!is_bool($this->endingTimeReached)) $this->endingTimeReached = $this->object->endingTimeReached() && ($this->object->getTestType() != TYPE_SELF_ASSESSMENT); return $this->endingTimeReached; }
ilTestOutputGUI::isMaxProcessingTimeReached | ( | ) |
Checks wheather the maximum processing time is reached or not.
Checks wheather the maximum processing time is reached or not
Definition at line 193 of file class.ilTestOutputGUI.php.
Referenced by canSaveResult(), isTestAccessible(), outTestPage(), and outTestSummary().
{ global $ilUser; $starting_time = $this->object->getStartingTimeOfUser($ilUser->getId()); if ($starting_time === FALSE) { return FALSE; } else { return $this->object->isMaxProcessingTimeReached($starting_time); } }
ilTestOutputGUI::isNrOfTriesReached | ( | ) |
nr of tries exceeded
Definition at line 1404 of file class.ilTestOutputGUI.php.
Referenced by canSaveResult(), and isTestAccessible().
{ $active = $this->object->getActiveTestUser(); return $this->object->hasNrOfTriesRestriction() && is_object($active) && $this->object->isNrOfTriesReached($active->tries); }
ilTestOutputGUI::isTestAccessible | ( | ) |
test accessible returns true if the user can perform the test
Definition at line 1393 of file class.ilTestOutputGUI.php.
References isEndingTimeReached(), isMaxProcessingTimeReached(), and isNrOfTriesReached().
Referenced by prepareRequestVariables().
{ return !$this->isNrOfTriesReached() and !$this->isMaxProcessingTimeReached() and $this->object->startingTimeReached() and !$this->isEndingTimeReached(); }
ilTestOutputGUI::isTestResumable | ( | ) |
resumable is when there exists a test and the restrictions (time, nr of tries etc) don't prevent an access
Definition at line 1414 of file class.ilTestOutputGUI.php.
{ if ($this->object->getTestType() == TYPE_ONLINE_TEST) { if ($this->object->isActiveTestSubmitted()) return false; } $active = $this->object->getActiveTestUser(); return is_object($active) && $this->object->startingTimeReached() && !$this->object->endingTimeReached(); }
ilTestOutputGUI::maxProcessingTimeReached | ( | ) |
Outputs a message when the maximum processing time is reached.
Outputs a message when the maximum processing time is reached
public
Definition at line 2034 of file class.ilTestOutputGUI.php.
References outIntroductionPage().
Referenced by outTestPage().
{ $this->outIntroductionPage(); }
ilTestOutputGUI::next | ( | ) |
Go to the next question.
Go to the next question
public
Definition at line 915 of file class.ilTestOutputGUI.php.
References saveQuestionSolution().
{ $this->saveQuestionSolution(); $this->ctrl->setParameter($this, "activecommand", "next"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::onRunObjectEnter | ( | ) |
what to when entering the run object
Definition at line 1266 of file class.ilTestOutputGUI.php.
References $_POST, checkOnlineTestAccess(), and handleCancelCommand().
Referenced by outTestPage().
{ // cancel Test if it's not online test if ($_POST["cmd"]["cancelTest"]) { $this->handleCancelCommand(); } // check online exams access restrictions due to participants and client ip if ($this->object->getTestType() == TYPE_ONLINE_TEST) { $this->checkOnlineTestAccess(); } }
ilTestOutputGUI::outEvaluationForm | ( | ) |
Definition at line 1803 of file class.ilTestOutputGUI.php.
References $_GET, ilObjStyleSheet::getContentStylePath(), and ilObjStyleSheet::getSyntaxStylePath().
{ global $ilUser; $this->ctrl->saveParameter($this, "pass"); include_once("classes/class.ilObjStyleSheet.php"); $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); $test_id = $this->object->getTestId(); $question_gui = $this->object->createQuestionGUI("", $_GET["evaluation"]); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_evaluation.html", true); $this->tpl->setCurrentBlock("adm_content"); $active = $this->object->getActiveTestUser($ilUser->getId()); $result_output = $question_gui->getSolutionOutput($active->active_id, NULL, TRUE, FALSE, FALSE); $best_output = $question_gui->getSolutionOutput("", NULL, FALSE, FALSE, FALSE); $this->tpl->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was")); $this->tpl->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is")); $maxpoints = $question_gui->object->getMaximumPoints(); if ($maxpoints == 1) { $this->tpl->setVariable("QUESTION_TITLE", $question_gui->object->getTitle() . " (" . $maxpoints . " " . $this->lng->txt("point") . ")"); } else { $this->tpl->setVariable("QUESTION_TITLE", $question_gui->object->getTitle() . " (" . $maxpoints . " " . $this->lng->txt("points") . ")"); } $this->tpl->setVariable("SOLUTION_OUTPUT", $result_output); $this->tpl->setVariable("BEST_OUTPUT", $best_output); $this->tpl->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active->active_id), $maxpoints)); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back")); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::outIntroductionPage | ( | ) |
Creates the introduction page for a test.
Creates the introduction page for a test
public
Definition at line 180 of file class.ilTestOutputGUI.php.
Referenced by endingTimeReached(), finalSubmission(), finishTest(), and maxProcessingTimeReached().
{ $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); }
ilTestOutputGUI::outProcessingTime | ( | ) |
Definition at line 2064 of file class.ilTestOutputGUI.php.
References formatDate().
Referenced by outQuestionSummary(), outTestPage(), and outTestSummary().
{ global $ilUser; $starting_time = $this->object->getStartingTimeOfUser($ilUser->getId()); $processing_time = $this->object->getProcessingTimeInSeconds(); $processing_time_minutes = floor($processing_time / 60); $processing_time_seconds = $processing_time - $processing_time_minutes * 60; $str_processing_time = ""; if ($processing_time_minutes > 0) { $str_processing_time = $processing_time_minutes . " " . $this->lng->txt("minutes"); } if ($processing_time_seconds > 0) { if (strlen($str_processing_time) > 0) $str_processing_time .= " " . $this->lng->txt("and") . " "; $str_processing_time .= $processing_time_seconds . " " . $this->lng->txt("seconds"); } $time_left = $starting_time + $processing_time - mktime(); $testend_time = $this->object->getSecondsUntilEndingTime(); if (($testend_time > 0) && ($testend_time < $time_left)) { $time_left = $testend_time; } $time_left_minutes = floor($time_left / 60); $time_left_seconds = $time_left - $time_left_minutes * 60; $str_time_left = ""; if ($time_left_minutes > 0) { $str_time_left = $time_left_minutes . " " . $this->lng->txt("minutes"); } if ($time_left_seconds > 0) { if (strlen($str_time_left) > 0) $str_time_left .= " " . $this->lng->txt("and") . " "; $str_time_left .= $time_left_seconds . " " . $this->lng->txt("seconds"); } $date = getdate($starting_time); $formattedStartingTime = ilFormat::formatDate( $date["year"]."-". sprintf("%02d", $date["mon"])."-". sprintf("%02d", $date["mday"])." ". sprintf("%02d", $date["hours"]).":". sprintf("%02d", $date["minutes"]).":". sprintf("%02d", $date["seconds"]) ); $datenow = getdate(); $this->tpl->setCurrentBlock("enableprocessingtime"); $this->tpl->setVariable("USER_WORKING_TIME", sprintf( $this->lng->txt("tst_time_already_spent"), $formattedStartingTime, $str_processing_time ) ); $this->tpl->setVariable("USER_REMAINING_TIME", sprintf($this->lng->txt("tst_time_already_spent_left"), $str_time_left)); $this->tpl->parseCurrentBlock(); $template = new ilTemplate("tpl.workingtime.js.html", TRUE, TRUE, TRUE); $template->setVariable("STRING_MINUTE", $this->lng->txt("minute")); $template->setVariable("STRING_MINUTES", $this->lng->txt("minutes")); $template->setVariable("STRING_SECOND", $this->lng->txt("second")); $template->setVariable("STRING_SECONDS", $this->lng->txt("seconds")); $template->setVariable("STRING_TIMELEFT", $this->lng->txt("tst_time_already_spent_left")); $template->setVariable("AND", strtolower($this->lng->txt("and"))); $template->setVariable("YEAR", $date["year"]); $template->setVariable("MONTH", $date["mon"]-1); $template->setVariable("DAY", $date["mday"]); $template->setVariable("HOUR", $date["hours"]); $template->setVariable("MINUTE", $date["minutes"]); $template->setVariable("SECOND", $date["seconds"]); if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->object->getEndingTime(), $matches)) { $template->setVariable("ENDYEAR", $matches[1]); $template->setVariable("ENDMONTH", $matches[2]-1); $template->setVariable("ENDDAY", $matches[3]); $template->setVariable("ENDHOUR", $matches[4]); $template->setVariable("ENDMINUTE", $matches[5]); $template->setVariable("ENDSECOND", $matches[6]); } $template->setVariable("YEARNOW", $datenow["year"]); $template->setVariable("MONTHNOW", $datenow["mon"]-1); $template->setVariable("DAYNOW", $datenow["mday"]); $template->setVariable("HOURNOW", $datenow["hours"]); $template->setVariable("MINUTENOW", $datenow["minutes"]); $template->setVariable("SECONDNOW", $datenow["seconds"]); $template->setVariable("PTIME_M", $processing_time_minutes); $template->setVariable("PTIME_S", $processing_time_seconds); $this->tpl->setCurrentBlock("HeadContent"); $this->tpl->setVariable("CONTENT_BLOCK", $template->get()); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::outQuestionSummary | ( | ) |
Output of a summary of all test questions for test participants.
public
Definition at line 2386 of file class.ilTestOutputGUI.php.
References $_GET, $counter, $key, $user_id, ilUtil::getImagePath(), and outProcessingTime().
{ global $ilUser; $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_question_summary.html", true); $user_id = $ilUser->id; $active = $this->object->getActiveTestUser($ilUser->getId()); $color_class = array ("tblrow1", "tblrow2"); $counter = 0; $result_array = & $this->object->getTestSummary($active->active_id); foreach ($result_array as $key => $value) { if (preg_match("/\d+/", $key)) { $this->tpl->setCurrentBlock("question"); $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]); $this->tpl->setVariable("VALUE_QUESTION_COUNTER", $value["nr"]); $this->ctrl->setParameter($this, "sequence", $value["nr"]); $this->tpl->setVariable("VALUE_QUESTION_TITLE", "<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this), "gotoQuestion")."\">" . $value["title"] . "</a>"); $this->ctrl->setParameter($this, "sequence", $_GET["sequence"]); //$this->tpl->setVariable("VALUE_QUESTION_DESCRIPTION", $value["description"]); if ($value["worked_through"]) { $this->tpl->setVariable("VALUE_WORKED_THROUGH", ilUtil::getImagePath("icon_ok.gif")); $this->tpl->setVariable("ALT_WORKED_THROUGH", $this->lng->txt("worked_through")); } else { $this->tpl->setVariable("VALUE_WORKED_THROUGH", ilUtil::getImagePath("icon_not_ok.gif")); $this->tpl->setVariable("ALT_WORKED_THROUGH", $this->lng->txt("not_worked_through")); } if ($value["postponed"]) { $this->tpl->setVariable("VALUE_POSTPONED", $this->lng->txt("postponed")); } if (!$this->object->getHideTitlePoints()) { $this->tpl->setVariable("VALUE_QUESTION_POINTS", $value["points"]." ".$this->lng->txt("points_short")); } $this->tpl->parseCurrentBlock(); $counter ++; } } $this->tpl->setVariable("QUESTION_ACTION","actions"); $this->tpl->setVariable("QUESTION_COUNTER", $this->lng->txt("tst_qst_order")); $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title")); if (!$this->object->getHideTitlePoints()) { $this->tpl->setVariable("QUESTION_POINTS", $this->lng->txt("tst_maximum_points")); } $this->tpl->setVariable("WORKED_THROUGH", $this->lng->txt("worked_through")); $this->tpl->setVariable("USER_FEEDBACK", $this->lng->txt("tst_qst_summary_text")); $this->tpl->setVariable("TXT_BACK", $this->lng->txt("back")); $this->tpl->setVariable("TXT_SHOW_AND_SUBMIT_ANSWERS", $this->lng->txt("save_finish")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("TEXT_RESULTS", $this->lng->txt("question_summary")); if ($this->object->getEnableProcessingTime()) $this->outProcessingTime(); }
ilTestOutputGUI::outResults | ( | ) |
Definition at line 1443 of file class.ilTestOutputGUI.php.
References outResultsOverview(), and outTestResults().
Referenced by endingTimeReached(), and finishTest().
{ if ($this->object->getTestType() == TYPE_VARYING_RANDOMTEST) { $this->outResultsOverview(); } else { $this->outTestResults(); } }
ilTestOutputGUI::outResultsOverview | ( | ) |
Output of the learner overview for a varying random test.
Output of the learner overview for a varying random test
public
Definition at line 1462 of file class.ilTestOutputGUI.php.
References $counter, $user_id, ilObjTest::_getResultPass(), ilFormat::formatDate(), and ilFormat::ftimestamp2dateDB().
Referenced by outResults().
{ global $ilUser; if ($this->object->getTestType() != TYPE_VARYING_RANDOMTEST) { $this->ctrl->redirect($this, "outIntroductionPage"); } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_finish.html", true); $this->tpl->addBlockFile("TEST_RESULTS", "results", "tpl.il_as_tst_varying_results.html", true); $user_id = $ilUser->id; $color_class = array("tblrow1", "tblrow2"); $counter = 0; include_once "./assessment/classes/class.ilObjTest.php"; $active = $this->object->getActiveTestUser($ilUser->getId()); $counted_pass = ilObjTest::_getResultPass($active->active_id); $reached_pass = $this->object->_getPass($active->active_id); $result_percentage = 0; $result_total_reached = 0; $result_total_max = 0; for ($pass = 0; $pass <= $reached_pass; $pass++) { $finishdate = $this->object->getPassFinishDate($active->active_id, $pass); if ($finishdate > 0) { $result_array =& $this->object->getTestResult($active->active_id, $pass); if (!$result_array["test"]["total_max_points"]) { $percentage = 0; } else { $percentage = ($result_array["test"]["total_reached_points"]/$result_array["test"]["total_max_points"])*100; } $total_max = $result_array["test"]["total_max_points"]; $total_reached = $result_array["test"]["total_reached_points"]; $this->tpl->setCurrentBlock("result_row"); if ($pass == $counted_pass) { $this->tpl->setVariable("COLOR_CLASS", "tblrowmarked"); $this->tpl->setVariable("VALUE_SCORED", "⊗"); $result_percentage = $percentage; $result_total_reached = $total_reached; $result_total_max = $total_max; } else { $this->tpl->setVariable("COLOR_CLASS", $color_class[$pass % 2]); } $this->tpl->setVariable("VALUE_PASS", $pass + 1); $this->tpl->setVariable("VALUE_DATE", ilFormat::formatDate(ilFormat::ftimestamp2dateDB($finishdate), "date")); $this->tpl->setVariable("VALUE_ANSWERED", $this->object->getAnsweredQuestionCount($active->active_id, $pass) . " " . strtolower($this->lng->txt("of")) . " " . (count($result_array)-1)); $this->tpl->setVariable("VALUE_REACHED", $total_reached . " " . strtolower($this->lng->txt("of")) . " " . $total_max); $this->tpl->setVariable("VALUE_PERCENTAGE", sprintf("%.2f", $percentage) . "%"); if ($this->object->canViewResults()) { $this->tpl->setVariable("HREF_PASS_DETAILS", "<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this), "passDetails")."&pass=$pass\">" . $this->lng->txt("tst_pass_details") . "</a>"); } $this->tpl->parseCurrentBlock(); } } $this->tpl->setCurrentBlock("results"); $this->tpl->setVariable("PASS_SCORED", $this->lng->txt("scored_pass")); $this->tpl->setVariable("PASS_COUNTER", $this->lng->txt("pass")); $this->tpl->setVariable("DATE", $this->lng->txt("date")); $this->tpl->setVariable("ANSWERED_QUESTIONS", $this->lng->txt("tst_answered_questions")); $this->tpl->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points")); $this->tpl->setVariable("PERCENTAGE_CORRECT", $this->lng->txt("tst_percent_solved")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("BACK_TO_INTRODUCTION", $this->lng->txt("tst_results_back_introduction")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("test_user_name"); $this->tpl->setVariable("USER_NAME", sprintf($this->lng->txt("tst_result_user_name"), $ilUser->getFullname())); $this->tpl->parseCurrentBlock(); if ($this->object->canViewResults()) { $mark_obj = $this->object->mark_schema->getMatchingMark($result_percentage); if ($mark_obj) { if ($mark_obj->getPassed()) { $mark = $this->lng->txt("tst_result_congratulations"); } else { $mark = $this->lng->txt("tst_result_sorry"); } $mark .= "<br />" . $this->lng->txt("tst_your_mark_is") . ": "" . $mark_obj->getOfficialName() . """; } if ($this->object->ects_output) { $ects_mark = $this->object->getECTSGrade($result_total_reached, $result_total_max); $mark .= "<br />" . $this->lng->txt("tst_your_ects_mark_is") . ": "" . $ects_mark . "" (" . $this->lng->txt("ects_grade_". strtolower($ects_mark) . "_short") . ": " . $this->lng->txt("ects_grade_". strtolower($ects_mark)) . ")"; } $this->tpl->setVariable("USER_FEEDBACK", $mark); } $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("TEXT_RESULTS", $this->lng->txt("tst_results")); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::outShortResult | ( | $ | user_question_order | ) |
Shows a short result overview in courses.
Shows a short result overview in courses
public
Definition at line 269 of file class.ilTestOutputGUI.php.
References $_GET, $_SESSION, $pos, and $sequence.
Referenced by outTestPage().
{ if(!$_GET['crs_show_result']) {/* $this->tpl->setCurrentBlock("percentage"); $this->tpl->setVariable("PERCENTAGE", 200); $this->tpl->setVariable("PERCENTAGE_VALUE", sprintf($this->lng->txt("tst_position"), $this->sequence, count($user_question_order))); $this->tpl->setVariable("HUNDRED_PERCENT", "200"); $this->tpl->setVariable("TEXT_COMPLETED", $this->lng->txt("completed") . ": "); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("percentage_bottom"); $this->tpl->setVariable("PERCENTAGE", 200); $this->tpl->setVariable("PERCENTAGE_VALUE", sprintf($this->lng->txt("tst_position"), $this->sequence, count($user_question_order))); $this->tpl->setVariable("HUNDRED_PERCENT", "200"); $this->tpl->setVariable("TEXT_COMPLETED", $this->lng->txt("completed") . ": "); $this->tpl->parseCurrentBlock();*/ } else { $num_wrong = count($_SESSION['crs_sequence']); $pos = 1; foreach($_SESSION['crs_sequence'] as $sequence) { if($sequence == $this->sequence) { break; } $pos++; } /* $this->tpl->setCurrentBlock("percentage"); $this->tpl->setVariable("PERCENTAGE", 200); $this->tpl->setVariable("PERCENTAGE_VALUE", sprintf($this->lng->txt("tst_position"), $pos, $num_wrong)); $this->tpl->setVariable("HUNDRED_PERCENT", "200"); $this->tpl->setVariable("TEXT_COMPLETED", $this->lng->txt("completed") . ": "); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("percentage_bottom"); $this->tpl->setVariable("PERCENTAGE", 200); $this->tpl->setVariable("PERCENTAGE_VALUE", sprintf($this->lng->txt("tst_position"), $pos, $num_wrong)); $this->tpl->setVariable("HUNDRED_PERCENT", "200"); $this->tpl->setVariable("TEXT_COMPLETED", $this->lng->txt("completed") . ": "); $this->tpl->parseCurrentBlock();*/ } }
ilTestOutputGUI::outShowAnswersDetails | ( | $ | user_id, | |
$ | isForm = false | |||
) |
Outputs all answers including the solutions for the active user (output of the detail part).
Outputs all answers including the solutions for the active user (output of the detail part)
public
Definition at line 1895 of file class.ilTestOutputGUI.php.
References $counter, $t, $type, $user_id, ilUtil::date_mysql2time(), and ilUtil::getImagePath().
Referenced by show_answers(), and showAnswersOfUser().
{ $active = $this->object->getActiveTestUser($user_id); $t = $active->submittimestamp; include_once "./classes/class.ilObjUser.php"; $ilUser = new ilObjUser($user_id); if (strlen($ilUser->getMatriculation())) { $this->tpl->setCurrentBlock("user_matric"); $this->tpl->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("user_matric_value"); $this->tpl->setVariable("VALUE_USR_MATRIC", $ilUser->getMatriculation()); $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("user_matric_separator"); } $invited_users = array_pop($this->object->getInvitedUsers($ilUser->getId())); if (strlen($invited_users->clientip)) { $this->tpl->setCurrentBlock("user_clientip"); $this->tpl->setVariable("TXT_CLIENT_IP", $this->lng->txt("clientip")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("user_clientip_value"); $this->tpl->setVariable("VALUE_CLIENT_IP", $invited_users->clientip); $this->tpl->parseCurrentBlock(); $this->tpl->touchBlock("user_clientip_separator"); } include_once "./classes/class.ilUtil.php"; // output of submit date and signature if ($active->submitted) { // only display submit date when it exists (not in the summary but in the print form) $this->tpl->setCurrentBlock("freefield_bottom"); $this->tpl->setVariable("TXT_DATE", $this->lng->txt("date")); $this->tpl->setVariable("VALUE_DATE", strftime("%Y-%m-%d %H:%M:%S", ilUtil::date_mysql2time($t))); $freefieldtypes = array( "freefield_bottom" => array( array( "title" => $this->lng->txt("tst_signature"), "length" => 300 ) ) ); foreach ($freefieldtypes as $type => $freefields) { $counter = 0; while ($counter < count($freefields)) { $freefield = $freefields[$counter]; $this->tpl->setVariable("TXT_FREE_FIELD", $freefield["title"]); $this->tpl->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.gif")); $counter ++; } } $this->tpl->parseCurrentBlock(); } $pass = NULL; if ($this->object->isRandomTest()) { $pass = $this->object->_getResultPass($active->active_id); } $counter = 1; // get the questions in the sequence, the user worked through $questions =& $this->object->getQuestions($active->active_id, $pass, TRUE); // output of questions with solutions foreach ($questions as $question) { $this->tpl->setCurrentBlock("question"); $question_gui = $this->object->createQuestionGUI("", $question); $this->tpl->setVariable("COUNTER_QUESTION", $counter.". "); $this->tpl->setVariable("QUESTION_TITLE", $question_gui->object->getTitle()); $active = $this->object->getActiveTestUser($ilUser->getId()); $result_output = $question_gui->getSolutionOutput($active->active_id, $pass, FALSE, FALSE, FALSE); $this->tpl->setVariable("SOLUTION_OUTPUT", $result_output); $this->tpl->parseCurrentBlock(); $counter ++; } // output of submit buttons if ($isForm && !$active->submitted) { $this->tpl->setCurrentBlock("confirm"); $this->tpl->setVariable("TXT_SUBMIT_ANSWERS", $this->lng->txt("tst_submit_answers_txt")); $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("back")); $this->tpl->setVariable("BTN_OK", $this->lng->txt("tst_submit_answers")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("answer_sheet"); $this->tpl->setVariable("TXT_TEST_TITLE", $this->lng->txt("title")); $this->tpl->setVariable("VALUE_TEST_TITLE", $this->object->getTitle()); $this->tpl->setVariable("TXT_TEST_PROLOG", $this->lng->txt("tst_your_answers")); $this->tpl->setVariable("TITLE", $this->object->getTitle()); $this->tpl->setVariable("TXT_ANSWER_SHEET", $this->lng->txt("tst_answer_sheet")); $this->tpl->setVariable("TXT_USR_NAME", $this->lng->txt("name")); $this->tpl->setVariable("VALUE_USR_NAME", $ilUser->getLastname().", ".$ilUser->getFirstname()); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::outTestPage | ( | ) |
Outputs the question of the active sequence.
Outputs the question of the active sequence
public
Definition at line 1150 of file class.ilTestOutputGUI.php.
References $_GET, $rbacsystem, endingTimeReached(), isEndingTimeReached(), isMaxProcessingTimeReached(), maxProcessingTimeReached(), onRunObjectEnter(), outProcessingTime(), outShortResult(), outWorkingForm(), prepareRequestVariables(), and updateWorkingTime().
Referenced by redirectQuestion().
{ global $rbacsystem; $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_output.html", true); if (!$rbacsystem->checkAccess("read", $this->object->getRefId())) { // only with read access it is possible to run the test $this->ilias->raiseError($this->lng->txt("cannot_execute_test"),$this->ilias->error_obj->MESSAGE); } $this->prepareRequestVariables(); $this->onRunObjectEnter(); // update working time and set saveResult state $this->updateWorkingTime(); if ($this->isMaxProcessingTimeReached()) { $this->maxProcessingTimeReached(); return; } if ($this->isEndingTimeReached()) { $this->endingTimeReached(); return; } if ($this->object->getInstantVerification() == 1) { $this->tpl->setCurrentBlock("direct_feedback"); $this->tpl->setVariable("TEXT_DIRECT_FEEDBACK", $this->lng->txt("direct_feedback")); $this->tpl->parseCurrentBlock(); } // show next/previous question if ($this->sequence == $this->object->getQuestionCount()) { $finish = true; } else { $finish = false; } $postpone = false; if ($this->object->getSequenceSettings() == TEST_POSTPONE) { $postpone = true; } $active = $this->object->getActiveTestUser(); $user_question_order =& $this->object->getAllQuestionsForActiveUser(); $this->outShortResult($user_question_order); if ($this->object->getEnableProcessingTime()) { $this->outProcessingTime(); } $this->tpl->setVariable("FORM_TIMESTAMP", time()); $directfeedback = 0; if (strcmp($_GET["activecommand"], "directfeedback") == 0) $directfeedback = 1; $this->outWorkingForm($this->sequence, $finish, $this->object->getTestId(), $active, $postpone, $user_question_order, $directfeedback, $show_summary); }
ilTestOutputGUI::outTestResults | ( | $ | print = false , |
|
$ | pass = NULL | |||
) |
Output of the learners view of an existing test.
Output of the learners view of an existing test
public
Definition at line 1592 of file class.ilTestOutputGUI.php.
References $_GET, $counter, $key, $user_id, and ilUtil::getImagePath().
Referenced by outResults(), and passDetails().
{ global $ilUser; function sort_percent($a, $b) { if (strcmp($_GET["order"], "ASC")) { $smaller = 1; $greater = -1; } else { $smaller = -1; $greater = 1; } if ($a["percent"] == $b["percent"]) { if ($a["nr"] == $b["nr"]) return 0; return ($a["nr"] < $b["nr"]) ? -1 : 1; } $apercent = 0.0; if ($a["max"] != 0) { $apercent = $a["reached"] / $a["max"]; } $bpercent = 0.0; if ($b["max"] != 0) { $bpercent = $b["reached"] / $b["max"]; } return ($apercent < $bpercent) ? $smaller : $greater; } function sort_nr($a, $b) { if (strcmp($_GET["order"], "ASC")) { $smaller = 1; $greater = -1; } else { $smaller = -1; $greater = 1; } if ($a["nr"] == $b["nr"]) return 0; return ($a["nr"] < $b["nr"]) ? $smaller : $greater; } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_finish.html", true); $user_id = $ilUser->id; $active = $this->object->getActiveTestUser($ilUser->getId()); $color_class = array("tblrow1", "tblrow2"); $counter = 0; $this->tpl->addBlockFile("TEST_RESULTS", "results", "tpl.il_as_tst_results.html", true); $result_array =& $this->object->getTestResult($active->active_id, $pass); if (!$result_array["test"]["total_max_points"]) { $percentage = 0; } else { $percentage = ($result_array["test"]["total_reached_points"]/$result_array["test"]["total_max_points"])*100; } $total_max = $result_array["test"]["total_max_points"]; $total_reached = $result_array["test"]["total_reached_points"]; $img_title_percent = ""; $img_title_nr = ""; switch ($_GET["sortres"]) { case "percent": usort($result_array, "sort_percent"); $img_title_percent = " <img src=\"" . ilUtil::getImagePath(strtolower($_GET["order"]) . "_order.png", true) . "\" alt=\"".$this->lng->txt(strtolower($_GET["order"])."ending_order")."\" />"; if (strcmp($_GET["order"], "ASC") == 0) { $sortpercent = "DESC"; } else { $sortpercent = "ASC"; } break; case "nr": usort($result_array, "sort_nr"); $img_title_nr = " <img src=\"" . ilUtil::getImagePath(strtolower($_GET["order"]) . "_order.png", true) . "\" alt=\"".$this->lng->txt(strtolower($_GET["order"])."ending_order")."\" />"; if (strcmp($_GET["order"], "ASC") == 0) { $sortnr = "DESC"; } else { $sortnr = "ASC"; } break; } if (!$sortpercent) { $sortpercent = "ASC"; } if (!$sortnr) { $sortnr = "ASC"; } foreach ($result_array as $key => $value) { if (preg_match("/\d+/", $key)) { $this->tpl->setCurrentBlock("question"); $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]); $this->tpl->setVariable("VALUE_QUESTION_COUNTER", $value["nr"]); if ($this->object->isOnlineTest() || ($this->object->getShowSolutionDetails() == 0)) $this->tpl->setVariable("VALUE_QUESTION_TITLE", $value["title"]); else $this->tpl->setVariable("VALUE_QUESTION_TITLE", "<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this), "outEvaluationForm") . "&evaluation=" . $value["qid"] . "\">" . $value["title"] . "</a>"); $this->tpl->setVariable("VALUE_MAX_POINTS", $value["max"]); $this->tpl->setVariable("VALUE_REACHED_POINTS", $value["reached"]); if ((preg_match("/http/", $value["solution"])) || (preg_match("/goto/", $value["solution"]))) { $this->tpl->setVariable("SOLUTION_HINT", "<a href=\"".$value["solution"]."\" target=\"content\">" . $this->lng->txt("solution_hint"). "</a>"); } else { if ($value["solution"]) { $this->tpl->setVariable("SOLUTION_HINT", $this->lng->txt($value["solution"])); } else { $this->tpl->setVariable("SOLUTION_HINT", ""); } } $this->tpl->setVariable("VALUE_PERCENT_SOLVED", $value["percent"]); $this->tpl->parseCurrentBlock(); $counter++; } } $this->tpl->setCurrentBlock("footer"); $this->tpl->setVariable("VALUE_QUESTION_COUNTER", "<strong>" . $this->lng->txt("total") . "</strong>"); $this->tpl->setVariable("VALUE_QUESTION_TITLE", ""); $this->tpl->setVariable("SOLUTION_HINT", ""); $this->tpl->setVariable("VALUE_MAX_POINTS", "<strong>$total_max</strong>"); $this->tpl->setVariable("VALUE_REACHED_POINTS", "<strong>$total_reached</strong>"); $this->tpl->setVariable("VALUE_PERCENT_SOLVED", "<strong>" . sprintf("%2.2f", $percentage) . " %" . "</strong>"); $this->tpl->parseCurrentBlock(); if ($this->object->canShowSolutionPrintview($ilUser->getId())) { $counter = 1; // output of questions with solutions foreach ($result_array as $question_data) { $question = $question_data["qid"]; if (is_numeric($question)) { $this->tpl->setCurrentBlock("printview_question"); $question_gui = $this->object->createQuestionGUI("", $question); $this->tpl->setVariable("COUNTER_QUESTION", $counter.". "); $this->tpl->setVariable("QUESTION_TITLE", $question_gui->object->getTitle()); $active = $this->object->getActiveTestUser($ilUser->getId()); $result_output = $question_gui->getSolutionOutput($active->active_id, $pass, FALSE, FALSE, FALSE); $this->tpl->setVariable("SOLUTION_OUTPUT", $result_output); $this->tpl->parseCurrentBlock(); $counter ++; } } $this->tpl->setCurrentBlock("printview_details"); $this->tpl->setVariable("RESULTS_OVERVIEW", $this->lng->txt("tst_eval_results_by_pass")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("results"); $this->tpl->setVariable("QUESTION_COUNTER", "<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this), "passDetails") . "&sortres=nr&order=$sortnr\">" . $this->lng->txt("tst_question_no") . "</a>$img_title_nr"); $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title")); $this->tpl->setVariable("SOLUTION_HINT_HEADER", $this->lng->txt("solution_hint")); $this->tpl->setVariable("MAX_POINTS", $this->lng->txt("tst_maximum_points")); $this->tpl->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points")); $this->tpl->setVariable("PERCENT_SOLVED", "<a href=\"" . $this->ctrl->getLinkTargetByClass(get_class($this), "passDetails") . "&sortres=percent&order=$sortpercent\">" . $this->lng->txt("tst_percent_solved") . "</a>$img_title_percent"); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); if ($this->object->getTestType() != TYPE_VARYING_RANDOMTEST) { $mark_obj = $this->object->mark_schema->getMatchingMark($percentage); if ($mark_obj) { if ($mark_obj->getPassed()) { $mark = $this->lng->txt("tst_result_congratulations"); } else { $mark = $this->lng->txt("tst_result_sorry"); } $mark .= "<br />" . $this->lng->txt("tst_your_mark_is") . ": "" . $mark_obj->getOfficialName() . """; } if ($this->object->ects_output) { $ects_mark = $this->object->getECTSGrade($total_reached, $total_max); $mark .= "<br />" . $this->lng->txt("tst_your_ects_mark_is") . ": "" . $ects_mark . "" (" . $this->lng->txt("ects_grade_". strtolower($ects_mark) . "_short") . ": " . $this->lng->txt("ects_grade_". strtolower($ects_mark)) . ")"; } $this->tpl->setVariable("USER_FEEDBACK", $mark); } if ($this->object->getTestType() == TYPE_VARYING_RANDOMTEST) { $this->tpl->setVariable("BACK_TO_OVERVIEW", $this->lng->txt("tst_results_back_overview")); } else { $this->tpl->setVariable("BACK_TO_OVERVIEW", $this->lng->txt("tst_results_back_introduction")); } $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("test_user_name"); $this->tpl->setVariable("USER_NAME", sprintf($this->lng->txt("tst_result_user_name"), $ilUser->getFullname())); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("TEXT_RESULTS", $this->lng->txt("tst_results")); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::outTestSummary | ( | ) |
Output of the learners view of an existing test without evaluation.
public
Definition at line 2162 of file class.ilTestOutputGUI.php.
References $_GET, $counter, $key, $user_id, ilUtil::getImagePath(), isMaxProcessingTimeReached(), and outProcessingTime().
Referenced by endingTimeReached(), finishTest(), and redirectQuestion().
{ global $ilUser; // handle solved state if (is_numeric($_GET["set_solved"]) && is_numeric($_GET["question_id"])) { $this->object->setQuestionSetSolved($_GET["set_solved"] , $_GET["question_id"], $ilUser->getId()); } function sort_title($a, $b) { if (strcmp($_GET["order"], "ASC")) { $smaller = 1; $greater = -1; } else { $smaller = -1; $greater = 1; } if ($a["nr"] == $b["nr"]) return 0; if (strcmp($a["title"],$b["title"])< 0) return $smaller; else if (strcmp($a["title"],$b["title"])> 0) return $greater; return 0; } function sort_nr($a, $b) { if (strcmp($_GET["order"], "ASC")) { $smaller = 1; $greater = -1; } else { $smaller = -1; $greater = 1; } if ($a["nr"] == $b["nr"]) return 0; return ($a["nr"] < $b["nr"]) ? $smaller : $greater; } function sort_visited($a, $b) { if (strcmp($_GET["order"], "ASC")) { $smaller = 1; $greater = -1; } else { $smaller = -1; $greater = 1; } if ($a["nr"] == $b["nr"]) return 0; return ($a["visited"] < $b["visited"]) ? $smaller : $greater; } function sort_solved($a, $b) { if (strcmp($_GET["order"], "ASC")) { $smaller = 1; $greater = -1; } else { $smaller = -1; $greater = 1; } if ($a["nr"] == $b["nr"]) return 0; return ($a["solved"] < $b["solved"]) ? $smaller : $greater; } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_summary.html", true); $user_id = $ilUser->id; $active = $this->object->getActiveTestUser($ilUser->getId()); $color_class = array ("tblrow1", "tblrow2"); $counter = 0; $result_array = & $this->object->getTestSummary($active->active_id); $img_title_nr = ""; $img_title_title = ""; $img_title_solved = ""; if (!$_GET["sort_summary"] ) { $_GET["sort_summary"] = "nr"; $_GET["order"] = "ASC"; } switch ($_GET["sort_summary"]) { case nr: usort($result_array, "sort_nr"); $img_title_nr = " <img src=\"" . ilUtil::getImagePath(strtolower($_GET["order"]) . "_order.png", true) . "\" alt=\"".$this->lng->txt(strtolower($_GET["order"])."ending_order")."\" />"; if (strcmp($_GET["order"], "ASC") == 0) { $sortnr = "DESC"; } else { $sortnr = "ASC"; } break; case "title": usort($result_array, "sort_title"); $img_title_title = " <img src=\"" . ilUtil::getImagePath(strtolower($_GET["order"]) . "_order.png", true) . "\" alt=\"".$this->lng->txt(strtolower($_GET["order"])."ending_order")."\" />"; if (strcmp($_GET["order"], "ASC") == 0) { $sorttitle = "DESC"; } else { $sorttitle = "ASC"; } break; case "solved": usort($result_array, "sort_solved"); $img_title_solved = " <img src=\"" . ilUtil::getImagePath(strtolower($_GET["order"]) . "_order.png", true) . "\" alt=\"".$this->lng->txt(strtolower($_GET["order"])."ending_order")."\" />"; if (strcmp($_GET["order"], "ASC") == 0) { $sortsolved = "DESC"; } else { $sortsolved = "ASC"; } break; } if (!$sorttitle) { $sorttitle = "ASC"; } if (!$sortsolved) { $sortsolved = "ASC"; } if (!$sortnr) { $sortnr = "ASC"; } $img_solved = " <img border=\"0\" align=\"middle\" src=\"" . ilUtil::getImagePath("solved.png", true) . "\" alt=\"".$this->lng->txt("tst_click_to_change_state")."\" />"; $img_not_solved = " <img border=\"0\" align=\"middle\" src=\"" . ilUtil::getImagePath("not_solved.png", true) . "\" alt=\"".$this->lng->txt("tst_click_to_change_state")."\" />"; $goto_question = " <img border=\"0\" align=\"middle\" src=\"" . ilUtil::getImagePath("goto_question.png", true) . "\" alt=\"".$this->lng->txt("tst_qst_goto")."\" />"; $disabled = $this->isMaxProcessingTimeReached() | $this->object->endingTimeReached(); foreach ($result_array as $key => $value) { if (preg_match("/\d+/", $key)) { $this->tpl->setCurrentBlock("question"); $this->tpl->setVariable("COLOR_CLASS", $color_class[$counter % 2]); $this->tpl->setVariable("VALUE_QUESTION_COUNTER", $value["nr"]); $this->tpl->setVariable("VALUE_QUESTION_TITLE", $value["title"]); $this->tpl->setVariable("VALUE_QUESTION_SOLVED", ($value["solved"] > 0) ?$img_solved : $img_not_solved); if (!$disabled) { $this->ctrl->setParameter($this, "sequence", $value["nr"]); $this->tpl->setVariable("VALUE_QUESTION_HREF_GOTO", "<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this), "gotoQuestion")."\">"); $this->ctrl->setParameter($this, "sequence", $_GET["sequence"]); } $this->tpl->setVariable("VALUE_QUESTION_GOTO", $goto_question); $solvedvalue = (($value["solved"]) ? "0" : "1"); $this->tpl->setVariable("VALUE_QUESTION_HREF_SET_SOLVED", $this->ctrl->getLinkTargetByClass(get_class($this), "outTestSummary")."&order=".$_GET["order"]."&sort_summary=".$_GET["sort_summary"]."&set_solved=" . $solvedvalue."&question_id=".$value["qid"]); $this->tpl->setVariable("VALUE_QUESTION_SET_SOLVED", ($value["solved"] > 0) ?$this->lng->txt("tst_qst_resetsolved"):$this->lng->txt("tst_qst_setsolved")); $this->tpl->setVariable("VALUE_QUESTION_DESCRIPTION", $value["description"]); $this->tpl->setVariable("VALUE_QUESTION_POINTS", $value["points"]." ".$this->lng->txt("points_short")); $this->tpl->parseCurrentBlock(); $counter ++; } } if (!$disabled) { $this->tpl->setCurrentBlock("back"); $this->tpl->setVariable("TXT_BACK", $this->lng->txt("back")); $this->tpl->parseCurrentBlock(); } else { sendinfo($this->lng->txt("detail_max_processing_time_reached")); } $this->tpl->setVariable("QUESTION_ACTION","actions"); $this->tpl->setVariable("QUESTION_COUNTER","<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this), "outTestSummary")."&order=$sortnr&sort_summary=nr\">".$this->lng->txt("tst_qst_order")."</a>".$img_title_nr); $this->tpl->setVariable("QUESTION_TITLE", "<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this), "outTestSummary")."&order=$sorttitle&sort_summary=title\">".$this->lng->txt("tst_question_title")."</a>".$img_title_title); $this->tpl->setVariable("QUESTION_SOLVED", "<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this), "outTestSummary")."&order=$sortsolved&sort_summary=solved\">".$this->lng->txt("tst_question_solved_state")."</a>".$img_title_solved); $this->tpl->setVariable("QUESTION_POINTS", $this->lng->txt("tst_maximum_points")); $this->tpl->setVariable("USER_FEEDBACK", $this->lng->txt("tst_qst_summary_text")); $this->tpl->setVariable("TXT_SHOW_AND_SUBMIT_ANSWERS", $this->lng->txt("save_finish")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("TEXT_RESULTS", $this->lng->txt("question_summary")); if ($this->object->getEnableProcessingTime()) $this->outProcessingTime(); }
ilTestOutputGUI::outWorkingForm | ( | $ | sequence = 1 , |
|
$ | finish = false , |
|||
$ | test_id, | |||
$ | active, | |||
$ | postpone_allowed, | |||
$ | user_question_order, | |||
$ | directfeedback = 0 | |||
) |
Creates the learners output of a question.
Creates the learners output of a question
public
Definition at line 321 of file class.ilTestOutputGUI.php.
References $_GET, $_SESSION, $sequence, ilObjTest::_getQuestionCount(), ilObjTest::_getSolvedQuestions(), ilObjStyleSheet::getContentStylePath(), ilUtil::getImagePath(), and ilObjStyleSheet::getSyntaxStylePath().
Referenced by outTestPage().
{ global $ilUser; include_once("classes/class.ilObjStyleSheet.php"); $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0)); $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); $question_gui = $this->object->createQuestionGUI("", $this->object->getQuestionIdFromActiveUserSequence($sequence)); if ($ilUser->prefs["tst_javascript"]) { $question_gui->object->setOutputType(OUTPUT_JAVASCRIPT); } $is_postponed = false; if (is_object($active)) { if (!preg_match("/(^|\D)" . $question_gui->object->getId() . "($|\D)/", $active->postponed) and !($active->postponed == $question_gui->object->getId())) { $is_postponed = false; } else { $is_postponed = true; } } $this->ctrl->setParameter($this, "sequence", "$sequence"); $formaction = $this->ctrl->getFormAction($this, "redirectQuestion"); if($_GET['crs_show_result']) { $question_gui->setSequenceNumber(array_search($sequence,(array) $_SESSION['crs_sequence']) + 1); $question_gui->setQuestionCount(count($_SESSION['crs_sequence'])); } else { $question_gui->setSequenceNumber($sequence); $question_gui->setQuestionCount(ilObjTest::_getQuestionCount($this->object->getTestId())); } // output question $user_post_solution = FALSE; if (array_key_exists("previouspost", $_SESSION)) { $user_post_solution = $_SESSION["previouspost"]; unset($_SESSION["previouspost"]); } $active = $this->object->getActiveTestUser($ilUser->getId()); $question_gui->outQuestionForTest($formaction, $active->active_id, NULL, $is_postponed, $user_post_solution); if ($directfeedback) { if ($this->object->getShowSolutionDetails()) { $solutionoutput = $question_gui->getSolutionOutput("", NULL, FALSE, FALSE, FALSE); $this->tpl->setCurrentBlock("solution_output"); $this->tpl->setVariable("CORRECT_SOLUTION", $this->lng->txt("correct_solution_is")); $this->tpl->setVariable("QUESTION_FEEDBACK", $solutionoutput); $this->tpl->setVariable("RECEIVED_POINTS_INFORMATION", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->calculateReachedPoints($active->active_id, NULL), $question_gui->object->getMaximumPoints())); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("solution_output"); $this->tpl->setVariable("RECEIVED_POINTS_INFORMATION", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->calculateReachedPoints($active->active_id, NULL), $question_gui->object->getMaximumPoints())); $this->tpl->parseCurrentBlock(); } } // Normally the first sequence is 1 // In course objective mode it is the first wrongly answered question if($_GET['crs_show_result']) { $first_sequence = $_SESSION['crs_sequence'][0] ? $_SESSION['crs_sequence'][0] : 1; } else { $first_sequence = 1; } if ($sequence == $first_sequence) { $this->tpl->setCurrentBlock("prev"); $this->tpl->setVariable("BTN_PREV", "<< " . $this->lng->txt("save_introduction")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("prev_bottom"); $this->tpl->setVariable("BTN_PREV", "<< " . $this->lng->txt("save_introduction")); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("prev"); $this->tpl->setVariable("BTN_PREV", "<< " . $this->lng->txt("save_previous")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("prev_bottom"); $this->tpl->setVariable("BTN_PREV", "<< " . $this->lng->txt("save_previous")); $this->tpl->parseCurrentBlock(); } if ($postpone_allowed) { if (!$is_postponed) { $this->tpl->setCurrentBlock("postpone"); $this->tpl->setVariable("BTN_POSTPONE", $this->lng->txt("postpone")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("postpone_bottom"); $this->tpl->setVariable("BTN_POSTPONE", $this->lng->txt("postpone")); $this->tpl->parseCurrentBlock(); } } if (($this->object->isOnlineTest() && !$finish) || ($this->object->getShowSummary() && !$this->object->isOnlineTest())) { $this->tpl->setCurrentBlock("summary"); $this->tpl->setVariable("BTN_SUMMARY", $this->lng->txt("question_summary")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("summary_bottom"); $this->tpl->setVariable("BTN_SUMMARY", $this->lng->txt("question_summary")); $this->tpl->parseCurrentBlock(); } if (!$this->object->isOnlineTest()) { $this->tpl->setCurrentBlock("cancel_test"); $this->tpl->setVariable("TEXT_CANCELTEST", $this->lng->txt("cancel_test")); $this->tpl->setVariable("TEXT_ALTCANCELTEXT", $this->lng->txt("cancel_test")); $this->tpl->setVariable("TEXT_TITLECANCELTEXT", $this->lng->txt("cancel_test")); $this->tpl->setVariable("HREF_IMGCANCELTEST", $this->ctrl->getLinkTargetByClass(get_class($this), "outIntroductionPage") . "&cancelTest=true"); $this->tpl->setVariable("HREF_CANCELTEXT", $this->ctrl->getLinkTargetByClass(get_class($this), "outIntroductionPage") . "&cancelTest=true"); $this->tpl->setVariable("IMAGE_CANCEL", ilUtil::getImagePath("cancel.gif")); $this->tpl->parseCurrentBlock(); } if ($finish) { if (!$this->object->isOnlineTest()) { $this->tpl->setCurrentBlock("next"); $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("save_finish") . " >>"); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("next_bottom"); $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("save_finish") . " >>"); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("next"); $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("question_summary") . " >>"); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("next_bottom"); $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("question_summary") . " >>"); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setCurrentBlock("next"); $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("save_next") . " >>"); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("next_bottom"); $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("save_next") . " >>"); $this->tpl->parseCurrentBlock(); } if ($this->object->isOnlineTest()) { include_once "./assessment/classes/class.ilObjTest.php"; $solved_array = ilObjTest::_getSolvedQuestions($active->active_id, $question_gui->object->getId()); $solved = 0; if (count ($solved_array) > 0) { $solved = array_pop($solved_array); $solved = $solved->solved; } if ($solved==1) { $solved = ilUtil::getImagePath("solved.png", true); $solved_cmd = "resetsolved"; $solved_txt = $this->lng->txt("tst_qst_resetsolved"); } else { $solved = ilUtil::getImagePath("not_solved.png", true); $solved_cmd = "setsolved"; $solved_txt = $this->lng->txt("tst_qst_setsolved"); } $solved = "<input align=\"middle\" border=\"0\" alt=\"".$this->lng->txt("tst_qst_solved_state_click_to_change")."\" name=\"cmd[$solved_cmd]\" type=\"image\" src=\"$solved\" id=\"$solved_cmd\"> <small><label for=\"$solved_cmd\">$solved_txt</label></small>"; $this->tpl->setCurrentBlock("question_status"); $this->tpl->setVariable("TEXT_QUESTION_STATUS_LABEL", $this->lng->txt("tst_question_solved_state").":"); $this->tpl->setVariable("TEXT_QUESTION_STATUS", $solved); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("adm_content"); //$this->tpl->setVariable("FORMACTION", $formaction); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::passDetails | ( | ) |
Output of the learners view of an existing test pass.
Output of the learners view of an existing test pass
public
Definition at line 1572 of file class.ilTestOutputGUI.php.
References $_GET, and outTestResults().
{ if (array_key_exists("pass", $_GET) && (strlen($_GET["pass"]) > 0)) { $this->ctrl->saveParameter($this, "pass"); $this->outTestResults(false, $_GET["pass"]); } else { $this->outTestResults(false); } }
ilTestOutputGUI::postpone | ( | ) |
Postpone a question to the end of the test.
Postpone a question to the end of the test
public
Definition at line 943 of file class.ilTestOutputGUI.php.
References saveQuestionSolution().
{ $this->saveQuestionSolution(); $this->ctrl->setParameter($this, "activecommand", "postpone"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::prepareRequestVariables | ( | ) |
prepare Request variables e.g.
some get parameters have to be mapped to post params
Definition at line 1224 of file class.ilTestOutputGUI.php.
References $_GET, $_POST, and isTestAccessible().
Referenced by outTestPage().
{ if ($this->object->getTestType() == TYPE_ONLINE_TEST) { if ($_GET["sort_summary"]) // sort summary: click on title to sort in summary $_POST["cmd"]["summary"]="1"; if ($_POST["cmd"]["cancel_show_answers"]) { // cancel_show_answers: click on back in show_answer view if ($this->isTestAccessible()) { // everythings ok goto summary $_POST["cmd"]["summary"]="1"; } else { $_POST["cmd"]["run"]="1"; unset($_GET ["sequence"]); } } if ($_POST["cmd"]["show_answers"] or $_POST["cmd"]["back"] or $_POST["cmd"]["submit_answers"] or $_POST["cmd"]["run"]) { unset($_GET ["sort_summary"]); unset($_GET ["setsolved"]); unset($_GET ["resetsolved"]); if ($_POST["cmd"]["show_answers"] or $_POST["cmd"]["submit_answers"] or $_POST["cmd"]["run"]) unset($_GET ["sequence"]); } } else { // set showresult cmd if pressed on sort in result overview if ($_GET["sortres"]) $_POST["cmd"]["showresults"] = 1; } }
ilTestOutputGUI::previous | ( | ) |
Go to the previous question.
Go to the previous question
public
Definition at line 929 of file class.ilTestOutputGUI.php.
References saveQuestionSolution().
{ $this->saveQuestionSolution(); $this->ctrl->setParameter($this, "activecommand", "previous"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::readFullSequence | ( | ) |
Definition at line 1306 of file class.ilTestOutputGUI.php.
References $_GET, $_SESSION, $result, and $results.
Referenced by redirectQuestion().
{ global $ilUser; if(!$_GET['crs_show_result']) { return true; } $_SESSION['crs_sequence'] = array(); $active = $this->object->getActiveTestUser($ilUser->getId()); $results = $this->object->getTestResult($active->active_id); for($i = $this->object->getFirstSequence(); $i <= $this->object->getQuestionCount(); $i++) { $qid = $this->object->getQuestionIdFromActiveUserSequence($i); foreach($results as $result) { if($qid == $result['qid']) { if(!$result['max'] or $result['max'] != $result['reached']) { $_SESSION['crs_sequence'][] = $i; } } } } $this->sequence = $_SESSION['crs_sequence'][0]; $_SESSION['crs_sequence'] = array_unique($_SESSION['crs_sequence']); return true; }
ilTestOutputGUI::redirectQuestion | ( | ) |
Definition at line 746 of file class.ilTestOutputGUI.php.
References $_GET, ilObjTest::_getQuestionCount(), calculateSequence(), outTestPage(), outTestSummary(), and readFullSequence().
{ global $ilUser; include_once "./assessment/classes/class.ilObjTest.php"; switch ($_GET["activecommand"]) { case "next": $this->sequence = $this->calculateSequence(); // calculate count of questions statically to prevent problems with // random tests. If the numer of questions in the used questionpools // has been reduced lower than the number of questions which should be // chosen, the dynamic method fails because it returns the number of questions // that should be chosen. This leds to an error if the test is completed $questioncount = ilObjTest::_getQuestionCount($this->object->getTestId()); if ($this->sequence > $questioncount) { if ($this->object->isOnlineTest()) { $this->outTestSummary(); } else { $this->ctrl->redirect($this, "finishTest"); } } else { $this->object->setActiveTestUser($this->sequence); $this->outTestPage(); } break; case "previous": $this->sequence = $this->calculateSequence(); $this->object->setActiveTestUser($this->sequence); if (!$this->sequence) { $this->ctrl->redirect($this, "outIntroductionPage"); } else { $this->outTestPage(); } break; case "postpone": $this->sequence = $this->calculateSequence(); $postpone = $this->sequence; $this->object->setActiveTestUser($this->sequence, $postpone); $this->outTestPage(); break; case "setsolved": $this->sequence = $this->calculateSequence(); $this->object->setActiveTestUser($this->sequence); $q_id = $this->object->getQuestionIdFromActiveUserSequence($_GET["sequence"]); $this->object->setQuestionSetSolved(1, $q_id, $ilUser->getId()); $this->outTestPage(); break; case "resetsolved": $this->sequence = $this->calculateSequence(); $this->object->setActiveTestUser($this->sequence); $q_id = $this->object->getQuestionIdFromActiveUserSequence($_GET["sequence"]); $this->object->setQuestionSetSolved(0, $q_id, $ilUser->getId()); $this->outTestPage(); break; case "directfeedback": $this->sequence = $this->calculateSequence(); $this->object->setActiveTestUser($this->sequence); $this->outTestPage(); break; case "selectImagemapRegion": $this->sequence = $this->calculateSequence(); $this->object->setActiveTestUser($this->sequence); $this->outTestPage(); break; case "summary": if ($this->object->isOnlineTest()) { $this->ctrl->redirect($this, "outTestSummary"); } else { $this->ctrl->redirect($this, "outQuestionSummary"); } break; case "start": case "resume": $this->sequence = $this->calculateSequence(); $this->object->setActiveTestUser($this->sequence); $this->readFullSequence(); if ($this->object->isOnlineTest()) { $this->outTestSummary(); } else { $this->outTestPage(); } break; case "back": case "gotoquestion": default: $this->sequence = $this->calculateSequence(); $this->object->setActiveTestUser($this->sequence); $this->outTestPage(); break; } }
ilTestOutputGUI::resetsolved | ( | ) |
Set a question unsolved.
Set a question unsolved
public
Definition at line 993 of file class.ilTestOutputGUI.php.
References saveQuestionSolution().
{ $this->saveQuestionSolution(); $this->ctrl->setParameter($this, "activecommand", "resetsolved"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::resume | ( | ) |
Resume a test at the last position.
Resume a test at the last position
public
Definition at line 681 of file class.ilTestOutputGUI.php.
References handleStartCommands(), and showMaximumAllowedUsersReachedMessage().
{ if ($this->object->checkMaximumAllowedUsers() == FALSE) { return $this->showMaximumAllowedUsersReachedMessage(); } $this->handleStartCommands(); $this->ctrl->setParameter($this, "activecommand", "resume"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::saveQuestionSolution | ( | ) |
saves the user input of a question
Definition at line 121 of file class.ilTestOutputGUI.php.
References $_GET, $_POST, $_SESSION, and canSaveResult().
Referenced by directfeedback(), next(), postpone(), previous(), resetsolved(), selectImagemapRegion(), setsolved(), and summary().
{ $this->saveResult = false; $formtimestamp = $_POST["formtimestamp"]; if (strlen($formtimestamp) == 0) $formtimestamp = $_GET["formtimestamp"]; if ($formtimestamp != $_SESSION["formtimestamp"]) { $_SESSION["formtimestamp"] = $formtimestamp; } else { return; } // save question solution if ($this->canSaveResult()) { // but only if the ending time is not reached $q_id = $this->object->getQuestionIdFromActiveUserSequence($_GET["sequence"]); if (is_numeric($q_id)) { global $ilUser; $question_gui = $this->object->createQuestionGUI("", $q_id); if ($ilUser->prefs["tst_javascript"]) { $question_gui->object->setOutputType(OUTPUT_JAVASCRIPT); } $pass = NULL; $active = $this->object->getActiveTestUser($ilUser->getId()); if ($this->object->isRandomTest()) { $pass = $this->object->_getPass($active->active_id); } $this->saveResult = $question_gui->object->saveWorkingData($active->active_id, $pass); } } if ($this->saveResult == FALSE) { $this->ctrl->setParameter($this, "save_error", "1"); $_SESSION["previouspost"] = $_POST; } }
ilTestOutputGUI::selectImagemapRegion | ( | ) |
Select an image map region in an image map question.
Select an image map region in an image map question
public
Definition at line 1021 of file class.ilTestOutputGUI.php.
References $_POST, and saveQuestionSolution().
{ $this->saveQuestionSolution(); $activecommand = "selectImagemapRegion"; if (array_key_exists("cmd", $_POST)) { $activecommand = key($_POST["cmd"]); } $this->ctrl->setParameter($this, "activecommand", $activecommand); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::setAnonymousId | ( | ) |
ilTestOutputGUI::setsolved | ( | ) |
Set a question solved.
Set a question solved
public
Definition at line 979 of file class.ilTestOutputGUI.php.
References saveQuestionSolution().
{ $this->saveQuestionSolution(); $this->ctrl->setParameter($this, "activecommand", "setsolved"); $this->ctrl->redirect($this, "redirectQuestion"); }
ilTestOutputGUI::show_answers | ( | ) |
Outputs all answers including the solutions for the active user.
Outputs all answers including the solutions for the active user
public
Definition at line 1852 of file class.ilTestOutputGUI.php.
References outShowAnswersDetails().
{ global $ilUser; $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_print_answers_sheet_details.html", true); $this->outShowAnswersDetails($ilUser->getId(), true); }
ilTestOutputGUI::showAnswersOfUser | ( | ) |
Output of the results of the active learner.
Output of the results of the active learner
public
Definition at line 1866 of file class.ilTestOutputGUI.php.
References outShowAnswersDetails().
{ global $ilUser; $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_print_answers_sheet_details.html", true); $this->tpl->setCurrentBlock("generic_css"); $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./assessment/templates/default/test_print.css"); $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print"); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("navigation_buttons"); $this->tpl->setVariable("BUTTON_PRINT", $this->lng->txt("print")); $this->tpl->setVariable("BUTTON_BACK", $this->lng->txt("back")); $this->tpl->setVariable("URL_BACK", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "infoScreen")); $this->tpl->parseCurrentBlock(); $invited_user =& $this->object->getInvitedUsers($ilUser->getId()); $pagetitle = $this->object->getTitle() . " - " . $this->lng->txt("clientip") . ": " . $invited_user[$ilUser->getId()]->clientip . " - " . $this->lng->txt("matriculation") . ": " . $invited_user[$ilUser->getId()]->matriculation; $this->tpl->setVariable("PAGETITLE", $pagetitle); $this->outShowAnswersDetails($ilUser->getId()); }
ilTestOutputGUI::showMaximumAllowedUsersReachedMessage | ( | ) |
Definition at line 2449 of file class.ilTestOutputGUI.php.
Referenced by resume(), and startTest().
{ $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_max_allowed_users_reached.html", true); $this->tpl->setCurrentBlock("adm_content"); $this->tpl->setVariable("MAX_ALLOWED_USERS_MESSAGE", sprintf($this->lng->txt("tst_max_allowed_users_message"), $this->object->getAllowedUsersTimeGap())); $this->tpl->setVariable("MAX_ALLOWED_USERS_HEADING", sprintf($this->lng->txt("tst_max_allowed_users_heading"), $this->object->getAllowedUsersTimeGap())); $this->tpl->setVariable("BACK_TO_INTRODUCTION", $this->lng->txt("tst_results_back_introduction")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::showPasswordProtectionPage | ( | ) |
Displays a password protection page when a test password is set.
Displays a password protection page when a test password is set
public
Definition at line 534 of file class.ilTestOutputGUI.php.
Referenced by startTest().
{ $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_password_protection.html", true); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "checkPassword")); $this->tpl->setVariable("PASSWORD_INTRODUCTION", $this->lng->txt("tst_password_introduction")); $this->tpl->setVariable("TEXT_PASSWORD", $this->lng->txt("tst_password")); $this->tpl->setVariable("SUBMIT", $this->lng->txt("submit")); $this->tpl->parseCurrentBlock(); }
ilTestOutputGUI::showTestResults | ( | ) |
showTestResults returns true if the according request is set
Definition at line 1438 of file class.ilTestOutputGUI.php.
References $_GET.
{ return $_GET['crs_show_result']; }
ilTestOutputGUI::start | ( | ) |
Start a test for the first time.
Start a test for the first time. This method contains a lock to prevent multiple submissions from the start test button.
public
Definition at line 586 of file class.ilTestOutputGUI.php.
References $_POST, $_SESSION, $ilLog, and handleStartCommands().
{ global $ilLog; //$ilLog->write("Test lock session = " . $_SESSION["lock"]); //$ilLog->write("POST lock session = " . $_POST["lock"]); if (strcmp($_SESSION["lock"], $_POST["lock"]) != 0) { //$ilLog->write("Test lock session != test lock"); $_SESSION["lock"] = $_POST["lock"]; //$ilLog->write("Set Test lock session = " . $_SESSION["lock"]); $this->handleStartCommands(); $this->ctrl->redirect($this, "startTest"); } else { //$ilLog->write("Test lock session == test lock, redirect"); $this->ctrl->redirectByClass("ilobjtestgui", "redirectToInfoScreen"); } }
ilTestOutputGUI::startTest | ( | ) |
Start a test for the first time after a redirect.
Start a test for the first time after a redirect
public
Definition at line 613 of file class.ilTestOutputGUI.php.
References $_SESSION, $ilLog, $rbacsystem, showMaximumAllowedUsersReachedMessage(), and showPasswordProtectionPage().
{ global $ilLog; $ilLog->write("startTest"); if ($this->object->checkMaximumAllowedUsers() == FALSE) { return $this->showMaximumAllowedUsersReachedMessage(); } if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID) { $this->object->setAccessCodeSession($this->object->createNewAccessCode()); } else { $this->object->unsetAccessCodeSession(); } if (strlen($this->object->getPassword())) { global $ilUser; global $rbacsystem; $pwd = $ilUser->getPref("tst_password_".$this->object->getTestId()); if ((strcmp($pwd, $this->object->getPassword()) != 0) && (!$rbacsystem->checkAccess("write", $this->object->getRefId()))) { return $this->showPasswordProtectionPage(); } } if ($this->object->isRandomTest()) { $this->object->generateRandomQuestions(); $this->object->loadQuestions(); } if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID) { $this->ctrl->redirect($this, "displayCode"); } else { $this->ctrl->setParameter($this, "activecommand", "start"); $this->ctrl->redirect($this, "redirectQuestion"); } }
ilTestOutputGUI::summary | ( | ) |
Show the question summary in online exams.
Show the question summary in online exams
public
Definition at line 957 of file class.ilTestOutputGUI.php.
References saveQuestionSolution().
{ $this->saveQuestionSolution(); if ($this->saveResult == FALSE) { $this->ctrl->setParameter($this, "activecommand", ""); $this->ctrl->redirect($this, "redirectQuestion"); } else { $this->ctrl->setParameter($this, "activecommand", "summary"); $this->ctrl->redirect($this, "redirectQuestion"); } }
ilTestOutputGUI::updateWorkingTime | ( | ) |
updates working time and stores state saveresult to see if question has to be stored or not
Definition at line 109 of file class.ilTestOutputGUI.php.
References $_SESSION.
Referenced by outTestPage().
{ if ($_SESSION["active_time_id"]) // && $this->object->getEnableProcessingTime()) { $this->object->updateWorkingTime($_SESSION["active_time_id"]); //echo "updating Worktime<br>"; } }
ilTestOutputGUI::$cmdCtrl |
Definition at line 49 of file class.ilTestOutputGUI.php.
ilTestOutputGUI::$ctrl |
Definition at line 43 of file class.ilTestOutputGUI.php.
ilTestOutputGUI::$endingTimeReached |
Definition at line 51 of file class.ilTestOutputGUI.php.
ilTestOutputGUI::$ilias |
Definition at line 44 of file class.ilTestOutputGUI.php.
Referenced by finalSubmission(), handleStartCommands(), and ilTestOutputGUI().
ilTestOutputGUI::$lng |
Definition at line 41 of file class.ilTestOutputGUI.php.
Referenced by ilTestOutputGUI().
ilTestOutputGUI::$maxProcessingTimeReached |
Definition at line 50 of file class.ilTestOutputGUI.php.
ilTestOutputGUI::$object |
Definition at line 40 of file class.ilTestOutputGUI.php.
ilTestOutputGUI::$saveResult |
Definition at line 47 of file class.ilTestOutputGUI.php.
ilTestOutputGUI::$sequence |
Definition at line 48 of file class.ilTestOutputGUI.php.
Referenced by calculateSequence(), getNextSequenceByResult(), getPreviousSequenceByResult(), outShortResult(), and outWorkingForm().
ilTestOutputGUI::$tpl |
Definition at line 42 of file class.ilTestOutputGUI.php.
Referenced by ilTestOutputGUI().
ilTestOutputGUI::$tree |
Definition at line 45 of file class.ilTestOutputGUI.php.
Referenced by ilTestOutputGUI().