本文整理汇总了PHP中CIntranetUtils::GetDepartmentManager方法的典型用法代码示例。如果您正苦于以下问题:PHP CIntranetUtils::GetDepartmentManager方法的具体用法?PHP CIntranetUtils::GetDepartmentManager怎么用?PHP CIntranetUtils::GetDepartmentManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIntranetUtils
的用法示例。
在下文中一共展示了CIntranetUtils::GetDepartmentManager方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetDepartmentManager
public static function GetDepartmentManager($arDepartments, $skipUserId = false, $bRecursive = false)
{
if (!is_array($arDepartments) || empty($arDepartments)) {
return array();
}
if (null == self::$SECTIONS_SETTINGS_CACHE) {
self::_GetDeparmentsTree();
}
$arManagers = array();
$arManagerIDs = array();
foreach ($arDepartments as $section_id) {
$arSection = self::$SECTIONS_SETTINGS_CACHE['DATA'][$section_id];
if ($arSection['UF_HEAD'] && $arSection['UF_HEAD'] != $skipUserId) {
$arManagerIDs[] = $arSection['UF_HEAD'];
}
}
if (count($arManagerIDs) > 0) {
$dbRes = CUser::GetList($by = 'ID', $sort = 'ASC', array('ID' => implode('|', array_unique($arManagerIDs))));
while ($arUser = $dbRes->GetNext()) {
$arManagers[$arUser['ID']] = $arUser;
}
}
foreach ($arDepartments as $section_id) {
$arSection = self::$SECTIONS_SETTINGS_CACHE['DATA'][$section_id];
$bFound = $arSection['UF_HEAD'] && $arSection['UF_HEAD'] != $skipUserId && array_key_exists($arSection['UF_HEAD'], $arManagers);
if (!$bFound && $bRecursive && $arSection['IBLOCK_SECTION_ID']) {
$ar = CIntranetUtils::GetDepartmentManager(array($arSection['IBLOCK_SECTION_ID']), $skipUserId, $bRecursive);
$arManagers = $arManagers + $ar;
}
}
return $arManagers;
}
示例2: array
$arResult['DEPARTMENTS'] = array();
$dbRes = CIntranetUtils::GetSubordinateDepartmentsList($arResult["User"]["ID"]);
while ($arRes = $dbRes->GetNext()) {
$arRes['URL'] = str_replace('#ID#', $arRes['ID'], $arParams['PATH_TO_CONPANY_DEPARTMENT']);
$arResult['DEPARTMENTS'][$arRes['ID']] = $arRes;
$arResult['DEPARTMENTS'][$arRes['ID']]['EMPLOYEE_COUNT'] = 0;
$rsUsers = CIntranetUtils::GetDepartmentEmployees(array($arRes['ID']), $bRecursive = true);
while ($arUser = $rsUsers->Fetch()) {
if ($arUser['ID'] != $arResult["User"]["ID"]) {
//self
$arResult['DEPARTMENTS'][$arRes['ID']]['EMPLOYEE_COUNT']++;
}
}
}
//managers
$arResult['MANAGERS'] = CIntranetUtils::GetDepartmentManager($arResult["User"]["UF_DEPARTMENT"], $arResult["User"]["ID"], true);
if ($arParams["CACHE_TIME"] > 0) {
$obCache->EndDataCache(array('DEPARTMENTS' => $arResult['DEPARTMENTS'], 'MANAGERS' => $arResult['MANAGERS']));
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
} elseif ($arParams["CACHE_TIME"] > 0) {
$vars = $obCache->GetVars();
$arResult['DEPARTMENTS'] = $vars['DEPARTMENTS'];
$arResult['MANAGERS'] = $vars['MANAGERS'];
}
if (CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite() && !CExtranet::IsIntranetUser()) {
$arResult['MANAGERS'] = array();
}
}
示例3: OnAfterUserUpdate
public static function OnAfterUserUpdate(&$arFields)
{
if (isset($arFields["UF_DEPARTMENT"])) {
$provider = new CIntranetAuthProvider();
//clear for user himself
$provider->DeleteByUser($arFields["ID"]);
//clear for users's managers
$managers = CIntranetUtils::GetDepartmentManager($arFields["UF_DEPARTMENT"], $arFields["ID"], true);
foreach ($managers as $manager) {
$provider->DeleteByUser($manager["ID"]);
}
}
}
示例4: GetUserManagers
public static function GetUserManagers($userId, $bReturnIds = false)
{
if (!isset(self::$userManagers[$userId])) {
$rsUser = CUser::GetByID($userId);
if ($arUser = $rsUser->Fetch()) {
self::SetUserDepartment($userId, $arUser["UF_DEPARTMENT"]);
self::$userManagers[$userId] = CIntranetUtils::GetDepartmentManager($arUser["UF_DEPARTMENT"], $arUser["ID"], true);
} else {
self::$userManagers[$userId] = false;
}
}
if (!$bReturnIds) {
return self::$userManagers[$userId];
}
$res = array();
if (is_array(self::$userManagers[$userId])) {
foreach (self::$userManagers[$userId] as $user) {
$res[] = $user['ID'];
}
}
return $res;
}
示例5: array
$arResult['DEPARTMENTS'] = array();
$dbRes = CIntranetUtils::GetSubordinateDepartmentsList($arUser["ID"]);
while ($arRes = $dbRes->GetNext()) {
$arRes['URL'] = str_replace('#ID#', $arRes['ID'], $arParams['PATH_TO_COMPANY_DEPARTMENT']);
$arResult['DEPARTMENTS'][$arRes['ID']] = $arRes;
$arResult['DEPARTMENTS'][$arRes['ID']]['EMPLOYEE_COUNT'] = 0;
$rsUsers1 = CIntranetUtils::GetDepartmentEmployees(array($arRes['ID']), $bRecursive = true);
while ($arUser1 = $rsUsers1->Fetch()) {
if ($arUser1['ID'] != $arUser["ID"]) {
//self
$arResult['DEPARTMENTS'][$arRes['ID']]['EMPLOYEE_COUNT']++;
}
}
}
//managers
$arRes = CIntranetUtils::GetDepartmentManager($arUser["UF_DEPARTMENT"], $arUser["ID"], true);
foreach ($arRes as $val) {
$arResult["MANAGERS"][$val["ID"]]["ID"] = $val["ID"];
$arResult["MANAGERS"][$val["ID"]]["NAME"] = $val["LAST_NAME"] . " " . $val["NAME"];
$arResult["MANAGERS"][$val["ID"]]["URL"] = str_replace('#ID#', $val['ID'], $arParams['PATH_TO_USER']);
$arResult["MANAGERS"][$val["ID"]]["PHOTO"] = CFile::ResizeImageGet($val['PERSONAL_PHOTO'], array("width" => 30, "height" => 30));
}
if ($arParams["CACHE_TIME"] > 0) {
$obCache->EndDataCache(array('DEPARTMENTS' => $arResult['DEPARTMENTS'], 'MANAGERS' => $arResult['MANAGERS']));
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
} elseif ($arParams["CACHE_TIME"] > 0) {
$vars = $obCache->GetVars();
$arResult['DEPARTMENTS'] = $vars['DEPARTMENTS'];