Public Member Functions | Data Fields | Private Member Functions

ilTestOutputGUI Class Reference
[Modules/Test]

Output class for assessment test execution. More...

Inheritance diagram for ilTestOutputGUI:
Collaboration diagram for ilTestOutputGUI:

Public Member Functions

 ilTestOutputGUI ($a_object)
 ilSurveyExecutionGUI constructor
executeCommand ()
 execute 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 TRUE if the answers of the current user could be saved.
 outIntroductionPage ()
 Creates the introduction page for a test.
 isMaxProcessingTimeReached ()
 Checks wheather the maximum processing time is reached or not.
 outWorkingForm ($sequence="", $test_id, $postpone_allowed, $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 ()
 Sets a session variable with the test access code for an anonymous test user.
 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 ()
 Called when a user answered a question to perform a redirect after POST.
 calculateSequence ()
 Calculates the sequence to determine the next question.
 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.
 setmarked ()
 Set a question solved.
 resetmarked ()
 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.
 checkOnlineTestAccess ()
 check access restrictions like client ip, partipating user etc.
 isTestAccessible ()
 test accessible returns true if the user can perform the test
 isNrOfTriesReached ()
 nr of tries exceeded
 passDetails ()
 Output of the learners view of an existing test pass.
 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 ($active_id)
 outQuestionSummary ()
 Output of a summary of all test questions for test participants.
 showMaximumAllowedUsersReachedMessage ()
 backConfirmFinish ()
 finishListOfAnswers ()
 outCorrectSolution ()
 Creates an output of the solution of an answer compared to the correct solution.
 showListOfAnswers ($active_id, $pass=NULL, $top_data="", $bottom_data="")
 Creates an output of the list of answers for a test participant during the test (only the actual pass will be shown).
 outUserListOfAnswerPasses ()
 Output of the pass overview for a user when he/she wants to see his/her list of answers.
 outUserResultsOverview ()
 Output of the pass overview for a test called by a test participant.
 outUserPassDetails ()
 Output of the pass details of an existing test pass for the active test participant.
 outParticipantsResultsOverview ()
 Output of the pass overview for a test called from the statistics.
 outParticipantsPassDetails ()
 Output of the pass details of an existing test pass for the test statistics.

Data Fields

 $ref_id
 $saveResult
 $sequence
 $cmdCtrl
 $maxProcessingTimeReached
 $endingTimeReached

Private Member Functions

 endingTimeReached ()
 handle endingTimeReached

Detailed Description

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

Author:
Helmut Schottmüller <helmut.schottmueller@mac.com>
Version:
Id:
class.ilTestOutputGUI.php 22066 2009-10-08 07:34:42Z hschottm

Definition at line 39 of file class.ilTestOutputGUI.php.


Member Function Documentation

ilTestOutputGUI::backConfirmFinish (  ) 

Definition at line 1456 of file class.ilTestOutputGUI.php.

References showListOfAnswers().

        {
                global $ilUser;
                if ($this->object->canShowSolutionPrintview($ilUser->getId()))
                {
                        $template = new ilTemplate("tpl.il_as_tst_finish_navigation.html", TRUE, TRUE, "Modules/Test");
                        $template->setVariable("BUTTON_FINISH", $this->lng->txt("btn_next"));
                        $template->setVariable("BUTTON_CANCEL", $this->lng->txt("btn_previous"));
                        
                        $template_top = new ilTemplate("tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE, "Modules/Test");
                        $template_top->setCurrentBlock("button_print");
                        $template_top->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
                        $template_top->parseCurrentBlock();
                        $active_id = $this->object->getTestSession()->getActiveId();
                        return $this->showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
                }
                else
                {
                        $this->ctrl->redirect($this, "redirectQuestion");
                }
        }

Here is the call graph for this function:

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 973 of file class.ilTestOutputGUI.php.

        {
                $this->ctrl->setParameter($this, "activecommand", "back");
                $this->ctrl->redirect($this, "redirectQuestion");
        }

ilTestOutputGUI::calculateSequence (  ) 

Calculates the sequence to determine the next question.

Calculates the sequence to determine the next question

public

Definition at line 803 of file class.ilTestOutputGUI.php.

References $_GET, and $sequence.

Referenced by redirectQuestion().

        {
                $sequence = $_GET["sequence"];
                if (!$sequence) $sequence = $this->object->getTestSequence()->getFirstSequence();
                if (array_key_exists("save_error", $_GET))
                {
                        if ($_GET["save_error"] == 1)
                        {
                                return $sequence;
                        }
                }
                switch ($_GET["activecommand"])
                {
                        case "next":
                                $sequence = $this->object->getTestSequence()->getNextSequence($sequence);
                                break;
                        case "previous":
                                $sequence = $this->object->getTestSequence()->getPreviousSequence($sequence);
                                break;
                }
                return $sequence;
        }

Here is the caller graph for this function:

ilTestOutputGUI::canSaveResult (  ) 

Returns TRUE if the answers of the current user could be saved.

Returns TRUE if the answers of the current user could be saved

Returns:
boolean TRUE if the answers could be saved, FALSE otherwise private

Definition at line 160 of file class.ilTestOutputGUI.php.

References isMaxProcessingTimeReached(), and isNrOfTriesReached().

Referenced by saveQuestionSolution().

         {
                 return !$this->object->endingTimeReached() && !$this->isMaxProcessingTimeReached() && !$this->isNrOfTriesReached();
         }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestOutputGUI::checkOnlineTestAccess (  ) 

check access restrictions like client ip, partipating user etc.

check access restrictions like client ip, partipating user etc.

public

Definition at line 1147 of file class.ilTestOutputGUI.php.

References $user, and ilUtil::sendInfo().

        {
                global $ilUser;
                
                // check if user is invited to participate
                $user = $this->object->getInvitedUsers($ilUser->getId());
                if (!is_array ($user) || count($user)!=1)
                {
                                ilUtil::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)
                {
                        ilUtil::sendInfo($this->lng->txt("user_wrong_clientip"), true);
                        $this->ctrl->redirectByClass("ilobjtestgui", "backToRepository");
                }               
        }       

Here is the call graph for this function:

ilTestOutputGUI::checkPassword (  ) 

Check the password, a user entered for test access.

Check the password, a user entered for test access

public

Definition at line 450 of file class.ilTestOutputGUI.php.

References $_SESSION, and ilUtil::sendInfo().

        {
                if (strcmp($this->object->getPassword(), $_POST["password"]) == 0)
                {
                        global $ilUser;
                        if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
                        {
                                $ilUser->setPref("tst_password_".$this->object->getTestId(), $this->object->getPassword());
                                $ilUser->writePref("tst_password_".$this->object->getTestId(), $this->object->getPassword());
                        }
                        $this->ctrl->redirect($this, "start");
                }
                else
                {
                        ilUtil::sendInfo($this->lng->txt("tst_password_entered_wrong_password"), true);
                        $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); 
                }
        }

Here is the call graph for this function:

ilTestOutputGUI::codeConfirmed (  ) 

Definition at line 559 of file class.ilTestOutputGUI.php.

        {
                $this->ctrl->setParameter($this, "activecommand", "start");
                $this->ctrl->redirect($this, "redirectQuestion");
        }

ilTestOutputGUI::confirmFinish (  ) 

The final submission of a test was confirmed.

The final submission of a test was confirmed

public

Definition at line 986 of file class.ilTestOutputGUI.php.

References finishTest().

        {
                $this->finishTest(false);
        }

Here is the call graph for this function:

ilTestOutputGUI::confirmFinishTest (  ) 

Confirmation of the tests final submission.

Confirmation of the tests final submission

public

Definition at line 998 of file class.ilTestOutputGUI.php.

Referenced by finishListOfAnswers(), and finishTest().

        {
                global $ilUser;
                
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_finish_confirmation.html", "Modules/Test");
                $this->tpl->setVariable("FINISH_QUESTION", $this->lng->txt("tst_finish_confirmation_question"));
                $this->tpl->setVariable("BUTTON_CONFIRM", $this->lng->txt("tst_finish_confirm_button"));
                if ($this->object->canShowSolutionPrintview($ilUser->getId()))
                {
                        $this->tpl->setVariable("BUTTON_CANCEL", $this->lng->txt("tst_finish_confirm_list_of_answers_button"));
                }
                else
                {
                        $this->tpl->setVariable("BUTTON_CANCEL", $this->lng->txt("tst_finish_confirm_cancel_button"));
                }
                $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
                $this->tpl->parseCurrentBlock();
        }

Here is the caller graph for this function:

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 1247 of file class.ilTestOutputGUI.php.

        {
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_submit_answers_confirm.html", "Modules/Test");
                $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, "finalSubmission"));
                $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 925 of file class.ilTestOutputGUI.php.

