2015-06-01 16:29:03 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Tables;
|
|
|
|
|
2015-08-03 13:55:01 +02:00
|
|
|
use Icinga\Module\Director\Objects\IcingaCommand;
|
2015-06-01 16:29:03 +02:00
|
|
|
use Icinga\Module\Director\Web\Table\QuickTable;
|
|
|
|
|
|
|
|
class IcingaCommandArgumentTable extends QuickTable
|
|
|
|
{
|
2015-08-03 13:55:01 +02:00
|
|
|
protected $commandObject;
|
|
|
|
|
2015-07-29 15:30:10 +02:00
|
|
|
protected $searchColumns = array(
|
|
|
|
'command',
|
|
|
|
);
|
|
|
|
|
2015-08-03 13:55:01 +02:00
|
|
|
public function setCommandObject(IcingaCommand $command)
|
|
|
|
{
|
|
|
|
$this->commandObject = $command;
|
|
|
|
if ($this->connection === null) {
|
|
|
|
$this->setConnection($command->getConnection());
|
|
|
|
}
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-06-01 16:29:03 +02:00
|
|
|
public function getColumns()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
'id' => 'ca.id',
|
2015-08-03 13:55:01 +02:00
|
|
|
'command_id' => 'c.id',
|
2015-06-01 16:29:03 +02:00
|
|
|
'command' => 'c.object_name',
|
|
|
|
'argument_name' => 'ca.argument_name',
|
|
|
|
'argument_value' => 'ca.argument_value',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getActionUrl($row)
|
|
|
|
{
|
2015-08-03 13:55:01 +02:00
|
|
|
return $this->url(
|
|
|
|
'director/command/arguments',
|
|
|
|
array(
|
|
|
|
'argument_id' => $row->id,
|
|
|
|
'name' => $this->commandObject->object_name
|
|
|
|
)
|
|
|
|
);
|
2015-06-01 16:29:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitles()
|
|
|
|
{
|
|
|
|
$view = $this->view();
|
|
|
|
return array(
|
2015-06-02 17:37:54 +02:00
|
|
|
'argument_name' => $view->translate('Argument'),
|
|
|
|
'argument_value' => $view->translate('Value'),
|
2015-06-01 16:29:03 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-07-23 16:19:22 +02:00
|
|
|
public function getBaseQuery()
|
2015-06-01 16:29:03 +02:00
|
|
|
{
|
|
|
|
$db = $this->connection()->getConnection();
|
|
|
|
$query = $db->select()->from(
|
|
|
|
array('ca' => 'icinga_command_argument'),
|
2015-07-23 16:19:22 +02:00
|
|
|
array()
|
2015-06-01 16:29:03 +02:00
|
|
|
)->joinLeft(
|
|
|
|
array('c' => 'icinga_command'),
|
|
|
|
'ca.command_id = c.id',
|
|
|
|
array()
|
|
|
|
);
|
|
|
|
|
2015-07-23 16:19:22 +02:00
|
|
|
return $query;
|
2015-06-01 16:29:03 +02:00
|
|
|
}
|
|
|
|
}
|