Exemplo n.º 1
0
 /**
  * Update start objects
  * Depends on course objective settings
  * 
  * @param ilContainerStartObjects
  */
 public function updateStartObjects(ilContainerStartObjects $start)
 {
     switch ($this->getType()) {
         case self::LOC_INITIAL_ALL:
             if ($start->exists($this->getQualifiedTest())) {
                 $start->deleteItem($this->getQualifiedTest());
             }
             if (!$start->exists($this->getInitialTest())) {
                 $start->add($this->getInitialTest());
             }
             break;
         case self::LOC_INITIAL_SEL:
         case self::LOC_PRACTISE:
             if ($start->exists($this->getQualifiedTest())) {
                 $start->deleteItem($this->getQualifiedTest());
             }
             if ($start->exists($this->getInitialTest())) {
                 $start->deleteItem($this->getInitialTest());
             }
             break;
         case self::LOC_QUALIFIED:
             if (!$start->exists($this->getQualifiedTest())) {
                 $start->add($this->getQualifiedTest());
             }
             if ($start->exists($this->getInitialTest())) {
                 $start->deleteItem($this->getInitialTest());
             }
             break;
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Update start objects
  * Depends on course objective settings
  * 
  * @param ilContainerStartObjects
  */
 public function updateStartObjects(ilContainerStartObjects $start)
 {
     if ($this->getInitialTestType() != self::TYPE_INITIAL_NONE) {
         if ($start->exists($this->getQualifiedTest())) {
             $start->deleteItem($this->getQualifiedTest());
         }
     }
     switch ($this->getInitialTestType()) {
         case self::TYPE_INITIAL_PLACEMENT_ALL:
         case self::TYPE_INITIAL_QUALIFYING_ALL:
             if ($this->isInitialTestStart()) {
                 if (!$start->exists($this->getInitialTest())) {
                     $start->add($this->getInitialTest());
                 }
             } else {
                 if ($start->exists($this->getInitialTest())) {
                     $start->deleteItem($this->getInitialTest());
                 }
             }
             break;
         case self::TYPE_INITIAL_NONE:
             if ($start->exists($this->getInitialTest())) {
                 $start->deleteItem($this->getInitialTest());
             }
             break;
         default:
             if ($start->exists($this->getInitialTest())) {
                 $start->deleteItem($this->getInitialTest());
             }
             break;
     }
     switch ($this->getQualifyingTestType()) {
         case self::TYPE_QUALIFYING_ALL:
             if ($this->isQualifyingTestStart()) {
                 if (!$start->exists($this->getQualifiedTest())) {
                     $start->add($this->getQualifiedTest());
                 }
             }
             break;
         default:
             if ($start->exists($this->getQualifiedTest())) {
                 $start->deleteItem($this->getQualifiedTest());
             }
             break;
     }
     return TRUE;
 }
Exemplo n.º 3
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');
 }