IcingaHostTemplateChoiceTable: table for choices

(still need to commit the related migration, sorry)
This commit is contained in:
Thomas Gelf 2017-06-05 23:45:29 +02:00
parent d84a3c68e0
commit 49747c4dca
1 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,54 @@
<?php
namespace Icinga\Module\Director\Tables;
use Icinga\Module\Director\Web\Table\QuickTable;
class IcingaHostTemplateChoiceTable extends QuickTable
{
protected $searchColumns = [
'name',
];
public function getTitles()
{
$view = $this->view();
return [
'name' => $view->translate('Name'),
'templates' => $view->translate('Choices'),
];
}
public function getColumns()
{
return [
'id' => 'hc.id',
'name' => 'hc.object_name',
'templates' => 'GROUP_CONCAT(t.object_name)'
];
}
protected function getActionUrl($row)
{
return $this->url('director/hosttemplatechoice', array('name' => $row->name));
}
protected function getUnfilteredQuery()
{
$query = $this->db()->select()->from(
['hc' => 'icinga_host_template_choice'],
[]
)->joinLeft(
['t' => 'icinga_host'],
't.template_choice_id = hc.id',
[]
)->order('hc.object_name')->group('hc.id');
return $query;
}
public function getBaseQuery()
{
return $this->getUnfilteredQuery();
}
}