References saveQuestionSolution().

        {
                $this->saveQuestionSolution();
                $this->ctrl->setParameter($this, "activecommand", "directfeedback");
                $this->ctrl->redirect($this, "redirectQuestion");
        }

Here is the call graph for this function:

ilTestOutputGUI::displayCode (  ) 

Definition at line 548 of file class.ilTestOutputGUI.php.

        {
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_anonymous_code_presentation.html", "Modules/Test");
                $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 1214 of file class.ilTestOutputGUI.php.

References ilFormat::ftimestamp2datetimeDB(), outIntroductionPage(), outUserResultsOverview(), and ilUtil::sendInfo().

Referenced by outTestPage().

        {
                ilUtil::sendInfo(sprintf($this->lng->txt("detail_ending_time_reached"), ilFormat::ftimestamp2datetimeDB($this->object->getEndingTime())));
                $this->object->getTestSession()->increasePass();
                $this->object->getTestSession()->setLastSequence(0);
                $this->object->getTestSession()->saveToDb();
                if (!$this->object->canViewResults()) 
                {
                        $this->outIntroductionPage();
                }
                else
                {
                        $this->outUserResultsOverview();
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilTestOutputGUI::executeCommand (  ) 

execute command

Reimplemented from ilTestServiceGUI.

Definition at line 66 of file class.ilTestOutputGUI.php.

References $_GET, $cmd, $ret, and ilTestServiceGUI::getCommand().

        {
                global $ilUser;
                $cmd = $this->ctrl->getCmd();
                $next_class = $this->ctrl->getNextClass($this);
                $this->ctrl->saveParameter($this, "sequence");
                $this->ctrl->saveParameter($this, "active_id");

                if ($_GET["active_id"])
                {
                        $this->object->setTestSession($_GET["active_id"]);
                }
                else
                {
                        $this->object->setTestSession();
                }

                $cmd = $this->getCommand($cmd);
                switch($next_class)
                {
                        default:
                                $ret =& $this->$cmd();
                                break;
                }
                return $ret;
        }

Here is the call graph for this function:

ilTestOutputGUI::finishListOfAnswers (  ) 

Definition at line 1478 of file class.ilTestOutputGUI.php.

References confirmFinishTest().

        {
                $this->confirmFinishTest();
        }

Here is the call graph for this function:

ilTestOutputGUI::finishTest ( confirm = true  ) 

Finish the test.

Finish the test

public

Definition at line 1024 of file class.ilTestOutputGUI.php.

References $_GET, $_SESSION, $ilAuth, ilTestServiceGUI::$ilias, confirmFinishTest(), outIntroductionPage(), and showListOfAnswers().

Referenced by confirmFinish().

        {
                global $ilUser;
                global $ilias;
                global $ilAuth;
                
                unset($_SESSION["tst_next"]);
                
                $active_id = $this->object->getTestSession()->getActiveId();
                $actualpass = $this->object->_getPass($active_id);
                if (($actualpass == $this->object->getNrOfTries() - 1) && (!$confirm))
                {
                        $this->object->setActiveTestSubmitted($ilUser->getId());
                        $ilAuth->setIdle($ilias->ini->readVariable("session","expire"), false);
                        $ilAuth->setExpire(0);
                }
                
                if (($confirm) && ($actualpass == $this->object->getNrOfTries() - 1))
                {
                        if ($this->object->canShowSolutionPrintview($ilUser->getId()))
                        {
                                $template = new ilTemplate("tpl.il_as_tst_finish_navigation.html", TRUE, TRUE, "Modules/Test");
                                $template->setVariable("BUTTON_FINISH", $this->lng->txt("btn_next"));
                                $template->setVariable("BUTTON_CANCEL", $this->lng->txt("btn_previous"));
                                
                                $template_top = new ilTemplate("tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE, "Modules/Test");
                                $template_top->setCurrentBlock("button_print");
                                $template_top->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
                                $template_top->parseCurrentBlock();

                                $this->showListOfAnswers($active_id, NULL, $template_top->get(), $template->get());
                                return;
                        }
                        else
                        {
                                // show confirmation page
                                return $this->confirmFinishTest();
                        }
                }

                if (!$_SESSION['tst_pass_finish'])
                {
                        if (!$_SESSION['tst_pass_finish']) $_SESSION['tst_pass_finish'] = 1;
                        $this->object->getTestSession()->increasePass();
                        $this->object->getTestSession()->setLastSequence(0);
                        $this->object->getTestSession()->saveToDb();
                }
                
                if($_GET['crs_show_result'])
                {
                        $this->ctrl->redirectByClass("ilobjtestgui", "backToCourse");
                }

                if (!$this->object->canViewResults()) 
                {
                        $this->outIntroductionPage();
                }
                else
                {
                        $this->ctrl->redirect($this, "outUserResultsOverview");
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestOutputGUI::gotoQuestion (  ) 

Go to the question with the active sequence.

Go to the question with the active sequence

public

Definition at line 958 of file class.ilTestOutputGUI.php.

References $_GET.

        {
                $this->ctrl->setParameter($this, "sequence", $_GET["sequence"]);
                $this->ctrl->setParameter($this, "activecommand", "gotoquestion");
                $this->ctrl->saveParameter($this, "tst_javascript");
                $this->ctrl->redirect($this, "redirectQuestion");
        }

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 590 of file class.ilTestOutputGUI.php.

Referenced by resume(), and start().

        {
                global $ilUser;

                if ($_POST["chb_javascript"])
                {
                        $ilUser->writePref("tst_javascript", 1);
                }
                else
                {
                        $ilUser->writePref("tst_javascript", 0);
                }
                
                // hide previous results
                if ($this->object->getNrOfTries() != 1)
                {
                        if ($this->object->getUsePreviousAnswers() == 1)
                        {
                                if ($_POST["chb_use_previous_answers"])
                                {
                                        $ilUser->writePref("tst_use_previous_answers", 1);
                                }
                                else
                                { 
                                        $ilUser->writePref("tst_use_previous_answers", 0);
                                }
                        }
                }
        }

Here is the caller graph for this function:

ilTestOutputGUI::ilTestOutputGUI ( a_object  ) 

ilSurveyExecutionGUI constructor

The constructor takes possible arguments an creates an instance of the ilSurveyExecutionGUI object.

Parameters:
object $a_object Associated ilObjSurvey class public

Definition at line 57 of file class.ilTestOutputGUI.php.

References $_GET, and ilTestServiceGUI::ilTestServiceGUI().

  {
                parent::ilTestServiceGUI($a_object);
                $this->ref_id = $_GET["ref_id"];
        }

Here is the call graph for this function:

ilTestOutputGUI::isMaxProcessingTimeReached (  ) 

Checks wheather the maximum processing time is reached or not.

Checks wheather the maximum processing time is reached or not

Returns:
TRUE if the maximum processing time is reached, FALSE otherwise public

Definition at line 185 of file class.ilTestOutputGUI.php.

Referenced by canSaveResult(), isTestAccessible(), and outTestPage().

        {
                global $ilUser;
                $active_id = $this->object->getTestSession()->getActiveId();
                $starting_time = $this->object->getStartingTimeOfUser($active_id);
                if ($starting_time === FALSE)
                {
                        return FALSE;
                }
                else
                {
                        return $this->object->isMaxProcessingTimeReached($starting_time);
                }
        }

Here is the caller graph for this function:

ilTestOutputGUI::isNrOfTriesReached (  ) 

nr of tries exceeded

Definition at line 1183 of file class.ilTestOutputGUI.php.

Referenced by canSaveResult(), and isTestAccessible().

        {
                return $this->object->hasNrOfTriesRestriction() && $this->object->isNrOfTriesReached($this->object->getTestSession()->getPass());       
        }

Here is the caller graph for this function:

ilTestOutputGUI::isTestAccessible (  ) 

test accessible returns true if the user can perform the test

Definition at line 1172 of file class.ilTestOutputGUI.php.

References isMaxProcessingTimeReached(), and isNrOfTriesReached().

        {               
                return  !$this->isNrOfTriesReached()                            
                                and      !$this->isMaxProcessingTimeReached()
                                and  $this->object->startingTimeReached()
                                and  !$this->object->endingTimeReached();
        }

Here is the call graph for this function:

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 1237 of file class.ilTestOutputGUI.php.

References outIntroductionPage().

Referenced by outTestPage().

        {
                $this->outIntroductionPage();
        }               

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestOutputGUI::next (  ) 

Go to the next question.

Go to the next question

public

Definition at line 833 of file class.ilTestOutputGUI.php.

References saveQuestionSolution().

        {
                $this->saveQuestionSolution();
                $this->ctrl->setParameter($this, "activecommand", "next");
                $this->ctrl->redirect($this, "redirectQuestion");
        }

Here is the call graph for this function:

ilTestOutputGUI::outCorrectSolution (  ) 

Creates an output of the solution of an answer compared to the correct solution.

public

Definition at line 1488 of file class.ilTestOutputGUI.php.

References $_GET, ilObjStyleSheet::getContentStylePath(), ilTestServiceGUI::getCorrectSolutionOutput(), ilUtil::getStyleSheetLocation(), and ilObjStyleSheet::getSyntaxStylePath().

        {
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_correct_solution.html", "Modules/Test");

                include_once("classes/class.ilObjStyleSheet.php");
                $this->tpl->setCurrentBlock("ContentStyle");
                $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
                $this->tpl->parseCurrentBlock();

                $this->tpl->setCurrentBlock("SyntaxStyle");
                $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
                $this->tpl->parseCurrentBlock();

                $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
                if ($this->object->getShowSolutionAnswersOnly())
                {
                        $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
                }

                $this->tpl->setCurrentBlock("adm_content");
                $solution = $this->getCorrectSolutionOutput($_GET["evaluation"], $_GET["active_id"], $_GET["pass"]);
                $this->tpl->setVariable("OUTPUT_SOLUTION", $solution);
                $this->tpl->setVariable("TEXT_BACK", $this->lng->txt("back"));
                $this->ctrl->saveParameter($this, "pass");
                $this->ctrl->saveParameter($this, "active_id");
                $this->tpl->setVariable("URL_BACK", $this->ctrl->getLinkTarget($this, "outUserResultsOverview"));
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

ilTestOutputGUI::outIntroductionPage (  ) 

Creates the introduction page for a test.

Creates the introduction page for a test

public

Definition at line 172 of file class.ilTestOutputGUI.php.

Referenced by endingTimeReached(), finishTest(), and maxProcessingTimeReached().

        {
                $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); 
        }

Here is the caller graph for this function:

ilTestOutputGUI::outParticipantsPassDetails (  ) 

Output of the pass details of an existing test pass for the test statistics.

Output of the pass details of an existing test pass for the test statistics

public

Definition at line 1916 of file class.ilTestOutputGUI.php.

References $_GET, ilTestServiceGUI::getFinalStatement(), ilTestServiceGUI::getPassDetailsOverview(), ilTestServiceGUI::getPassListOfAnswers(), ilTestServiceGUI::getResultsUserdata(), and ilUtil::getStyleSheetLocation().

        {
                $this->ctrl->saveParameter($this, "pass");
                $this->ctrl->saveParameter($this, "active_id");
                $active_id = $_GET["active_id"];
                $pass = $_GET["pass"];
                $result_array =& $this->object->getTestResult($active_id, $pass);

                $overview = $this->getPassDetailsOverview($result_array, $active_id, $pass, "iltestoutputgui", "outParticipantsPassDetails");
                $user_data = $this->getResultsUserdata($active_id, FALSE);

                $user_id = $this->object->_getUserIdFromActiveId($active_id);

                $this->tpl->addBlockFile("PRINT_CONTENT", "adm_content", "tpl.il_as_tst_pass_details_overview_participants.html", "Modules/Test");

                if (array_key_exists("statistics", $_GET) && ($_GET["statistics"] == 1))
                {
                        $this->tpl->setVariable("BACK_TEXT", $this->lng->txt("back"));
                        $this->ctrl->setParameterByClass("ilTestEvaluationGUI", "active_id", $active_id);
                        $this->tpl->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilTestEvaluationGUI", "detailedEvaluation"));
                }
                else
                {
                        if ($this->object->getNrOfTries() == 1)
                        {
                                $this->tpl->setVariable("BACK_TEXT", $this->lng->txt("back"));
                                $this->tpl->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "participants"));
                        }
                        else
                        {
                                $this->tpl->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass(get_class($this), "outParticipantsResultsOverview"));
                                $this->tpl->setVariable("BACK_TEXT", $this->lng->txt("tst_results_back_overview"));
                        }
                }
                $this->tpl->setVariable("PRINT_TEXT", $this->lng->txt("print"));
                $this->tpl->setVariable("PRINT_URL", "javascript:window.print();");

                $this->tpl->parseCurrentBlock();

                if ($this->object->getNrOfTries() == 1)
                {
                        $statement = $this->getFinalStatement($result_array["test"]);
                        $this->tpl->setVariable("USER_MARK", $statement["mark"]);
                        if (strlen($statement["markects"]))
                        {
                                $this->tpl->setVariable("USER_MARK_ECTS", $statement["markects"]);
                        }
                }
                
                $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, TRUE);
                
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("LIST_OF_ANSWERS", $list_of_answers);
                $this->tpl->setVariable("TEXT_RESULTS", $this->lng->txt("tst_results"));
                $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("PASS_DETAILS", $overview);
                $this->tpl->setVariable("USER_DETAILS", $user_data);
                $uname = $this->object->userLookupFullName($user_id);
                $this->tpl->setVariable("USER_NAME", sprintf($this->lng->txt("tst_result_user_name_pass"), $pass + 1, $uname));
                $this->tpl->parseCurrentBlock();

                $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
                if ($this->object->getShowSolutionAnswersOnly())
                {
                        $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
                }
        }

Here is the call graph for this function:

ilTestOutputGUI::outParticipantsResultsOverview (  ) 

Output of the pass overview for a test called from the statistics.

Output of the pass overview for a test called from the statistics

public

Definition at line 1867 of file class.ilTestOutputGUI.php.

References $_GET, ilObjTest::_getResultPass(), ilTestServiceGUI::getFinalStatement(), ilTestServiceGUI::getPassOverview(), ilTestServiceGUI::getResultsUserdata(), and ilUtil::getStyleSheetLocation().

        {
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_pass_overview_participants.html", "Modules/Test");

                $active_id = $_GET["active_id"];
                if ($this->object->getNrOfTries() == 1)
                {
                        $this->ctrl->setParameter($this, "active_id", $active_id);
                        $this->ctrl->setParameter($this, "pass", ilObjTest::_getResultPass($active_id));
                        $this->ctrl->redirect($this, "outParticipantsPassDetails");
                }

                $overview = $this->getPassOverview($active_id, "iltestoutputgui", "outParticipantsPassDetails");
                $this->tpl->setVariable("PASS_OVERVIEW", $overview);
                $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("BACK_TEXT", $this->lng->txt("back"));
                $this->tpl->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "participants"));
                $this->tpl->setVariable("PRINT_TEXT", $this->lng->txt("print"));
                $this->tpl->setVariable("PRINT_URL", "javascript:window.print();");
                
                $result_pass = $this->object->_getResultPass($active_id);
                $result_array =& $this->object->getTestResult($active_id, $result_pass);
                $statement = $this->getFinalStatement($result_array["test"]);
                $user_id = $this->object->_getUserIdFromActiveId($active_id);
                $user_data = $this->getResultsUserdata($active_id);
                $this->tpl->setVariable("USER_DATA", $user_data);
                $this->tpl->setVariable("TEXT_OVERVIEW", $this->lng->txt("tst_results_overview"));
                $this->tpl->setVariable("USER_MARK", $statement["mark"]);
                if (strlen($statement["markects"]))
                {
                        $this->tpl->setVariable("USER_MARK_ECTS", $statement["markects"]);
                }
                $this->tpl->setVariable("TEXT_RESULTS", $this->lng->txt("tst_results"));
                $this->tpl->parseCurrentBlock();

                $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
                if ($this->object->getShowSolutionAnswersOnly())
                {
                        $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
                }
        }

