Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
page.php
1<?
3
8
9Loc::loadMessages(__FILE__);
10
43class PageTable extends Main\Entity\DataManager
44{
50 public static function getTableName()
51 {
52 return "b_composite_page";
53 }
54
60 public static function getMap()
61 {
62 return array(
63 "ID" => array(
64 "data_type" => "integer",
65 "primary" => true,
66 "autocomplete" => true,
67 "title" => "ID",
68 ),
69 "CACHE_KEY" => array(
70 "data_type" => "string",
71 "required" => true,
72 "validation" => array(__CLASS__, "validateCacheKey"),
73 "title" => Loc::getMessage("PAGE_ENTITY_CACHE_KEY_FIELD"),
74 ),
75 "HOST" => array(
76 "data_type" => "string",
77 "required" => true,
78 "validation" => array(__CLASS__, "validateHost"),
79 "title" => Loc::getMessage("PAGE_ENTITY_HOST_FIELD"),
80 ),
81 "URI" => array(
82 "data_type" => "string",
83 "required" => true,
84 "validation" => array(__CLASS__, "validateUri"),
85 "title" => Loc::getMessage("PAGE_ENTITY_URI_FIELD"),
86 ),
87 "TITLE" => array(
88 "data_type" => "string",
89 "validation" => array(__CLASS__, "validateTitle"),
90 "title" => Loc::getMessage("PAGE_ENTITY_TITLE_FIELD"),
91 ),
92 "CREATED" => array(
93 "data_type" => "datetime",
94 "required" => true,
95 "default_value" => new DateTime(),
96 "title" => Loc::getMessage("PAGE_ENTITY_CREATED_FIELD"),
97 ),
98 "CHANGED" => array(
99 "data_type" => "datetime",
100 "required" => true,
101 "default_value" => new DateTime(),
102 "title" => Loc::getMessage("PAGE_ENTITY_CHANGED_FIELD"),
103 ),
104 "LAST_VIEWED" => array(
105 "data_type" => "datetime",
106 "required" => true,
107 "default_value" => new DateTime(),
108 "title" => Loc::getMessage("PAGE_ENTITY_LAST_VIEWED_FIELD"),
109 ),
110 "VIEWS" => array(
111 "data_type" => "integer",
112 "required" => true,
113 "default_value" => 0,
114 "title" => Loc::getMessage("PAGE_ENTITY_VIEWS_FIELD"),
115 ),
116 "REWRITES" => array(
117 "data_type" => "integer",
118 "required" => true,
119 "default_value" => 0,
120 "title" => Loc::getMessage("PAGE_ENTITY_REWRITES_FIELD"),
121 ),
122 "SIZE" => array(
123 "data_type" => "integer",
124 "required" => true,
125 "default_value" => 0,
126 "title" => Loc::getMessage("PAGE_ENTITY_SIZE_FIELD"),
127 ),
128 );
129 }
130
136 public static function validateCacheKey()
137 {
138 return array(
139 new Main\Entity\Validator\Length(null, 2000),
140 );
141 }
142
148 public static function validateHost()
149 {
150 return array(
151 new Main\Entity\Validator\Length(null, 100),
152 );
153 }
154
160 public static function validateUri()
161 {
162 return array(
163 new Main\Entity\Validator\Length(null, 2000),
164 );
165 }
166
172 public static function validateTitle()
173 {
174 return array(
175 new Main\Entity\Validator\Length(null, 250),
176 );
177 }
178
179 public static function deleteAll()
180 {
181 $tableName = static::getTableName();
182 $connection = Application::getConnection();
183 $connection->queryExecute("DELETE FROM {$tableName}");
184 }
185
192 public static function deleteBatch(array $filter)
193 {
194 $tableName = static::getTableName();
195 $connection = Application::getConnection();
196 if (isset($filter["ID"]) && is_array($filter["ID"]) && !empty($filter["ID"]))
197 {
198 $ids = implode(",", array_map("intval", $filter["ID"]));
199 $connection->queryExecute("DELETE FROM {$tableName} WHERE ID IN ($ids)");
200 }
201 }
202}
static getConnection($name="")
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29