- Модуль: timeman
- Путь к файлу: ~/bitrix/modules/timeman/classes/general/timeman_report_full.php
- Класс: CUserReportFull
- Вызов: CUserReportFull::GetReportData
public function GetReportData($force = false)
{
$result = [
'REPORT_INFO' => [],
'REPORT_DATA' => [],
];
$result['REPORT_INFO'] = $currentReportInfo = $this->getReportInfo();
if ($this->isNeedSkipReport($currentReportInfo, $force))
{
return $result;
}
$userId = $this->USER_ID;
list($currentUser, $currentUserManagers) = $this->getManagersData($userId);
list($entriesInfo, $savedReport) = $this->getSavedReportFull($userId);
if (!$this->isSavedReport($entriesInfo['REPORT_ID'] ?? null))
{
$reportFiles = self::getReportFiles();
if ($reportFiles)
{
$entriesInfo['FILES'] = $reportFiles;
}
$shortFormat = CSite::getDateFormat("SHORT", SITE_ID);
$entriesInfo['REPORT_DATE_FROM'] = MakeTimeStamp($currentReportInfo['DATE_FROM'], $shortFormat);
$entriesInfo['REPORT_DATE_TO'] = MakeTimeStamp($currentReportInfo['DATE_TO'], $shortFormat);
}
$dateFrom = (($currentReportInfo['DATE_FROM']) ? $currentReportInfo['DATE_FROM'] : $savedReport['DATE_FROM']);
$dateTo = (($currentReportInfo['DATE_TO']) ? $currentReportInfo['DATE_TO'] : $savedReport['DATE_TO']);
$entriesInfo = $this->preparePlannerData($entriesInfo);
$filter = [
'>=REPORT_DATE' => $dateFrom,
'<=REPORT_DATE' => $dateTo,
'USER_ID' => $userId
];
list($entriesInfo, $entryIds) = $this->prepareDailyReports($filter, $entriesInfo);
if (!in_array($entriesInfo["ID"], $entryIds))
{
$entriesInfo = $this->addCurrentReport($entriesInfo);
}
$entriesInfo = $this->clearEventsByCheckStatus($entriesInfo);
if (!$this->isSavedReport($entriesInfo["REPORT_ID"] ?? null))
{
$entriesInfo['DATE_TEXT'] = $this->getReportDateText(
$entriesInfo["REPORT_DATE_FROM"],
$entriesInfo["REPORT_DATE_TO"]
);
}
$result["REPORT_DATA"] = [
'FROM' => $currentUser,
'TO' => array_values($currentUserManagers),
'INFO' => $entriesInfo,
'REPORT' => $entriesInfo["REPORT"] ?? null,
'PLANS' => $entriesInfo["PLANS"] ?? null,
'REPORT_ID' => $entriesInfo["REPORT_ID"] ?? ''
];
return $result;
}