Private GIT

Skip to content
Snippets Groups Projects
Commit 8674dfb8 authored by loiclau's avatar loiclau Committed by Matthieu Kermagoret
Browse files

fix(api rest) show rtDowntime without param

parent 1b0d2921
Branches
Tags
No related merge requests found
...@@ -66,6 +66,16 @@ class CentreonRtDowntime extends CentreonObject ...@@ -66,6 +66,16 @@ class CentreonRtDowntime extends CentreonObject
'INSTANCE', 'INSTANCE',
); );
/**
* @var
*/
protected $dHosts;
/**
* @var
*/
protected $dServices;
/** /**
* CentreonRtDowntime constructor. * CentreonRtDowntime constructor.
*/ */
...@@ -161,11 +171,37 @@ class CentreonRtDowntime extends CentreonObject ...@@ -161,11 +171,37 @@ class CentreonRtDowntime extends CentreonObject
*/ */
public function show($parameters = null) public function show($parameters = null)
{ {
if ($parameters !== '') {
$parsedParameters = $this->parseShowparameters($parameters); $parsedParameters = $this->parseShowparameters($parameters);
$method = 'show' . ucfirst($parsedParameters['type']); $method = 'show' . ucfirst($parsedParameters['type']);
$this->$method($parsedParameters['resource']); $this->$method($parsedParameters['resource']);
} else {
$this->dHosts = $this->object->getHostDowntimes();
$this->dServices = $this->object->getSvcDowntimes();
$list = '';
//all host
if (count($this->dHosts) !== 0) {
foreach ($this->dHosts as $host) {
$list .= $host['name'] . '|';
}
$list = rtrim($list, '|');
}
$list .= ';';
//all service
if (count($this->dServices) !== 0) {
foreach ($this->dServices as $service) {
$list .= $service['name'] . ',' . $service['description'] . '|';
}
$list = rtrim($list, '|');
}
$list .= ';';
echo "hosts;services\n";
echo $list;
}
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment