本文整理汇总了PHP中ilObjRole::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjRole::delete方法的具体用法?PHP ilObjRole::delete怎么用?PHP ilObjRole::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjRole
的用法示例。
在下文中一共展示了ilObjRole::delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restoreObjects
/**
* Move objects from trash back to repository
*/
function restoreObjects($a_cur_ref_id, $a_ref_ids)
{
global $rbacsystem, $log, $ilAppEventHandler, $lng, $tree;
$cur_obj_id = ilObject::_lookupObjId($a_cur_ref_id);
foreach ($a_ref_ids as $id) {
$obj_data = ilObjectFactory::getInstanceByRefId($id);
if (!$rbacsystem->checkAccess('create', $a_cur_ref_id, $obj_data->getType())) {
$no_create[] = ilObject::_lookupTitle(ilObject::_lookupObjId($id));
}
}
if (count($no_create)) {
include_once "./Services/Repository/exceptions/class.ilRepositoryException.php";
throw new ilRepositoryException($lng->txt("msg_no_perm_paste") . " " . implode(',', $no_create));
}
$affected_ids = array();
foreach ($a_ref_ids as $id) {
$affected_ids[$id] = $id;
// INSERT AND SET PERMISSIONS
ilRepUtil::insertSavedNodes($id, $a_cur_ref_id, -(int) $id, $affected_ids);
// DELETE SAVED TREE
$saved_tree = new ilTree(-(int) $id);
$saved_tree->deleteTree($saved_tree->getNodeData($id));
include_once './Services/Object/classes/class.ilObjectFactory.php';
$factory = new ilObjectFactory();
$ref_obj = $factory->getInstanceByRefId($id, FALSE);
if ($ref_obj instanceof ilObject) {
$lroles = $GLOBALS['rbacreview']->getRolesOfRoleFolder($id, FALSE);
foreach ($lroles as $role_id) {
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$role = new ilObjRole($role_id);
$role->setParent($id);
$role->delete();
}
$parent_ref = $GLOBALS['tree']->getParentId($id);
if ($parent_ref) {
$ref_obj->setPermissions($parent_ref);
}
}
// BEGIN ChangeEvent: Record undelete.
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
global $ilUser;
ilChangeEvent::_recordWriteEvent(ilObject::_lookupObjId($id), $ilUser->getId(), 'undelete', ilObject::_lookupObjId($tree->getParentId($id)));
ilChangeEvent::_catchupWriteEvents($cur_obj_id, $ilUser->getId());
// END PATCH ChangeEvent: Record undelete.
}
// send events
foreach ($affected_ids as $id) {
// send global event
$ilAppEventHandler->raise("Services/Object", "undelete", array("obj_id" => ilObject::_lookupObjId($id), "ref_id" => $id));
}
}