예제 #1
0
 /**
  * Delete test assignment
  */
 protected function deleteTest()
 {
     $this->setTestType((int) $_REQUEST['tt']);
     $this->ctrl->setParameter($this, 'tt', $this->getTestType());
     $settings = ilLOSettings::getInstanceByObjId($this->getParentObject()->getId());
     switch ($this->getTestType()) {
         case ilLOSettings::TYPE_TEST_INITIAL:
             $GLOBALS['ilTabs']->activateSubTab('itest');
             break;
         case ilLOSettings::TYPE_TEST_QUALIFIED:
             $GLOBALS['ilTabs']->activateSubTab('qtest');
             break;
     }
     foreach ((array) $_REQUEST['tst'] as $tst_id) {
         switch ($this->getTestType()) {
             case ilLOSettings::TYPE_TEST_INITIAL:
                 $settings->setInitialTest(0);
                 break;
             case ilLOSettings::TYPE_TEST_QUALIFIED:
                 $settings->setQualifiedTest(0);
                 break;
         }
         $settings->update();
         // finally delete start object assignment
         include_once './Services/Container/classes/class.ilContainerStartObjects.php';
         $start = new ilContainerStartObjects($this->getParentObject()->getRefId(), $this->getParentObject()->getId());
         $start->deleteItem($tst_id);
         // ... and assigned questions
         include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
         ilCourseObjectiveQuestion::deleteTest($tst_id);
     }
     ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
     $this->ctrl->redirect($this, 'testOverview');
 }