本文整理汇总了PHP中CIntranetUtils::GetDepartmentColleagues方法的典型用法代码示例。如果您正苦于以下问题:PHP CIntranetUtils::GetDepartmentColleagues方法的具体用法?PHP CIntranetUtils::GetDepartmentColleagues怎么用?PHP CIntranetUtils::GetDepartmentColleagues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIntranetUtils
的用法示例。
在下文中一共展示了CIntranetUtils::GetDepartmentColleagues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetAccess
public static function GetAccess()
{
global $USER;
// simplest caching. is it enough? maybe...
static $access = null;
if (!is_array($access)) {
$access = array('READ' => array(), 'WRITE' => array());
$arAccessSettings = null;
if ($USER->CanDoOperation('tm_read')) {
$access['READ'][] = '*';
} elseif ($USER->CanDoOperation('tm_read_subordinate')) {
$arAccessSettings = self::GetAccessSettings();
if ($arAccessSettings['READ']['EMPLOYEE'] >= 2) {
$access['READ'][] = '*';
} else {
// everybody can read his own entries
$access['READ'][] = $USER->GetID();
if ($arAccessSettings['READ']['EMPLOYEE'] >= 1) {
$dbUsers = CIntranetUtils::GetDepartmentColleagues();
while ($arRes = $dbUsers->Fetch()) {
$access['READ'][] = $arRes['ID'];
}
}
$dbUsers = CIntranetUtils::GetSubordinateEmployees($USER->GetID(), $arAccessSettings['READ']['HEAD'] == 1);
while ($arRes = $dbUsers->Fetch()) {
if ($arAccessSettings['READ']['HEAD'] == 2) {
$access['READ'] = array('*');
break;
}
$access['READ'][] = $arRes['ID'];
}
$access['READ'] = array_values(array_unique($access['READ']));
}
}
if ($USER->CanDoOperation('tm_write')) {
$access['WRITE'][] = '*';
} elseif ($USER->CanDoOperation('tm_write_subordinate')) {
if ($arAccessSettings['WRITE']['EMPLOYEE'] >= 2) {
$access['WRITE'][] = '*';
} else {
// check if current user is The Boss.
$arManagers = self::GetUserManagers($USER->GetID());
if (count($arManagers) == 1 && $arManagers[0] == $USER->GetID()) {
$access['WRITE'][] = $USER->GetID();
}
if (!is_array($arAccessSettings)) {
$arAccessSettings = self::GetAccessSettings();
}
$dbUsers = CIntranetUtils::GetSubordinateEmployees($USER->GetID(), $arAccessSettings['WRITE']['HEAD'] == 1);
while ($arRes = $dbUsers->Fetch()) {
$access['WRITE'][] = $arRes['ID'];
}
$access['WRITE'] = array_values(array_unique($access['WRITE']));
}
}
}
return $access;
}