This repository has been archived on 2024-12-01. You can view files and clone it, but cannot push or open issues or pull requests.
factuges_web/www/protected/extensions/bootstrap/widgets/TbDataColumn.php
david e93adbdd4e - Importación inicial
- Registro, activación y entrada de usuarios


git-svn-id: https://192.168.0.254/svn/Rodax.factuges_web/trunk@2 e455b18d-f7fe-5245-9c43-e2c35af70a32
2013-06-13 16:04:48 +00:00

57 lines
1.5 KiB
PHP

<?php
/**
* TbDataColumn class file.
* @author Christoffer Niska <ChristofferNiska@gmail.com>
* @copyright Copyright &copy; Christoffer Niska 2011-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package bootstrap.widgets
*/
Yii::import('zii.widgets.grid.CDataColumn');
/**
* Bootstrap grid data column.
*/
class TbDataColumn extends CDataColumn
{
/**
* Renders the header cell content.
* This method will render a link that can trigger the sorting if the column is sortable.
*/
protected function renderHeaderCellContent()
{
if ($this->grid->enableSorting && $this->sortable && $this->name !== null)
{
$sort = $this->grid->dataProvider->getSort();
$label = isset($this->header) ? $this->header : $sort->resolveLabel($this->name);
if ($sort->resolveAttribute($this->name) !== false)
$label .= '<span class="caret"></span>';
echo $sort->link($this->name, $label, array('class'=>'sort-link'));
}
else
{
if ($this->name !== null && $this->header === null)
{
if ($this->grid->dataProvider instanceof CActiveDataProvider)
echo CHtml::encode($this->grid->dataProvider->model->getAttributeLabel($this->name));
else
echo CHtml::encode($this->name);
}
else
parent::renderHeaderCellContent();
}
}
/**
* Renders the filter cell.
*/
public function renderFilterCell()
{
echo '<td><div class="filter-container">';
$this->renderFilterCellContent();
echo '</div></td>';
}
}