2015-06-03 14:34:54 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Tables;
|
|
|
|
|
2015-12-15 17:16:07 +01:00
|
|
|
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
|
2015-06-03 14:34:54 +02:00
|
|
|
|
2015-12-15 17:16:07 +01:00
|
|
|
class IcingaServiceTable extends IcingaObjectTable
|
2015-06-03 14:34:54 +02:00
|
|
|
{
|
2015-07-29 15:30:10 +02:00
|
|
|
protected $searchColumns = array(
|
|
|
|
'service',
|
2015-12-10 12:55:34 +01:00
|
|
|
'host'
|
2015-07-29 15:30:10 +02:00
|
|
|
);
|
|
|
|
|
2015-06-03 14:34:54 +02:00
|
|
|
public function getColumns()
|
|
|
|
{
|
|
|
|
return array(
|
2015-12-15 17:16:07 +01:00
|
|
|
'id' => 's.id',
|
|
|
|
'host_id' => 's.host_id',
|
|
|
|
'host' => 'h.object_name',
|
|
|
|
'service' => 's.object_name',
|
|
|
|
'object_type' => 's.object_type',
|
2015-06-03 14:34:54 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getActionUrl($row)
|
|
|
|
{
|
2015-12-10 12:55:34 +01:00
|
|
|
$params = array('name' => $row->service);
|
|
|
|
if ($row->host !== null) {
|
|
|
|
$params['host'] = $row->host;
|
|
|
|
}
|
|
|
|
return $this->url('director/service', $params);
|
2015-06-03 14:34:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitles()
|
|
|
|
{
|
|
|
|
$view = $this->view();
|
|
|
|
return array(
|
|
|
|
'service' => $view->translate('Servicename'),
|
2015-12-10 12:55:34 +01:00
|
|
|
'host' => $view->translate('Host'),
|
2015-06-03 14:34:54 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-07-30 16:24:17 +02:00
|
|
|
public function getUnfilteredQuery()
|
2015-06-03 14:34:54 +02:00
|
|
|
{
|
|
|
|
$db = $this->connection()->getConnection();
|
|
|
|
$query = $db->select()->from(
|
|
|
|
array('s' => 'icinga_service'),
|
2015-07-23 16:19:22 +02:00
|
|
|
array()
|
2015-12-10 12:55:34 +01:00
|
|
|
)->joinLeft(
|
|
|
|
array('h' => 'icinga_host'),
|
|
|
|
'h.id = s.host_id',
|
|
|
|
array()
|
2015-06-03 14:34:54 +02:00
|
|
|
);
|
|
|
|
|
2015-07-23 16:19:22 +02:00
|
|
|
return $query;
|
2015-06-03 14:34:54 +02:00
|
|
|
}
|
2015-07-30 16:24:17 +02:00
|
|
|
|
|
|
|
public function getBaseQuery()
|
|
|
|
{
|
2015-12-15 19:01:48 +01:00
|
|
|
return $this->getUnfilteredQuery();
|
2015-07-30 16:24:17 +02:00
|
|
|
}
|
2015-06-03 14:34:54 +02:00
|
|
|
}
|