protected function checkSCORMPreconditions() { include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; if (count(ilConditionHandler::_getConditionsOfTrigger('sahs', $this->obj_id))) { return true; } return false; }
public function preload() { global $objDefinition, $tree, $ilObjDataCache, $ilUser, $rbacsystem; if (!$this->obj_ids) { return; } $this->obj_ids = array_unique($this->obj_ids); $this->types = array_unique($this->types); if ($this->ref_ids) { $this->ref_ids = array_unique($this->ref_ids); } // type specific preloads include_once "./Services/AccessControl/classes/class.ilConditionHandler.php"; foreach ($this->types as $type) { $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]); if (is_array($this->ref_ids_by_type[$type])) { $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]); } if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) { ilConditionHandler::preloadConditionsForTargetRecords($type, $this->obj_ids_by_type[$type]); } $class = $objDefinition->getClassName($type); $location = $objDefinition->getLocation($type); if ($class && $location) { $full_class = "ilObj" . $class . "Access"; include_once $location . "/class." . $full_class . ".php"; if (class_exists($full_class)) { call_user_func(array($full_class, "_preloadData"), $this->obj_ids_by_type[$type], $this->ref_ids_by_type[$type]); } } } if ($this->ref_ids) { $tree->preloadDeleted($this->ref_ids); $tree->preloadDepthParent($this->ref_ids); $ilObjDataCache->preloadReferenceCache($this->ref_ids, false); $rbacsystem->preloadRbacPaCache($this->ref_ids, $ilUser->getId()); if ($ilUser->getId != ANONYMOUS_USER_ID && $this->context != ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP) { ilObjUser::preloadIsDesktopItem($ilUser->getId(), $this->ref_ids); } include_once "./Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::preloadData($this->ref_ids); } include_once "./Services/Object/classes/class.ilObjectListGUI.php"; ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context); if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) { include_once "./Services/Rating/classes/class.ilRating.php"; include_once "./Services/Rating/classes/class.ilRatingGUI.php"; ilRating::preloadListGUIData($this->obj_ids); include_once "./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php"; ilAdvancedMDValues::preloadByObjIds($this->obj_ids); } if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) { include_once "./Services/Tracking/classes/class.ilLPStatus.php"; ilLPStatus::preloadListGUIData($this->obj_ids); } }
function moveObject($sid, $ref_id, $target_id) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } include_once './webservice/soap/classes/class.ilSoapUtils.php'; global $rbacreview, $rbacadmin, $objDefinition, $rbacsystem, $lng, $ilUser, $tree; // does source object exist if (!($source_object_type = ilObjectFactory::getTypeByRefId($ref_id, false))) { return $this->__raiseError('No valid source given.', 'Client'); } // does target object exist if (!($target_object_type = ilObjectFactory::getTypeByRefId($target_id, false))) { return $this->__raiseError('No valid target given.', 'Client'); } // check for trash if (ilObject::_isInTrash($ref_id)) { return $this->__raiseError('Object is trashed.', 'Client'); } if (ilObject::_isInTrash($target_id)) { return $this->__raiseError('Object is trashed.', 'Client'); } $canAddType = $this->canAddType($source_object_type, $target_object_type, $target_id); if ($this->isFault($canAddType)) { return $canAddType; } // check if object already linked to target $possibleChilds = $tree->getChildsByType($target_id, $ref_id); foreach ($possibleChilds as $child) { if ($child["obj_id"] == $ref_id) { return $this->__raiseError("Object already exists in target.", "Client"); } } // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF if ($tree->isGrandChild($ref_id, $target_id)) { return $this->__raiseError("Cannot move object into itself.", "Client"); } $old_parent = $tree->getParentId($ref_id); $tree->moveTree($ref_id, $target_id); $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent); include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; ilConditionHandler::_adjustMovedObjectConditions($ref_id); return true; }
function showChilds($a_ref_id, $a_obj_id = 0) { global $rbacsystem; if ($a_ref_id == 0) { return true; } if (!ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id, $a_obj_id)) { return false; } if ($rbacsystem->checkAccess("read", $a_ref_id)) { return true; } else { return false; } }
/** * Clone object dependencies * * This method allows to refresh any ref id references to other objects * that are affected in the same copy process. Ask ilCopyWizardOptions for * the mappings. * * @access public * @param int ref_id of target object * @param int copy_id * */ public function cloneDependencies($a_target_id, $a_copy_id) { include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php'; $cwo = ilCopyWizardOptions::_getInstance($a_copy_id); $mappings = $cwo->getMappings(); $conditions = ilConditionHandler::_getConditionsOfTarget($this->getRefId(), $this->getId()); foreach ($conditions as $con) { if ($mappings[$con['trigger_ref_id']]) { $newCondition = new ilConditionHandler(); $target_obj = ilObject::_lookupObjId($a_target_id); $target_typ = ilObject::_lookupType($target_obj); $newCondition->setTargetRefId($a_target_id); $newCondition->setTargetObjId($target_obj); $newCondition->setTargetType($target_typ); $trigger_ref = $mappings[$con['trigger_ref_id']]; $trigger_obj = ilObject::_lookupObjId($trigger_ref); $trigger_typ = ilObject::_lookupType($trigger_obj); $newCondition->setTriggerRefId($trigger_ref); $newCondition->setTriggerObjId($trigger_obj); $newCondition->setTriggerType($trigger_typ); $newCondition->setOperator($con['operator']); $newCondition->setValue($con['value']); $newCondition->setReferenceHandlingType($con['ref_handling']); $newCondition->setObligatory($con['obligatory']); $newCondition->storeCondition(); } } return true; }
/** * @param int $ref_id */ public static function ensureCorrectPublicChatroomTreeLocation($ref_id) { /** * @var $tree ilTree * @var $ilDB ilDB * @var $rbacadmin ilRbacAdmin */ global $tree, $ilDB, $rbacadmin; $ilDB->setLimit(1); $query = "\n\t\t\tSELECT object_data.obj_id, object_reference.ref_id\n\t\t\tFROM object_data\n\t\t\tINNER JOIN object_reference ON object_reference.obj_id = object_data.obj_id\n\t\t\tWHERE type = " . $ilDB->quote('chta', 'text'); $rset = $ilDB->query($query); $row = $ilDB->fetchAssoc($rset); $chatfolder_ref_id = $row['ref_id']; $pid = $tree->getParentId($ref_id); if ($chatfolder_ref_id && $pid != $chatfolder_ref_id && !$tree->isDeleted($chatfolder_ref_id)) { $tree->moveTree($ref_id, $chatfolder_ref_id); $rbacadmin->adjustMovedObjectPermissions($ref_id, $pid); include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; ilConditionHandler::_adjustMovedObjectConditions($ref_id); } }
/** * inititialize new item * * @param int $a_ref_id reference id * @param int $a_obj_id object id * @param string $a_title title * @param string $a_description description */ function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "") { global $ilBench; parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description); $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id, $this->obj_id); }
protected function addItemDetails(ilObjectListGUI $a_item_list_gui, array $a_item) { global $lng, $ilCtrl; $item_ref_id = $a_item["ref_id"]; if (is_array($this->objective_map)) { $details = array(); if (isset($this->objective_map["material"][$item_ref_id])) { // #12965 foreach ($this->objective_map["material"][$item_ref_id] as $objective_id) { $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $objective_id); $url = $ilCtrl->getLinkTargetByClass(array('illoeditorgui', 'ilcourseobjectivesgui'), 'edit'); $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', ''); $details[] = array('desc' => $lng->txt('crs_loc_tab_materials') . ': ', 'target' => '_top', 'link' => $url, 'name' => $this->objective_map["names"][$objective_id]); } } if ($this->objective_map["test_i"] == $item_ref_id) { $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1); $details[] = array('desc' => '', 'target' => '_top', 'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'), 'name' => $lng->txt('crs_loc_tab_itest')); $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0); } if ($this->objective_map["test_q"] == $item_ref_id) { $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2); $details[] = array('desc' => '', 'target' => '_top', 'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'), 'name' => $lng->txt('crs_loc_tab_qtest')); $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0); } // #15367 - patch LOK if (is_array($this->objective_map["test_ass"][$item_ref_id])) { foreach ($this->objective_map["test_ass"][$item_ref_id] as $type => $items) { if ($type == ilLOSettings::TYPE_TEST_INITIAL) { $caption = $lng->txt('crs_loc_tab_itest'); $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1); } else { $caption = $lng->txt('crs_loc_tab_qtest'); $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2); } foreach ($items as $objtv_title) { $details[] = array('desc' => '', 'target' => '_top', 'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testsOverview'), 'name' => $caption . " (" . $this->lng->txt("crs_loc_learning_objective") . ": " . $objtv_title . ")"); } $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0); } } if (sizeof($details)) { $a_item_list_gui->enableItemDetailLinks(true); $a_item_list_gui->setItemDetailLinks($details, $lng->txt('crs_loc_settings_tbl') . ': '); } else { $a_item_list_gui->enableItemDetailLinks(false); } } // order if ($this->getContainerGUI()->isActiveOrdering()) { $a_item_list_gui->enableCommands(true, true); $a_item_list_gui->enableProperties(false); } else { if (!$this->getContainerGUI()->isActiveAdministrationPanel()) { $a_item_list_gui->enableCommands(true, true); $a_item_list_gui->enableProperties(false); } } if ($a_item['objective_id']) { $a_item_list_gui->setDefaultCommandParameters(array('objective_id' => $a_item['objective_id'])); if ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) { $a_item_list_gui->setConditionTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj'); // check conditions of target include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; $fullfilled = ilConditionHandler::_checkAllConditionsOfTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj'); if (!$fullfilled || $a_item['objective_status']) { $a_item_list_gui->disableTitleLink(true); } } include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php'; $res = ilLOUserResults::lookupResult($this->getContainerObject()->getId(), $GLOBALS['ilUser']->getId(), $a_item['objective_id'], ilLOUserResults::TYPE_QUALIFIED); $res = $this->updateResult($res, $a_item['ref_id'], $a_item['objective_id'], $GLOBALS['ilUser']->getId()); if ($res['is_final']) { $a_item_list_gui->disableTitleLink(true); $a_item_list_gui->enableProperties(true); $a_item_list_gui->addCustomProperty($this->lng->txt('crs_loc_passes_reached'), '', true); } elseif ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) { include_once './Modules/Course/classes/class.ilCourseObjective.php'; $poss_pass = ilCourseObjective::lookupMaxPasses($a_item['objective_id']); if ($poss_pass) { $a_item_list_gui->enableProperties(true); $a_item_list_gui->addCustomProperty($this->lng->txt('crs_loc_passes_left'), $poss_pass - $res['tries'] > 0 ? $poss_pass - $res['tries'] : 1, false); } } } }
/** * Get subitems of container * * @param bool administration panel enabled * @param bool side blocks enabled * * @return array */ function getSubItems($a_admin_panel_enabled = false, $a_include_side_block = false, $a_get_single = 0) { global $objDefinition, $ilBench, $tree, $ilObjDataCache, $ilUser, $rbacsystem, $ilSetting; // Caching if (is_array($this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]) && !$a_get_single) { return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]; } $type_grps = $this->getGroupedObjTypes(); $objects = $tree->getChilds($this->getRefId(), "title"); // using long descriptions? $short_desc = $ilSetting->get("rep_shorten_description"); $short_desc_max_length = $ilSetting->get("rep_shorten_description_length"); if (!$short_desc || $short_desc_max_length != ilObject::TITLE_LENGTH) { // using (part of) shortened description if ($short_desc && $short_desc_max_length && $short_desc_max_length < ilObject::TITLE_LENGTH) { foreach ($objects as $key => $object) { $objects[$key]["description"] = ilUtil::shortenText($object["description"], $short_desc_max_length, true); } } else { $obj_ids = array(); foreach ($objects as $key => $object) { $obj_ids[] = $object["obj_id"]; } if (sizeof($obj_ids)) { $long_desc = ilObject::getLongDescriptions($obj_ids); foreach ($objects as $key => $object) { if ($short_desc && $short_desc_max_length) { $long_desc[$object["obj_id"]] = ilUtil::shortenText($long_desc[$object["obj_id"]], $short_desc_max_length, true); } $objects[$key]["description"] = $long_desc[$object["obj_id"]]; } } } } $found = false; $all_obj_types = array(); $all_ref_ids = array(); $all_obj_ids = array(); include_once 'Services/Container/classes/class.ilContainerSorting.php'; $sort = ilContainerSorting::_getInstance($this->getId()); // TODO: check this // get items attached to a session include_once './Modules/Session/classes/class.ilEventItems.php'; $event_items = ilEventItems::_getItemsOfContainer($this->getRefId()); foreach ($objects as $key => $object) { if ($a_get_single > 0 && $object["child"] != $a_get_single) { continue; } // hide object types in devmode if ($objDefinition->getDevMode($object["type"]) || $object["type"] == "adm" || $object["type"] == "rolf") { continue; } // remove inactive plugins if ($objDefinition->isInactivePlugin($object["type"])) { continue; } // BEGIN WebDAV: Don't display hidden Files, Folders and Categories if (in_array($object['type'], array('file', 'fold', 'cat'))) { include_once 'Modules/File/classes/class.ilObjFileAccess.php'; if (ilObjFileAccess::_isFileHidden($object['title'])) { $this->setHiddenFilesFound(true); if (!$a_admin_panel_enabled) { continue; } } } // END WebDAV: Don't display hidden Files, Folders and Categories // filter out items that are attached to an event if (in_array($object['ref_id'], $event_items)) { continue; } // filter side block items if (!$a_include_side_block && $objDefinition->isSideBlock($object['type'])) { continue; } $all_obj_types[$object["type"]] = $object["type"]; $obj_ids_of_type[$object["type"]][] = $object["obj_id"]; $ref_ids_of_type[$object["type"]][] = $object["child"]; $all_ref_ids[] = $object["child"]; $all_obj_ids[] = $object["obj_id"]; } // data preloader if (!self::$data_preloaded && sizeof($all_ref_ids)) { // type specific preloads foreach ($all_obj_types as $t) { // condition handler: preload conditions include_once "./Services/AccessControl/classes/class.ilConditionHandler.php"; ilConditionHandler::preloadConditionsForTargetRecords($t, $obj_ids_of_type[$t]); $class = $objDefinition->getClassName($t); $location = $objDefinition->getLocation($t); $full_class = "ilObj" . $class . "Access"; include_once $location . "/class." . $full_class . ".php"; call_user_func(array($full_class, "_preloadData"), $obj_ids_of_type[$t], $ref_ids_of_type[$t]); } // general preloads $tree->preloadDeleted($all_ref_ids); $tree->preloadDepthParent($all_ref_ids); $ilObjDataCache->preloadReferenceCache($all_ref_ids, false); ilObjUser::preloadIsDesktopItem($ilUser->getId(), $all_ref_ids); $rbacsystem->preloadRbacPaCache($all_ref_ids, $ilUser->getId()); include_once "./Services/Object/classes/class.ilObjectListGUI.php"; ilObjectListGUI::preloadCommonProperties($all_obj_ids); include_once "./Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::preloadData($all_ref_ids); self::$data_preloaded = true; } foreach ($objects as $key => $object) { // see above, objects were filtered if (!in_array($object["child"], $all_ref_ids)) { continue; } // group object type groups together (e.g. learning resources) $type = $objDefinition->getGroupOfObj($object["type"]); if ($type == "") { $type = $object["type"]; } // this will add activation properties (ilObjActivation) $this->addAdditionalSubItemInformation($object); $this->items[$type][$key] = $object; $this->items["_all"][$key] = $object; if ($object["type"] != "sess") { $this->items["_non_sess"][$key] = $object; } } $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block] = $sort->sortItems($this->items); return $this->items[(int) $a_admin_panel_enabled][(int) $a_include_side_block]; }
/** * insert all missing preconditions */ function insertPreconditions() { global $ilAccess, $lng, $objDefinition, $tree; include_once "./Services/AccessControl/classes/class.ilConditionHandler.php"; $missing_cond_exist = false; // do not show multi level conditions (messes up layout) if ($this->condition_depth > 0) { return; } // Sort by title /* foreach(ilConditionHandler::_getConditionsOfTarget($this->ref_id, $this->obj_id) as $condition) { $condition['title'] = ilObject::_lookupTitle($condition['trigger_obj_id']); } */ if ($this->condition_target) { $conditions = ilConditionHandler::_getConditionsOfTarget($this->condition_target['ref_id'], $this->condition_target['obj_id'], $this->condition_target['target_type']); } else { $conditions = ilConditionHandler::_getConditionsOfTarget($this->ref_id, $this->obj_id); } if (sizeof($conditions)) { for ($i = 0; $i < count($conditions); $i++) { $conditions[$i]['title'] = ilObject::_lookupTitle($conditions[$i]['trigger_obj_id']); } $conditions = ilUtil::sortArray($conditions, 'title', 'DESC'); ++self::$js_unique_id; // Show obligatory and optional preconditions seperated $all_done_obl = $this->parseConditions(self::$js_unique_id, $conditions, true); $all_done_opt = $this->parseConditions(self::$js_unique_id, $conditions, false); if (!$all_done_obl || !$all_done_opt) { $this->tpl->setCurrentBlock("preconditions_toggle"); $this->tpl->setVariable("PRECONDITION_TOGGLE_INTRO", $this->lng->txt("precondition_toggle")); $this->tpl->setVariable("PRECONDITION_TOGGLE_TRIGGER", $this->lng->txt("show")); $this->tpl->setVariable("PRECONDITION_TOGGLE_ID", self::$js_unique_id); $this->tpl->setVariable("TXT_PRECONDITION_SHOW", $this->lng->txt("show")); $this->tpl->setVariable("TXT_PRECONDITION_HIDE", $this->lng->txt("hide")); $this->tpl->parseCurrentBlock(); } } }
/** * Is node clickable? * * @param mixed $a_node node object/array * @return boolean node clickable true/false */ function isNodeClickable($a_node) { global $rbacsystem, $tree, $ilDB, $ilUser, $ilAccess; $obj_id = ilObject::_lookupObjId($a_node["child"]); if (!ilConditionHandler::_checkAllConditionsOfTarget($a_node["child"], $obj_id)) { return false; } switch ($a_node["type"]) { case "crs": return $ilAccess->checkAccess("read", "", $a_node["child"]); // visible groups can allways be clicked; group processing decides // what happens next // visible groups can allways be clicked; group processing decides // what happens next case "grp": return true; case 'tst': if (!$rbacsystem->checkAccess("read", $a_node["child"])) { return false; } $query = sprintf("SELECT * FROM tst_tests WHERE obj_fi=%s", $obj_id); $res = $ilDB->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { return (bool) $row->complete; } return false; case 'svy': if (!$rbacsystem->checkAccess("read", $a_node["child"])) { return false; } $query = sprintf("SELECT * FROM svy_svy WHERE obj_fi=%s", $obj_id); $res = $ilDB->query($query); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { return (bool) $row->complete; } return false; // media pools can only be edited // media pools can only be edited case "mep": if ($rbacsystem->checkAccess("read", $a_node["child"])) { return true; } else { return false; } break; case 'crsr': case 'catr': include_once './Services/ContainerReference/classes/class.ilContainerReferenceAccess.php'; return ilContainerReferenceAccess::_isAccessible($a_node["child"]); // all other types are only clickable, if read permission is given // all other types are only clickable, if read permission is given default: if ($rbacsystem->checkAccess("read", $a_node["child"])) { // check if lm is online if ($a_node["type"] == "lm") { include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php"; $lm_obj =& new ilObjLearningModule($a_node["child"]); if (!$lm_obj->getOnline() && !$rbacsystem->checkAccess('write', $a_node["child"])) { return false; } } // check if fblm is online if ($a_node["type"] == "htlm") { include_once "./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLM.php"; $lm_obj =& new ilObjFileBasedLM($a_node["child"]); if (!$lm_obj->getOnline() && !$rbacsystem->checkAccess('write', $a_node["child"])) { return false; } } // check if fblm is online if ($a_node["type"] == "sahs") { include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $lm_obj =& new ilObjSAHSLearningModule($a_node["child"]); if (!$lm_obj->getOnline() && !$rbacsystem->checkAccess('write', $a_node["child"])) { return false; } } // check if glossary is online if ($a_node["type"] == "glo") { $obj_id = ilObject::_lookupObjectId($a_node["child"]); include_once "./Modules/Glossary/classes/class.ilObjGlossary.php"; if (!ilObjGlossary::_lookupOnline($obj_id) && !$rbacsystem->checkAccess('write', $a_node["child"])) { return false; } } return true; } else { return false; } break; } }
function assignCourse() { global $ilErr, $ilAccess, $ilObjDataCache, $tree, $ilUser; if (!$ilAccess->checkAccess('write', '', $this->content_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE); } if (!$_GET['obj_id']) { $this->listGroupings(); return false; } // delete all existing conditions include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; $condh = new ilConditionHandler(); $condh->deleteByObjId((int) $_GET['obj_id']); $added = 0; $container_ids = is_array($_POST['crs_ids']) ? $_POST['crs_ids'] : array(); foreach ($container_ids as $course_ref_id) { $tmp_crs = ilObjectFactory::getInstanceByRefId($course_ref_id); $tmp_condh = new ilConditionHandler(); $tmp_condh->enableAutomaticValidation(false); $tmp_condh->setTargetRefId($course_ref_id); $tmp_condh->setTargetObjId($tmp_crs->getId()); $tmp_condh->setTargetType($this->getContentType()); $tmp_condh->setTriggerRefId(0); $tmp_condh->setTriggerObjId($this->id); $tmp_condh->setTriggerType('crsg'); $tmp_condh->setOperator('not_member'); $tmp_condh->setValue($this->grp_obj->getUniqueField()); if (!$tmp_condh->checkExists()) { $tmp_condh->storeCondition(); ++$added; } } ilUtil::sendSuccess($this->lng->txt('settings_saved'), true); $this->ctrl->redirect($this, 'edit'); }
/** * Init form for condition table * * @access private * @param * */ private function initFormCondition($a_source_id, $a_condition_id = 0, $a_mode = 'add') { $trigger_obj_id = ilObject::_lookupObjId($a_source_id); $trigger_type = ilObject::_lookupType($trigger_obj_id); $condition = ilConditionHandler::_getCondition($a_condition_id); if (is_object($this->form)) { return true; } include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->ctrl->setParameter($this, 'source_id', $a_source_id); $this->form->setFormAction($this->ctrl->getFormAction($this)); $info_source = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_source")); $info_source->setValue(ilObject::_lookupTitle(ilObject::_lookupObjId($a_source_id))); $this->form->addItem($info_source); $info_target = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_target")); $info_target->setValue($this->getTargetTitle()); $this->form->addItem($info_target); /* moved to list $obl = new ilCheckboxInputGUI($this->lng->txt('precondition_obligatory'), 'obligatory'); $obl->setInfo($this->lng->txt('precondition_obligatory_info')); $obl->setValue(1); if($a_condition_id) { $obl->setChecked($condition['obligatory']); } else { $obl->setChecked(true); } $this->form->addItem($obl); */ $obl = new ilHiddenInputGUI('obligatory'); if ($a_condition_id) { $obl->setValue($condition['obligatory']); } else { $obl->setValue(1); } $this->form->addItem($obl); $sel = new ilSelectInputGUI($this->lng->txt('condition'), 'operator'); include_once "./Services/AccessControl/classes/class.ilConditionHandler.php"; $ch_obj = new ilConditionHandler(); if ($a_mode == 'add') { $operators[0] = $this->lng->txt('select_one'); } foreach ($ch_obj->getOperatorsByTargetType($trigger_type) as $operator) { $operators[$operator] = $this->lng->txt('condition_' . $operator); } $sel->setValue(isset($condition['operator']) ? $condition['operator'] : 0); $sel->setOptions($operators); $sel->setRequired(true); $this->form->addItem($sel); if (ilConditionHandler::_isReferenceHandlingOptional($this->getTargetType())) { $rad_opt = new ilRadioGroupInputGUI($this->lng->txt('cond_ref_handling'), 'ref_handling'); $rad_opt->setValue(isset($condition['ref_handling']) ? $condition['ref_handling'] : ilConditionHandler::SHARED_CONDITIONS); $opt2 = new ilRadioOption($this->lng->txt('cond_ref_shared'), ilConditionHandler::SHARED_CONDITIONS); $rad_opt->addOption($opt2); $opt1 = new ilRadioOption($this->lng->txt('cond_ref_unique'), ilConditionHandler::UNIQUE_CONDITIONS); $rad_opt->addOption($opt1); $this->form->addItem($rad_opt); } // Additional settings for SCO's if ($trigger_type == 'sahs') { $this->lng->loadLanguageModule('trac'); $cus = new ilCustomInputGUI($this->lng->txt('trac_sahs_relevant_items'), 'item_ids[]'); $cus->setRequired(true); $tpl = new ilTemplate('tpl.condition_handler_sco_row.html', true, true, "Services/AccessControl"); $counter = 0; include_once 'Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($trigger_obj_id); $collection = $olp->getCollectionInstance(); if ($collection) { foreach ($collection->getPossibleItems() as $item_id => $sahs_item) { $tpl->setCurrentBlock("sco_row"); $tpl->setVariable('SCO_ID', $item_id); $tpl->setVariable('SCO_TITLE', $sahs_item['title']); $tpl->setVariable('CHECKED', $collection->isAssignedEntry($item_id) ? 'checked="checked"' : ''); $tpl->parseCurrentBlock(); $counter++; } } $tpl->setVariable('INFO_SEL', $this->lng->txt('trac_lp_determination_info_sco')); $cus->setHTML($tpl->get()); $this->form->addItem($cus); } switch ($a_mode) { case 'edit': $this->form->setTitleIcon(ilUtil::getImagePath('icon_' . $this->getTargetType() . '.svg')); $this->form->setTitle($this->lng->txt('rbac_edit_condition')); $this->form->addCommandButton('updateCondition', $this->lng->txt('save')); $this->form->addCommandButton('listConditions', $this->lng->txt('cancel')); break; case 'add': $this->form->setTitleIcon(ilUtil::getImagePath('icon_' . $this->getTargetType() . '.svg')); $this->form->setTitle($this->lng->txt('add_condition')); $this->form->addCommandButton('assign', $this->lng->txt('save')); $this->form->addCommandButton('selector', $this->lng->txt('back')); break; } return true; }
/** * condition check (currently only implemented for read permission) * */ function doConditionCheck($a_permission, $a_cmd, $a_ref_id, $a_user_id, $a_obj_id, $a_type) { //echo "conditionCheck<br/>"; global $lng, $ilBench; if (($a_permission == "read" or $a_permission == 'join') && !$this->checkAccessOfUser($a_user_id, "write", "", $a_ref_id, $a_type, $a_obj_id)) { $ilBench->start("AccessControl", "4000_checkAccess_condition_check"); if (!ilConditionHandler::_checkAllConditionsOfTarget($a_ref_id, $a_obj_id, $a_type, $a_user_id)) { $conditions = ilConditionHandler::_getConditionsOfTarget($a_ref_id, $a_obj_id, $a_type); foreach ($conditions as $condition) { $this->current_info->addInfoItem(IL_MISSING_PRECONDITION, $lng->txt("missing_precondition") . ": " . ilObject::_lookupTitle($condition["trigger_obj_id"]) . " " . $lng->txt("condition_" . $condition["operator"]) . " " . $condition["value"], $condition); } $ilBench->stop("AccessControl", "4000_checkAccess_condition_check"); return false; } $ilBench->stop("AccessControl", "4000_checkAccess_condition_check"); } return true; }
/** * 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(); }
/** * get top chapter of page for that any precondition is missing */ function _getMissingPreconditionsTopChapter($cont_obj_ref_id, $cont_obj_id, $page_id) { $lm_tree = new ilTree($cont_obj_id); $lm_tree->setTableNames('lm_tree', 'lm_data'); $lm_tree->setTreeTablePK("lm_id"); $conds = array(); if ($lm_tree->isInTree($page_id)) { // get full path of page $path = $lm_tree->getPathFull($page_id, $lm_tree->readRootId()); foreach ($path as $node) { if ($node["type"] == "st") { // get all preconditions of upper chapters $tconds = ilConditionHandler::_getConditionsOfTarget($cont_obj_ref_id, $node["child"], "st"); foreach ($tconds as $tcond) { // look for missing precondition if (!ilConditionHandler::_checkCondition($tcond["id"])) { return $node["child"]; } } } } } return ""; }
function __showOtherResources() { global $ilias, $rbacsystem, $ilObjDataCache, $objDefinition; if (!count($ors = $this->__getOtherResources())) { return false; } $this->tpl->addBlockfile('RESOURCES_BLOCK', 'resources_block', 'tpl.crs_objectives_view_or_table.html', 'Modules/Course'); $this->tpl->setVariable("TBL_TITLE_OR", $this->lng->txt('crs_other_resources')); $this->__showHideLinks('or'); if (isset($_SESSION['crs_hide_or'])) { return true; } $this->tpl->setCurrentBlock("tbl_header_columns_or"); $this->tpl->setVariable("TBL_HEADER_WIDTH_OR", "5%"); $this->tpl->setVariable("TBL_HEADER_NAME_OR", $this->lng->txt('type')); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_header_columns_or"); $this->tpl->setVariable("TBL_HEADER_WIDTH_OR", "75%"); $this->tpl->setVariable("TBL_HEADER_NAME_OR", $this->lng->txt('description')); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_header_columns_or"); $this->tpl->setVariable("TBL_HEADER_WIDTH_OR", "20%"); $this->tpl->setVariable("TBL_HEADER_NAME_OR", ''); $this->tpl->parseCurrentBlock(); $counter = 1; foreach ($ors as $or_id) { $obj_id = $ilObjDataCache->lookupObjId($or_id); $obj_type = $ilObjDataCache->lookupType($obj_id); // do not show side block items if ($objDefinition->isSideBlock($obj_type)) { continue; } $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($or_id, $obj_id); $obj_link = ilRepositoryExplorer::buildLinkTarget($or_id, $obj_type); $obj_frame = ilRepositoryExplorer::buildFrameTarget($obj_type, $or_id, $obj_id); $obj_frame = $obj_frame ? $obj_frame : ''; if (ilRepositoryExplorer::isClickable($obj_type, $or_id, $obj_id)) { $this->tpl->setCurrentBlock("or_read"); $this->tpl->setVariable("READ_TITLE_OR", $ilObjDataCache->lookupTitle($obj_id)); $this->tpl->setVariable("READ_TARGET_OR", $obj_frame); $this->tpl->setVariable("READ_LINK_OR", $obj_link); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("or_visible"); $this->tpl->setVariable("VISIBLE_LINK_OR", $ilObjDataCache->lookupTitle($obj_id)); $this->tpl->parseCurrentBlock(); } // add to desktop link if (!$ilias->account->isDesktopItem($or_id, $obj_type) and $this->course_obj->getAboStatus() == $this->course_obj->ABO_ENABLED) { if ($rbacsystem->checkAccess('read', $or_id)) { $this->tpl->setCurrentBlock("or_desklink"); $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $or_id); $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $or_id); $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $obj_type); $this->tpl->setVariable("DESK_LINK_OR", $this->ctrl->getLinkTarget($this->container_gui, 'addToDesk')); $this->tpl->setVariable("TXT_DESK_OR", $this->lng->txt("to_desktop")); $this->tpl->parseCurrentBlock(); } } $this->tpl->setCurrentBlock("or_row"); $this->tpl->setVariable("OBJ_TITLE_OR", $ilObjDataCache->lookupTitle($obj_id)); $this->tpl->setVariable('IMG_TYPE_OR', ilUtil::getTypeIconPath($obj_type, $obj_id, 'small')); $this->tpl->setVariable("TXT_IMG_OR", $this->lng->txt('obj_' . $obj_type)); $this->tpl->setVariable("OBJ_CLASS_CENTER_OR", 'option_value_center'); $this->tpl->setVariable("OBJ_CLASS_OR", 'option_value'); $this->tpl->parseCurrentBlock(); ++$counter; } }
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; }
/** * 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); }
/** * Clone object dependencies * * This method allows to refresh any ref id references to other objects * that are affected in the same copy process. Ask ilCopyWizardOptions for * the mappings. * * @access public * @param int ref_id of target object * @param int copy_id * */ public function cloneDependencies($a_target_id, $a_copy_id) { include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php'; $cwo = ilCopyWizardOptions::_getInstance($a_copy_id); $mappings = $cwo->getMappings(); $conditions = ilConditionHandler::_getConditionsOfTarget($this->getRefId(), $this->getId()); foreach ($conditions as $con) { if ($mappings[$con['trigger_ref_id']]) { $newCondition = new ilConditionHandler(); $target_obj = ilObject::_lookupObjId($a_target_id); $target_typ = ilObject::_lookupType($target_obj); $newCondition->setTargetRefId($a_target_id); $newCondition->setTargetObjId($target_obj); $newCondition->setTargetType($target_typ); $trigger_ref = $mappings[$con['trigger_ref_id']]; $trigger_obj = ilObject::_lookupObjId($trigger_ref); $trigger_typ = ilObject::_lookupType($trigger_obj); $newCondition->setTriggerRefId($trigger_ref); $newCondition->setTriggerObjId($trigger_obj); $newCondition->setTriggerType($trigger_typ); $newCondition->setOperator($con['operator']); $newCondition->setValue($con['value']); $newCondition->setReferenceHandlingType($con['ref_handling']); $newCondition->setObligatory($con['obligatory']); $newCondition->setHiddenStatus(ilConditionHandler::lookupHiddenStatusByTarget($this->getRefId())); $newCondition->storeCondition(); } } include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php'; $tpl_id = ilDidacticTemplateObjSettings::lookupTemplateId($this->getRefId()); if ($tpl_id) { include_once './Services/Object/classes/class.ilObjectFactory.php'; $factory = new ilObjectFactory(); $obj = $factory->getInstanceByRefId($a_target_id, FALSE); if ($obj instanceof ilObject) { $obj->applyDidacticTemplate($tpl_id); } } return true; }
/** * inititialize new item * Course reference inits the course item * * @param int $a_ref_id reference id * @param int $a_obj_id object id * @param string $a_title title * @param string $a_description description */ function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "") { global $ilBench, $ilAccess, $tree; $this->reference_ref_id = $a_ref_id; $this->reference_obj_id = $a_obj_id; include_once './Services/ContainerReference/classes/class.ilContainerReference.php'; $target_obj_id = ilContainerReference::_lookupTargetId($a_obj_id); $target_ref_ids = ilObject::_getAllReferences($target_obj_id); $target_ref_id = current($target_ref_ids); $target_title = ilContainerReference::_lookupTitle($a_obj_id); $target_description = ilObject::_lookupDescription($target_obj_id); $this->deleted = $tree->isDeleted($target_ref_id); $ilBench->start("ilObjCourseListGUI", "1000_checkAllConditions"); $this->conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($target_ref_id, $target_obj_id); $ilBench->stop("ilObjCourseListGUI", "1000_checkAllConditions"); parent::initItem($target_ref_id, $target_obj_id, $target_title, $target_description); // general commands array include_once './Modules/CourseReference/classes/class.ilObjCourseReferenceAccess.php'; $this->commands = ilObjCourseReferenceAccess::_getCommands($this->reference_ref_id); if ($ilAccess->checkAccess('write', '', $this->reference_ref_id) or $this->deleted) { $this->info_screen_enabled = false; } else { $this->info_screen_enabled = true; } }
/** * paste object from clipboard to current place * Depending on the chosen command the object(s) are linked, copied or moved * * @access public */ function pasteObject() { global $rbacsystem, $rbacadmin, $rbacreview, $log, $tree; global $ilUser, $lng, $ilCtrl; // BEGIN ChangeEvent: Record paste event. require_once 'Services/Tracking/classes/class.ilChangeEvent.php'; // END ChangeEvent: Record paste event. //var_dump($_SESSION["clipboard"]);exit; if (!in_array($_SESSION["clipboard"]["cmd"], array("cut", "link", "copy"))) { $message = get_class($this) . "::pasteObject(): cmd was neither 'cut','link' or 'copy'; may be a hack attempt!"; $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING); } // this loop does all checks foreach ($_SESSION["clipboard"]["ref_ids"] as $ref_id) { $obj_data =& $this->ilias->obj_factory->getInstanceByRefId($ref_id); // CHECK ACCESS if (!$rbacsystem->checkAccess('create', $this->object->getRefId(), $obj_data->getType())) { $no_paste[] = $ref_id; $no_paste_titles[] = $obj_data->getTitle(); } // CHECK IF REFERENCE ALREADY EXISTS if ($this->object->getRefId() == $this->tree->getParentId($obj_data->getRefId())) { $exists[] = $ref_id; break; } // CHECK IF PASTE OBJECT SHALL BE CHILD OF ITSELF if ($this->tree->isGrandChild($ref_id, $this->object->getRefId())) { $is_child[] = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id)); } if ($ref_id == $this->object->getRefId()) { $is_child[] = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id)); } // CHECK IF OBJECT IS ALLOWED TO CONTAIN PASTED OBJECT AS SUBOBJECT $obj_type = $obj_data->getType(); if (!in_array($obj_type, array_keys($this->objDefinition->getSubObjects($this->object->getType())))) { $not_allowed_subobject[] = $obj_data->getType(); } } //////////////////////////// // process checking results // BEGIN WebDAV: Copying an object into the same container is allowed if (count($exists) && $_SESSION["clipboard"]["cmd"] != "copy") { $this->ilias->raiseError($this->lng->txt("msg_obj_exists"), $this->ilias->error_obj->MESSAGE); } if (count($is_child)) { $this->ilias->raiseError($this->lng->txt("msg_not_in_itself") . " " . implode(',', $is_child), $this->ilias->error_obj->MESSAGE); } if (count($not_allowed_subobject)) { $this->ilias->raiseError($this->lng->txt("msg_may_not_contain") . " " . implode(',', $not_allowed_subobject), $this->ilias->error_obj->MESSAGE); } if (count($no_paste)) { $this->ilias->raiseError($this->lng->txt("msg_no_perm_paste") . " " . implode(',', $no_paste), $this->ilias->error_obj->MESSAGE); } // log pasteObject call $log->write("ilObjectGUI::pasteObject(), cmd: " . $_SESSION["clipboard"]["cmd"]); //////////////////////////////////////////////////////// // everything ok: now paste the objects to new location // to prevent multiple actions via back/reload button $ref_ids = $_SESSION["clipboard"]["ref_ids"]; unset($_SESSION["clipboard"]["ref_ids"]); // BEGIN WebDAV: Support a copy command in the repository // process COPY command if ($_SESSION["clipboard"]["cmd"] == "copy") { unset($_SESSION["clipboard"]["cmd"]); // new implementation, redirects to ilObjectCopyGUI if (count($ref_ids) == 1) { $ilCtrl->setParameterByClass("ilobjectcopygui", "target", $this->object->getRefId()); $ilCtrl->setParameterByClass("ilobjectcopygui", "source_id", $ref_ids[0]); $ilCtrl->redirectByClass("ilobjectcopygui", "saveTarget"); } else { $ilCtrl->setParameterByClass("ilobjectcopygui", "target", $this->object->getRefId()); $ilCtrl->setParameterByClass("ilobjectcopygui", "source_ids", implode($ref_ids, "_")); $ilCtrl->redirectByClass("ilobjectcopygui", "saveTarget"); } /* old implementation foreach($ref_ids as $ref_id) { $revIdMapping = array(); $oldNode_data = $tree->getNodeData($ref_id); if ($oldNode_data['parent'] == $this->object->getRefId()) { require_once 'Modules/File/classes/class.ilObjFileAccess.php'; $newTitle = ilObjFileAccess::_appendNumberOfCopyToFilename($oldNode_data['title'],null); $newRef = $this->cloneNodes($ref_id, $this->object->getRefId(), $refIdMapping, $newTitle); } else { $newRef = $this->cloneNodes($ref_id, $this->object->getRefId(), $refIdMapping, null); } // BEGIN ChangeEvent: Record copy event. $old_parent_data = $tree->getParentNodeData($ref_id); $newNode_data = $tree->getNodeData($newRef); ilChangeEvent::_recordReadEvent($oldNode_data['type'], $ref_id, $oldNode_data['obj_id'], $ilUser->getId()); ilChangeEvent::_recordWriteEvent($newNode_data['obj_id'], $ilUser->getId(), 'add', $this->object->getId()); ilChangeEvent::_catchupWriteEvents($newNode_data['obj_id'], $ilUser->getId()); // END ChangeEvent: Record copy event. }*/ $log->write("ilObjectGUI::pasteObject(), copy finished"); } // END WebDAV: Support a Copy command in the repository // process CUT command if ($_SESSION["clipboard"]["cmd"] == "cut") { foreach ($ref_ids as $ref_id) { // Store old parent $old_parent = $tree->getParentId($ref_id); $this->tree->moveTree($ref_id, $this->object->getRefId()); $rbacadmin->adjustMovedObjectPermissions($ref_id, $old_parent); include_once './Services/AccessControl/classes/class.ilConditionHandler.php'; ilConditionHandler::_adjustMovedObjectConditions($ref_id); // BEGIN ChangeEvent: Record cut event. $node_data = $tree->getNodeData($ref_id); $old_parent_data = $tree->getNodeData($old_parent); ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'remove', $old_parent_data['obj_id']); ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add', $this->object->getId()); ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId()); // END PATCH ChangeEvent: Record cut event. } } // END CUT // process LINK command if ($_SESSION["clipboard"]["cmd"] == "link") { foreach ($ref_ids as $ref_id) { // get node data $top_node = $this->tree->getNodeData($ref_id); // get subnodes of top nodes $subnodes[$ref_id] = $this->tree->getSubtree($top_node); } // now move all subtrees to new location foreach ($subnodes as $key => $subnode) { // first paste top_node.... $obj_data =& $this->ilias->obj_factory->getInstanceByRefId($key); $new_ref_id = $obj_data->createReference(); $obj_data->putInTree($_GET["ref_id"]); $obj_data->setPermissions($_GET["ref_id"]); // BEGIN ChangeEvent: Record link event. $node_data = $tree->getNodeData($new_ref_id); ilChangeEvent::_recordWriteEvent($node_data['obj_id'], $ilUser->getId(), 'add', $this->object->getId()); ilChangeEvent::_catchupWriteEvents($node_data['obj_id'], $ilUser->getId()); // END PATCH ChangeEvent: Record link event. } $log->write("ilObjectGUI::pasteObject(), link finished"); // inform other objects in hierarchy about link operation //$this->object->notify("link",$this->object->getRefId(),$_SESSION["clipboard"]["parent_non_rbac_id"],$this->object->getRefId(),$subnodes); } // END LINK // save cmd for correct message output after clearing the clipboard $last_cmd = $_SESSION["clipboard"]["cmd"]; // clear clipboard $this->clearObject(); if ($last_cmd == "cut") { ilUtil::sendSuccess($this->lng->txt("msg_cut_copied"), true); } else { if ($last_cmd == "copy") { ilUtil::sendSuccess($this->lng->txt("msg_cloned"), true); } else { if ($last_cmd == 'link') { ilUtil::sendSuccess($this->lng->txt("msg_linked"), true); } } } $this->ctrl->returnToParent($this); }
function showStartObjects() { include_once './Modules/Course/classes/class.ilCourseLMHistory.php'; include_once './Services/Repository/classes/class.ilRepositoryExplorer.php'; include_once './Services/Link/classes/class.ilLink.php'; global $rbacsystem, $ilias, $ilUser, $ilAccess, $ilObjDataCache; $this->tabs_gui->setSubTabActive('crs_content'); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_start_view.html", 'Modules/Course'); $this->tpl->setVariable("INFO_STRING", $this->lng->txt('crs_info_start')); $this->tpl->setVariable("TBL_TITLE_START", $this->lng->txt('crs_table_start_objects')); $this->tpl->setVariable("HEADER_NR", $this->lng->txt('crs_nr')); $this->tpl->setVariable("HEADER_DESC", $this->lng->txt('description')); $this->tpl->setVariable("HEADER_EDITED", $this->lng->txt('crs_objective_accomplished')); $lm_continue =& new ilCourseLMHistory($this->course_obj->getRefId(), $ilUser->getId()); $continue_data = $lm_continue->getLMHistory(); $counter = 0; foreach ($this->start_obj->getStartObjects() as $start) { $obj_id = $ilObjDataCache->lookupObjId($start['item_ref_id']); $ref_id = $start['item_ref_id']; $type = $ilObjDataCache->lookupType($obj_id); $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($ref_id, $obj_id); $obj_link = ilLink::_getLink($ref_id, $type); $obj_frame = ilRepositoryExplorer::buildFrameTarget($type, $ref_id, $obj_id); $obj_frame = $obj_frame ? $obj_frame : ''; // Tmp fix for tests $obj_frame = $type == 'tst' ? '' : $obj_frame; $contentObj = false; if ($ilAccess->checkAccess('read', '', $ref_id)) { $this->tpl->setCurrentBlock("start_read"); $this->tpl->setVariable("READ_TITLE_START", $ilObjDataCache->lookupTitle($obj_id)); $this->tpl->setVariable("READ_TARGET_START", $obj_frame); $this->tpl->setVariable("READ_LINK_START", $obj_link . '&crs_show_result=' . $this->course_obj->getRefId()); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("start_visible"); $this->tpl->setVariable("VISIBLE_LINK_START", $ilObjDataCache->lookupTitle($obj_id)); $this->tpl->parseCurrentBlock(); } // CONTINUE LINK if (isset($continue_data[$ref_id])) { $this->tpl->setCurrentBlock("link"); $this->tpl->setVariable("LINK_HREF", ilLink::_getLink($ref_id, '', array('obj_id', $continue_data[$ref_id]['lm_page_id']))); #$this->tpl->setVariable("CONTINUE_LINK_TARGET",$target); $this->tpl->setVariable("LINK_NAME", $this->lng->txt('continue_work')); $this->tpl->parseCurrentBlock(); } // add to desktop link if (!$ilUser->isDesktopItem($ref_id, $type) and $this->course_obj->getAboStatus()) { if ($ilAccess->checkAccess('read', '', $ref_id)) { $this->tpl->setCurrentBlock("link"); $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id); $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id); $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type); $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTarget($this->container_gui, 'addToDesk')); $this->tpl->setVariable("LINK_NAME", $this->lng->txt("to_desktop")); $this->tpl->parseCurrentBlock(); } } elseif ($this->course_obj->getAboStatus()) { $this->tpl->setCurrentBlock("link"); $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_ref_id', $ref_id); $this->ctrl->setParameterByClass(get_class($this->container_gui), 'item_id', $ref_id); $this->ctrl->setParameterByClass(get_class($this->container_gui), 'type', $type); $this->tpl->setVariable("LINK_HREF", $this->ctrl->getLinkTarget($this->container_gui, 'removeFromDesk')); $this->tpl->setVariable("LINK_NAME", $this->lng->txt("unsubscribe")); $this->tpl->parseCurrentBlock(); } // Description if (strlen($ilObjDataCache->lookupDescription($obj_id))) { $this->tpl->setCurrentBlock("start_description"); $this->tpl->setVariable("DESCRIPTION_START", $ilObjDataCache->lookupDescription($obj_id)); $this->tpl->parseCurrentBlock(); } if ($this->start_obj->isFullfilled($ilUser->getId(), $ref_id)) { $accomplished = 'accomplished'; } else { $accomplished = 'not_accomplished'; } $this->tpl->setCurrentBlock("start_row"); $this->tpl->setVariable("EDITED_IMG", ilUtil::getImagePath('crs_' . $accomplished . '.png')); $this->tpl->setVariable("EDITED_ALT", $this->lng->txt('crs_objective_' . $accomplished)); $this->tpl->setVariable("ROW_CLASS", 'option_value'); $this->tpl->setVariable("ROW_CLASS_CENTER", 'option_value_center'); $this->tpl->setVariable("OBJ_NR_START", ++$counter . '.'); $this->tpl->parseCurrentBlock(); } return true; }
function checkCircle($a_ref_id, $a_obj_id) { foreach (ilConditionHandler::_getConditionsOfTarget($a_ref_id, $a_obj_id) as $condition) { if ($condition['trigger_obj_id'] == $this->target_obj_id and $condition['operator'] == $this->getOperator()) { $this->circle = true; break; } else { $this->checkCircle($condition['trigger_ref_id'], $condition['trigger_obj_id']); } } return $this->circle; }