Fix trigger downtime default value issing, docstring fixes

refs #4580
This commit is contained in:
Jannis Moßhammer 2013-09-04 18:07:24 +02:00
parent b74e264f01
commit 7f4e1936f7
5 changed files with 40 additions and 14 deletions

View File

@ -33,4 +33,4 @@ namespace Icinga\Protocol\Commandpipe;
*/
interface CommandType
{
}
}

View File

@ -89,21 +89,25 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
$cfg = $this->getConfiguration();
$preferences = $this->getUserPreferences();
$downtimes = Backend::getInstance($this->getRequest()->getParam('backend'))->select()
->from('downtime', array(
'host_name',
'service_description',
'downtime_scheduled_start_time',
'downtime_internal_downtime_id',
))->fetchAll();
->from(
'downtime',
array(
'host_name',
'service_description',
'downtime_scheduled_start_time',
'downtime_internal_downtime_id'
)
)->fetchAll();
$options = array();
foreach ($downtimes as $downtime)
{
$options = array(
'0' => 'No Triggered Downtime '
);
foreach ($downtimes as $downtime) {
$dt = DateTimeFactory::create($downtime->downtime_scheduled_start_time);
$date_format = $preferences->get('app.dateFormat', $cfg->get('app.dateFormat', 'd/m/Y'));
$time_format = $preferences->get('app.timeFormat', $cfg->get('app.timeFormat', 'g:i A'));
$label = sprintf(
'ID %s: %s%s starting @ %s',
'ID %s: %s%s Starting @ %s',
$downtime->downtime_internal_downtime_id,
$downtime->host_name,
!empty($downtime->service_description) ? ' (' . $downtime->service_description . ')' : '',
@ -327,7 +331,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
/**
* Create Downtime from request Data
*
* @return \Icinga\Protocol\Commandpipe\Downtime
* @return Downtime
*/
public function getDowntime()
{

View File

@ -30,6 +30,9 @@ namespace Icinga\Module\Monitoring\Command;
use Icinga\Protocol\Commandpipe\Comment;
/**
* Command for acknowledging an object
*/
class AcknowledgeCommand extends BaseCommand
{
/**
@ -147,6 +150,9 @@ class AcknowledgeCommand extends BaseCommand
}
/**
* @param String $hostname The name of the host to create the command for for
*
* @return String The command string to return for the host
* @see BaseCommand::getHostCommand()
*/
public function getHostCommand($hostname)
@ -157,6 +163,10 @@ class AcknowledgeCommand extends BaseCommand
}
/**
* @param String $hostname The name of the host to create the command for
* @param String $servicename The name of the service to create the command for
*
* @return String The command string to return for the service
* @see BaseCommand::getServiceCommand()
*/
public function getServiceCommand($hostname, $servicename)
@ -165,4 +175,4 @@ class AcknowledgeCommand extends BaseCommand
return sprintf('ACKNOWLEDGE_SVC_PROBLEM%s;', $this->expireTime > -1 ? '_EXPIRE' : '')
. implode(';', array_merge(array($hostname, $servicename), $parameters));
}
}
}

View File

@ -30,6 +30,11 @@ namespace Icinga\Module\Monitoring\Command;
use Icinga\Protocol\Commandpipe\Comment;
/**
* Icinga Command for adding comments
*
* @see BaseCommand
*/
class AddCommentCommand extends BaseCommand
{
/**
@ -62,6 +67,9 @@ class AddCommentCommand extends BaseCommand
}
/**
* @param String $hostname The name of the host to create the command for for
*
* @return String The command string to return for the host
* @see BaseCommand::getHostCommand()
*/
public function getHostCommand($hostname)
@ -70,6 +78,10 @@ class AddCommentCommand extends BaseCommand
}
/**
* @param String $hostname The name of the host to create the command for
* @param String $servicename The name of the service to create the command for
*
* @return String The command string to return for the service
* @see BaseCommand::getServiceCommand()
*/
public function getServiceCommand($hostname, $servicename)

View File

@ -93,4 +93,4 @@ class BaseCommand implements CommandType
{
throw new NotImplementedError();
}
}
}