1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
reminderhelper.php
См. документацию.
1<?php
2
4
8
9final class ReminderHelper
10{
18 public static function prepareReminderValue(
19 Remind $remind,
20 bool $isFullDay
21 ): array
22 {
23 $valueType = '';
24 $value = '';
25
26 if ($remind->getUnits() === 'minutes')
27 {
28 $valueType = 'DURATION';
29 if ($remind->getTime() === 60 || $remind->getTime() === 120)
30 {
31 $value = '-PT' . $remind->getTime() / 60 . 'H';
32 }
33 else if ($remind->getTime() === 0)
34 {
35 $value = 'PT' . $remind->getTime() . 'S';
36 }
37 else
38 {
39 $value = '-PT' . $remind->getTime() . 'M';
40 }
41 }
42 else if ($remind->getSpecificTime() && $remind->getDaysBefore() !== null)
43 {
44 $valueType = 'DURATION';
45 $diff = $remind->getTimeBeforeStartInMinutes();
46 $parsedDiff = Util::minutesToDayHoursMinutes(abs($diff));
47 if ($isFullDay && $remind->getDaysBefore() === 0)
48 {
49 $value = 'PT' . $parsedDiff['hours'] . 'H';
50 }
51 else if (
52 ($remind->getDaysBefore() === 0 && !$isFullDay && $diff > 0)
53 || ($remind->getDaysBefore() === 1 && $parsedDiff['days'] === 0)
54 )
55 {
56 $hours = '';
57 $minutes = '';
58 if ($parsedDiff['hours'])
59 {
60 $hours = $parsedDiff['hours'] . 'H';
61 }
62 if ($parsedDiff['minutes'])
63 {
64 $minutes = $parsedDiff['minutes'] . 'M';
65 }
66 $value = '-PT' . $hours . $minutes;
67 }
68 else if ($parsedDiff['days'] > 0)
69 {
70 $hours = '';
71 $minutes = '';
72 $value = '-P' . $parsedDiff['days'] . 'D';
73 if ($parsedDiff['hours'])
74 {
75 $hours = $parsedDiff['hours'] . 'H';
76 }
77 if ($parsedDiff['minutes'])
78 {
79 $minutes = $parsedDiff['minutes'] . 'M';
80 }
81 if ($hours || $minutes)
82 {
83 $value .= 'T' . $hours . $minutes;
84 }
85 }
86 else
87 {
88 return [null, null];
89 }
90 }
91 else if ($remind->getSpecificTime())
92 {
93 $valueType = 'DATE-TIME';
94 $value = date(IcsBuilder::UTC_DATETIME_FORMAT, $remind->getSpecificTime()->getTimestamp());
95 }
96
97 return [$value, $valueType];
98 }
99}
static prepareReminderValue(Remind $remind, bool $isFullDay)
Определения reminderhelper.php:18
const UTC_DATETIME_FORMAT
Определения icsbuilder.php:15
Определения util.php:21
static minutesToDayHoursMinutes(int $minutes)
Определения util.php:711
$hours
Определения cron_html_pages.php:15
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804