/** * Obtener el listado de paradas programadas. * * @return mixed */ public function getScheduledDowntimes() { $fields = array('author', 'comment', 'duration', 'host_alias', 'host_name', 'is_service', 'service_display_name', 'start_time', 'end_time'); if ($this->isAllHeaders() === false) { $filter = array('GET downtimes', 'ResponseHeader: fixed16', 'Columns: ' . implode(' ', $fields), 'ColumnHeaders: off', 'OutputFormat: json'); $dataQuery = implode("\n", $filter) . "\n\n"; } else { $dataQuery = "GET downtimes\nColumnHeaders: off\nOutputFormat: json\n\n"; } $data = $this->getJsonFromSocket($dataQuery); $downtimes = array(); foreach ($data as $downtime) { $Downtime = new Downtime(); $Downtime->setAuthor($downtime[0]); $Downtime->setComment($downtime[1]); $Downtime->setDuration($downtime[2]); $Downtime->setHostAlias($downtime[3]); $Downtime->setHostName($downtime[4]); $Downtime->setIsService($downtime[5]); $Downtime->setServiceDisplayName($downtime[6]); $Downtime->setStartTime($downtime[7]); $Downtime->setEndTime($downtime[8]); $Downtime->setBackendAlias($this->backend->getAlias()); $downtimes[] = $Downtime; } return $this->isAllHeaders() === false ? $downtimes : $data; }