\n"; $idKey = key($row); $id = $row->$idKey; unset($row->$idKey); foreach ($row as $key => $val) { $htm .= ' ' . ($val === null ? '-' : $this->view()->escape($val)) . "\n"; } $htm .= ' ' . $this->getActionLinks($id) . "\n"; return $htm . " \n"; } public function setConnection(Selectable $connection) { $this->connection = $connection; return $this; } protected function connection() { // TODO: Fail if missing? Require connection in constructor? return $this->connection; } protected function renderTitles($row) { $view = $this->view; $htm = "\n \n"; foreach ($row as $title) { $htm .= ' ' . $view->escape($title) . "\n"; } $htm .= ' ' . $view->translate('Actions') . "\n"; return $htm . " \n\n"; } public function render() { $data = $this->fetchData(); $htm = '' . "\n" . $this->renderTitles($this->getTitles()) . "\n"; foreach ($data as $row) { $htm .= $this->renderRow($row); } return $htm . "\n
\n"; } protected function view() { if ($this->view === null) { $this->view = Icinga::app()->getViewRenderer()->view; } return $this->view; } public function setView($view) { $this->view = $view; } public function __toString() { return $this->render(); } }