From: Andrey Kutejko Date: Tue, 2 Jul 2013 19:22:50 +0000 (+0300) Subject: column titles in admin tables X-Git-Tag: 0.5~195 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=9c7d234358e0c9dc354ab5a98dee647048b7488d;p=ipf.git column titles in admin tables --- 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;