14 private static function getCallingClass()
16 if (static::$internalClass ===
null)
18 throw new \Bitrix\Main\SystemException(
19 'Variable static::$internalClass must be declarated in external class.'
22 return '\\' . __NAMESPACE__ .
'\\' . static::$internalClass;
29 public static function getMap()
32 $class = self::getCallingClass();
33 return $class::getMap();
41 public static function add($fields)
44 $uid = $uid ? $uid : 1;
45 $date = new \Bitrix\Main\Type\DateTime;
48 'ACTIVE',
'PUBLIC',
'SITEMAP',
'FOLDER'
50 foreach ($charValue as $code)
52 if (isset($fields[$code]) && $fields[$code] !=
'Y')
57 if (!isset($fields[
'CREATED_BY_ID']))
59 $fields[
'CREATED_BY_ID'] = $uid;
61 if (!isset($fields[
'MODIFIED_BY_ID']))
63 $fields[
'MODIFIED_BY_ID'] = $uid;
65 if (!isset($fields[
'DATE_CREATE']))
67 $fields[
'DATE_CREATE'] = $date;
69 if (!isset($fields[
'DATE_MODIFY']))
71 $fields[
'DATE_MODIFY'] = $date;
75 $class = self::getCallingClass();
76 return $class::add($fields);
85 public static function update($id, $fields = array())
88 $date = new \Bitrix\Main\Type\DateTime;
91 'ACTIVE',
'PUBLIC',
'SITEMAP',
'FOLDER'
93 foreach ($charValue as $code)
95 if (isset($fields[$code]) && $fields[$code] !=
'Y')
101 if (isset($fields[
'ID']))
103 unset($fields[
'ID']);
105 if (!isset($fields[
'MODIFIED_BY_ID']))
107 $fields[
'MODIFIED_BY_ID'] = $uid;
109 else if (!$fields[
'MODIFIED_BY_ID'])
111 unset($fields[
'MODIFIED_BY_ID']);
113 if (!isset($fields[
'DATE_MODIFY']))
115 $fields[
'DATE_MODIFY'] = $date;
117 if (!$fields[
'DATE_MODIFY'])
119 unset($fields[
'DATE_MODIFY']);
123 $class = self::getCallingClass();
124 return $class::update($id, $fields);
132 public static function delete($id)
135 $class = self::getCallingClass();
136 \Bitrix\Landing\Debug::log(
138 'id: ' . $id .
'@' . print_r(\
Bitrix\Main\Diag\Helper::getBackTrace(5),
true),
139 'LANDING_ENTITY_DELETE'
141 return $class::delete($id);
149 public static function getList($params = array())
151 $class = self::getCallingClass();
153 if (method_exists($class,
'setAccessFilter'))
155 $params = $class::setAccessFilter($params);
159 return $class::getList($params);
170 $class = self::getCallingClass();
171 if (mb_substr(mb_strtolower($class), -5) ==
'table')
173 $class = mb_substr($class, 0, -5);
176 $eventManager = \Bitrix\Main\EventManager::getInstance();
177 $eventManager->addEventHandler(
179 $class .
'::' . $code,