Here is the call graph for this function:

ilTestOutputGUI::outProcessingTime ( active_id  ) 

Definition at line 1267 of file class.ilTestOutputGUI.php.

References formatDate().

Referenced by outQuestionSummary(), and outTestPage().

        {
                global $ilUser;

                $starting_time = $this->object->getStartingTimeOfUser($active_id);
                $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();
                $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();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestOutputGUI::outQuestionSummary (  ) 

Output of a summary of all test questions for test participants.

public

Definition at line 1359 of file class.ilTestOutputGUI.php.

References $_GET, ilObjTest::_getSolvedQuestions(), ilUtil::getImagePath(), and outProcessingTime().

Referenced by redirectQuestion().

        {
                $active_id = $this->object->getTestSession()->getActiveId();
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_question_summary.html", "Modules/Test");
                $color_class = array ("tblrow1", "tblrow2");
                $counter = 0;
                
                $result_array = & $this->object->getTestSequence()->getSequenceSummary();
                $marked_questions = array();
                if ($this->object->getShowMarker())
                {
                        include_once "./Modules/Test/classes/class.ilObjTest.php";
                        $marked_questions = ilObjTest::_getSolvedQuestions($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["sequence"]);
                                $this->tpl->setVariable("VALUE_QUESTION_TITLE", "<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this), "gotoQuestion")."\">" . $this->object->getQuestionTitle($value["title"]) . "</a>");
                                $this->ctrl->setParameter($this, "sequence", $_GET["sequence"]);
                                if ($this->object->getListOfQuestionsDescription())
                                {
                                        $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->getTitleOutput())
                                {
                                        $this->tpl->setVariable("VALUE_QUESTION_POINTS", $value["points"]."&nbsp;".$this->lng->txt("points_short"));
                                }
                                if (count($marked_questions))
                                {
                                        if (array_key_exists($value["qid"], $marked_questions))
                                        {
                                                $obj = $marked_questions[$value["qid"]];
                                                if ($obj->solved == 1)
                                                {
                                                        $this->tpl->setVariable("ALT_MARKED_IMAGE", $this->lng->txt("tst_question_marked"));
                                                        $this->tpl->setVariable("TITLE_MARKED_IMAGE", $this->lng->txt("tst_question_marked"));
                                                        $this->tpl->setVariable("MARKED_IMAGE", ilUtil::getImagePath("marked.png"));
                                                }
                                        } 
                                }
                                $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->getTitleOutput())
                {
                        $this->tpl->setVariable("QUESTION_POINTS", $this->lng->txt("tst_maximum_points"));
                }
                if ($this->object->getShowMarker())
                {
                        $this->tpl->setVariable("TEXT_MARKED", $this->lng->txt("tst_question_marker"));
                }
                $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, "backFromSummary"));    
                $this->tpl->setVariable("TEXT_RESULTS", $this->lng->txt("question_summary"));           
                
                if ($this->object->getEnableProcessingTime())
                        $this->outProcessingTime($active_id);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestOutputGUI::outTestPage (  ) 

