HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbDataColumn.php
Go to the documentation of this file.
1 <?php
10 Yii::import('zii.widgets.grid.CDataColumn');
11 
19 class TbDataColumn extends CDataColumn
20 {
26 
33  protected function renderHeaderCellContent()
34  {
35  if ($this->grid->enableSorting && $this->sortable && $this->name !== null) {
36  $sort = $this->grid->dataProvider->getSort();
37  $label = isset($this->header) ? $this->header : $sort->resolveLabel($this->name);
38 
39  $booster = Booster::getBooster();
40 
41  if ($sort->resolveAttribute($this->name) !== false)
42  $label .= ' <span class="caret"></span>';
43  /* {
44  if($sort->getDirection($this->name) === CSort::SORT_ASC){
45  $label .= ' <span class="'.($booster->fontAwesomeCss ? 'fa fa-sort-asc' : 'icon-chevron-down').'"></span>';
46  } elseif($sort->getDirection($this->name) === CSort::SORT_DESC){
47  $label .= ' <span class="'.($booster->fontAwesomeCss ? 'fa fa-sort-desc' : 'icon-chevron-up').'"></span>';
48  } else {
49  $label .= ' ';
50  }
51  } */
52 
53  echo $sort->link($this->name, $label, array('class' => 'sort-link'));
54  } else {
55  if ($this->name !== null && $this->header === null) {
56  if ($this->grid->dataProvider instanceof CActiveDataProvider) {
57  echo CHtml::encode($this->grid->dataProvider->model->getAttributeLabel($this->name));
58  } else {
59  echo CHtml::encode($this->name);
60  }
61  } else {
63  }
64  }
65  }
66 
74  public function renderFilterCell()
75  {
76  echo CHtml::openTag('td', $this->filterHtmlOptions);
77  echo '<div class="filter-container">';
78  $this->renderFilterCellContent();
79  echo '</div>';
80  echo CHtml::closeTag('td');
81  }
82 
90  protected function renderFilterCellContent()
91  {
92  if (is_string($this->filter)) {
93  echo $this->filter;
94  } else if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos(
95  $this->name,
96  '.'
97  ) === false
98  ) {
99  if ($this->filterInputOptions) {
101  if (empty($filterInputOptions['id'])) {
102  $filterInputOptions['id'] = false;
103  }
104  } else {
105  $filterInputOptions = array();
106  }
107 
108  if(!isset($filterInputOptions['class']) || empty($filterInputOptions['class']))
109  $filterInputOptions['class'] = 'form-control';
110  else
111  $filterInputOptions['class'] .= ' form-control';
112 
113  if (is_array($this->filter)) {
114  if (!isset($filterInputOptions['prompt'])) {
115  $filterInputOptions['prompt'] = '';
116  }
117  echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, $filterInputOptions);
118  } else if ($this->filter === null) {
119  echo CHtml::activeTextField($this->grid->filter, $this->name, $filterInputOptions);
120  }
121  } else {
123  }
124  }
125 }