- Модуль: voximplant
- Путь к файлу: ~/bitrix/modules/voximplant/lib/integration/report/handler/callactivity/callactivitygraph.php
- Класс: BitrixVoximplantIntegrationReportHandlerCallActivityCallActivityGraph
- Вызов: CallActivityGraph::getActiveHoursByWorktime
private function getActiveHoursByWorktime($workTimeFrom, $workTimeTo): array
{
$activeHours = [];
for ($i = 1; $i <= 24; $i++)
{
$hour = [
'id' => $i,
'name' => $i
];
if ($i === 0 || $i === 24 || ($i) % 6 === 0)
{
$hour['show'] = true;
}
if (($workTimeFrom < $workTimeTo) && ($i > $workTimeFrom && $i <= $workTimeTo))
{
$hour['active'] = true;
}
elseif (($workTimeFrom > $workTimeTo) && !($i <= $workTimeFrom && $i > $workTimeTo))
{
//If after converting time zones, the start time is later than the end.
$hour['active'] = true;
}
$activeHours[] = $hour;
}
if (fmod($workTimeFrom, 1) != 0)
{
$firstHourIndex = (int)$workTimeFrom;
$activeHours[$firstHourIndex]['active'] = true;
$activeHours[$firstHourIndex]['firstHalf'] = true;
}
if (fmod($workTimeTo, 1) != 0)
{
$lastHourIndex = (int)$workTimeTo;
$activeHours[$lastHourIndex]['active'] = true;
$activeHours[$lastHourIndex]['lastHalf'] = true;
}
if (fmod($workTimeTo, 1) >= 0.31)
{
$hour['active'] = true;
unset($activeHours[$lastHourIndex]['firstHalf'], $activeHours[$lastHourIndex]['lastHalf']);
}
return $activeHours;
}