. **/ class CControllerAvailabilityReportTrigger extends CController { /** * @var array */ private $trigger = []; protected function init(): void { $this->disableCsrfValidation(); } protected function checkInput(): bool { $fields = [ 'triggerid' => 'required|array_db triggers.triggerid' ]; $ret = $this->validateInput($fields); if (!$ret) { $this->setResponse(new CControllerResponseFatal()); } return $ret; } protected function checkPermissions(): bool { if (!$this->checkAccess(CRoleHelper::UI_REPORTS_AVAILABILITY_REPORT)) { return false; } $this->trigger = API::Trigger()->get([ 'output' => ['triggerid', 'description'], 'triggerids' => $this->getInput('triggerid'), 'selectHosts' => ['name'], 'expandDescription' => true ]); if (!$this->trigger) { return false; } $this->trigger = reset($this->trigger); return true; } protected function doAction(): void { $data = [ 'trigger' => $this->trigger, 'host_name' => $this->trigger['hosts'][0]['name'] ]; $response = new CControllerResponseData($data); $response->setTitle(_('Availability report graph')); $this->setResponse($response); } }