Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
group.php
1<?
8
9class Group
10{
11 public static function onSocNetGroupDelete($groupId)
12 {
13 if (!Loader::includeModule('iblock'))
14 {
15 return true;
16 }
17
18 $iblockIdList = array();
19 $res = \CIBlock::getList(array(), array("ACTIVE" => "Y", "CODE"=>"group_photogallery%"));
20 while($iblock = $res->fetch())
21 {
22 $iblockIdList[] = $iblock["ID"];
23 }
24
25 if (empty($iblockIdList))
26 {
27 return true;
28 }
29
30 $res = \CIBlockSection::getList(
31 array(),
32 array(
33 "IBLOCK_ID" => $iblockIdList,
34 "SOCNET_GROUP_ID" => $groupId
35 ),
36 false,
37 array('ID', 'LEFT_MARGIN', 'RIGHT_MARGIN')
38 );
39 while ($section = $res->fetch())
40 {
41 @set_time_limit(1000);
42
43 $treeSectionIdList = $treeElementIdList = array();
44
45 $pseudoComponentParams = array(
46 'IS_SOCNET' => 'Y',
47 'USER_ALIAS' => 'group_'.$groupId
48 );
49
50 $pseudoComponentResult = array(
51 'SECTION' => $section
52 );
53
54 foreach(getModuleEvents("photogallery", "OnBeforeSectionDrop", true) as $event)
55 {
56 executeModuleEventEx($event, array($section['ID'], $pseudoComponentParams, $pseudoComponentResult, &$treeSectionIdList, &$treeElementIdList));
57 }
58
59 if (\CIBlockSection::delete($section['ID'], false))
60 {
61 $eventFields = array(
62 "ID" => $section['ID'],
63 "SECTIONS_IN_TREE" => $treeSectionIdList,
64 "ELEMENTS_IN_TREE" => $treeElementIdList
65 );
66 foreach(getModuleEvents("photogallery", "OnAfterSectionDrop", true) as $event)
67 {
68 executeModuleEventEx($event, array($section['ID'], $eventFields, $pseudoComponentParams, $pseudoComponentResult));
69 }
70 }
71 }
72
73 return true;
74 }
75}
76?>