11 Yii::import(
'booster.widgets.TbEditable');
12 Yii::import(
'booster.widgets.TbEditableField');
13 Yii::import(
'zii.widgets.grid.CDataColumn');
31 throw new CException(
'You should provide name for TbEditableColumn');
43 $isModel =
$data instanceOf CModel;
46 $widgetClass =
'TbEditableField';
49 'attribute' => empty($this->editable[
'attribute']) ? $this->name : $this->editable[
'attribute'],
54 $passText = !empty($this->
value);
56 $widgetClass =
'TbEditable';
58 'pk' =>
$data[$this->grid->dataProvider->keyField],
59 'name' => empty($this->editable[
'name']) ? $this->name : $this->editable[
'name'],
65 $options[
'value'] =
$data[$this->name];
71 $options[
'liveTarget'] = $this->grid->id;
73 $options = CMap::mergeArray($this->editable, $options);
79 $text = ob_get_clean();
80 $options[
'text'] = $text;
81 $options[
'encode'] =
false;
85 if (isset($options[
'apply']) && is_string($options[
'apply'])) {
86 $options[
'apply'] = $this->evaluateExpression($options[
'apply'], array(
'data'=>
$data,
'row'=>$row));
91 if (isset($options[
'htmlOptions']) && is_array($options[
'htmlOptions'])) {
92 foreach($options[
'htmlOptions'] as $k => $v) {
93 if(is_string($v) && (strpos($v,
'$data') !==
false || strpos($v,
'$row') !==
false)) {
94 $options[
'htmlOptions'][$k] = $this->evaluateExpression($v, array(
'data'=>
$data,
'row'=>$row));
99 $this->grid->controller->widget($widgetClass, $options);
113 if ($this->grid->enableSorting && $this->sortable && $this->name !== null)
115 $sort = $this->grid->dataProvider->getSort();
116 $label = isset($this->header) ? $this->header : $sort->resolveLabel($this->name);
118 if ($sort->resolveAttribute($this->name) !==
false)
119 $label .=
'<span class="caret"></span>';
121 echo $sort->link($this->name,
$label, array(
'class'=>
'sort-link'));
125 if ($this->name !== null && $this->header === null)
127 if ($this->grid->dataProvider instanceof CActiveDataProvider)
128 echo CHtml::encode($this->grid->dataProvider->model->getAttributeLabel($this->name));
130 echo CHtml::encode($this->name);
148 echo
'<td><div class="filter-container">';
149 $this->renderFilterCellContent();