From 9c7d234358e0c9dc354ab5a98dee647048b7488d Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Tue, 2 Jul 2013 22:22:50 +0300 Subject: [PATCH] column titles in admin tables --- ipf/admin/model.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ipf/admin/model.php b/ipf/admin/model.php index 3e353bc..2705f60 100644 --- a/ipf/admin/model.php +++ b/ipf/admin/model.php @@ -389,16 +389,26 @@ class IPF_Admin_Model public function ListItemsHeader() { $this->header = array(); - if (method_exists($this,'list_display')) + if (method_exists($this, 'list_display')) $this->names = $this->list_display(); else $this->names = $this->model->getTable()->getColumnNames(); + $columns = $this->model->getTable()->getColumns(); + foreach ($this->names as $name) { + if (is_array($name)) { + list($name, $title) = $name; + } elseif (array_key_exists($name, $columns) && array_key_exists('verbose', $columns[$name])) { + $title = $columns[$name]['verbose']; + } else { + $title = IPF_Utils::humanTitle($name); + } + $this->header[$name] = new IPF_Template_ContextVars(array( - 'title' => IPF_Utils::humanTitle($name), - 'name' => $name, - 'sortable' => null, + 'title' => $title, + 'name' => $name, + 'sortable' => null, )); } return $this->header; -- 2.49.0