- Модуль: timeman
- Путь к файлу: ~/bitrix/modules/timeman/lib/controller/shiftplan.php
- Класс: BitrixTimemanControllerShiftPlan
- Вызов: ShiftPlan::makeResult
private function makeResult($shiftPlanResult, $deleted = false)
{
$shiftPlan = $shiftPlanResult->getShiftPlan();
if (!$shiftPlan)
{
return [];
}
$shift = $shiftPlanResult->getShift();
$res = [];
if ($shiftPlan->getUserId())
{
$res = [
'userId' => (int)$shiftPlan->getUserId(),
'shiftId' => (int)$shiftPlan->getShiftId(),
'dateAssigned' => $shiftPlan->getDateAssignedUtc()->format(ShiftPlanTable::DATE_FORMAT),
];
}
$res['shift'] = [
'id' => $shift->getId(),
'name' => $shift->getName(),
'breakDuration' => $shift->getBreakDuration(),
'workTimeStart' => $shift->getWorkTimeStart(),
'workTimeEnd' => $shift->getWorkTimeEnd(),
'formattedWorkTimeStart' => TimeHelper::getInstance()->convertSecondsToHoursMinutes($shift->getWorkTimeStart()),
'formattedWorkTimeEnd' => TimeHelper::getInstance()->convertSecondsToHoursMinutes($shift->getWorkTimeEnd()),
'scheduleId' => $shift->getScheduleId(),
'workDays' => $shift->getWorkDays(),
];
global $APPLICATION;
ob_start();
$start = $shiftPlan->buildShiftStartDateTimeUtc($shiftPlanResult->getShift());
$userId = $this->getCurrentUser()->getId();
if ($this->getRequest()->get('useEmployeesTimezone') === 'Y')
{
$userId = $shiftPlan->getUserId();
}
$start->setTimezone(TimeHelper::getInstance()->createTimezoneByOffset(
TimeHelper::getInstance()->getUserUtcOffset($userId))
);
$APPLICATION->IncludeComponent(
'bitrix:timeman.worktime.grid',
'.default',
[
'PARTIAL_ITEM' => 'shiftCell',
'IS_SHIFTPLAN' => true,
'DRAWING_TIMESTAMP' => $start->getTimestamp(),
'INCLUDE_CSS' => false,
'SCHEDULE_ID' => $shift->getScheduleId(),
'USER_ID' => $shiftPlan->getUserId(),
]
);
$res['cellHtml'] = ob_get_clean();
return $res;
}