Example #1
0
 /**
  * Apply auto generated setttings template
  * @param ilObjTest $tst
  */
 protected function applySettingsTemplate(ilObjTest $tst)
 {
     include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
     include_once './Modules/Test/classes/class.ilObjAssessmentFolderGUI.php';
     $tpl_id = 0;
     foreach (ilSettingsTemplate::getAllSettingsTemplates('tst', true) as $nr => $template) {
         switch ($this->getTestType()) {
             case self::TEST_TYPE_IT:
                 if ($template['title'] == self::SETTINGS_TEMPLATE_IT) {
                     $tpl_id = $template['id'];
                 }
                 break;
             case self::TEST_TYPE_QT:
                 if ($template['title'] == self::SETTINGS_TEMPLATE_QT) {
                     $tpl_id = $template['id'];
                 }
                 break;
         }
         if ($tpl_id) {
             break;
         }
     }
     if (!$tpl_id) {
         return false;
     }
     include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
     include_once './Modules/Test/classes/class.ilObjAssessmentFolderGUI.php';
     $template = new ilSettingsTemplate($tpl_id, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
     $template_settings = $template->getSettings();
     if ($template_settings) {
         include_once './Modules/Test/classes/class.ilObjTestGUI.php';
         $tst_gui = new ilObjTestGUI();
         $tst_gui->applyTemplate($template_settings, $tst);
     }
     $tst->setTemplate($tpl_id);
     return true;
 }
 /**
  * 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;
 }
Example #3
0
     require_once "./Modules/Forum/classes/class.ilObjForumGUI.php";
     $target_thread = $target_arr[2];
     $target_posting = $target_arr[3];
     ilObjForumGUI::_goto($target_id, $target_thread, $target_posting);
     break;
     // please migrate to default branch implementation
 // please migrate to default branch implementation
 case "exc":
     require_once "./Modules/Exercise/classes/class.ilObjExerciseGUI.php";
     ilObjExerciseGUI::_goto($target_id);
     break;
     // please migrate to default branch implementation
 // please migrate to default branch implementation
 case "tst":
     require_once "./Modules/Test/classes/class.ilObjTestGUI.php";
     ilObjTestGUI::_goto($target_id);
     break;
     // please migrate to default branch implementation
 // please migrate to default branch implementation
 case "qpl":
     require_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPoolGUI.php";
     ilObjQuestionPoolGUI::_goto($target_id);
     break;
     // please migrate to default branch implementation
 // please migrate to default branch implementation
 case "spl":
     require_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPoolGUI.php";
     ilObjSurveyQuestionPoolGUI::_goto($target_id);
     break;
     // please migrate to default branch implementation
 // please migrate to default branch implementation