本文整理匯總了PHP中umiObjectsCollection::getObjectIdByGUID方法的典型用法代碼示例。如果您正苦於以下問題:PHP umiObjectsCollection::getObjectIdByGUID方法的具體用法?PHP umiObjectsCollection::getObjectIdByGUID怎麽用?PHP umiObjectsCollection::getObjectIdByGUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類umiObjectsCollection
的用法示例。
在下文中一共展示了umiObjectsCollection::getObjectIdByGUID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setPerms
public function setPerms($element_id) {
$permissions = permissionsCollection::getInstance();
if(!getRequest('perms_read') && !getRequest('perms_edit') && !getRequest('perms_create') &&
!getRequest('perms_delete') && !getRequest('perms_move') &&
/* Note this argument. It's important' */
getRequest('default-permissions-set')) {
$permissions->setDefaultPermissions($element_id);
return;
} elseif (!getRequest('perms_read') && !getRequest('perms_edit') && !getRequest('perms_create') &&
!getRequest('perms_delete') && !getRequest('permissions-sent')) {
return;
}
$perms_read = ($t = getRequest('perms_read')) ? $t : array();
$perms_edit = ($t = getRequest('perms_edit')) ? $t : array();
$perms_create = ($t = getRequest('perms_create')) ? $t : array();
$perms_delete = ($t = getRequest('perms_delete')) ? $t : array();
$perms_move = ($t = getRequest('perms_move')) ? $t : array();
$permissions->resetElementPermissions($element_id);
$owners = array_keys($perms_read);
$owners = array_merge($owners, array_keys($perms_edit));
$owners = array_merge($owners, array_keys($perms_create));
$owners = array_merge($owners, array_keys($perms_delete));
$owners = array_merge($owners, array_keys($perms_move));
$owners = array_unique($owners);
foreach($owners as $owner) {
$level = 0;
if(isset($perms_read[$owner])) $level |= 1;
if(isset($perms_edit[$owner])) $level |= 2;
if(isset($perms_create[$owner])) $level |= 4;
if(isset($perms_delete[$owner])) $level |= 8;
if(isset($perms_move[$owner])) $level |= 16;
if (is_string($owner)) $owner = umiObjectsCollection::getObjectIdByGUID($owner);
$permissions->setElementPermissions($owner, $element_id, $level);
}
}