diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 68b56a88..43e760be 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -26,7 +26,10 @@ class ServiceController extends ObjectController ->setIcingaObject($this->object) ->setDb($this->db()) ->handleRequest(); + + $this->view->table = $this->loadTable('icingaObjectAssignment') + ->setObject($this->object); $this->view->title = 'Assign service to host'; - $this->render('object/form', null, true); + $this->render('object/fields', null, true); // TODO: render table } } diff --git a/application/tables/IcingaObjectAssignmentTable.php b/application/tables/IcingaObjectAssignmentTable.php new file mode 100644 index 00000000..3e1c8612 --- /dev/null +++ b/application/tables/IcingaObjectAssignmentTable.php @@ -0,0 +1,60 @@ +object = $object; + $this->setConnection($object->getConnection()); + return $this; + } + + protected $searchColumns = array( + 'filter', + ); + + public function getColumns() + { + return array( + 'id' => 'oa.id', + 'filter_string' => 'oa.filter_string', + ); + } + + protected function getActionUrl($row) + { + return Url::fromRequest()->with('field_id', $row->id); + } + + public function getTitles() + { + $view = $this->view(); + return array( + 'filter_string' => $view->translate('Filter string'), + ); + } + + public function getBaseQuery() + { + $db = $this->connection()->getConnection(); + $otable = $this->object->getTableName() . '_assignment'; + $oname = $this->object->getShortTableName(); + + $query = $db->select()->from( + array('oa' => $otable), + array() + )->where('oa.' . $oname . '_id = ?', $this->object->id) + ->order('oa.filter_string ASC'); + + return $query; + } +} diff --git a/application/views/scripts/object/fields.phtml b/application/views/scripts/object/fields.phtml index 13979fd1..928f5dcc 100644 --- a/application/views/scripts/object/fields.phtml +++ b/application/views/scripts/object/fields.phtml @@ -5,5 +5,5 @@