/** * @param $show_pass_details * @param $show_answers * @param $show_reached_points * @param $show_user_results * * @return ilTemplate */ public function createUserResults($show_pass_details, $show_answers, $show_reached_points, $show_user_results) { global $ilTabs, $ilDB; $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'participants')); if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) { require_once 'Services/Link/classes/class.ilLink.php'; $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId()); $ilTabs->setBack2Target($this->lng->txt('back_to_objective_container'), $courseLink); } $template = new ilTemplate("tpl.il_as_tst_participants_result_output.html", TRUE, TRUE, "Modules/Test"); require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php'; $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng); $this->ctrl->setParameter($this, 'pdf', '1'); $toolbar->setPdfExportLinkTarget($this->ctrl->getLinkTarget($this, $this->ctrl->getCmd())); $this->ctrl->setParameter($this, 'pdf', ''); if ($show_answers) { if (isset($_GET['show_best_solutions'])) { $_SESSION['tst_results_show_best_solutions'] = true; } elseif (isset($_GET['hide_best_solutions'])) { $_SESSION['tst_results_show_best_solutions'] = false; } elseif (!isset($_SESSION['tst_results_show_best_solutions'])) { $_SESSION['tst_results_show_best_solutions'] = false; } if ($_SESSION['tst_results_show_best_solutions']) { $this->ctrl->setParameter($this, 'hide_best_solutions', '1'); $toolbar->setHideBestSolutionsLinkTarget($this->ctrl->getLinkTarget($this, 'showUserAnswers')); $this->ctrl->setParameter($this, 'hide_best_solutions', ''); } else { $this->ctrl->setParameter($this, 'show_best_solutions', '1'); $toolbar->setShowBestSolutionsLinkTarget($this->ctrl->getLinkTarget($this, 'showUserAnswers')); $this->ctrl->setParameterByClass('', 'show_best_solutions', ''); } } require_once 'Modules/Test/classes/class.ilTestParticipantData.php'; $participantData = new ilTestParticipantData($ilDB, $this->lng); if ($this->object->getFixedParticipants()) { $participantData->setUserIds($show_user_results); } else { $participantData->setActiveIds($show_user_results); } $participantData->load($this->object->getTestId()); $toolbar->setParticipantSelectorOptions($participantData->getOptionArray($show_user_results)); $toolbar->build(); $template->setVariable('RESULTS_TOOLBAR', $this->ctrl->getHTML($toolbar)); include_once "./Modules/Test/classes/class.ilTestServiceGUI.php"; $serviceGUI = new ilTestServiceGUI($this->object); $serviceGUI->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer()); $serviceGUI->setParticipantData($participantData); $count = 0; foreach ($show_user_results as $key => $active_id) { $count++; $results = ""; if ($this->object->getFixedParticipants()) { $active_id = $this->object->getActiveIdOfUser($active_id); } if ($active_id > 0) { $results = $serviceGUI->getResultsOfUserOutput($this->testSessionFactory->getSession($active_id), $active_id, $this->object->_getResultPass($active_id), $this, $show_pass_details, $show_answers, FALSE, $show_reached_points); } if ($count < count($show_user_results)) { $template->touchBlock("break"); } $template->setCurrentBlock("user_result"); $template->setVariable("USER_RESULT", $results); $template->parseCurrentBlock(); } if ($this->isPdfDeliveryRequest()) { require_once 'class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle()); } else { return $template; } }
/** * 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 * * @access public */ function outParticipantsPassDetails() { global $ilTabs, $ilAccess; if (!$ilAccess->checkAccess('write', '', $this->ref_id)) { // allow only write access ilUtil::sendInfo($this->lng->txt('no_permission'), true); $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen'); } $this->ctrl->saveParameter($this, "active_id"); $active_id = (int) $_GET["active_id"]; $testSession = $this->testSessionFactory->getSession($active_id); // protect actives from other tests if ($testSession->getTestId() != $this->object->getTestId()) { ilUtil::sendInfo($this->lng->txt('no_permission'), true); $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen'); } $this->ctrl->saveParameter($this, "pass"); $pass = (int) $_GET["pass"]; if (isset($_GET['statistics']) && $_GET['statistics'] == 1) { $this->ctrl->setParameterByClass("ilTestEvaluationGUI", "active_id", $active_id); $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'detailedEvaluation')); } elseif ($this->object->getNrOfTries() == 1) { $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTargetByClass('ilobjtestgui', 'participants')); } else { $ilTabs->setBackTarget($this->lng->txt('tst_results_back_overview'), $this->ctrl->getLinkTarget($this, 'outParticipantsResultsOverview')); } $result_array =& $this->object->getTestResult($active_id, $pass); $overview = $this->getPassDetailsOverview($result_array, $active_id, $pass, $this, "outParticipantsPassDetails", '', true); $user_data = $this->getResultsUserdata($testSession, $active_id, FALSE); $user_id = $this->object->_getUserIdFromActiveId($active_id); $template = new ilTemplate("tpl.il_as_tst_pass_details_overview_participants.html", TRUE, TRUE, "Modules/Test"); require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php'; $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng); $this->ctrl->setParameter($this, 'pdf', '1'); $toolbar->setPdfExportLinkTarget($this->ctrl->getLinkTarget($this, 'outParticipantsPassDetails')); $this->ctrl->setParameter($this, 'pdf', ''); if (isset($_GET['show_best_solutions'])) { $_SESSION['tst_results_show_best_solutions'] = true; } elseif (isset($_GET['hide_best_solutions'])) { $_SESSION['tst_results_show_best_solutions'] = false; } elseif (!isset($_SESSION['tst_results_show_best_solutions'])) { $_SESSION['tst_results_show_best_solutions'] = false; } if ($_SESSION['tst_results_show_best_solutions']) { $this->ctrl->setParameter($this, 'hide_best_solutions', '1'); $toolbar->setHideBestSolutionsLinkTarget($this->ctrl->getLinkTarget($this, 'outParticipantsPassDetails')); $this->ctrl->setParameter($this, 'hide_best_solutions', ''); } else { $this->ctrl->setParameter($this, 'show_best_solutions', '1'); $toolbar->setShowBestSolutionsLinkTarget($this->ctrl->getLinkTarget($this, 'outParticipantsPassDetails')); $this->ctrl->setParameter($this, 'show_best_solutions', ''); } $toolbar->build(); $template->setVariable('RESULTS_TOOLBAR', $this->ctrl->getHTML($toolbar)); if ($this->isGradingMessageRequired() && $this->object->getNrOfTries() == 1) { $template->setCurrentBlock('grading_message'); $template->setVariable('GRADING_MESSAGE', $this->getGradingMessage($active_id)); $template->parseCurrentBlock(); } $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, $_SESSION['tst_results_show_best_solutions'], false, false, false, true); $template->setVariable("LIST_OF_ANSWERS", $list_of_answers); $template->setVariable("TEXT_RESULTS", $this->lng->txt("tst_results")); $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $template->setVariable("PASS_DETAILS", $overview); $template->setVariable("USER_DATA", $user_data); $uname = $this->object->userLookupFullName($user_id); $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name_pass"), $pass + 1, $uname)); $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 ($this->isPdfDeliveryRequest()) { //$this->object->deliverPDFfromHTML($template->get()); require_once 'class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle()); } else { $this->tpl->setVariable("ADM_CONTENT", $template->get()); } }