40 $this->bindingId =
$code;
47 private static function clearCache(): void
49 if (defined(
'BX_COMP_MANAGED_CACHE'))
52 'intranet_menu_binding'
63 private function getBindingId(
$entityId, $entityType)
65 $res = BindingTable::getList([
70 '=BINDING_TYPE' => static::$bindingType,
71 '=BINDING_ID' => $this->bindingId,
72 '=ENTITY_TYPE' => $entityType,
76 if ($row =
$res->fetch())
92 private function addBinding(
$entityId, $entityType)
94 $res = BindingTable::add([
95 'BINDING_TYPE' => static::$bindingType,
96 'BINDING_ID' => $this->bindingId,
97 'ENTITY_TYPE' => $entityType,
100 if (
$res->isSuccess())
102 return $res->getId();
127 private function bind(
$entityId, $entityType)
129 if (!$this->getBindingId(
$entityId, $entityType))
132 return $this->addBinding(
$entityId, $entityType) > 0;
146 private function unbind(
$entityId, $entityType)
166 private static function getBindings(
$bindingId)
172 '=BINDING_TYPE' => static::$bindingType,
174 self::ENTITY_TYPE_SITE,
175 self::ENTITY_TYPE_LANDING
185 $runtime[] =
new Main\Entity\ReferenceField(
187 'Bitrix\Landing\Internals\SiteTable',
189 '=this.ENTITY_ID' =>
'ref.ID',
190 '=this.ENTITY_TYPE' => [
191 '?', self::ENTITY_TYPE_SITE
195 $runtime[] =
new Main\Entity\ReferenceField(
197 'Bitrix\Landing\Internals\LandingTable',
199 '=this.ENTITY_ID' =>
'ref.ID',
200 '=this.ENTITY_TYPE' => [
201 '?', self::ENTITY_TYPE_LANDING
208 self::ENTITY_TYPE_SITE => [],
209 self::ENTITY_TYPE_LANDING => []
211 $res = BindingTable::getList([
216 'SITE_TITLE' =>
'SITE.TITLE',
217 'LANDING_TITLE' =>
'LANDING.TITLE',
218 'SITE_DELETED' =>
'SITE.DELETED',
219 'LANDING_DELETED' =>
'LANDING.DELETED'
222 'runtime' => $runtime,
227 while ($row =
$res->fetch())
230 $row[
'SITE_DELETED'] ==
'Y' ||
231 $row[
'LANDING_DELETED'] ==
'Y'
236 $urls[$row[
'ENTITY_TYPE']][] = $row[
'ENTITY_ID'];
237 $title = ($row[
'ENTITY_TYPE'] == self::ENTITY_TYPE_SITE)
239 : $row[
'LANDING_TITLE'];
245 'ENTITY_ID' => $row[
'ENTITY_ID'],
246 'ENTITY_TYPE' => $row[
'ENTITY_TYPE'],
247 'BINDING_ID' => $row[
'BINDING_ID'],
254 if ($urls[self::ENTITY_TYPE_SITE])
256 $urls[self::ENTITY_TYPE_SITE] = Site::getPublicUrl(
257 $urls[self::ENTITY_TYPE_SITE]
260 if ($urls[self::ENTITY_TYPE_LANDING])
262 $landing = Landing::createInstance(0);
263 $urls[self::ENTITY_TYPE_LANDING] = $landing->getPublicUrl(
264 $urls[self::ENTITY_TYPE_LANDING]
269 foreach (
$items as &$item)
271 if (isset($urls[$item[
'ENTITY_TYPE']][$item[
'ENTITY_ID']]))
273 $item[
'PUBLIC_URL'] = $urls[$item[
'ENTITY_TYPE']][$item[
'ENTITY_ID']];
288 return self::getBindings(
$code);
302 if (
$success && method_exists($this,
'addSiteRights'))
320 if (method_exists($this,
'updateSiteRights'))
322 $this->updateSiteRights(
$siteId);
339 if (
$success && method_exists($this,
'removeSiteRights'))
341 $this->removeSiteRights(
$siteId);
354 $landingId = intval($landingId);
356 $success = $this->bind($landingId, $this::ENTITY_TYPE_LANDING);
358 if (
$success && method_exists($this,
'addLandingRights'))
360 $this->addLandingRights($landingId);
373 $landingId = intval($landingId);
375 $success = $this->unbind($landingId, $this::ENTITY_TYPE_LANDING);
377 if (
$success && method_exists($this,
'removeLandingRights'))
379 $this->removeLandingRights($landingId);
392 if (defined(
'BX_COMP_MANAGED_CACHE'))
394 $res = BindingTable::getList([
400 '=ENTITY_TYPE' => self::ENTITY_TYPE_SITE
415 &&
Site\Type::getCurrentScopeId() !==
'GROUP'