本文整理汇总了PHP中CIBlockRights::getRights方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockRights::getRights方法的具体用法?PHP CIBlockRights::getRights怎么用?PHP CIBlockRights::getRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockRights
的用法示例。
在下文中一共展示了CIBlockRights::getRights方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createIBlockRights
/**
* @param int $iblockId This variable is the id iblock.
*/
private static function createIBlockRights($iblockId)
{
$rightObject = new \CIBlockRights($iblockId);
$rights = $rightObject->getRights();
$rightsList = $rightObject->getRightsList(false);
$rightId = array_search('iblock_full', $rightsList);
$rights['n0'] = array('GROUP_CODE' => "G1", 'TASK_ID' => $rightId);
$rights['n1'] = array('GROUP_CODE' => "U1", 'TASK_ID' => $rightId);
$rightId = array_search('iblock_element_add', $rightsList);
$rights['n2'] = array('GROUP_CODE' => "G2", 'TASK_ID' => $rightId);
$rightObject->setRights($rights);
}
示例2: processActionCheckDelegateResponsible
protected function processActionCheckDelegateResponsible()
{
$this->checkRequiredPostParams(array('iblockId'));
if (!Loader::includeModule('iblock')) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_CONNECTION_MODULE_IBLOCK'))));
}
$this->iblockId = intval($this->request->getPost('iblockId'));
$this->iblockTypeId = COption::GetOptionString('lists', 'livefeed_iblock_type_id');
$this->checkPermission();
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$rightObject = new CIBlockRights($this->iblockId);
$rights = $rightObject->getRights();
$rightsList = $rightObject->getRightsList(false);
$idRight = array_search('iblock_full', $rightsList);
$listUser = array();
$nameTemplate = CSite::GetNameFormat(false);
$count = 0;
foreach ($rights as $right) {
$res = strpos($right['GROUP_CODE'], 'U');
if ($right['TASK_ID'] == $idRight && $res === 0) {
$userId = substr($right['GROUP_CODE'], 1);
$userGroups = CUser::getUserGroup($userId);
if (!in_array(1, $userGroups)) {
$userQuery = CUser::getByID($userId);
if ($user = $userQuery->getNext()) {
$listUser[$count]['id'] = $right['GROUP_CODE'];
$listUser[$count]['name'] = CUser::formatName($nameTemplate, $user, false);
}
}
}
$count++;
}
$this->sendJsonSuccessResponse(array('listUser' => $listUser));
}
示例3: processActionGetListAdmin
protected function processActionGetListAdmin()
{
$this->checkRequiredPostParams(array('iblockId', 'iblockTypeId', 'socnetGroupId', 'sectionId'));
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$this->fillDataForCheckPermission();
$this->checkPermission();
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$rightObject = new CIBlockRights($this->iblockId);
$rights = $rightObject->getRights();
$rightsList = $rightObject->getRightsList(false);
$idRight = array_search('iblock_full', $rightsList);
$listUser = array();
$nameTemplate = CSite::GetNameFormat(false);
foreach ($rights as $right) {
$res = strpos($right['GROUP_CODE'], 'U');
if ($right['TASK_ID'] == $idRight && $res === 0) {
$userId = substr($right['GROUP_CODE'], 1);
$users = CUser::GetList($by = "id", $order = "asc", array('ID' => $userId), array('FIELDS' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME')));
$user = $users->fetch();
$file['src'] = '';
if ($user) {
$file = \CFile::ResizeImageGet($user['PERSONAL_PHOTO'], array('width' => 58, 'height' => 58), \BX_RESIZE_IMAGE_EXACT, false);
}
$listUser[$userId]['id'] = $userId;
$listUser[$userId]['img'] = $file['src'];
$listUser[$userId]['name'] = CUser::FormatName($nameTemplate, $user, false);
}
}
$users = CUser::getList($b = 'ID', $o = 'ASC', array('GROUPS_ID' => 1, 'ACTIVE' => 'Y'), array('FIELDS' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME')));
while ($user = $users->fetch()) {
$file = \CFile::ResizeImageGet($user['PERSONAL_PHOTO'], array('width' => 58, 'height' => 58), \BX_RESIZE_IMAGE_EXACT, false);
$listUser[$user['ID']]['id'] = $user['ID'];
$listUser[$user['ID']]['img'] = $file['src'];
$listUser[$user['ID']]['name'] = CUser::FormatName($nameTemplate, $user, false);
}
$listUser = array_values($listUser);
$this->sendJsonSuccessResponse(array('listAdmin' => $listUser));
}