本文整理汇总了PHP中CBPHelper::getExtendedGroupName方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::getExtendedGroupName方法的具体用法?PHP CBPHelper::getExtendedGroupName怎么用?PHP CBPHelper::getExtendedGroupName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::getExtendedGroupName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetAllowableUserGroups
/**
* @param $documentType
* @param bool $withExtended
* @return array|bool
*/
public function GetAllowableUserGroups($documentType, $withExtended = false)
{
$documentType = trim($documentType);
if (strlen($documentType) <= 0) {
return false;
}
$iblockId = intval(substr($documentType, strlen("iblock_")));
$result = array("Author" => GetMessage("IBD_DOCUMENT_AUTHOR"));
$groupsId = array(1);
$extendedGroupsCode = array();
if (CIBlock::getArrayByID($iblockId, "RIGHTS_MODE") === "E") {
$rights = new CIBlockRights($iblockId);
foreach ($rights->getGroups() as $iblockGroupCode) {
if (preg_match("/^G(\\d+)\$/", $iblockGroupCode, $match)) {
$groupsId[] = $match[1];
} else {
$extendedGroupsCode[] = $iblockGroupCode;
}
}
} else {
foreach (CIBlock::getGroupPermissions($iblockId) as $groupId => $perm) {
if ($perm > "R") {
$groupsId[] = $groupId;
}
}
}
$groupsIterator = CGroup::getListEx(array("NAME" => "ASC"), array("ID" => $groupsId));
while ($group = $groupsIterator->fetch()) {
$result[$group["ID"]] = $group["NAME"];
}
if ($withExtended && $extendedGroupsCode) {
foreach ($extendedGroupsCode as $groupCode) {
$result['group_' . $groupCode] = CBPHelper::getExtendedGroupName($groupCode);
}
}
return $result;
}
示例2: parseStringParameterMatches
public static function parseStringParameterMatches($matches, $documentType = null)
{
$result = "";
$documentType = is_array($documentType) ? array_filter($documentType) : null;
if ($matches[1] == "user") {
$user = $matches[2];
$l = strlen("user_");
if (substr($user, 0, $l) == "user_") {
$result = CBPHelper::ConvertUserToPrintableForm(intval(substr($user, $l)));
} elseif (strpos($user, 'group_') === 0) {
$result = htmlspecialcharsbx(CBPHelper::getExtendedGroupName($user));
} elseif ($documentType) {
$v = implode(",", $documentType);
if (!array_key_exists($v, self::$userGroupsCache)) {
self::$userGroupsCache[$v] = CBPDocument::GetAllowableUserGroups($documentType);
}
$result = self::$userGroupsCache[$v][$user];
} else {
$result = $user;
}
} elseif ($matches[1] == "group") {
if (strpos($matches[2], 'group_') === 0) {
$result = htmlspecialcharsbx(CBPHelper::getExtendedGroupName($matches[2]));
} elseif ($documentType) {
$v = implode(",", $documentType);
if (!array_key_exists($v, self::$userGroupsCache)) {
self::$userGroupsCache[$v] = CBPDocument::GetAllowableUserGroups($documentType);
}
$result = self::$userGroupsCache[$v][$matches[2]];
} else {
$result = $matches[2];
}
} else {
$result = $matches[0];
}
return $result;
}