/**
  * @param ilPropertyFormGUI $form
  */
 private function saveResultMiscOptionsSettings(ilPropertyFormGUI $form)
 {
     // result filter taxonomies
     if ($this->testQuestionSetConfigFactory->getQuestionSetConfig()->isResultTaxonomyFilterSupported()) {
         if (!$this->isHiddenFormItem('results_tax_filters') && count($this->getAvailableTaxonomyIds())) {
             $this->testOBJ->setResultFilterTaxIds(array_intersect($this->getAvailableTaxonomyIds(), $form->getItemByPostVar('results_tax_filters')->getValue()));
         }
     }
     if ($this->formPropertyExists($form, 'anonymity')) {
         // anonymity setting
         $this->testOBJ->setAnonymity($form->getItemByPostVar('anonymity')->getValue());
     }
     if ($this->formPropertyExists($form, 'enable_archiving')) {
         // Archiving
         if ($this->testOBJ->getAnonymity() == true && $form->getItemByPostVar('enable_archiving')->getChecked() == true) {
             $this->testOBJ->setEnableArchiving(false);
             ilUtil::sendInfo($this->lng->txt('no_archive_on_anonymous'), true);
         } else {
             $this->testOBJ->setEnableArchiving($form->getItemByPostVar('enable_archiving')->getChecked());
         }
     }
 }
 private function cleanupTestSettings()
 {
     $this->testOBJ->setResultFilterTaxIds(array());
     $this->testOBJ->saveToDb(true);
 }
 private function performSaveForm(ilPropertyFormGUI $form)
 {
     if ($this->areScoringSettingsWritable()) {
         if (!$this->isHiddenFormItem('count_system')) {
             $this->testOBJ->setCountSystem($form->getItemByPostVar('count_system')->getValue());
         }
         if (!$this->isHiddenFormItem('mc_scoring')) {
             $this->testOBJ->setMCScoring($form->getItemByPostVar('mc_scoring')->getValue());
         }
         if (!$this->isHiddenFormItem('score_cutting')) {
             $this->testOBJ->setScoreCutting($form->getItemByPostVar('score_cutting')->getValue());
         }
         if (!$this->isHiddenFormItem('pass_scoring')) {
             $this->testOBJ->setPassScoring($form->getItemByPostVar('pass_scoring')->getValue());
         }
     }
     if (!$this->isHiddenFormItem('results_access_enabled')) {
         if ($form->getItemByPostVar('results_access_enabled')->getChecked()) {
             $this->testOBJ->setScoreReporting($form->getItemByPostVar('results_access_setting')->getValue());
             if ($this->testOBJ->getScoreReporting() == REPORT_AFTER_DATE) {
                 $this->testOBJ->setReportingDate($form->getItemByPostVar('reporting_date')->getDate()->get(IL_CAL_FKT_DATE, 'YmdHis'));
             } else {
                 $this->testOBJ->setReportingDate('');
             }
             $this->testOBJ->setShowPassDetails($form->getItemByPostVar('pass_details')->getChecked());
         } else {
             $this->testOBJ->setScoreReporting(4);
             // never
             $this->testOBJ->setShowPassDetails(false);
             $this->testOBJ->setReportingDate('');
         }
     }
     if (!$this->isHiddenFormItem('show_result_grading')) {
         $this->testOBJ->setShowGradingStatusEnabled($form->getItemByPostVar('grading_status')->getChecked());
         $this->testOBJ->setShowGradingMarkEnabled((int) $form->getItemByPostVar('grading_mark')->getChecked());
     }
     if (!$this->isHiddenFormItem('solution_details')) {
         if ($form->getItemByPostVar('solution_details')->getChecked()) {
             $this->testOBJ->setShowSolutionDetails(1);
             $this->testOBJ->setPrintBestSolutionWithResult((int) $form->getItemByPostVar('print_bs_with_res')->getChecked());
         } else {
             $this->testOBJ->setShowSolutionDetails(0);
             $this->testOBJ->setPrintBestSolutionWithResult(0);
         }
     }
     if (!$this->isHiddenFormItem('solution_printview')) {
         if ($form->getItemByPostVar('solution_printview')->getChecked()) {
             $this->testOBJ->setShowSolutionPrintview(1);
             $this->testOBJ->setShowSolutionListComparison((bool) $form->getItemByPostVar('solution_compare')->getChecked());
             $this->testOBJ->setShowSolutionAnswersOnly((int) $form->getItemByPostVar('solution_answers_only')->getChecked());
         } else {
             $this->testOBJ->setShowSolutionPrintview(0);
             $this->testOBJ->setShowSolutionListComparison(false);
             $this->testOBJ->setShowSolutionAnswersOnly(0);
         }
     }
     if (!$this->isHiddenFormItem('solution_feedback')) {
         $this->testOBJ->setShowSolutionFeedback($form->getItemByPostVar('solution_feedback')->getChecked());
     }
     if (!$this->isHiddenFormItem('solution_signature')) {
         $this->testOBJ->setShowSolutionSignature($form->getItemByPostVar('solution_signature')->getChecked());
     }
     if (!$this->isHiddenFormItem('examid_in_test_res')) {
         $this->testOBJ->setShowExamIdInTestResultsEnabled($form->getItemByPostVar('examid_in_test_res')->getChecked());
     }
     if (!$this->isHiddenFormItem('solution_suggested')) {
         $this->testOBJ->setShowSolutionSuggested($form->getItemByPostVar('solution_suggested')->getChecked());
     }
     if (!$this->isHiddenFormItem('exp_sc_short')) {
         $this->testOBJ->setExportSettingsSingleChoiceShort((int) $form->getItemByPostVar('exp_sc_short')->getChecked());
     }
     if (!$this->isHiddenFormItem('pass_deletion_allowed')) {
         $this->testOBJ->setPassDeletionAllowed((bool) $form->getItemByPostVar('pass_deletion_allowed')->getValue());
     }
     // result filter taxonomies
     if ($this->testQuestionSetConfigFactory->getQuestionSetConfig()->isResultTaxonomyFilterSupported()) {
         if (!$this->isHiddenFormItem('results_tax_filters') && count($this->getAvailableTaxonomyIds())) {
             $this->testOBJ->setResultFilterTaxIds(array_intersect($this->getAvailableTaxonomyIds(), $form->getItemByPostVar('results_tax_filters')->getValue()));
         }
     }
     if (!$this->isHiddenFormItem('anonymity')) {
         // anonymity setting
         $this->testOBJ->setAnonymity($form->getItemByPostVar('anonymity')->getValue());
     }
     if (!$this->isHiddenFormItem('enable_archiving')) {
         // Archiving
         if ($this->testOBJ->getAnonymity() == true && $form->getItemByPostVar('enable_archiving')->getChecked() == true) {
             $this->testOBJ->setEnableArchiving(false);
             ilUtil::sendInfo($this->lng->txt('no_archive_on_anonymous'), true);
         } else {
             $this->testOBJ->setEnableArchiving($form->getItemByPostVar('enable_archiving')->getChecked());
         }
     }
     if (!$this->isHiddenFormItem('highscore_enabled')) {
         // highscore settings
         $this->testOBJ->setHighscoreEnabled((bool) $form->getItemByPostVar('highscore_enabled')->getChecked());
         $this->testOBJ->setHighscoreAnon((bool) $form->getItemByPostVar('highscore_anon')->getChecked());
         $this->testOBJ->setHighscoreAchievedTS((bool) $form->getItemByPostVar('highscore_achieved_ts')->getChecked());
         $this->testOBJ->setHighscoreScore((bool) $form->getItemByPostVar('highscore_score')->getChecked());
         $this->testOBJ->setHighscorePercentage((bool) $form->getItemByPostVar('highscore_percentage')->getChecked());
         $this->testOBJ->setHighscoreHints((bool) $form->getItemByPostVar('highscore_hints')->getChecked());
         $this->testOBJ->setHighscoreWTime((bool) $form->getItemByPostVar('highscore_wtime')->getChecked());
         $this->testOBJ->setHighscoreMode((int) $form->getItemByPostVar('highscore_mode')->getValue());
         $this->testOBJ->setHighscoreTopNum((int) $form->getItemByPostVar('highscore_top_num')->getValue());
     }
     // store settings to db
     $this->testOBJ->saveToDb(true);
 }