Exemplo n.º 1
0
 public static function getLinkData($entityType, $entityId, $sectionData)
 {
     $chain = self::getNavChain($sectionData['IBLOCK_ID'], $sectionData['ID']);
     $sectionIds = array();
     foreach ($chain as $item) {
         $sectionIds[] = $item['ID'];
     }
     unset($item);
     //hack. Now we have symlink only in user library. And then entityType ~equals to user
     if ($entityType == self::ENTITY_TYPE_USER) {
         $userLib = CWebDavIblock::LibOptions('user_files', false, SITE_ID);
         if ($userLib && isset($userLib['id']) && ($iblockId = intval($userLib['id']))) {
             $rootSection = self::getRootSectionData($entityType, $entityId);
             if (empty($rootSection)) {
                 $rootSection = CWebDavIblock::getRootSectionDataForUser($entityId);
                 if (empty($rootSection)) {
                     return array();
                 }
                 $margins = CIBlockSection::GetList(array(), array('ID' => $rootSection['SECTION_ID'], 'IBLOCK_ID' => $rootSection['IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N'), false, array('LEFT_MARGIN', 'RIGHT_MARGIN', 'IBLOCK_ID'));
                 if (!$margins) {
                     return array();
                 }
                 $rootSection = $margins->fetch();
                 self::addRootSectionData($entityType, $entityId, $rootSection);
             }
             $symlinkSection = CIBlockSection::getList(array(), array('IBLOCK_ID' => $iblockId, CWebDavIblock::UF_LINK_SECTION_ID => $sectionIds, 'CHECK_PERMISSIONS' => 'N', '>LEFT_BORDER' => $rootSection['LEFT_MARGIN'], '<RIGHT_BORDER' => $rootSection['RIGHT_MARGIN']), false, CWebDavIblock::getUFNamesForSectionLink());
             if (!$symlinkSection || !($symlinkSection = $symlinkSection->fetch())) {
                 return array();
             }
             return $symlinkSection;
         }
     } elseif ($entityType == self::ENTITY_TYPE_GROUP) {
         return array();
     } elseif ($entityType == self::ENTITY_TYPE_SECTION) {
         return array();
     } elseif ($entityType == self::ENTITY_TYPE_SHARED) {
         return array();
     }
 }