Outputs the question of the active sequence.

Outputs the question of the active sequence

public

Definition at line 1094 of file class.ilTestOutputGUI.php.

References $_GET, endingTimeReached(), isMaxProcessingTimeReached(), maxProcessingTimeReached(), outProcessingTime(), and outWorkingForm().

Referenced by redirectQuestion().

        {
                global $rbacsystem;
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_output.html", "Modules/Test");    
                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);
                }
                
                if ($this->isMaxProcessingTimeReached())
                {
                        $this->maxProcessingTimeReached();
                        return;
                }
                
                if ($this->object->endingTimeReached())
                {
                        $this->endingTimeReached();
                        return;
                }
                        
                if (($this->object->getInstantFeedbackSolution() == 1) || ($this->object->getAnswerFeedback() == 1) || ($this->object->getAnswerFeedbackPoints() == 1))
                {
                        $this->tpl->setCurrentBlock("direct_feedback");
                        $this->tpl->setVariable("TEXT_DIRECT_FEEDBACK", $this->lng->txt("check"));
                        $this->tpl->parseCurrentBlock();
                }
                
                $postpone = false;
                if ($this->object->getSequenceSettings() == TEST_POSTPONE)
                {
                        $postpone = true;
                }

                if ($this->object->getEnableProcessingTime())
                {
                        $this->outProcessingTime($this->object->getTestSession()->getActiveId());
                }

                $this->tpl->setVariable("FORM_TIMESTAMP", time());
                $directfeedback = 0;
                if (strcmp($_GET["activecommand"], "directfeedback") == 0) $directfeedback = 1;
                $this->outWorkingForm($this->sequence, $this->object->getTestId(), $postpone, $directfeedback, $show_summary);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestOutputGUI::outUserListOfAnswerPasses (  ) 

Output of the pass overview for a user when he/she wants to see his/her list of answers.

Output of the pass overview for a user when he/she wants to see his/her list of answers

public

Definition at line 1600 of file class.ilTestOutputGUI.php.

References $_GET, ilTestServiceGUI::getPassListOfAnswers(), ilTestServiceGUI::getPassOverview(), ilTestServiceGUI::getResultsSignature(), ilTestServiceGUI::getResultsUserdata(), and ilUtil::getStyleSheetLocation().

        {
                global $ilUser;
                
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_info_list_of_answers.html", "Modules/Test");

                $pass = null;
                if (array_key_exists("pass", $_GET))
                {
                        if (strlen($_GET["pass"])) $pass = $_GET["pass"];
                }
                $user_id = $ilUser->getId();
                $active_id = $this->object->getTestSession()->getActiveId();
                $overview = "";
                if ($this->object->getNrOfTries() == 1)
                {
                        $pass = 0;
                }
                else
                {
                        $overview = $this->getPassOverview($active_id, "iltestoutputgui", "outUserListOfAnswerPasses", TRUE);
                        $this->tpl->setVariable("TEXT_RESULTS", $this->lng->txt("tst_passes"));
                        $this->tpl->setVariable("PASS_OVERVIEW", $overview);
                }

                $signature = "";
                if (strlen($pass))
                {
                        $signature = $this->getResultsSignature();
                        $result_array =& $this->object->getTestResult($active_id, $pass);
                        $user_id =& $this->object->_getUserIdFromActiveId($active_id);
                        $showAllAnswers = TRUE;
                        if ($this->object->isExecutable($user_id))
                        {
                                $showAllAnswers = FALSE;
                        }
                        $answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, FALSE, $showAllAnswers);
                        $this->tpl->setVariable("PASS_DETAILS", $answers);
                }
                $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("BACK_TEXT", $this->lng->txt("tst_results_back_introduction"));
                $this->tpl->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "infoScreen"));
                $this->tpl->setVariable("PRINT_TEXT", $this->lng->txt("print"));
                $this->tpl->setVariable("PRINT_URL", "javascript:window.print();");
                
                $user_data = $this->getResultsUserdata($active_id, TRUE);
                $this->tpl->setVariable("USER_DATA", $user_data);
                $this->tpl->setVariable("TEXT_LIST_OF_ANSWERS", $this->lng->txt("tst_list_of_answers"));
                if (strlen($signature))
                {
                        $this->tpl->setVariable("SIGNATURE", $signature);
                }
                $this->tpl->parseCurrentBlock();

                $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
                if ($this->object->getShowSolutionAnswersOnly())
                {
                        $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
                }
        }

Here is the call graph for this function:

ilTestOutputGUI::outUserPassDetails (  ) 

Output of the pass details of an existing test pass for the active test participant.

Output of the pass details of an existing test pass for the active test participant

public

Definition at line 1800 of file class.ilTestOutputGUI.php.

