1C-Bitrix 25.700.0
group.php
См. документацию.
1<?php
3
13
14class Group extends Scope
15{
21 public static function init(array $params = [])
22 {
23 if (!Restriction\Manager::isAllowed('limit_crm_free_knowledge_base_project'))
24 {
25 return;
26 }
27 parent::init($params);
28 Role::setExpectedType(self::$currentScopeId);
29 }
30
35 public static function getPublicationPath()
36 {
38 {
39 return '/mobile/knowledge/group/';
40 }
41
42 return '/knowledge/group/';
43 }
44
49 public static function getKeyCode()
50 {
51 return 'CODE';
52 }
53
58 public static function getDomainId()
59 {
60 if (!Manager::isB24())
61 {
62 return Domain::getCurrentId();
63 }
64 return 0;
65 }
66
71 public static function getFilterType()
72 {
73 return self::getCurrentScopeId();
74 }
75
80 public static function getExcludedHooks(): array
81 {
82 return [
83 'B24BUTTON',
84 'COPYRIGHT',
85 'CSSBLOCK',
86 'FAVICON',
87 'GACOUNTER',
88 'GTM',
89 'HEADBLOCK',
90 'METAGOOGLEVERIFICATION',
91 'METAMAIN',
92 'METAROBOTS',
93 'METAYANDEXVERIFICATION',
94 'PIXELFB',
95 'PIXELVK',
96 'ROBOTS',
97 'SETTINGS',
98 'SPEED',
99 'YACOUNTER',
100 'COOKIES'
101 ];
102 }
103
110 public static function getGroupIdBySiteId(int $siteId, bool $checkAccess = false): ?int
111 {
112 $res = BindingTable::getList([
113 'select' => [
114 'BINDING_ID'
115 ],
116 'filter' => [
117 '=ENTITY_TYPE' => BindingTable::ENTITY_TYPE_SITE,
118 '=BINDING_TYPE' => 'G',
119 'ENTITY_ID' => $siteId
120 ]
121 ]);
122 if ($row = $res->fetch())
123 {
124 $groupId = (int) $row['BINDING_ID'];
125 if ($checkAccess && Loader::includeModule('socialnetwork'))
126 {
127 $canRead = \CSocNetFeaturesPerms::CanPerformOperation(
130 $groupId,
132 'read'
133 );
134 if (!$canRead)
135 {
136 return null;
137 }
138 }
139 return $groupId;
140 }
141
142 return null;
143 }
144
151 public static function getOperationsForSite(int $siteId): array
152 {
153 static $cache = [];
154
155 if (!array_key_exists($siteId, $cache))
156 {
157 $groupId = self::getGroupIdBySiteId($siteId) ?: 0;
158 $cache[$siteId] = [
159 'read' => false,//see below
160 'edit' => SocialNetwork::canPerformOperation($groupId, Rights::ACCESS_TYPES['edit']),
161 'sett' => SocialNetwork::canPerformOperation($groupId, Rights::ACCESS_TYPES['sett']),
162 'delete' => SocialNetwork::canPerformOperation($groupId, Rights::ACCESS_TYPES['delete']),
163 ];
164
165 if (array_sum($cache[$siteId]))
166 {
167 $cache[$siteId]['read'] = true;
168 }
169 }
170
171 return $cache[$siteId];
172 }
173}
static isMobileHit()
Определения mobile.php:154
static canPerformOperation(int $groupId, string $operation)
Определения socialnetwork.php:380
static isB24()
Определения manager.php:1135
static getUserId()
Определения manager.php:107
const ACCESS_TYPES
Определения rights.php:21
static setExpectedType($type)
Определения role.php:537
static getPublicationPath()
Определения group.php:35
static getOperationsForSite(int $siteId)
Определения group.php:151
static getExcludedHooks()
Определения group.php:80
static init(array $params=[])
Определения group.php:21
static getFilterType()
Определения group.php:71
static getKeyCode()
Определения group.php:49
static getGroupIdBySiteId(int $siteId, bool $checkAccess=false)
Определения group.php:110
static getDomainId()
Определения group.php:58
Определения loader.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$siteId
Определения ajax.php:8
Определения ai.php:3
Определения agent.php:3
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$canRead
Определения options.php:9
const SONET_ENTITY_GROUP
Определения include.php:117