4use \Bitrix\Landing\Internals\TemplateRefTable;
25 protected static function set($id, $type, array $data = array())
28 $res = TemplateRefTable::getList(array(
30 'ID',
'AREA',
'LANDING_ID'
34 '=ENTITY_TYPE' => $type
37 while (($row = $res->fetch()))
39 if (isset($data[$row[
'AREA']]) && $data[$row[
'AREA']] > 0)
41 if ($row[
'LANDING_ID'] != $data[$row[
'AREA']])
43 TemplateRefTable::update($row[
'ID'], array(
44 'LANDING_ID' => $data[$row[
'AREA']]
47 unset($data[$row[
'AREA']]);
51 TemplateRefTable::delete($row[
'ID']);
54 foreach ($data as $area => $lid)
58 TemplateRefTable::add(array(
60 'ENTITY_TYPE' => $type,
74 protected static function get($id, $type)
76 static $staticData = array();
79 if (!isset($staticData[$type . $id]))
84 $res = TemplateRefTable::getList(array(
90 '=ENTITY_TYPE' => $type
93 while (($row = $res->fetch()))
95 $data[$row[
'AREA']] = $row[
'LANDING_ID'];
99 $staticData[$type . $id] = $data;
102 return $staticData[$type . $id];
111 public static function setForSite($id, array $data = array())
115 self::set($id, self::ENTITY_TYPE_SITE, $data);
129 self::set($id, self::ENTITY_TYPE_LANDING, $data);
140 return self::get($id, self::ENTITY_TYPE_SITE);
150 return self::get($id, self::ENTITY_TYPE_LANDING);
160 $res = TemplateRefTable::getList(array(
168 foreach ($lid as $id)
170 $return[(int)$id] =
false;
172 while ($row = $res->fetch())
174 $return[$row[
'LANDING_ID']] =
true;
180 return $res->fetch() ? true :
false;
193 $res = TemplateRefTable::getList(array(
198 while ($row = $res->fetch())
200 TemplateRefTable::delete($row[
'ID']);
211 if ($type == self::ENTITY_TYPE_SITE)
213 return '\Bitrix\Landing\Site';
215 else if ($type == self::ENTITY_TYPE_LANDING)
217 return '\Bitrix\Landing\Landing';
static hasAccessForLanding($landingId, $accessType)
static hasAccessForSite($siteId, $accessType, $deleted=false)
static getForLanding($id)
static landingIsArea($lid)
static resolveClassByType($type)
static set($id, $type, array $data=array())
const ENTITY_TYPE_LANDING
static setForLanding($id, array $data=array())
static setForSite($id, array $data=array())