1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
alarm.php
См. документацию.
1<?php
2
4
13
14final class Alarm extends BasicComponent
15{
16 public function __construct(
17 private readonly string $type,
18 private readonly string $value,
19 private readonly string $message = '',
20 )
21 {
22 }
23
24 public function getType(): string
25 {
26 return 'VALARM';
27 }
28
29 protected function setContent(): Content
30 {
31 $content = Content::getInstance($this->getType())
32 ->textProperty('ACTION', 'DISPLAY')
33 ->property($this->resolveTriggerProperty())
34 ;
35
36 if ($this->message)
37 {
38 $content->textProperty('DESCRIPTION', $this->message);
39 }
40
41 return $content;
42 }
43
44 private function resolveTriggerProperty(): PropertyType
45 {
46 $property = null;
47
48 switch ($this->type)
49 {
50 case 'DURATION':
51 $property = new TextPropertyType('TRIGGER', $this->value);
52 break;
53 case 'DATE-TIME':
54 $dateTime = Util::getDateObject(
55 date: (new DateTime($this->value, IcsBuilder::UTC_DATETIME_FORMAT))
57 fullDay: false
58 );
59 $property = new DatetimePropertyType(
60 names: 'TRIGGER',
61 dateTime: $dateTime,
62 withTime: true,
63 withTimezone: false,
64 isUTC: true
65 );
66 break;
67 }
68
69 return $property;
70 }
71
72 public function getProperties(): array
73 {
74 return [
75 'ACTION',
76 'TRIGGER',
77 ];
78 }
79}
$type
Определения options.php:106
__construct(private readonly string $type, private readonly string $value, private readonly string $message='',)
Определения alarm.php:16
const UTC_DATETIME_FORMAT
Определения icsbuilder.php:15
const DEFAULT_DATETIME_FORMAT
Определения icsbuilder.php:16
Определения util.php:21
static getDateObject(string $date=null, ?bool $fullDay=true, ?string $tz='UTC')
Определения util.php:107
$content
Определения commerceml.php:144
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$message
Определения payment.php:8