parent
4c5adda4bf
commit
30c2dfad75
|
@ -2,12 +2,12 @@
|
|||
|
||||
namespace Icinga\Module\Director\Tables;
|
||||
|
||||
use Icinga\Module\Director\Web\Table\IcingaObjectTable;
|
||||
use Icinga\Module\Director\Web\Table\QuickTable;
|
||||
|
||||
class IcingaNotificationTable extends IcingaObjectTable
|
||||
class IcingaNotificationTable extends QuickTable
|
||||
{
|
||||
protected $searchColumns = array(
|
||||
'user',
|
||||
'notification',
|
||||
);
|
||||
|
||||
public function getColumns()
|
||||
|
@ -19,11 +19,6 @@ class IcingaNotificationTable extends IcingaObjectTable
|
|||
);
|
||||
}
|
||||
|
||||
protected function listTableClasses()
|
||||
{
|
||||
return array_merge(array('assignment-table'), parent::listTableClasses());
|
||||
}
|
||||
|
||||
protected function getActionUrl($row)
|
||||
{
|
||||
return $this->url('director/notification', array('id' => $row->id));
|
||||
|
@ -37,58 +32,6 @@ class IcingaNotificationTable extends IcingaObjectTable
|
|||
);
|
||||
}
|
||||
|
||||
protected function renderRow($row)
|
||||
{
|
||||
$v = $this->view();
|
||||
$extra = $this->appliedOnes($row->id);
|
||||
$htm = " <tr" . $this->getRowClassesString($row) . ">\n";
|
||||
$htm .= '<td>' . $v->qlink($row->notification, $this->getActionUrl($row));
|
||||
if (empty($extra)) {
|
||||
$htm .= ' ' . $v->qlink(
|
||||
'Create apply-rule',
|
||||
'director/notification/add',
|
||||
array('apply' => $row->notification, 'type' => 'apply'),
|
||||
array('class' => 'icon-plus')
|
||||
);
|
||||
|
||||
} else {
|
||||
$htm .= '. Related apply rules: <ul class="apply-rules">';
|
||||
foreach ($extra as $id => $notification) {
|
||||
$htm .= '<li>'
|
||||
. $v->qlink($notification, 'director/notification', array('id' => $id))
|
||||
. '</li>';
|
||||
}
|
||||
$htm .= '</ul>';
|
||||
$htm .= $v->qlink(
|
||||
'Add more',
|
||||
'director/notification/add',
|
||||
array('apply' => $row->notification),
|
||||
array('class' => 'icon-plus')
|
||||
);
|
||||
}
|
||||
$htm .= '</td>';
|
||||
return $htm . " </tr>\n";
|
||||
}
|
||||
|
||||
protected function appliedOnes($id)
|
||||
{
|
||||
$db = $this->db();
|
||||
$query = $db->select()->from(
|
||||
array('s' => 'icinga_notification'),
|
||||
array(
|
||||
'id' => 's.id',
|
||||
'objectname' => 's.object_name',
|
||||
)
|
||||
)->join(
|
||||
array('i' => 'icinga_notification_inheritance'),
|
||||
'i.notification_id = s.id',
|
||||
array()
|
||||
)->where('i.parent_notification_id = ?', $id)
|
||||
->where('s.object_type = ?', 'apply');
|
||||
|
||||
|
||||
return $db->fetchPairs($query);
|
||||
}
|
||||
|
||||
public function getUnfilteredQuery()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Tables;
|
||||
|
||||
class IcingaNotificationTemplateTable extends IcingaNotificationTable
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue