%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.133.154.2 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/report/lib/visualconstructor/ |
Upload File : |
<?php namespace Bitrix\Report\VisualConstructor; use Bitrix\Report\VisualConstructor\Config\Common; use Bitrix\Report\VisualConstructor\Entity\Report; use Bitrix\Report\VisualConstructor\Handler\BaseReport; use Bitrix\Report\VisualConstructor\Helper\Dashboard; use Bitrix\Report\VisualConstructor\Internal\Error\Error; use Bitrix\Report\VisualConstructor\Internal\Error\IErrorable; /** * Class ReportDispatcher * @package Bitrix\Report\VisualConstructor */ class ReportDispatcher implements IErrorable { private $view; private $report; private $errors = array(); /** * @return mixed|null|string */ public function getReportCompatibleData() { if (!$this->getView()) { $this->errors[] = new Error("Set view to get data"); return null; } if (!$this->getReport()) { $this->errors[] = new Error("Set report to get data"); return null; } $compatibleDataType = $this->getView()->getCompatibleDataType(); $result = array(); if(!isset(Common::$reportImplementationTypesMap[$compatibleDataType])) { $this->errors[] = new Error("No isset : '" . $compatibleDataType . "' compatible data type.'"); return null; } else { $reportHandler = $this->getReport()->getReportHandler(); if (!$reportHandler->isEnabled()) { return null; } $reportHandler->setView($this->getView()); if ($reportHandler instanceof Common::$reportImplementationTypesMap[$compatibleDataType]['interface']) { if (!Dashboard::getBoardModeIsDemo($this->getReport()->getWidget()->getBoardId())) { $reportHandler->setCalculatedData($reportHandler->prepare()); $getDataMethodName = Common::$reportImplementationTypesMap[$compatibleDataType]['method']; $result = $reportHandler->{$getDataMethodName}(); } else { $getDemoDataMethodName = Common::$reportImplementationTypesMap[$compatibleDataType]['demoMethod']; $result = $reportHandler->{$getDemoDataMethodName}(); } } elseif ($reportHandler::getClassName() === BaseReport::getClassName()) { $getDataMethodName = Common::$reportImplementationTypesMap[$compatibleDataType]['method']; if (method_exists($reportHandler, $getDataMethodName)) { $result = $reportHandler->{$getDataMethodName}(); } else { $result = array(); } } else { $this->errors[] = new Error('Report handler ' . $reportHandler::getClassName() . ' does not implement a compatible interface'); return null; } } return $result; } /** * @return Error[] */ public function getErrors() { return $this->errors; } /** * @return View */ public function getView() { return $this->view; } /** * @param View $view View controller entity. * @return void */ public function setView(View $view) { $this->view = $view; } /** * @return Report */ public function getReport() { return $this->report; } /** * @param Report $report Report entity. * @return void */ public function setReport($report) { $this->report = $report; } }