1 <?php
2 3 4 5 6 7 8
9
10 Yii::import('zii.widgets.grid.CDataColumn');
11
12 13 14
15 class TbDataColumn extends CDataColumn
16 {
17 18 19 20
21 protected function ()
22 {
23 if ($this->grid->enableSorting && $this->sortable && $this->name !== null)
24 {
25 $sort = $this->grid->dataProvider->getSort();
26 $label = isset($this->header) ? $this->header : $sort->resolveLabel($this->name);
27
28 if ($sort->resolveAttribute($this->name) !== false)
29 $label .= '<span class="caret"></span>';
30
31 echo $sort->link($this->name, $label, array('class'=>'sort-link'));
32 }
33 else
34 {
35 if ($this->name !== null && $this->header === null)
36 {
37 if ($this->grid->dataProvider instanceof CActiveDataProvider)
38 echo CHtml::encode($this->grid->dataProvider->model->getAttributeLabel($this->name));
39 else
40 echo CHtml::encode($this->name);
41 }
42 else
43 parent::renderHeaderCellContent();
44 }
45 }
46
47 48 49
50 public function renderFilterCell()
51 {
52 echo '<td><div class="filter-container">';
53 $this->renderFilterCellContent();
54 echo '</div></td>';
55 }
56 }
57