public function archiveActivesPass($activeId, $pass) { $content = $this->renderOverviewContent($activeId, $pass); $filename = $this->buildOverviewFilename($activeId, $pass); ilTestPDFGenerator::generatePDF($content, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); $archiver = new ilTestArchiver($this->testOBJ->getId()); $archiver->handInTestResult($activeId, $pass, $filename); unlink($filename); }
function createTestArchiveExport() { global $ilAccess, $ilCtrl; if ($ilAccess->checkAccess("write", "", $this->obj->ref_id)) { include_once "./Modules/Test/classes/class.ilTestArchiver.php"; $test_id = $this->obj->getId(); $archive_exp = new ilTestArchiver($test_id); require_once './Modules/Test/classes/class.ilTestScoring.php'; $scoring = new ilTestScoring($this->obj); $best_solution = $scoring->calculateBestSolutionForTest(); require_once './Modules/Test/classes/class.ilTestPDFGenerator.php'; $generator = new ilTestPDFGenerator(); $generator->generatePDF($best_solution, ilTestPDFGenerator::PDF_OUTPUT_FILE, 'Best_Solution.pdf'); $archive_exp->handInTestBestSolution($best_solution, 'Best_Solution.pdf'); unlink('Best_Solution.pdf'); $archive_exp->updateTestArchive(); $archive_exp->compressTestArchive(); } else { ilUtil::sendInfo("cannot_export_archive", TRUE); } $ilCtrl->redirectByClass('iltestexportgui'); }
/** * @param $userdata * @param $active_id */ public function recalculatePasses($userdata, $active_id) { require_once './Modules/Test/classes/class.ilTestEvaluationGUI.php'; // Below! require_once './Modules/Test/classes/class.ilTestPDFGenerator.php'; require_once './Modules/Test/classes/class.ilTestArchiver.php'; $passes = $userdata->getPasses(); foreach ($passes as $pass => $passdata) { if (is_object($passdata)) { $this->recalculatePass($passdata, $active_id, $pass); if ($this->test->getEnableArchiving()) { // requires out of the loop! $test_evaluation_gui = new ilTestEvaluationGUI($this->test); $overview = $test_evaluation_gui->getPassListOfAnswers($passdata, $active_id, $pass, true, false, false, true); $filename = ilUtil::getWebspaceDir() . '/assessment/scores-' . $this->test->getId() . '-' . $active_id . '-' . $pass . '.pdf'; ilTestPDFGenerator::generatePDF($overview, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); $archiver = new ilTestArchiver($this->test->getId()); $archiver->handInTestResult($active_id, $pass, $filename); unlink($filename); } } } }
/** * Replaces the test-log with the current one. * * @return void */ public function updateTestArchive() { $query = 'SELECT * FROM ass_log WHERE obj_fi = ' . $this->ilDB->quote($this->test_obj_id, 'integer'); $result = $this->ilDB->query($query); $outfile_lines = ''; /** @noinspection PhpAssignmentInConditionInspection */ while ($row = $this->ilDB->fetchAssoc($result)) { $outfile_lines .= "\r\n" . implode("\t", $row); } file_put_contents($this->getTestArchive() . self::DIR_SEP . self::TEST_LOG_FILENAME, $outfile_lines); // Generate test pass overview $test = new ilObjTest($this->test_obj_id, false); $gui = new ilObjTestGUI(); $gui->object = $test; $array_of_actives = array(); $participants = $test->getParticipants(); foreach ($participants as $key => $value) { $array_of_actives[] = $key; } $output_template = $gui->createUserResults(true, false, true, $array_of_actives); require_once 'class.ilTestPDFGenerator.php'; $filename = $this->getTestArchive() . self::DIR_SEP . 'participant_pass_overview.pdf'; ilTestPDFGenerator::generatePDF($output_template->get(), ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); return; }
/** * Review tab to create a print of all questions without points and solutions * * Review tab to create a print of all questions without points and solutions * * @access public */ function reviewobject() { global $ilAccess, $ilias; if (!$ilAccess->checkAccess("write", "", $this->ref_id)) { // allow only write access ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true); $this->ctrl->redirect($this, "infoScreen"); } $this->getQuestionsSubTabs(); $template = new ilTemplate("tpl.il_as_tst_print_test_confirm.html", TRUE, TRUE, "Modules/Test"); $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print"); global $ilUser; $print_date = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")); $max_points = 0; $counter = 1; foreach ($this->object->questions as $question) { $template->setCurrentBlock("question"); $question_gui = $this->object->createQuestionGUI("", $question); $template->setVariable("COUNTER_QUESTION", $counter . "."); $template->setVariable("QUESTION_TITLE", ilUtil::prepareFormOutput($question_gui->object->getTitle())); if ($question_gui->object->getMaximumPoints() == 1) { $template->setVariable("QUESTION_POINTS", $question_gui->object->getMaximumPoints() . " " . $this->lng->txt("point")); } else { $template->setVariable("QUESTION_POINTS", $question_gui->object->getMaximumPoints() . " " . $this->lng->txt("points")); } /** @var $question_gui assQuestionGUI */ //$result_output = $question_gui->getTestOutput('', NULL, FALSE, FALSE, FALSE); $result_output = $question_gui->getPreview(false); if (strlen($result_output) == 0) { $result_output = $question_gui->getPreview(FALSE); } $template->setVariable("SOLUTION_OUTPUT", $result_output); $template->parseCurrentBlock("question"); $counter++; $max_points += $question_gui->object->getMaximumPoints(); } $template->setVariable("TITLE", ilUtil::prepareFormOutput($this->object->getTitle())); $template->setVariable("PRINT_TEST", ilUtil::prepareFormOutput($this->lng->txt("review_view"))); $template->setVariable("TXT_PRINT_DATE", ilUtil::prepareFormOutput($this->lng->txt("date"))); $template->setVariable("VALUE_PRINT_DATE", ilUtil::prepareFormOutput(strftime("%c", $print_date))); $template->setVariable("TXT_MAXIMUM_POINTS", ilUtil::prepareFormOutput($this->lng->txt("tst_maximum_points"))); $template->setVariable("VALUE_MAXIMUM_POINTS", ilUtil::prepareFormOutput($max_points)); if (array_key_exists("pdf", $_GET) && $_GET["pdf"] == 1) { //$this->object->deliverPDFfromHTML($template->get(), $this->object->getTitle()); require_once 'class.ilTestPDFGenerator.php'; $content = $template->get(); ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle()); } else { $this->ctrl->setParameter($this, "pdf", "1"); $template->setCurrentBlock("pdf_export"); $template->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "review")); $this->ctrl->setParameter($this, "pdf", ""); $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export")); $template->parseCurrentBlock(); $template->setCurrentBlock("navigation_buttons"); $template->setVariable("BUTTON_PRINT", $this->lng->txt("print")); $template->parseCurrentBlock(); $this->tpl->setVariable("PRINT_CONTENT", $template->get()); } }
public function show() { require_once 'class.ilTestEvaluationGUI.php'; require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php'; global $ilUser; if (array_key_exists("pass", $_GET) && strlen($_GET["pass"]) > 0 || !is_null($pass)) { if (is_null($pass)) { $pass = $_GET["pass"]; } } $template = new ilTemplate("tpl.il_as_tst_submission_review.html", TRUE, TRUE, "Modules/Test"); $this->ilCtrl->setParameter($this, "crs_show_result", $_GET['crs_show_result']); $this->ilCtrl->setParameter($this, "skipfinalstatement", 1); $template->setVariable("FORMACTION", $this->ilCtrl->getFormAction($this->testOutputGUI, 'redirectBack') . '&reviewed=1'); $template->setVariable("BUTTON_CONTINUE", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_BACK", $this->lng->txt("btn_previous")); $this->ilCtrl->setParameter($this, "pass", ""); $this->ilCtrl->setParameter($this, "pdf", ""); $active = $this->test->getActiveIdOfUser($ilUser->getId()); $testevaluationgui = new ilTestEvaluationGUI($this->test); $results = $this->test->getTestResult($active, $pass); $results_output = $testevaluationgui->getPassListOfAnswers($results, $active, $pass, false, false, false, false); if ($this->test->getShowExamviewPdf()) { $template->setCurrentBlock("pdf_export"); $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export")); $template->setVariable("PDF_IMG_ALT", $this->lng->txt("pdf_export")); $template->setVariable("PDF_IMG_URL", ilUtil::getHtmlPath(ilUtil::getImagePath("application-pdf.png"))); global $ilSetting; $inst_id = $ilSetting->get('inst_id', null); $path = ilUtil::getWebspaceDir() . '/assessment/' . $this->testOutputGUI->object->getId() . '/exam_pdf'; if (!is_dir($path)) { ilUtil::makeDirParents($path); } $filename = $path . '/exam_N' . $inst_id . '-' . $this->testOutputGUI->object->getId() . '-' . $active . '-' . $pass . '.pdf'; require_once 'class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($results_output, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); $template->setVariable("PDF_FILE_LOCATION", $filename); } if ($this->test->getShowExamviewHtml()) { $template->setCurrentBlock('html_review'); $template->setVariable('HTML_REVIEW', $results_output); } $this->tpl->setVariable($this->getContentBlockName(), $template->get()); }
/** * @param $active * * @return void */ protected function archiveParticipantSubmission($active, $pass) { global $ilObjDataCache; require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php'; $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache); $objectivesList = null; if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) { $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($this->testSession->getActiveId(), $this->testSession->getPass()); $testSequence->loadFromDb(); $testSequence->loadQuestions(); require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php'; $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($this->testSession); $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence); $objectivesList->loadObjectivesTitles(); $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($this->testSession->getObjectiveOrientedContainerId()); $testResultHeaderLabelBuilder->setUserId($this->testSession->getUserId()); $testResultHeaderLabelBuilder->setTestObjId($this->object->getId()); $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId()); $testResultHeaderLabelBuilder->initObjectiveOrientedMode(); } $results = $this->object->getTestResult($active, $pass, false, !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()); require_once 'class.ilTestEvaluationGUI.php'; $testevaluationgui = new ilTestEvaluationGUI($this->object); $results_output = $testevaluationgui->getPassListOfAnswers($results, $active, $pass, false, false, false, false, false, $objectivesList, $testResultHeaderLabelBuilder); require_once './Modules/Test/classes/class.ilTestArchiver.php'; global $ilSetting; $inst_id = $ilSetting->get('inst_id', null); $archiver = new ilTestArchiver($this->object->getId()); $path = ilUtil::getWebspaceDir() . '/assessment/' . $this->object->getId() . '/exam_pdf'; if (!is_dir($path)) { ilUtil::makeDirParents($path); } $filename = $path . '/exam_N' . $inst_id . '-' . $this->object->getId() . '-' . $active . '-' . $pass . '.pdf'; require_once 'class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($results_output, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); //$template->setVariable("PDF_FILE_LOCATION", $filename); // Participant submission $archiver->handInParticipantSubmission($active, $pass, $filename, $results_output); //$archiver->handInParticipantMisc( $active, $pass, 'signature_gedoens.sig', $filename ); //$archiver->handInParticipantQuestionMaterial( $active, $pass, 123, 'file_upload.pdf', $filename ); global $ilias; $questions = $this->object->getQuestions(); foreach ($questions as $question_id) { $question_object = $this->object->getQuestionDataset($question_id); if ($question_object->type_tag == 'assFileUpload') { // Pfad: /data/default/assessment/tst_2/14/21/files/file_14_4_1370417414.png // /data/ - klar // /assessment/ - Konvention // /tst_2/ = /tst_<test_id> (ilObjTest) // /14/ = /<active_fi>/ // /21/ = /<question_id>/ (question_object) // /files/ - Konvention // file_14_4_1370417414.png = file_<active_fi>_<pass>_<some timestamp>.<ext> $candidate_path = $ilias->ini_ilias->readVariable('server', 'absolute_path') . ilTestArchiver::DIR_SEP . $ilias->ini_ilias->readVariable('clients', 'path') . ilTestArchiver::DIR_SEP . $ilias->client_id . ilTestArchiver::DIR_SEP . 'assessment' . ilTestArchiver::DIR_SEP . 'tst_' . $this->object->test_id . ilTestArchiver::DIR_SEP . $active . ilTestArchiver::DIR_SEP . $question_id . ilTestArchiver::DIR_SEP . 'files' . ilTestArchiver::DIR_SEP; $handle = opendir($candidate_path); while ($handle !== false && ($file = readdir($handle)) !== false) { if ($file != null) { $filename_start = 'file_' . $active . '_' . $pass . '_'; if (strpos($file, $filename_start) === 0) { $archiver->handInParticipantQuestionMaterial($active, $pass, $question_id, $file, $file); } } } } } $passdata = $this->object->getTestResult($active, $pass, false, !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()); $overview = $testevaluationgui->getPassListOfAnswers($passdata, $active, $pass, true, false, false, true, false, $objectivesList, $testResultHeaderLabelBuilder); $filename = ilUtil::getWebspaceDir() . '/assessment/scores-' . $this->object->getId() . '-' . $active . '-' . $pass . '.pdf'; ilTestPDFGenerator::generatePDF($overview, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); $archiver->handInTestResult($active, $pass, $filename); unlink($filename); return; }
public function show() { require_once 'class.ilTestEvaluationGUI.php'; require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php'; global $ilUser; $template = new ilTemplate("tpl.il_as_tst_submission_review.html", TRUE, TRUE, "Modules/Test"); $this->ilCtrl->setParameter($this, "skipfinalstatement", 1); $template->setVariable("FORMACTION", $this->ilCtrl->getFormAction($this->testOutputGUI, 'redirectBack') . '&reviewed=1'); $template->setVariable("BUTTON_CONTINUE", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_BACK", $this->lng->txt("btn_previous")); if ($this->test->getListOfQuestionsEnd()) { $template->setVariable("CANCEL_CMD", 'outQuestionSummary'); } else { $template->setVariable("CANCEL_CMD", 'backFromSummary'); } $active = $this->test->getActiveIdOfUser($ilUser->getId()); $testevaluationgui = new ilTestEvaluationGUI($this->test); $results = $this->test->getTestResult($active, $this->testSession->getPass()); $results_output = $testevaluationgui->getPassListOfAnswers($results, $active, $this->testSession->getPass(), false, false, false, false); if ($this->test->getShowExamviewPdf()) { $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export")); global $ilSetting; $inst_id = $ilSetting->get('inst_id', null); $path = ilUtil::getWebspaceDir() . '/assessment/' . $this->testOutputGUI->object->getId() . '/exam_pdf'; if (!is_dir($path)) { ilUtil::makeDirParents($path); } $filename = $path . '/exam_N' . $inst_id . '-' . $this->testOutputGUI->object->getId() . '-' . $active . '-' . $this->testSession->getPass() . '.pdf'; require_once 'class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($results_output, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); $template->setVariable("PDF_FILE_LOCATION", $filename); } else { $template->setCurrentBlock('prevent_double_form_subm'); $template->touchBlock('prevent_double_form_subm'); $template->parseCurrentBlock(); } if ($this->test->getShowExamviewHtml()) { if ($this->test->getListOfQuestionsEnd()) { $template->setVariable("CANCEL_CMD_BOTTOM", 'outQuestionSummary'); } else { $template->setVariable("CANCEL_CMD_BOTTOM", 'backFromSummary'); } $template->setVariable("BUTTON_CONTINUE_BOTTOM", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_BACK_BOTTOM", $this->lng->txt("btn_previous")); $template->setVariable('HTML_REVIEW', $results_output); } $this->tpl->setVariable($this->getContentBlockName(), $template->get()); }
/** * Output of the pass overview for a test called by a test participant * * @global ilTabsGUI $ilTabs */ function outUserResultsOverview() { global $ilUser, $ilTabs; $ilTabs->setBackTarget($this->lng->txt('tst_results_back_introduction'), $this->ctrl->getLinkTargetByClass('ilObjTestGUI', 'infoScreen')); $testSession = $this->testSessionFactory->getSession(); $active_id = $testSession->getActiveId(); $user_id = $ilUser->getId(); $uname = $this->object->userLookupFullName($user_id, TRUE); if (!$this->object->canShowTestResults($testSession, $ilUser->getId())) { $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); } $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"); 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, 'outUserResultsOverview')); $this->ctrl->setParameter($this, 'pdf', ''); include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php'; if ($this->object->canShowCertificate($testSession, $user_id, $active_id)) { $toolbar->setCertificateLinkTarget($this->ctrl->getLinkTarget($this, 'outCertificate')); } $toolbar->build(); $templatehead->setVariable('RESULTS_TOOLBAR', $this->ctrl->getHTML($toolbar)); $hide_details = !$this->object->getShowPassDetails(); #if ($hide_details) #{ # $executable = $this->object->isExecutable($testSession, $ilUser->getId()); # if (!$executable["executable"]) $hide_details = FALSE; #} $template->setCurrentBlock("pass_overview"); $overview = $this->getPassOverview($active_id, "iltestevaluationgui", "outUserPassDetails", FALSE, $hide_details); $template->setVariable("PASS_OVERVIEW", $overview); $template->setVariable("TEXT_RESULTS", $this->lng->txt("tst_results_overview")); $template->parseCurrentBlock(); $user_data = $this->getResultsUserdata($testSession, $active_id, TRUE); if ($this->object->getAnonymity()) { $template->setVariable("TEXT_HEADING", $this->lng->txt("tst_result")); } else { $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname)); $template->setVariable("USER_DATA", $user_data); } if ($this->isGradingMessageRequired()) { $template->setCurrentBlock('grading_message'); $template->setVariable('GRADING_MESSAGE', $this->getGradingMessage($active_id)); $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 ($this->isPdfDeliveryRequest()) { //$this->object->deliverPDFfromHTML($template->get(), $this->object->getTitle()); require_once 'class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle()); //$this->object->deliverPDFfromHTML($template->get(), sprintf($this->lng->txt("tst_result_user_name"), $uname)); } else { $this->tpl->setContent($templatehead->get()); } }
/** * @param string $content */ protected function populateContent($content) { if ($this->isPdfDeliveryRequest()) { require_once 'class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($content, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle()); } else { $this->tpl->setContent($content); } }
public function show() { require_once 'class.ilTestEvaluationGUI.php'; require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php'; global $ilUser, $ilObjDataCache; $template = new ilTemplate("tpl.il_as_tst_submission_review.html", TRUE, TRUE, "Modules/Test"); $this->ctrl->setParameter($this, "skipfinalstatement", 1); $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this->testOutputGUI, 'redirectBack') . '&reviewed=1'); $template->setVariable("BUTTON_CONTINUE", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_BACK", $this->lng->txt("btn_previous")); if ($this->object->getListOfQuestionsEnd()) { $template->setVariable("CANCEL_CMD", 'outQuestionSummary'); } else { $template->setVariable("CANCEL_CMD", 'backFromSummary'); } $active = $this->object->getActiveIdOfUser($ilUser->getId()); require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php'; $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache); $objectivesList = null; if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) { $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($this->testSession->getActiveId(), $this->testSession->getPass()); $testSequence->loadFromDb(); $testSequence->loadQuestions(); require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php'; $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($this->testSession); $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence); $objectivesList->loadObjectivesTitles(); $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($this->testSession->getObjectiveOrientedContainerId()); $testResultHeaderLabelBuilder->setUserId($this->testSession->getUserId()); $testResultHeaderLabelBuilder->setTestObjId($this->object->getId()); $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId()); $testResultHeaderLabelBuilder->initObjectiveOrientedMode(); } $results = $this->object->getTestResult($active, $this->testSession->getPass(), false, !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()); $testevaluationgui = new ilTestEvaluationGUI($this->object); $results_output = $testevaluationgui->getPassListOfAnswers($results, $active, $this->testSession->getPass(), false, false, false, false, false, $objectivesList, $testResultHeaderLabelBuilder); if ($this->object->getShowExamviewPdf()) { $template->setCurrentBlock("pdf_export"); $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export")); global $ilSetting; $inst_id = $ilSetting->get('inst_id', null); $path = ilUtil::getWebspaceDir() . '/assessment/' . $this->testOutputGUI->object->getId() . '/exam_pdf'; if (!is_dir($path)) { ilUtil::makeDirParents($path); } $filename = $path . '/exam_N' . $inst_id . '-' . $this->testOutputGUI->object->getId() . '-' . $active . '-' . $this->testSession->getPass() . '.pdf'; require_once 'class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($results_output, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename); $template->setVariable("PDF_FILE_LOCATION", $filename); } if ($this->object->getShowExamviewHtml()) { if ($this->object->getListOfQuestionsEnd()) { $template->setVariable("CANCEL_CMD_BOTTOM", 'outQuestionSummary'); } else { $template->setVariable("CANCEL_CMD_BOTTOM", 'backFromSummary'); } $template->setVariable("BUTTON_CONTINUE_BOTTOM", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_BACK_BOTTOM", $this->lng->txt("btn_previous")); $template->setVariable('HTML_REVIEW', $results_output); } $this->tpl->setVariable($this->getContentBlockName(), $template->get()); }
/** * 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 * * @access public */ function outUserResultsOverview() { global $ilUser, $ilias, $ilLog; $testSession = $this->testSessionFactory->getSession(); if (!$this->object->canShowTestResults($testSession, $ilUser->getId())) { $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); } include_once "./Services/UICore/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 = $testSession->getActiveId(); $hide_details = !$this->object->getShowPassDetails(); if ($hide_details) { $executable = $this->object->isExecutable($testSession, $ilUser->getId()); if (!$executable["executable"]) { $hide_details = FALSE; } } $begin = microtime(true); if ($this->object->getNrOfTries() == 1 && !$hide_details) { $pass = 0; } else { $template->setCurrentBlock("pass_overview"); $overview = $this->getPassOverview($active_id, "iltestevaluationgui", "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"]; } } $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(); include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php'; if (ilRPCServerSettings::getInstance()->isEnabled()) { if ($this->object->canShowCertificate($testSession, $user_id, $active_id)) { $templatehead->setVariable("CERTIFICATE_URL", $this->ctrl->getLinkTarget($this, "outCertificate")); $templatehead->setVariable("CERTIFICATE_TEXT", $this->lng->txt("certificate")); } } $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();"); $statement = $this->getFinalStatement($active_id); $user_data = $this->getResultsUserdata($testSession, $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, "iltestevaluationgui", "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, $this->object->getShowSolutionListComparison()); } else { if ($this->object->getShowSolutionDetails()) { // if this is not commented out, all questions with checkmarks/crosses will be shown // $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, true); } } $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); if ($this->object->getShowExamid()) { $template->setVariable('EXAM_ID', $this->object->getExamId($testSession->getActiveId(), $testSession->getPass())); $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id')); } } if ($this->object->getAnonymity()) { $template->setVariable("TEXT_HEADING", $this->lng->txt("tst_result")); } else { $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) { //$this->object->deliverPDFfromHTML($template->get(), $this->object->getTitle()); require_once 'class.ilTestPDFGenerator.php'; $content = $template->get(); ilTestPDFGenerator::generatePDF($template->get(), ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitle()); //$this->object->deliverPDFfromHTML($template->get(), sprintf($this->lng->txt("tst_result_user_name"), $uname)); } else { $this->tpl->setVariable("PRINT_CONTENT", $templatehead->get()); } }
/** * Creates a HTML representation for the results of a given question in a test * * @param integer $question_id The original id of the question * @param integer $test_id The test id * @return string HTML code of the question results */ public function getQuestionResultForTestUsers($question_id, $test_id) { $foundusers = $this->object->getParticipantsForTestAndQuestion($test_id, $question_id); $output = ""; foreach ($foundusers as $active_id => $passes) { $resultpass = $this->object->_getResultPass($active_id); for ($i = 0; $i < count($passes); $i++) { if ($resultpass !== null && $resultpass == $passes[$i]["pass"]) { $question_gui =& $this->object->createQuestionGUI("", $passes[$i]["qid"]); $output .= $this->getResultsHeadUserAndPass($active_id, $resultpass + 1); $output .= $question_gui->getSolutionOutput($active_id, $resultpass, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE); $output .= "<br /><br /><br />"; } } } require_once './Modules/Test/classes/class.ilTestPDFGenerator.php'; ilTestPDFGenerator::generatePDF($output, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $question_gui->object->getTitle()); }