References $_GET, ilTestServiceGUI::getFinalStatement(), ilTestServiceGUI::getPassDetailsOverview(), ilTestServiceGUI::getPassListOfAnswers(), and ilUtil::getStyleSheetLocation().

        {
                $this->ctrl->saveParameter($this, "pass");
                $this->ctrl->saveParameter($this, "active_id");
                $active_id = $_GET["active_id"];
                $pass = $_GET["pass"];
                $result_array =& $this->object->getTestResult($active_id, $pass);

                $command_solution_details = "";
                if ($this->object->getShowSolutionDetails())
                {
                        $command_solution_details = "outCorrectSolution";
                }
                $overview = $this->getPassDetailsOverview($result_array, $active_id, $pass, "iltestoutputgui", "outUserPassDetails", $command_solution_details);

                $user_id = $this->object->_getUserIdFromActiveId($active_id);

                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_pass_details_overview_participants.html", "Modules/Test");

                if ($this->object->getNrOfTries() == 1)
                {
                        $this->tpl->setVariable("BACK_TEXT", $this->lng->txt("tst_results_back_introduction"));
                        $this->tpl->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "infoScreen"));
                }
                else
                {
                        $this->tpl->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass(get_class($this), "outUserResultsOverview"));
                        $this->tpl->setVariable("BACK_TEXT", $this->lng->txt("tst_results_back_overview"));
                }

                $this->tpl->parseCurrentBlock();

                if ($this->object->getNrOfTries() == 1)
                {
                        $statement = $this->getFinalStatement($result_array["test"]);
                        $this->tpl->setVariable("USER_MARK", $statement["mark"]);
                        if (strlen($statement["markects"]))
                        {
                                $this->tpl->setVariable("USER_MARK_ECTS", $statement["markects"]);
                        }
                }
                
                $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass);
                
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("LIST_OF_ANSWERS", $list_of_answers);
                $this->tpl->setVariable("TEXT_RESULTS", $this->lng->txt("tst_results"));
                $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("PASS_DETAILS", $overview);
                $uname = $this->object->userLookupFullName($user_id, TRUE);
                $this->tpl->setVariable("USER_NAME", sprintf($this->lng->txt("tst_result_user_name_pass"), $pass + 1, $uname));
                $this->tpl->parseCurrentBlock();

                $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
                if ($this->object->getShowSolutionAnswersOnly())
                {
                        $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
                }
        }

Here is the call graph for this function:

ilTestOutputGUI::outUserResultsOverview (  ) 

Output of the pass overview for a test called by a test participant.

Output of the pass overview for a test called by a test participant

public

Definition at line 1668 of file class.ilTestOutputGUI.php.

References $_GET, ilTestServiceGUI::$ilias, ilTestServiceGUI::getFinalStatement(), ilUtil::getHtmlPath(), ilUtil::getImagePath(), ilTestServiceGUI::getPassDetailsOverview(), ilTestServiceGUI::getPassListOfAnswers(), ilTestServiceGUI::getPassOverview(), ilTestServiceGUI::getResultsSignature(), ilTestServiceGUI::getResultsUserdata(), and ilUtil::getStyleSheetLocation().

