/** * Clone object dependencies (start objects, preconditions) * * @access public * @param int target ref id of new course * @param int copy id * */ public function cloneDependencies($a_target_id, $a_copy_id) { parent::cloneDependencies($a_target_id, $a_copy_id); // Clone course start objects include_once 'Services/Container/classes/class.ilContainerStartObjects.php'; $start = new ilContainerStartObjects($this->getRefId(), $this->getId()); $start->cloneDependencies($a_target_id, $a_copy_id); // Clone course item settings include_once 'Services/Object/classes/class.ilObjectActivation.php'; ilObjectActivation::cloneDependencies($this->getRefId(), $a_target_id, $a_copy_id); include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php'; ilLOSettings::cloneSettings($a_copy_id, $this->getId(), ilObject::_lookupObjId($a_target_id)); // Clone course learning objectives include_once 'Modules/Course/classes/class.ilCourseObjective.php'; $crs_objective = new ilCourseObjective($this); $crs_objective->ilClone($a_target_id, $a_copy_id); return true; }
/** * 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; }
/** * 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'); }
/** * 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; }
/** * Check if current run is a start object run * @param ilTestSession $session * @return boolean */ protected function isQualifiedStartRun(ilTestSession $session) { if ($session->getRefId() == $this->getSettings()->getInitialTest()) { $GLOBALS['ilLog']->write(__METHOD__ . ': is intial'); return false; } if ($session->getRefId() != $this->getSettings()->getQualifiedTest()) { $GLOBALS['ilLog']->write(__METHOD__ . ': is not qualified'); return false; } include_once './Services/Container/classes/class.ilContainerStartObjects.php'; if (!ilContainerStartObjects::isStartObject($this->getContainerId(), $session->getRefId())) { $GLOBALS['ilLog']->write(__METHOD__ . ': no start object'); return false; } // Check if start object is fullfilled $container_ref_ids = ilObject::_getAllReferences($this->getContainerId()); $container_ref_id = end($container_ref_ids); $start = new ilContainerStartObjects($container_ref_id, $this->getContainerId()); if ($start->isFullfilled($this->getUserId(), $session->getRefId())) { $GLOBALS['ilLog']->write(__METHOD__ . ': is fullfilled'); return false; } $GLOBALS['ilLog']->write(__METHOD__ . ': is not fullfilled'); return true; }