]> git.andy128k.dev Git - ipf.git/commitdiff
column titles in admin tables
authorAndrey Kutejko <andy128k@gmail.com>
Tue, 2 Jul 2013 19:22:50 +0000 (22:22 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Tue, 2 Jul 2013 19:22:50 +0000 (22:22 +0300)
ipf/admin/model.php

index 3e353bcd6f05459cbe464c953363e32b9dfd1c35..2705f609f20ec44d8d88cd7a649002967b931ca9 100644 (file)
@@ -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;