/**
  * 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());
     }
 }
Exemplo n.º 2
0
 /**
  * @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;
     }
 }
Exemplo n.º 3
0
 /**
  * @return ilTestResultsToolbarGUI
  */
 protected function buildUserTestResultsToolbarGUI()
 {
     require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
     $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng);
     $toolbar->setSkillResultButtonEnabled($this->object->isSkillServiceToBeConsidered());
     return $toolbar;
 }