Referenced by endingTimeReached().

        {
                global $ilUser, $ilias;

                include_once("./classes/class.ilTemplate.php");
                $templatehead = new ilTemplate("tpl.il_as_tst_results_participants.html", TRUE, TRUE, "Modules/Test");
                $template = new ilTemplate("tpl.il_as_tst_results_participant.html", TRUE, TRUE, "Modules/Test");

                $pass = null;
                $user_id = $ilUser->getId();
                $uname = $this->object->userLookupFullName($user_id, TRUE);
                $active_id = $this->object->getTestSession()->getActiveId();
                $hide_details = !$this->object->getShowPassDetails();
                if ($hide_details)
                {
                        $executable = $this->object->isExecutable($ilUser->getId());
                        if (!$executable["executable"]) $hide_details = FALSE;
                }
                if (($this->object->getNrOfTries() == 1) && (!$hide_details))
                {
                        $pass = 0;
                }
                else
                {
                        $template->setCurrentBlock("pass_overview");
                        $overview = $this->getPassOverview($active_id, "iltestoutputgui", "outUserResultsOverview", FALSE, $hide_details);
                        $template->setVariable("PASS_OVERVIEW", $overview);
                        $template->setVariable("TEXT_RESULTS", $this->lng->txt("tst_results_overview"));
                        $template->parseCurrentBlock();
                }

                if (((array_key_exists("pass", $_GET)) && (strlen($_GET["pass"]) > 0)) || (!is_null($pass)))
                {
                        if (is_null($pass))     $pass = $_GET["pass"];
                }

                if ((strlen($ilias->getSetting("rpc_server_host"))) && (strlen($ilias->getSetting("rpc_server_port"))))
                {
                        $this->ctrl->setParameter($this, "pass", $pass);
                        $this->ctrl->setParameter($this, "pdf", "1");
                        $templatehead->setCurrentBlock("pdf_export");
                        $templatehead->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "outUserResultsOverview"));
                        $this->ctrl->setParameter($this, "pass", "");
                        $this->ctrl->setParameter($this, "pdf", "");
                        $templatehead->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
                        $templatehead->setVariable("PDF_IMG_ALT", $this->lng->txt("pdf_export"));
                        $templatehead->setVariable("PDF_IMG_URL", ilUtil::getHtmlPath(ilUtil::getImagePath("application-pdf.png")));
                        $templatehead->parseCurrentBlock();
                        if ($this->object->canShowCertificate($user_id, $active_id))
                        {
                                $templatehead->setCurrentBlock("certificate");
                                $templatehead->setVariable("CERTIFICATE_URL", $this->ctrl->getLinkTargetByClass("iltestcertificategui", "outCertificate"));
                                $templatehead->setVariable("CERTIFICATE_TEXT", $this->lng->txt("certificate"));
                                $templatehead->parseCurrentBlock();
                        }
                }
                $templatehead->setVariable("BACK_TEXT", $this->lng->txt("tst_results_back_introduction"));
                $templatehead->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "infoScreen"));
                $templatehead->setVariable("PRINT_TEXT", $this->lng->txt("print"));
                $templatehead->setVariable("PRINT_URL", "javascript:window.print();");
                
                $result_pass = $this->object->_getResultPass($active_id);
                $result_array =& $this->object->getTestResult($active_id, $result_pass);
                $statement = $this->getFinalStatement($result_array["test"]);
                $user_data = $this->getResultsUserdata($active_id, TRUE);

                // output of the details of a selected pass
                $this->ctrl->saveParameter($this, "pass");
                $this->ctrl->saveParameter($this, "active_id");
                if (!is_null($pass))
                {
                        $result_array =& $this->object->getTestResult($active_id, $pass);
                        $command_solution_details = "";
                        if ($this->object->getShowSolutionDetails())
                        {
                                $command_solution_details = "outCorrectSolution";
                        }
                        $detailsoverview = (!$hide_details) ? $this->getPassDetailsOverview($result_array, $active_id, $pass, "iltestoutputgui", "outUserResultsOverview", $command_solution_details) : '';
        
                        $user_id = $this->object->_getUserIdFromActiveId($active_id);
        
                        if (!$hide_details && $this->object->canShowSolutionPrintview())
                        {
                                $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass);
                        }
                        
                        $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
                        $template->setVariable("PASS_RESULTS_OVERVIEW", sprintf($this->lng->txt("tst_results_overview_pass"), $pass + 1));
                        $template->setVariable("PASS_DETAILS", $detailsoverview);

                        $signature = $this->getResultsSignature();
                        $template->setVariable("SIGNATURE", $signature);
                }
                $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
                $template->setVariable("USER_DATA", $user_data);
                $template->setVariable("USER_MARK", $statement["mark"]);
                if (strlen($statement["markects"]))
                {
                        $template->setVariable("USER_MARK_ECTS", $statement["markects"]);
                }
                $template->parseCurrentBlock();

                $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
                if ($this->object->getShowSolutionAnswersOnly())
                {
                        $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
                }
                $templatehead->setVariable("RESULTS_PARTICIPANT", $template->get());
                
                if (array_key_exists("pdf", $_GET) && ($_GET["pdf"] == 1))
                {
                        $printbody = new ilTemplate("tpl.il_as_tst_print_body.html", TRUE, TRUE, "Modules/Test");
                        $printbody->setVariable("TITLE", sprintf($this->lng->txt("tst_result_user_name"), $uname));
                        $printbody->setVariable("ADM_CONTENT", $template->get());
                        $printoutput = $printbody->get();
                        $printoutput = preg_replace("/href=\".*?\"/", "", $printoutput);
                        $fo = $this->object->processPrintoutput2FO($printoutput);
                        $this->object->deliverPDFfromFO($fo);
                }
                else
                {
                        $this->tpl->setVariable("PRINT_CONTENT", $templatehead->get());
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestOutputGUI::outWorkingForm ( sequence = "",
test_id,
postpone_allowed,
directfeedback = 0 
)

Creates the learners output of a question.

Creates the learners output of a question

public

Definition at line 207 of file class.ilTestOutputGUI.php.

References $_GET, $_SESSION, $sequence, ilObjTest::_getSolvedQuestions(), ilObjStyleSheet::getContentStylePath(), ilUtil::getImagePath(), and ilObjStyleSheet::getSyntaxStylePath().

Referenced by outTestPage().

        {
                global $ilUser;

                if ($sequence < 1) $sequence = $this->object->getTestSequence()->getFirstSequence();
                $active_time_id = $this->object->startWorkingTime($this->object->getTestSession()->getActiveId(), $this->object->getTestSession()->getPass());
                $_SESSION["active_time_id"] = $active_time_id;

                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->getTestSequence()->getQuestionForSequence($sequence));
                if ($this->object->getJavaScriptOutput())
                {
                        $question_gui->object->setOutputType(OUTPUT_JAVASCRIPT);
                }

                $is_postponed = $this->object->getTestSequence()->isPostponedQuestion($question_gui->object->getId());

                $this->ctrl->setParameter($this, "sequence", "$sequence");
                $formaction = $this->ctrl->getFormAction($this, "redirectQuestion");

                $question_gui->setSequenceNumber($this->object->getTestSequence()->getPositionOfSequence($sequence));
                $question_gui->setQuestionCount($this->object->getTestSequence()->getUserQuestionCount());
                // output question
                $user_post_solution = FALSE;
                if (array_key_exists("previouspost", $_SESSION))
                {
                        $user_post_solution = $_SESSION["previouspost"];
                        unset($_SESSION["previouspost"]);
                }
                $answer_feedback = FALSE;
                if (($directfeedback) && ($this->object->getAnswerFeedback()))
                {
                        $answer_feedback = TRUE;
                }
                global $ilNavigationHistory;
                $ilNavigationHistory->addItem($_GET["ref_id"], $this->ctrl->getLinkTarget($this, "resume"), "tst");
                $question_gui->outQuestionForTest($formaction, $this->object->getTestSession()->getActiveId(), NULL, $is_postponed, $user_post_solution, $answer_feedback);
                if ($directfeedback)
                {
                        if ($this->object->getInstantFeedbackSolution())
                        {
                                $solutionoutput = $question_gui->getSolutionOutput("", NULL, FALSE, FALSE, FALSE);
                                $this->tpl->setCurrentBlock("solution_output");
                                $this->tpl->setVariable("CORRECT_SOLUTION", $this->lng->txt("tst_best_solution_is"));
                                $this->tpl->setVariable("QUESTION_FEEDBACK", $solutionoutput);
                                $this->tpl->parseCurrentBlock();
                        }
                        if ($this->object->getAnswerFeedbackPoints())
                        {
                                $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($this->object->getTestSession()->getActiveId(), NULL), $question_gui->object->getMaximumPoints()));
                                $this->tpl->parseCurrentBlock();
                        }
                        if ($this->object->getAnswerFeedback())
                        {
                                $this->tpl->setCurrentBlock("answer_feedback");
                                $this->tpl->setVariable("ANSWER_FEEDBACK", $question_gui->getAnswerFeedbackOutput($this->object->getTestSession()->getActiveId(), NULL));
                                $this->tpl->parseCurrentBlock();
                        }
                }

                if ($sequence == $this->object->getTestSequence()->getFirstSequence())
                {
                        $this->tpl->setCurrentBlock("prev");
                        $this->tpl->setVariable("BTN_PREV", "&lt;&lt; " . $this->lng->txt("save_introduction"));
                        $this->tpl->parseCurrentBlock();
                        $this->tpl->setCurrentBlock("prev_bottom");
                        $this->tpl->setVariable("BTN_PREV", "&lt;&lt; " . $this->lng->txt("save_introduction"));
                        $this->tpl->parseCurrentBlock();
                }
                else
                {
                        $this->tpl->setCurrentBlock("prev");
                        $this->tpl->setVariable("BTN_PREV", "&lt;&lt; " . $this->lng->txt("save_previous"));
                        $this->tpl->parseCurrentBlock();
                        $this->tpl->setCurrentBlock("prev_bottom");
                        $this->tpl->setVariable("BTN_PREV", "&lt;&lt; " . $this->lng->txt("save_previous"));
                        $this->tpl->parseCurrentBlock();
                }

                if ($postpone_allowed)
                {
                        if (!$is_postponed)
                        {
                                if (!$finish)
                                {
                                        $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->getListOfQuestions()) 
                {
                        if (!(($finish) && ($this->object->getListOfQuestionsEnd())))
                        {
                                $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->getShowCancel()) 
                {
                        $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 ($this->object->getTestSequence()->getQuestionForSequence($this->object->getTestSequence()->getLastSequence()) == $question_gui->object->getId())
                {
                        if ($this->object->getListOfQuestionsEnd()) 
                        {
                                $this->tpl->setCurrentBlock("next");
                                $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("question_summary") . " &gt;&gt;");
                                $this->tpl->parseCurrentBlock();
                                $this->tpl->setCurrentBlock("next_bottom");
                                $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("question_summary") . " &gt;&gt;");
                                $this->tpl->parseCurrentBlock();                                
                        } 
                        else 
                        {
                                $this->tpl->setCurrentBlock("next");
                                $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("save_finish") . " &gt;&gt;");
                                $this->tpl->parseCurrentBlock();
                                $this->tpl->setCurrentBlock("next_bottom");
                                $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("save_finish") . " &gt;&gt;");
                                $this->tpl->parseCurrentBlock();
                        }
                }
                else
                {
                        $this->tpl->setCurrentBlock("next");
                        $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("save_next") . " &gt;&gt;");
                        $this->tpl->parseCurrentBlock();
                        $this->tpl->setCurrentBlock("next_bottom");
                        $this->tpl->setVariable("BTN_NEXT", $this->lng->txt("save_next") . " &gt;&gt;");
                        $this->tpl->parseCurrentBlock();
                }

                if ($this->object->getShowMarker())
                {
                        include_once "./Modules/Test/classes/class.ilObjTest.php";
                        $solved_array = ilObjTest::_getSolvedQuestions($this->object->getTestSession()->getActiveId(), $question_gui->object->getId());
                        $solved = 0;
                        
                        if (count ($solved_array) > 0) 
                        {
                                $solved = array_pop($solved_array);
                                $solved = $solved->solved;
                        }                       
                        
                        if ($solved==1) 
                        {
                                $this->tpl->setCurrentBlock("ismarked");
                                $this->tpl->setVariable("TEXT_QUESTION_STATUS_LABEL", $this->lng->txt("tst_question_marked").":");
                                $this->tpl->setVariable("TEXT_RESET_MARK", $this->lng->txt("remove"));
                                $this->tpl->setVariable("ALT_MARKED", $this->lng->txt("tst_question_marked"));
                                $this->tpl->setVariable("TITLE_MARKED", $this->lng->txt("tst_question_marked"));
                                $this->tpl->setVariable("MARKED_SOURCE", ilUtil::getImagePath("marked.png"));
                                $this->tpl->parseCurrentBlock();
                        } 
                        else 
                        {
                                $this->tpl->setCurrentBlock("ismarked");
                                $this->tpl->setVariable("TEXT_MARK_QUESTION", $this->lng->txt("tst_question_mark"));
                                $this->tpl->parseCurrentBlock();
                        }
                }

                if ($this->object->getJavaScriptOutput())
                {
                        $this->tpl->setVariable("JAVASCRIPT_IMAGE", ilUtil::getImagePath("javascript_disable.png"));
                        $this->tpl->setVariable("JAVASCRIPT_IMAGE_ALT", $this->lng->txt("disable_javascript"));
                        $this->tpl->setVariable("JAVASCRIPT_IMAGE_TITLE", $this->lng->txt("disable_javascript"));
                        $this->ctrl->setParameter($this, "tst_javascript", "0");
                        $this->tpl->setVariable("JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this, "gotoQuestion"));
                }
                else
                {
                        $this->tpl->setVariable("JAVASCRIPT_IMAGE", ilUtil::getImagePath("javascript.png"));
                        $this->tpl->setVariable("JAVASCRIPT_IMAGE_ALT", $this->lng->txt("enable_javascript"));
                        $this->tpl->setVariable("JAVASCRIPT_IMAGE_TITLE", $this->lng->txt("enable_javascript"));
                        $this->ctrl->setParameter($this, "tst_javascript", "1");
                        $this->tpl->setVariable("JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this, "gotoQuestion"));
                }

                if ($question_gui->object->supportsJavascriptOutput())
                {
                        $this->tpl->touchBlock("jsswitch");
                }

                $this->tpl->setCurrentBlock("adm_content");
                //$this->tpl->setVariable("FORMACTION", $formaction);
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

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 1195 of file class.ilTestOutputGUI.php.

References $_GET.

        {
                if (array_key_exists("pass", $_GET) && (strlen($_GET["pass"]) > 0))
                {
                        $this->ctrl->saveParameter($this, "pass");
                        $this->ctrl->saveParameter($this, "active_id");
                        $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 861 of file class.ilTestOutputGUI.php.

References saveQuestionSolution().

        {
                $this->saveQuestionSolution();
                $this->ctrl->setParameter($this, "activecommand", "postpone");
                $this->ctrl->redirect($this, "redirectQuestion");
        }

Here is the call graph for this function:

ilTestOutputGUI::previous (  ) 

Go to the previous question.

Go to the previous question

public

Definition at line 847 of file class.ilTestOutputGUI.php.

References saveQuestionSolution().

        {
                $this->saveQuestionSolution();
                $this->ctrl->setParameter($this, "activecommand", "previous");
                $this->ctrl->redirect($this, "redirectQuestion");
        }

Here is the call graph for this function:

ilTestOutputGUI::redirectQuestion (  ) 

Called when a user answered a question to perform a redirect after POST.

Called when a user answered a question to perform a redirect after POST. This is called for security reasons to prevent users sending a form twice.

public

Definition at line 628 of file class.ilTestOutputGUI.php.

References $_GET, $_SESSION, calculateSequence(), outQuestionSummary(), outTestPage(), and ilUtil::sendInfo().

        {
                global $ilUser;
                
                // check the test restrictions to access the test in case one
                // of the test navigation commands was called by an external script
                // e.g. $ilNavigationHistory
                $executable = $this->object->isExecutable($ilUser->getId());
                if (!$executable["executable"])
                {
                        ilUtil::sendInfo($executable["errormessage"], TRUE);
                        $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
                }
                switch ($_GET["activecommand"])
                {
                        case "next":
                                $this->sequence = $this->calculateSequence();
                                if ($this->sequence === FALSE)
                                {
                                        if ($this->object->getListOfQuestionsEnd())
                                        {
                                                $this->outQuestionSummary();
                                        }
                                        else
                                        {
                                                $this->ctrl->redirect($this, "finishTest");
                                        }
                                }
                                else
                                {
                                        $this->object->getTestSession()->setLastSequence($this->sequence);
                                        $this->object->getTestSession()->saveToDb();
                                        $this->outTestPage();
                                }
                                break;
                        case "previous":
                                $this->sequence = $this->calculateSequence();
                                $this->object->getTestSession()->setLastSequence($this->sequence);
                                $this->object->getTestSession()->saveToDb();
                                if ($this->sequence === FALSE)
                                {
                                        $this->ctrl->redirect($this, "outIntroductionPage");
                                }
                                else
                                {
                                        $this->outTestPage();
                                }
                                break;
                        case "postpone":
                                $this->sequence = $this->calculateSequence();
                                $nextSequence = $this->object->getTestSequence()->getNextSequence($this->sequence);
                                $this->object->getTestSequence()->postponeSequence($this->sequence);
                                $this->object->getTestSequence()->saveToDb();
                                $this->object->getTestSession()->setLastSequence($nextSequence);
                                $this->object->getTestSession()->saveToDb();
                                $this->sequence = $nextSequence;
                                $this->outTestPage();
                                break;
                        case "setmarked":
                                $this->sequence = $this->calculateSequence();   
                                $this->object->getTestSession()->setLastSequence($this->sequence);
                                $this->object->getTestSession()->saveToDb();
                                $q_id  = $this->object->getTestSequence()->getQuestionForSequence($_GET["sequence"]);
                                $this->object->setQuestionSetSolved(1, $q_id, $ilUser->getId());
                                $this->outTestPage();
                                break;
                        case "resetmarked":
                                $this->sequence = $this->calculateSequence();   
                                $this->object->getTestSession()->setLastSequence($this->sequence);
                                $this->object->getTestSession()->saveToDb();
                                $q_id  = $this->object->getTestSequence()->getQuestionForSequence($_GET["sequence"]);
                                $this->object->setQuestionSetSolved(0, $q_id, $ilUser->getId());
                                $this->outTestPage();
                                break;
                        case "directfeedback":
                                $this->sequence = $this->calculateSequence();   
                                $this->object->getTestSession()->setLastSequence($this->sequence);
                                $this->object->getTestSession()->saveToDb();
                                $this->outTestPage();
                                break;
                        case "selectImagemapRegion":
                                $this->sequence = $this->calculateSequence();   
                                $this->object->getTestSession()->setLastSequence($this->sequence);
                                $this->object->getTestSession()->saveToDb();
                                $this->outTestPage();
                                break;
                        case "summary":
                                $this->ctrl->redirect($this, "outQuestionSummary");
                                break;
                        case "start":
                                $_SESSION['tst_pass_finish'] = 0;
                                $this->object->createTestSession();
                                $active_id = $this->object->getTestSession()->getActiveId();
                                $this->ctrl->setParameter($this, "active_id", $active_id);
                                $shuffle = $this->object->getShuffleQuestions();
                                if ($this->object->isRandomTest())
                                {
                                        $this->object->generateRandomQuestions($this->object->getTestSession()->getActiveId());
                                        $this->object->loadQuestions();
                                        $shuffle = FALSE; // shuffle is already done during the creation of the random questions
                                }
                                $this->object->createTestSequence($active_id, 0, $shuffle);
                                $active_time_id = $this->object->startWorkingTime($this->object->getTestSession()->getActiveId(), $this->object->getTestSession()->getPass());
                                $_SESSION["active_time_id"] = $active_time_id;
                                $this->ctrl->setParameter($this, "sequence", $this->sequence);
                                $this->ctrl->saveParameter($this, "tst_javascript");
                                if ($this->object->getListOfQuestionsStart())
                                {
                                        $this->ctrl->redirect($this, "outQuestionSummary");
                                }
                                else
                                {
                                        $this->ctrl->setParameter($this, "activecommand", "gotoquestion");
                                        $this->ctrl->redirect($this, "redirectQuestion");
                                }
                                break;
                        case "resume":
                                $_SESSION['tst_pass_finish'] = 0;
                                $active_id = $this->object->getTestSession()->getActiveId();
                                $this->ctrl->setParameter($this, "active_id", $active_id);

                                if ($this->object->isRandomTest())
                                {
                                        if (!$this->object->hasRandomQuestionsForPass($active_id, $this->object->getTestSession()->getPass()))
                                        {
                                                // create a new set of random questions
                                                $this->object->generateRandomQuestions($active_id, $this->object->getTestSession()->getPass());
                                        }
                                }

                                $shuffle = $this->object->getShuffleQuestions();
                                if ($this->object->isRandomTest())
                                {
                                        $shuffle = FALSE;
                                }
                                $this->object->createTestSequence($active_id, $this->object->getTestSession()->getPass(), $shuffle);

                                $this->sequence = $this->object->getTestSession()->getLastSequence();
                                $active_time_id = $this->object->startWorkingTime($active_id, $this->object->getTestSession()->getPass());
                                $_SESSION["active_time_id"] = $active_time_id;
                                $this->ctrl->setParameter($this, "sequence", $this->sequence);
                                $this->ctrl->saveParameter($this, "tst_javascript");
                                if ($this->object->getListOfQuestionsStart())
                                {
                                        $this->ctrl->redirect($this, "outQuestionSummary");
                                }
                                else
                                {
                                        $this->ctrl->setParameter($this, "activecommand", "gotoquestion");
                                        $this->ctrl->redirect($this, "redirectQuestion");
                                }
                                break;
                        case "back":
                        case "gotoquestion":
                        default:
                                $_SESSION['tst_pass_finish'] = 0;
                                if (array_key_exists("tst_javascript", $_GET))
                                {
                                        $ilUser->writePref("tst_javascript", $_GET["tst_javascript"]);
                                }
                                $this->sequence = $this->calculateSequence();   
                                $this->object->getTestSession()->setLastSequence($this->sequence);
                                $this->object->getTestSession()->saveToDb();
                                $this->outTestPage();
                                break;
                }
        }

Here is the call graph for this function:

ilTestOutputGUI::resetmarked (  ) 

Set a question unsolved.

Set a question unsolved

public

Definition at line 911 of file class.ilTestOutputGUI.php.

References saveQuestionSolution().

        {
                $this->saveQuestionSolution();
                $this->ctrl->setParameter($this, "activecommand", "resetmarked");
                $this->ctrl->redirect($this, "redirectQuestion");
        }

Here is the call graph for this function:

ilTestOutputGUI::resume (  ) 

Resume a test at the last position.

Resume a test at the last position

public

Definition at line 572 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");
        }

Here is the call graph for this function:

ilTestOutputGUI::saveQuestionSolution (  ) 

saves the user input of a question

Definition at line 108 of file class.ilTestOutputGUI.php.

References $_GET, $_SESSION, canSaveResult(), and updateWorkingTime().

Referenced by directfeedback(), next(), postpone(), previous(), resetmarked(), selectImagemapRegion(), setmarked(), and summary().

        {
                $this->updateWorkingTime();
                $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->getTestSequence()->getQuestionForSequence($_GET["sequence"]);
                        if (is_numeric($q_id)) 
                        {
                                global $ilUser;
                                
                                $question_gui = $this->object->createQuestionGUI("", $q_id);
                                if ($this->object->getJavaScriptOutput())
                                {
                                        $question_gui->object->setOutputType(OUTPUT_JAVASCRIPT);
                                }
                                $pass = NULL;
                                $active_id = $this->object->getTestSession()->getActiveId();
                                if ($this->object->isRandomTest())
                                {
                                        $pass = $this->object->_getPass($active_id);
                                }
                                $this->saveResult = $question_gui->object->saveWorkingData($active_id, $pass);
                        }                                                                                               
                }
                if ($this->saveResult == FALSE)
                {
                        $this->ctrl->setParameter($this, "save_error", "1");
                        $_SESSION["previouspost"] = $_POST;
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

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 939 of file class.ilTestOutputGUI.php.

References 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");
        }

Here is the call graph for this function:

ilTestOutputGUI::setAnonymousId (  ) 

Sets a session variable with the test access code for an anonymous test user.

Sets a session variable with the test access code for an anonymous test user

public

Definition at line 476 of file class.ilTestOutputGUI.php.

References $_SESSION.

        {
                if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
                {
                        $this->object->setAccessCodeSession($_POST["anonymous_id"]);
                }
                $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
        }

ilTestOutputGUI::setmarked (  ) 

Set a question solved.

Set a question solved

public

Definition at line 897 of file class.ilTestOutputGUI.php.

References saveQuestionSolution().

        {
                $this->saveQuestionSolution();
                $this->ctrl->setParameter($this, "activecommand", "setmarked");
                $this->ctrl->redirect($this, "redirectQuestion");
        }

Here is the call graph for this function:

ilTestOutputGUI::showListOfAnswers ( active_id,
pass = NULL,
top_data = "",
bottom_data = "" 
)

Creates an output of the list of answers for a test participant during the test (only the actual pass will be shown).

Parameters:
integer $active_id Active id of the participant
integer $pass Test pass of the participant
boolean $testnavigation Deceides wheather to show a navigation for tests or not public

Definition at line 1526 of file class.ilTestOutputGUI.php.

References ilTestServiceGUI::getResultsSignature(), ilTestServiceGUI::getResultsUserdata(), and ilUtil::getStyleSheetLocation().

Referenced by backConfirmFinish(), and finishTest().

        {
                global $ilUser;

                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_finish_list_of_answers.html", "Modules/Test");

                $result_array =& $this->object->getTestResult($active_id, $pass);

                $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);
                                $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", TRUE, TRUE, "Modules/TestQuestionPool");
                                $template->setVariable("COUNTER_QUESTION", $counter.". ");
                                $template->setVariable("QUESTION_TITLE", $question_gui->object->getTitle());
                                
                                $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
                                $result_output = $question_gui->getSolutionOutput($active_id, $pass, FALSE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
                                $template->setVariable("SOLUTION_OUTPUT", $result_output);
                                $this->tpl->setVariable("QUESTION_OUTPUT", $template->get());
                                $this->tpl->parseCurrentBlock();
                                $counter ++;
                        }
                }

                $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
                if ($this->object->getShowSolutionAnswersOnly())
                {
                        $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
                }
                if (strlen($top_data))
                {
                        $this->tpl->setCurrentBlock("top_data");
                        $this->tpl->setVariable("TOP_DATA", $top_data);
                        $this->tpl->parseCurrentBlock();
                }
                
                if (strlen($bottom_data))
                {
                        $this->tpl->setCurrentBlock("bottom_data");
                        $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
                        $this->tpl->setVariable("BOTTOM_DATA", $bottom_data);
                        $this->tpl->parseCurrentBlock();
                }
                
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("TXT_ANSWER_SHEET", $this->lng->txt("tst_list_of_answers"));
                $user_data = $this->getResultsUserdata($active_id, TRUE);
                $signature = $this->getResultsSignature();
                $this->tpl->setVariable("USER_DETAILS", $user_data);
                $this->tpl->setVariable("SIGNATURE", $signature);
                $this->tpl->setVariable("TITLE", $this->object->getTitle());
                $this->tpl->setVariable("TXT_TEST_PROLOG", $this->lng->txt("tst_your_answers"));
                $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->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestOutputGUI::showMaximumAllowedUsersReachedMessage (  ) 

Definition at line 1445 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", "Modules/Test");
                $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();
        }

Here is the caller graph for this function:

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 433 of file class.ilTestOutputGUI.php.

Referenced by startTest().

        {
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_password_protection.html", "Modules/Test");
                $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();
        }

Here is the caller graph for this function:

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 by the start test button

public

Definition at line 493 of file class.ilTestOutputGUI.php.

References $_SESSION, and handleStartCommands().

        {
                if (strcmp($_SESSION["lock"], $_POST["lock"]) != 0)
                {
                        $_SESSION["lock"] = $_POST["lock"];
                        $this->handleStartCommands();
                        $this->ctrl->redirect($this, "startTest");
                }
                else
                {
                        $this->ctrl->redirectByClass("ilobjtestgui", "redirectToInfoScreen");
                }
        }

Here is the call graph for this function:

ilTestOutputGUI::startTest (  ) 

Start a test for the first time after a redirect.

public

Definition at line 512 of file class.ilTestOutputGUI.php.

References $_SESSION, showMaximumAllowedUsersReachedMessage(), and showPasswordProtectionPage().

        {
                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 ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
                {
                        $this->ctrl->redirect($this, "displayCode");
                }
                else
                {
                        $this->ctrl->setParameter($this, "activecommand", "start");
                        $this->ctrl->redirect($this, "redirectQuestion");
                }
        }

Here is the call graph for this function:

ilTestOutputGUI::summary (  ) 

Show the question summary in online exams.

Show the question summary in online exams

public

Definition at line 875 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");
                }
        }

