58 $sendingStart = $this->letter->getConfiguration()->get(
'SENDING_START');
59 $sendingEnd = $this->letter->getConfiguration()->get(
'SENDING_END');
60 $sendingTimeEnabled = $this->letter->getConfiguration()->get(
'SENDING_TIME');
62 if (!$sendingEnd || !$sendingStart || $sendingTimeEnabled !==
'Y')
66 $checkTime = strtotime($sendingStart);
67 $sendingStart = strtotime($sendingStart);
68 $sendingEnd = strtotime($sendingEnd);
69 $currentTime = strtotime((
new DateTime())->format(
"H:i:s"));
71 $sendingStart = $sendingStart > $sendingEnd ? $sendingEnd : $sendingStart;
72 $sendingEnd = $checkTime > $sendingEnd ? $checkTime : $sendingEnd;
78 if ($currentTime > $sendingStart && $currentTime < $sendingEnd)
178 $sendingStart = $configuration->getOption(
'SENDING_START');
179 $sendingEnd = $configuration->getOption(
'SENDING_END');
180 $checkbox = $configuration->getOption(
'SENDING_TIME');
182 $view =
function($input, $checkbox)
184 $prefix =
'CONFIGURATION_';
185 $inputCode = htmlspecialcharsbx($prefix.$input->getCode());
186 $checkboxCode = htmlspecialcharsbx($prefix.$checkbox->getCode());
188 Extension::load(
"sender.secret_block");
189 $inputHtml =
"<select
192 value='".$input->getValue().
"'
193 class=\"bx-sender-form-control bx-sender-message-editor-field-select\">";
194 for ($hour = 0; $hour < 24; $hour++)
196 foreach ([0, 30] as $minute)
198 $time = strtotime(sprintf(
"%02d:%02d", $hour, $minute));
199 $formatted = (new \DateTime())
200 ->setTimestamp($time)
203 ->getShortTimeFormat()
206 $inputHtml .=
"<option value='{$formatted}'";
207 $inputHtml .= $time === strtotime($input->getValue()) ?
"selected" :
"";
208 $inputHtml .=
">{$formatted}</option>";
212 $inputHtml .=
'</select>';
215 $params = \Bitrix\Main\Web\Json::encode(
217 'elementId' => $inputCode,
218 'conditionElementId' => $checkboxCode
222 echo
"<script>new BX.Sender.SecretBlock(".$params.
")</script>";
224 return ob_get_clean();
227 $sendingStart->setView($view($sendingStart, $checkbox));
228 $sendingEnd->setView($view($sendingEnd, $checkbox));