Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
eventtable.php
1<?php
2
4
7use Bitrix\Main\Entity\ReferenceField;
9use Bitrix\Main\ORM\Data\Internal\DeleteByFilterTrait;
17
34class EventTable extends Main\Entity\DataManager
35{
36 use DeleteByFilterTrait;
37
43 public static function getTableName()
44 {
45 return 'b_calendar_event';
46 }
47
53 public static function getUfId()
54 {
56 }
57
58
65 public static function getMap()
66 {
67 return [
68 (new IntegerField('ID'))
69 ->configureTitle(Loc::getMessage('EVENT_ENTITY_ID_FIELD'))
70 ->configurePrimary(true)
71 ->configureAutocomplete(true)
72 ,
73 (new IntegerField('PARENT_ID'))
74 ->configureTitle(Loc::getMessage('EVENT_ENTITY_PARENT_ID_FIELD'))
75 ,
76 (new BooleanField('ACTIVE'))
77 ->configureTitle(Loc::getMessage('EVENT_ENTITY_ACTIVE_FIELD'))
78 ->configureValues('N', 'Y')
79 ->configureDefaultValue('Y')
80 ,
81 (new BooleanField('DELETED'))
82 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DELETED_FIELD'))
83 ->configureValues('N', 'Y')
84 ->configureDefaultValue('N')
85 ,
86 (new StringField('CAL_TYPE',
87 [
88 'validation' => [__CLASS__, 'validateCalType']
89 ]
90 ))
91 ->configureTitle(Loc::getMessage('EVENT_ENTITY_CAL_TYPE_FIELD'))
92 ,
93 (new IntegerField('OWNER_ID'))
94 ->configureTitle(Loc::getMessage('EVENT_ENTITY_OWNER_ID_FIELD'))
95 ->configureRequired(true)
96 ,
97 (new StringField('NAME',
98 [
99 'validation' => [__CLASS__, 'validateName']
100 ]
101 ))
102 ->configureTitle(Loc::getMessage('EVENT_ENTITY_NAME_FIELD'))
103 ,
104 (new DatetimeField('DATE_FROM'))
105 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DATE_FROM_FIELD'))
106 ,
107 (new DatetimeField('DATE_TO'))
108 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DATE_TO_FIELD'))
109 ,
110 (new DatetimeField('ORIGINAL_DATE_FROM'))
111 ->configureTitle(Loc::getMessage('EVENT_ENTITY_ORIGINAL_DATE_FROM_FIELD'))
112 ,
113 (new StringField('TZ_FROM',
114 [
115 'validation' => [__CLASS__, 'validateTzFrom']
116 ]
117 ))
118 ->configureTitle(Loc::getMessage('EVENT_ENTITY_TZ_FROM_FIELD'))
119 ,
120 (new StringField('TZ_TO',
121 [
122 'validation' => [__CLASS__, 'validateTzTo']
123 ]
124 ))
125 ->configureTitle(Loc::getMessage('EVENT_ENTITY_TZ_TO_FIELD'))
126 ,
127 (new IntegerField('TZ_OFFSET_FROM'))
128 ->configureTitle(Loc::getMessage('EVENT_ENTITY_TZ_OFFSET_FROM_FIELD'))
129 ,
130 (new IntegerField('TZ_OFFSET_TO'))
131 ->configureTitle(Loc::getMessage('EVENT_ENTITY_TZ_OFFSET_TO_FIELD'))
132 ,
133 (new IntegerField('DATE_FROM_TS_UTC'))
134 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DATE_FROM_TS_UTC_FIELD'))
135 ,
136 (new IntegerField('DATE_TO_TS_UTC'))
137 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DATE_TO_TS_UTC_FIELD'))
138 ,
139 (new BooleanField('DT_SKIP_TIME'))
140 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DT_SKIP_TIME_FIELD'))
141 ->configureValues('N', 'Y')
142 ->configureDefaultValue('N')
143 ,
144 (new IntegerField('DT_LENGTH'))
145 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DT_LENGTH_FIELD'))
146 ,
147 (new StringField('EVENT_TYPE',
148 [
149 'validation' => [__CLASS__, 'validateEventType']
150 ]
151 ))
152 ->configureTitle(Loc::getMessage('EVENT_ENTITY_EVENT_TYPE_FIELD'))
153 ,
154 (new IntegerField('CREATED_BY'))
155 ->configureTitle(Loc::getMessage('EVENT_ENTITY_CREATED_BY_FIELD'))
156 ->configureRequired(true)
157 ,
158 (new DatetimeField('DATE_CREATE'))
159 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DATE_CREATE_FIELD'))
160 ,
161 (new DatetimeField('TIMESTAMP_X'))
162 ->configureTitle(Loc::getMessage('EVENT_ENTITY_TIMESTAMP_X_FIELD'))
163 ,
164 (new TextField('DESCRIPTION'))
165 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DESCRIPTION_FIELD'))
166 ,
167 (new DatetimeField('DT_FROM'))
168 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DT_FROM_FIELD'))
169 ,
170 (new DatetimeField('DT_TO'))
171 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DT_TO_FIELD'))
172 ,
173 (new StringField('PRIVATE_EVENT',
174 [
175 'validation' => [__CLASS__, 'validatePrivateEvent']
176 ]
177 ))
178 ->configureTitle(Loc::getMessage('EVENT_ENTITY_PRIVATE_EVENT_FIELD'))
179 ,
180 (new StringField('ACCESSIBILITY',
181 [
182 'validation' => [__CLASS__, 'validateAccessibility']
183 ]
184 ))
185 ->configureTitle(Loc::getMessage('EVENT_ENTITY_ACCESSIBILITY_FIELD'))
186 ,
187 (new StringField('IMPORTANCE',
188 [
189 'validation' => [__CLASS__, 'validateImportance']
190 ]
191 ))->configureTitle(Loc::getMessage('EVENT_ENTITY_IMPORTANCE_FIELD'))
192 ,
193 (new StringField('IS_MEETING',
194 [
195 'validation' => [__CLASS__, 'validateIsMeeting']
196 ]
197 ))
198 ->configureTitle(Loc::getMessage('EVENT_ENTITY_IS_MEETING_FIELD'))
199 ,
200 (new StringField('MEETING_STATUS',
201 [
202 'validation' => [__CLASS__, 'validateMeetingStatus']
203 ]
204 ))
205 ->configureTitle(Loc::getMessage('EVENT_ENTITY_MEETING_STATUS_FIELD'))
206 ,
207 (new IntegerField('MEETING_HOST'))
208 ->configureTitle(Loc::getMessage('EVENT_ENTITY_MEETING_HOST_FIELD'))
209 ,
210 (new TextField('MEETING'))
211 ->configureTitle(Loc::getMessage('EVENT_ENTITY_MEETING_FIELD'))
212 ,
213 (new StringField('LOCATION',
214 [
215 'validation' => [__CLASS__, 'validateLocation']
216 ]
217 ))
218 ->configureTitle(Loc::getMessage('EVENT_ENTITY_LOCATION_FIELD'))
219 ,
220 (new TextField('REMIND',
221 [
222 'validation' => [__CLASS__, 'validateRemind']
223 ]
224 ))
225 ->configureTitle(Loc::getMessage('EVENT_ENTITY_REMIND_FIELD'))
226 ,
227 (new StringField('COLOR',
228 [
229 'validation' => [__CLASS__, 'validateColor']
230 ]
231 ))
232 ->configureTitle(Loc::getMessage('EVENT_ENTITY_COLOR_FIELD'))
233 ,
234 (new StringField('TEXT_COLOR',
235 [
236 'validation' => [__CLASS__, 'validateTextColor']
237 ]
238 ))
239 ->configureTitle(Loc::getMessage('EVENT_ENTITY_TEXT_COLOR_FIELD'))
240 ,
241 (new StringField('RRULE',
242 [
243 'validation' => [__CLASS__, 'validateRrule']
244 ]
245 ))
246 ->configureTitle(Loc::getMessage('EVENT_ENTITY_RRULE_FIELD'))
247 ,
248 (new TextField('EXDATE',
249 []
250 ))
251 ->configureTitle(Loc::getMessage('EVENT_ENTITY_EXDATE_FIELD'))
252 ,
253 (new StringField('DAV_XML_ID',
254 [
255 'validation' => [__CLASS__, 'validateDavXmlId']
256 ]
257 ))
258 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DAV_XML_ID_FIELD'))
259 ,
260 (new StringField('G_EVENT_ID',
261 [
262 'validation' => [__CLASS__, 'validateGEventId']
263 ]
264 ))
265 ->configureTitle(Loc::getMessage('EVENT_ENTITY_G_EVENT_ID_FIELD'))
266 ,
267 (new StringField('DAV_EXCH_LABEL',
268 [
269 'validation' => [__CLASS__, 'validateDavExchLabel']
270 ]
271 ))
272 ->configureTitle(Loc::getMessage('EVENT_ENTITY_DAV_EXCH_LABEL_FIELD'))
273 ,
274 (new StringField('CAL_DAV_LABEL',
275 [
276 'validation' => [__CLASS__, 'validateCalDavLabel']
277 ]
278 ))
279 ->configureTitle(Loc::getMessage('EVENT_ENTITY_CAL_DAV_LABEL_FIELD'))
280 ,
281 (new StringField('VERSION',
282 [
283 'validation' => [__CLASS__, 'validateVersion']
284 ]
285 ))
286 ->configureTitle(Loc::getMessage('EVENT_ENTITY_VERSION_FIELD'))
287 ,
288 (new TextField('ATTENDEES_CODES'))
289 ->configureTitle(Loc::getMessage('EVENT_ENTITY_ATTENDEES_CODES_FIELD'))
290 ,
291 (new IntegerField('RECURRENCE_ID'))
292 ->configureTitle(Loc::getMessage('EVENT_ENTITY_RECURRENCE_ID_FIELD'))
293 ,
294 (new StringField('RELATIONS',
295 [
296 'validation' => [__CLASS__, 'validateRelations']
297 ]
298 ))
299 ->configureTitle(Loc::getMessage('EVENT_ENTITY_RELATIONS_FIELD'))
300 ,
301 (new TextField('SEARCHABLE_CONTENT'))
302 ->configureTitle(Loc::getMessage('EVENT_ENTITY_SEARCHABLE_CONTENT_FIELD'))
303 ,
304 (new IntegerField('SECTION_ID'))
305 ->configureTitle(Loc::getMessage('EVENT_ENTITY_SECTION_ID_FIELD'))
306 ,
307 (new StringField('SYNC_STATUS',
308 [
309 'validation' => [__CLASS__, 'validateSyncStatus']
310 ]
311 ))
312 ->configureTitle(Loc::getMessage('EVENT_ENTITY_SYNC_STATUS_FIELD'))
313 ,
314 (new ReferenceField(
315 'SECTION',
316 SectionTable::class,
317 Join::on('this.SECTION_ID', 'ref.ID'),
318 ))
319 ,
320 (new ReferenceField(
321 'EVENT_SECT',
322 EventSectTable::class,
323 Join::on('this.ID', 'ref.EVENT_ID'),
324 ))
325 ,
326 ];
327 }
328
334 public static function validateCalType(): array
335 {
336 return [
337 new LengthValidator(null, 100),
338 ];
339 }
340
346 public static function validateName(): array
347 {
348 return [
349 new LengthValidator(null, 255),
350 ];
351 }
352
358 public static function validateTzFrom(): array
359 {
360 return [
361 new LengthValidator(null, 50),
362 ];
363 }
364
370 public static function validateTzTo(): array
371 {
372 return [
373 new LengthValidator(null, 50),
374 ];
375 }
376
382 public static function validateEventType(): array
383 {
384 return [
385 new LengthValidator(null, 50),
386 ];
387 }
388
394 public static function validatePrivateEvent(): array
395 {
396 return [
397 new LengthValidator(null, 10),
398 ];
399 }
400
406 public static function validateAccessibility(): array
407 {
408 return [
409 new LengthValidator(null, 10),
410 ];
411 }
412
418 public static function validateImportance(): array
419 {
420 return [
421 new LengthValidator(null, 10),
422 ];
423 }
424
430 public static function validateIsMeeting(): array
431 {
432 return [
433 new LengthValidator(null, 1),
434 ];
435 }
436
442 public static function validateMeetingStatus(): array
443 {
444 return [
445 new LengthValidator(null, 1),
446 ];
447 }
448
454 public static function validateLocation(): array
455 {
456 return [
457 new LengthValidator(null, 255),
458 ];
459 }
460
466 public static function validateColor(): array
467 {
468 return [
469 new LengthValidator(null, 10),
470 ];
471 }
472
478 public static function validateTextColor(): array
479 {
480 return [
481 new LengthValidator(null, 10),
482 ];
483 }
484
490 public static function validateRrule(): array
491 {
492 return [
493 new LengthValidator(null, 255),
494 ];
495 }
496
502 public static function validateDavXmlId(): array
503 {
504 return [
505 new LengthValidator(null, 255),
506 ];
507 }
508
514 public static function validateGEventId(): array
515 {
516 return [
517 new LengthValidator(null, 255),
518 ];
519 }
520
526 public static function validateDavExchLabel(): array
527 {
528 return [
529 new LengthValidator(null, 255),
530 ];
531 }
532
538 public static function validateCalDavLabel(): array
539 {
540 return [
541 new LengthValidator(null, 255),
542 ];
543 }
544
550 public static function validateVersion(): array
551 {
552 return [
553 new LengthValidator(null, 255),
554 ];
555 }
556
562 public static function validateRelations(): array
563 {
564 return [
565 new LengthValidator(null, 255),
566 ];
567 }
568
574 public static function validateSyncStatus(): array
575 {
576 return [
577 new LengthValidator(null, 20),
578 ];
579 }
580
586 public static function validateRemind()
587 {
588 return array(
589 new Main\Entity\Validator\Length(null, 255),
590 );
591 }
592}
const USER_FIELD_ENTITY_ID
Definition util.php:18
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29