当前位置: 首页>>代码示例>>PHP>>正文


PHP CIntranetUtils::SECTIONS_SETTINGS_CACHE方法代码示例

本文整理汇总了PHP中CIntranetUtils::SECTIONS_SETTINGS_CACHE方法的典型用法代码示例。如果您正苦于以下问题:PHP CIntranetUtils::SECTIONS_SETTINGS_CACHE方法的具体用法?PHP CIntranetUtils::SECTIONS_SETTINGS_CACHE怎么用?PHP CIntranetUtils::SECTIONS_SETTINGS_CACHE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIntranetUtils的用法示例。


在下文中一共展示了CIntranetUtils::SECTIONS_SETTINGS_CACHE方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _GetDeparmentsTree

 private static function _GetDeparmentsTree()
 {
     global $USER_FIELD_MANAGER, $CACHE_MANAGER, $DB, $DBType;
     self::$SECTIONS_SETTINGS_CACHE = array('TREE' => array(), 'DATA' => array());
     $ibDept = COption::GetOptionInt('intranet', 'iblock_structure', false);
     if ($ibDept <= 0) {
         return;
     }
     $cache_dir = '/intranet/structure';
     $cache_id = 'intranet|structure2|' . $ibDept;
     $obCache = new CPHPCache();
     if ($obCache->InitCache(30 * 86400, $cache_id, $cache_dir)) {
         self::$SECTIONS_SETTINGS_CACHE = $obCache->GetVars();
     } else {
         $obCache->StartDataCache();
         $CACHE_MANAGER->StartTagCache($cache_dir);
         $CACHE_MANAGER->RegisterTag("iblock_id_" . $ibDept);
         $CACHE_MANAGER->RegisterTag("intranet_users");
         $CACHE_MANAGER->RegisterTag("intranet_department_structure");
         $dbRes = CIBlockSection::GetList(array("LEFT_MARGIN" => "ASC"), array('IBLOCK_ID' => $ibDept, 'ACTIVE' => 'Y'), false, array('ID', 'NAME', 'IBLOCK_SECTION_ID', 'UF_HEAD', 'SECTION_PAGE_URL', 'DEPTH_LEVEL'));
         while ($arRes = $dbRes->Fetch()) {
             if (!$arRes['IBLOCK_SECTION_ID']) {
                 $arRes['IBLOCK_SECTION_ID'] = 0;
             }
             if (!self::$SECTIONS_SETTINGS_CACHE['TREE'][$arRes['IBLOCK_SECTION_ID']]) {
                 self::$SECTIONS_SETTINGS_CACHE['TREE'][$arRes['IBLOCK_SECTION_ID']] = array();
             }
             self::$SECTIONS_SETTINGS_CACHE['TREE'][$arRes['IBLOCK_SECTION_ID']][] = $arRes['ID'];
             self::$SECTIONS_SETTINGS_CACHE['DATA'][$arRes['ID']] = array('ID' => $arRes['ID'], 'NAME' => $arRes['NAME'], 'IBLOCK_SECTION_ID' => $arRes['IBLOCK_SECTION_ID'], 'UF_HEAD' => $arRes['UF_HEAD'], 'SECTION_PAGE_URL' => $arRes['SECTION_PAGE_URL'], 'DEPTH_LEVEL' => $arRes['DEPTH_LEVEL'], 'EMPLOYEES' => array());
         }
         if ($DBType == 'oracle') {
             $dbRes = $DB->query("\n\t\t\t\t\tSELECT BUF.VALUE_ID AS ID, BUF.VALUE_INT AS UF_DEPARTMENT\n\t\t\t\t\t\tFROM b_utm_user BUF\n\t\t\t\t\t\t\tLEFT JOIN b_user_field UF ON BUF.FIELD_ID = UF.ID\n\t\t\t\t\t\t\tLEFT JOIN b_user U ON BUF.VALUE_ID = U.ID\n\t\t\t\t\t\tWHERE ( U.ACTIVE = 'Y' )\n\t\t\t\t\t\t\tAND ( UF.FIELD_NAME = 'UF_DEPARTMENT' )\n\t\t\t\t\t\t\tAND ( BUF.VALUE_INT IS NOT NULL AND BUF.VALUE_INT <> 0 )\n\t\t\t\t");
             while ($arRes = $dbRes->fetch()) {
                 $dpt = $arRes['UF_DEPARTMENT'];
                 if (is_array(self::$SECTIONS_SETTINGS_CACHE['DATA'][$dpt])) {
                     self::$SECTIONS_SETTINGS_CACHE['DATA'][$dpt]['EMPLOYEES'][] = $arRes['ID'];
                 }
             }
         } else {
             $dbRes = CUser::GetList($by = 'ID', $order = 'ASC', array('ACTIVE' => 'Y', '!UF_DEPARTMENT' => false), array('FIELDS' => array('ID'), 'SELECT' => array('UF_DEPARTMENT')));
             while ($arRes = $dbRes->fetch()) {
                 foreach ($arRes['UF_DEPARTMENT'] as $dpt) {
                     if (is_array(self::$SECTIONS_SETTINGS_CACHE['DATA'][$dpt])) {
                         self::$SECTIONS_SETTINGS_CACHE['DATA'][$dpt]['EMPLOYEES'][] = $arRes['ID'];
                     }
                 }
             }
         }
         $CACHE_MANAGER->EndTagCache();
         $obCache->EndDataCache(self::$SECTIONS_SETTINGS_CACHE);
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:52,代码来源:utils.php


注:本文中的CIntranetUtils::SECTIONS_SETTINGS_CACHE方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。