Пример #1
0
}
$arManagers = array();
if (($arDepartments = CIntranetUtils::getUserDepartments($USER->GetID())) && is_array($arDepartments) && count($arDepartments) > 0) {
    $arManagers = array_keys(CIntranetUserSelectorHelper::getDepartmentManagersId($arDepartments, $USER->getID(), true));
}
$iBlockId = COption::GetOptionInt('intranet', 'iblock_structure');
$arSecFilter = array('IBLOCK_ID' => $iBlockId);
if ($bSubordinateOnly) {
    if (!$arSubDeps) {
        $arSubDeps = array(-1);
    }
    $arSecFilter["ID"] = $arSubDeps;
}
$arStructure = $arSections = array();
if ($arParams["DISPLAY_TAB_STRUCTURE"] == 'Y' && (!CModule::IncludeModule('extranet') || CExtranet::IsIntranetUser())) {
    $arStructure = CIntranetUtils::getSubStructure(0, 1);
    $arSections = $arStructure['DATA'];
    $arStructure = $arStructure['TREE'];
    if ($bSubordinateOnly) {
        $arStructure = array();
        foreach ($arSections as $k => $item) {
            $iblockSectionId = (int) $item['IBLOCK_SECTION_ID'];
            if (($isSub = !in_array($iblockSectionId, $arSubDeps)) && !in_array($item['ID'], $arSubDeps)) {
                unset($arSections[$k]);
                continue;
            }
            if ($isSub) {
                $iblockSectionId = 0;
            }
            if (!isset($arStructure[$iblockSectionId])) {
                $arStructure[$iblockSectionId] = array();
Пример #2
0
					typeof oData.id != 'undefined'
					&& oData.id != null
					&& typeof oData.name != 'undefined'
				)
				{
					inviteDialogStructureLink.innerHTML = oData.name;
					inviteDialogDepartmentIdField.value = oData.id;

					inviteDialogDepartmentPopup.close();
				}
			}

		</script><?php 
    }
    $iDepartmentID = is_array($_POST) && array_key_exists("arParams", $_POST) && is_array($_POST["arParams"]) && array_key_exists("UF_DEPARTMENT", $_POST["arParams"]) ? intval($_POST["arParams"]["UF_DEPARTMENT"]) : 0;
    $arStructure = CIntranetUtils::getSubStructure(0, $iDepartmentID > 0 ? false : 1);
    if (!array_key_exists($iDepartmentID, $arStructure["DATA"])) {
        $iDepartmentID = 0;
    }
    $iStructureCount = count(CIntranetUtils::GetDeparmentsTree());
    CModule::IncludeModule('socialnetwork');
    $cacheTtl = defined("BX_COMP_MANAGED_CACHE") ? 3153600 : 3600 * 4;
    $cacheId = 'invite_dialog_sonetgroups_' . $SITE_ID . '_' . ($bExtranetInstalled ? 'Y' : 'N') . '_' . $GLOBALS["USER"]->GetID();
    $cacheDir = '/intranet/invite_dialog/' . $SITE_ID . '/' . $GLOBALS["USER"]->GetID();
    $obCache = new CPHPCache();
    if ($obCache->InitCache($cacheTtl, $cacheId, $cacheDir)) {
        $arCacheVars = $obCache->GetVars();
        $arSonetGroups = $arCacheVars["SONET_GROUPS"];
        $arSonetGroupsExtranet = $arCacheVars["SONET_GROUPS_EXTRANET"];
    } else {
        $obCache->StartDataCache();
Пример #3
0
 public static function GetSiteByDepartmentId($arDepartmentId)
 {
     if (!is_array($arDepartmentId)) {
         $arDepartmentId = array($arDepartmentId);
     }
     $bFound = false;
     $arDefaultSite = false;
     $dbSitesList = CSite::GetList($b = "SORT", $o = "asc", array("ACTIVE" => "Y"));
     // cache used
     while ($arSite = $dbSitesList->GetNext()) {
         if (!$arDefaultSite && $arSite['DEF'] == 'Y') {
             $arDefaultSite = $arSite;
         }
         $siteRootDepartmentId = COption::GetOptionString("main", "wizard_departament", false, $arSite["LID"], true);
         if ($siteRootDepartmentId) {
             if (in_array($siteRootDepartmentId, $arDepartmentId)) {
                 $arResult = $arSite;
                 $bFound = true;
             } else {
                 $arSubStructure = CIntranetUtils::getSubStructure($siteRootDepartmentId);
                 $arSiteDepartmentId = array_keys($arSubStructure["DATA"]);
                 foreach ($arDepartmentId as $userDepartmentId) {
                     if (in_array($userDepartmentId, $arSiteDepartmentId)) {
                         $arResult = $arSite;
                         $bFound = true;
                         break;
                     }
                 }
             }
             if ($bFound) {
                 break;
             }
         }
     }
     if (!$bFound) {
         $arResult = $arDefaultSite;
     }
     return $arResult;
 }
Пример #4
0
     if (CModule::IncludeModule("extranet")) {
         if ($showExtranetUsers == SHOW_FROM_MY_GROUPS) {
             $arFilteredUserIDs = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
         } elseif ($showExtranetUsers == SHOW_FROM_EXACT_GROUP) {
             if (CModule::IncludeModule("socialnetwork")) {
                 $dbUsers = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => array($exGroupID), "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("ID", "USER_ID"));
                 if ($dbUsers) {
                     while ($arUser = $dbUsers->GetNext()) {
                         $arFilteredUserIDs[] = $arUser["USER_ID"];
                     }
                 }
             }
         }
     }
 } else {
     $arStructure = CIntranetUtils::getSubStructure($sectionId, 1);
     if (!empty($arStructure['TREE'])) {
         if ($bSubordinateOnly) {
             $arStructure['TREE'] = array();
             foreach ($arStructure['DATA'] as $k => $item) {
                 $iblockSectionId = (int) $item['IBLOCK_SECTION_ID'];
                 if (($isSub = !in_array($iblockSectionId, $arSubDeps)) && !in_array($item['ID'], $arSubDeps)) {
                     unset($arStructure['DATA'][$k]);
                     continue;
                 }
                 if ($isSub) {
                     $iblockSectionId = 0;
                 }
                 if (!isset($arStructure['TREE'][$iblockSectionId])) {
                     $arStructure['TREE'][$iblockSectionId] = array();
                 }