11 Yii::import(
'booster.widgets.TbEditableField');
12 Yii::import(
'zii.widgets.CDetailView');
41 if (!$this->data instanceof CModel) {
42 throw new CException(
'Property "data" should be of CModel class.');
47 $this->htmlOptions = array(
'class'=>
'table table-bordered table-striped table-hover');
49 $this->cssFile =
false;
58 $apply = !empty($options[
'name']) && (!isset($options[
'editable']) || $options[
'editable'] !==
false);
62 if(!isset($options[
'editable'])) $options[
'editable'] = array();
65 $options[
'editable'] = CMap::mergeArray($this->_data, $options[
'editable']);
68 $widgetOptions = array(
69 'model' => $this->data,
70 'attribute' => $options[
'name']
74 if(isset($options[
'value']) && $options[
'value'] !== null) {
75 $widgetOptions[
'text'] = $templateData[
'{value}'];
76 $widgetOptions[
'encode'] =
false;
79 $widgetOptions = CMap::mergeArray($widgetOptions, $options[
'editable']);
81 $widget = $this->controller->createWidget(
'TbEditableField', $widgetOptions);
87 $templateData[
'{value}'] = ob_get_clean();
109 if(!isset($this->_editableProperties)) {
110 $reflection =
new ReflectionClass(
'TbEditableField');
111 $this->_editableProperties = array_map(
function($d){
return $d->getName();},$reflection->getProperties());
121 return (array_key_exists($key,$this->_data) ? $this->_data[$key] : parent::__get($key));
128 public function __set($key, $value) {
130 $this->_data[$key] = $value;