2015-04-24 14:27:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Tables;
|
|
|
|
|
2015-12-15 17:16:07 +01:00
|
|
|
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
|
2015-04-24 14:27:22 +02:00
|
|
|
|
2015-12-15 17:16:07 +01:00
|
|
|
class IcingaCommandTable extends IcingaObjectTable
|
2015-04-24 14:27:22 +02:00
|
|
|
{
|
2015-07-29 15:30:10 +02:00
|
|
|
protected $searchColumns = array(
|
|
|
|
'command',
|
|
|
|
);
|
|
|
|
|
2015-04-24 14:27:22 +02:00
|
|
|
public function getColumns()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
'id' => 'c.id',
|
|
|
|
'command' => 'c.object_name',
|
2015-12-02 03:17:59 +01:00
|
|
|
'object_type' => 'c.object_type',
|
2015-04-24 14:27:22 +02:00
|
|
|
'command_line' => 'c.command',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-06-01 12:42:40 +02:00
|
|
|
protected function getActionUrl($row)
|
2015-04-24 14:27:22 +02:00
|
|
|
{
|
2015-12-02 03:17:59 +01:00
|
|
|
if ($row->object_type === 'external_object') {
|
|
|
|
return $this->url('director/command/render', array('name' => $row->command));
|
|
|
|
} else {
|
|
|
|
return $this->url('director/command', array('name' => $row->command));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-24 14:27:22 +02:00
|
|
|
public function getTitles()
|
|
|
|
{
|
|
|
|
$view = $this->view();
|
|
|
|
return array(
|
2015-06-02 17:37:54 +02:00
|
|
|
'command' => $view->translate('Command'),
|
|
|
|
'command_line' => $view->translate('Command line'),
|
2015-04-24 14:27:22 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-08-03 13:31:14 +02:00
|
|
|
protected function getUnfilteredQuery()
|
2015-04-24 14:27:22 +02:00
|
|
|
{
|
|
|
|
$db = $this->connection()->getConnection();
|
|
|
|
$query = $db->select()->from(
|
|
|
|
array('c' => 'icinga_command'),
|
2015-07-23 16:19:22 +02:00
|
|
|
array()
|
2015-12-02 03:17:59 +01:00
|
|
|
)->order('c.object_name');
|
2015-04-24 14:27:22 +02:00
|
|
|
|
2015-07-23 16:19:22 +02:00
|
|
|
return $query;
|
2015-04-24 14:27:22 +02:00
|
|
|
}
|
2015-08-03 13:31:14 +02:00
|
|
|
|
|
|
|
public function getBaseQuery()
|
|
|
|
{
|
2015-12-02 03:17:59 +01:00
|
|
|
return $this->getUnfilteredQuery();
|
2015-08-03 13:31:14 +02:00
|
|
|
}
|
2015-04-24 14:27:22 +02:00
|
|
|
}
|