Here is the call graph for this function:

ilTestOutputGUI::updateWorkingTime (  ) 

updates working time and stores state saveresult to see if question has to be stored or not

Definition at line 97 of file class.ilTestOutputGUI.php.

References $_SESSION.

Referenced by saveQuestionSolution().

        {
                if ($_SESSION["active_time_id"])
                {
                        $this->object->updateWorkingTime($_SESSION["active_time_id"]);
                }       
        }       

Here is the caller graph for this function:


Field Documentation

ilTestOutputGUI::$cmdCtrl

Definition at line 45 of file class.ilTestOutputGUI.php.

ilTestOutputGUI::$endingTimeReached

Definition at line 47 of file class.ilTestOutputGUI.php.

ilTestOutputGUI::$maxProcessingTimeReached

Definition at line 46 of file class.ilTestOutputGUI.php.

ilTestOutputGUI::$ref_id

Reimplemented from ilTestServiceGUI.

Definition at line 41 of file class.ilTestOutputGUI.php.

ilTestOutputGUI::$saveResult

Definition at line 43 of file class.ilTestOutputGUI.php.

ilTestOutputGUI::$sequence

Definition at line 44 of file class.ilTestOutputGUI.php.

Referenced by calculateSequence(), and outWorkingForm().


The documentation for this class was generated from the following file: