27 if (!ModuleManager::isModuleInstalled(
'photogallery'))
35 $folderUsers = $this->
getComponent()->getPathInstance()->getFolderUsersValue();
36 $folderWorkgroups = $this->
getComponent()->getPathInstance()->getFolderWorkgroupsValue();
42 !isset($componentParams[
'PHOTO_USER_IBLOCK_ID'])
43 || (
int)$componentParams[
'PHOTO_USER_IBLOCK_ID'] <= 0
45 && Loader::includeModule(
'iblock')
48 $res = \CIBlock::getList(
52 '=CODE' =>
'user_photogallery'
55 if ($iblockFields = $res->fetch())
57 $componentParams[
'PHOTO_USER_IBLOCK_ID'] = $iblockFields[
'ID'];
63 !isset($componentParams[
'PHOTO_FORUM_ID'])
64 || (
int)$componentParams[
'PHOTO_FORUM_ID'] <= 0
66 && Loader::includeModule(
'forum')
69 $res = \CForumNew::getListEx(
73 'XML_ID' =>
'PHOTOGALLERY_COMMENTS'
76 if ($forumFields = $res->fetch())
78 $componentParams[
'PHOTO_FORUM_ID'] = $forumFields[
'ID'];
84 Util::checkEmptyParamString($componentParams,
'PATH_TO_USER_PHOTO_SECTION', $folderUsers.
'user/#user_id#/photo/album/#section_id#/');
85 Util::checkEmptyParamString($componentParams,
'PATH_TO_GROUP_PHOTO_SECTION', $folderWorkgroups.
'group/#group_id#/photo/album/#section_id#/');
86 Util::checkEmptyParamString($componentParams,
'PATH_TO_USER_PHOTO_ELEMENT', $folderUsers.
'user/#user_id#/photo/photo/#section_id#/#element_id#/');
87 Util::checkEmptyParamString($componentParams,
'PATH_TO_GROUP_PHOTO_ELEMENT', $folderWorkgroups.
'group/#group_id#/photo/#section_id#/#element_id#/');
94 (
string)$componentParams[
'PHOTO_GROUP_IBLOCK_TYPE'] ===
''
95 || (
int)$componentParams[
'PHOTO_GROUP_IBLOCK_ID'] <= 0
97 && Loader::includeModule(
'iblock'))
100 $cacheId =
'sonet_group_photo_iblock_'.SITE_ID;
101 $cacheDir =
'/bitrix/sonet_group_photo_iblock';
102 $cache = new \CPHPCache;
104 if($cache->initCache($ttl, $cacheId, $cacheDir))
106 $cacheData = $cache->getVars();
107 $componentParams[
'PHOTO_GROUP_IBLOCK_TYPE'] = $cacheData[
'PHOTO_GROUP_IBLOCK_TYPE'];
108 $componentParams[
'PHOTO_GROUP_IBLOCK_ID'] = $cacheData[
'PHOTO_GROUP_IBLOCK_ID'];
113 $res = \CIBlockType::getById(
'photos');
114 if ($IBlockTypeFields = $res->fetch())
116 $resIBlock = \CIBlock::getList(
119 'IBLOCK_TYPE' => $IBlockTypeFields[
'ID'],
120 'CODE' => [
'group_photogallery',
'group_photogallery_'.SITE_ID ],
125 if ($IBlockFields = $resIBlock->fetch())
127 $componentParams[
'PHOTO_GROUP_IBLOCK_TYPE'] = $IBlockFields[
'IBLOCK_TYPE_ID'];
128 $componentParams[
'PHOTO_GROUP_IBLOCK_ID'] = $IBlockFields[
'ID'];
132 if ($cache->startDataCache())
134 $cache->endDataCache([
135 'PHOTO_GROUP_IBLOCK_TYPE' => $componentParams[
'PHOTO_GROUP_IBLOCK_TYPE'],
136 'PHOTO_GROUP_IBLOCK_ID' => $componentParams[
'PHOTO_GROUP_IBLOCK_ID']