public function getAttributeLabelWithoutCategoryName($attribute)
 {
     $label = parent::getAttributeLabel($attribute);
     $pos = strpos($label, ':');
     if ($pos) {
         $label = substr($label, $pos + 1);
     }
     return $label;
 }
Example #2
0
 /**
  * Add a model to the ColumnModel class.
  * 
  * Give this ColumnModel class a model where to get the columns from.
  * The public parameters and the customfield parameters are also set.
  * The $excludeColumns are meant to give up the column names that need to be excluded in the columnModel.
  * 
  * @TODO: The text parameters need to be excluded.
  * 
  * @param \GO\Base\Db\ActiveRecord $model
  * @param Array $excludeColumns 
  */
 public function setColumnsFromModel(\GO\Base\Db\ActiveRecord $model, $excludeColumns = array(), $includeColumns = array())
 {
     $attributes = $model->getColumns();
     foreach (array_keys($attributes) as $colName) {
         if (!in_array($colName, $excludeColumns)) {
             $sortIndex = empty($includeColumns) ? 0 : array_search($colName, $includeColumns);
             if ($sortIndex !== false) {
                 $column = new Column($colName, $model->getAttributeLabel($colName), $sortIndex);
                 $this->addColumn($column);
             }
         }
     }
     if (\GO::modules()->customfields && $model->customfieldsRecord) {
         $cfAttributes = array_keys($model->customfieldsRecord->columns);
         array_shift($cfAttributes);
         //remove model_id column
         foreach ($cfAttributes as $colName) {
             if (!in_array($colName, $excludeColumns)) {
                 $sortIndex = empty($includeColumns) ? 0 : array_search($colName, $includeColumns);
                 if ($sortIndex !== false) {
                     $column = new Column($colName, $model->customfieldsRecord->getAttributeLabel($colName), $sortIndex);
                     $this->addColumn($column);
                 }
             }
         }
     }
 }