Пример #1
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;
     }
 }
Пример #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)
 {
     $template = new ilTemplate("tpl.il_as_tst_participants_result_output.html", TRUE, TRUE, "Modules/Test");
     include_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
     $serviceGUI = new ilTestServiceGUI($this->object);
     $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), $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();
     }
     $template->setVariable("BACK_TEXT", $this->lng->txt("back"));
     $template->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "participants"));
     $template->setVariable("PRINT_TEXT", $this->lng->txt("print"));
     $template->setVariable("PRINT_URL", "javascript:window.print();");
     return $template;
 }