protected function checkSCORMPreconditions() { include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; if (count(ilConditionHandler::_getConditionsOfTrigger('sahs', $this->obj_id))) { return true; } return false; }
/** * test preconditions * @param * @return */ public function testConditions() { include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; ilConditionHandler::_getDistinctTargetRefIds(); ilConditionHandler::_deleteTargetConditionsByRefId(1); $handler = new ilConditionHandler(); $handler->setTargetRefId(99999); $handler->setTargetObjId(99998); $handler->setTargetType('xxx'); $handler->setTriggerRefId(99997); $handler->setTriggerObjId(99996); $handler->setTriggerType('yyy'); $handler->setReferenceHandlingType(0); $handler->enableAutomaticValidation(false); $suc = $handler->storeCondition(); $this->assertEquals($suc, true); $suc = $handler->checkExists(); $this->assertEquals($suc, false); $suc = $handler->delete(99999); $this->assertEquals($suc, true); // syntax check $handler->deleteByObjId(-1); $handler->deleteCondition(-1); ilConditionHandler::_getConditionsOfTrigger(-1, -1); ilConditionHandler::_getConditionsOfTarget(-1, -1); ilConditionHandler::_getCondition(-1); }
function _checkSCORMPreconditions($a_obj_id) { global $ilObjDataCache; if ($ilObjDataCache->lookupType($a_obj_id) != 'sahs') { return false; } include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; if (count($conditions = ilConditionHandler::_getConditionsOfTrigger('sahs', $a_obj_id))) { return true; } return false; }
/** * Get courses/groups that are assigned to the same membership limitation * * @param object container object * @return array array of reference ids */ function _getGroupingItems($container_obj) { global $tree, $ilObjDataCache, $ilAccess, $tree; include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; $trigger_ids = array(); foreach (ilConditionHandler::_getConditionsOfTarget($container_obj->getRefId(), $container_obj->getId(), $container_obj->getType()) as $condition) { if ($condition['operator'] == 'not_member') { $trigger_ids[] = $condition['trigger_obj_id']; } } if (!count($trigger_ids)) { return false; } $hash_table = array(); foreach ($trigger_ids as $trigger_id) { foreach (ilConditionHandler::_getConditionsOfTrigger('crsg', $trigger_id) as $condition) { // Continue if trigger is deleted if ($tree->isDeleted($condition['target_ref_id'])) { continue; } if ($condition['operator'] == 'not_member') { if (!$hash_table[$condition['target_ref_id']]) { $items[] = $condition['target_ref_id']; } $hash_table[$condition['target_ref_id']] = true; } } } return $items ? $items : array(); }