当前位置: 首页>>代码示例>>PHP>>正文


PHP CDataColumn::renderDataCellContent方法代码示例

本文整理汇总了PHP中CDataColumn::renderDataCellContent方法的典型用法代码示例。如果您正苦于以下问题:PHP CDataColumn::renderDataCellContent方法的具体用法?PHP CDataColumn::renderDataCellContent怎么用?PHP CDataColumn::renderDataCellContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDataColumn的用法示例。


在下文中一共展示了CDataColumn::renderDataCellContent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderDataCellContent

 protected function renderDataCellContent($row, $data)
 {
     if (!$this->isEditable($data)) {
         parent::renderDataCellContent($row, $data);
         return;
     }
     $options = CMap::mergeArray($this->editable, array('model' => $data, 'attribute' => $this->name));
     //if value defined for column --> use it as element text
     if (strlen($this->value)) {
         ob_start();
         parent::renderDataCellContent($row, $data);
         $text = ob_get_clean();
         $options['text'] = $text;
         $options['encode'] = false;
     }
     $editable = $this->grid->controller->createWidget('TbEditableField', $options);
     //manually make selector non unique to match all cells in column
     $selector = get_class($editable->model) . '_' . $editable->attribute;
     $editable->htmlOptions['rel'] = $selector;
     $editable->renderLink();
     //manually render client script (one for all cells in column)
     if (!$this->isScriptRendered) {
         $script = $editable->registerClientScript();
         Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $selector . '-event', '
             $("#' . $this->grid->id . '").parent().on("ajaxUpdate.yiiGridView", "#' . $this->grid->id . '", function() {' . $script . '});
         ');
         $this->isScriptRendered = true;
     }
 }
开发者ID:janym,项目名称:angular-yii,代码行数:29,代码来源:TbEditableColumn.php

示例2: renderDataCellContent

 protected function renderDataCellContent($row, $data)
 {
     if (!$this->visible) {
         return $this->grid->nullDisplay;
     } else {
         return parent::renderDataCellContent($row, $data);
     }
 }
开发者ID:nineinchnick,项目名称:edatatables,代码行数:8,代码来源:EDataColumn.php

示例3: renderDataCellContent

 public function renderDataCellContent($row, $data)
 {
     $isModel = $data instanceof CModel;
     if ($isModel) {
         $widgetClass = 'EditableField';
         $attribute = empty($this->editable['attribute']) ? $this->name : $this->editable['attribute'];
         $options = array('model' => $data, 'attribute' => $attribute);
         //if value defined in column config --> we should evaluate it
         //and pass to widget via `text` option: set flag `passText` = true
         $passText = !empty($this->value);
     } else {
         $widgetClass = 'Editable';
         $options = array('pk' => $data[$this->grid->dataProvider->keyField], 'name' => empty($this->editable['name']) ? $this->name : $this->editable['name']);
         $passText = true;
         //if autotext will be applied, do not pass `text` option (pass `value` instead)
         if (empty($this->value) && Editable::isAutotext($this->editable, isset($this->editable['type']) ? $this->editable['type'] : '')) {
             $options['value'] = $data[$this->name];
             $passText = false;
         }
     }
     //for live update
     $options['liveTarget'] = $this->grid->id;
     $options = CMap::mergeArray($this->editable, $options);
     //get text for element
     $ctext = CHtml::value($data, $attribute);
     //if value defined for column --> use it as element text
     if ($passText) {
         ob_start();
         parent::renderDataCellContent($row, $data);
         $text = ob_get_clean();
         $ctext = $text;
         $options['text'] = $text;
         $options['encode'] = false;
     }
     //apply may be a string expression, see https://github.com/vitalets/x-editable-yii/issues/33
     if (isset($options['apply']) && is_string($options['apply'])) {
         $options['apply'] = $this->evaluateExpression($options['apply'], array('data' => $data, 'row' => $row));
     }
     //evaluate htmlOptions inside editable config as they can depend on $data
     //see https://github.com/vitalets/x-editable-yii/issues/40
     if (isset($options['htmlOptions']) && is_array($options['htmlOptions'])) {
         foreach ($options['htmlOptions'] as $k => $v) {
             if (is_string($v) && (strpos($v, '$data') !== false || strpos($v, '$row') !== false)) {
                 $options['htmlOptions'][$k] = $this->evaluateExpression($v, array('data' => $data, 'row' => $row));
             }
         }
     }
     $this->grid->controller->widget($widgetClass, $options);
     //Added to support creating models on the fly
     //$ctext = CHtml::value($data, $attribute);
     $mClass = empty($this->modelName) ? get_class($data) : $this->modelName;
     if (empty($this->parentModel)) {
         echo cHtml::openTag('input', array('type' => 'hidden', 'class' => "optvalinput{$attribute}", 'id' => "{$mClass}_{$row}_{$attribute}", 'name' => "{$mClass}[{$row}][{$attribute}]", 'value' => $ctext));
     } else {
         echo cHtml::openTag('input', array('type' => 'hidden', 'class' => "optvalinput{$attribute}", 'id' => "{$this->parentModel[1]}_{$this->parentModel[0]}_{$mClass}_{$row}_{$attribute}", 'name' => "{$this->parentModel[1]}[{$this->parentModel[0]}][{$mClass}][{$row}][{$attribute}]", 'value' => $ctext));
     }
     echo cHtml::closeTag('input');
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:58,代码来源:EditableColumn.php

示例4: renderDataCellContent

 public function renderDataCellContent($row, $data)
 {
     $isModel = $data instanceof CModel;
     if ($isModel) {
         $widgetClass = 'EditableField';
         $options = array('model' => $data, 'attribute' => empty($this->editable['attribute']) ? $this->name : $this->editable['attribute']);
         //if value defined in column config --> we should evaluate it
         //and pass to widget via `text` option: set flag `passText` = true
         $passText = !empty($this->value);
     } else {
         $widgetClass = 'Editable';
         $options = array('pk' => $data[$this->grid->dataProvider->keyField], 'name' => empty($this->editable['name']) ? $this->name : $this->editable['name']);
         $passText = true;
         //if autotext will be applied, do not pass `text` option (pass `value` instead)
         if (empty($this->value) && Editable::isAutotext($this->editable, isset($this->editable['type']) ? $this->editable['type'] : '')) {
             $options['value'] = $data[$this->name];
             $passText = false;
         }
     }
     //for live update
     $options['liveTarget'] = $this->grid->id;
     $options = CMap::mergeArray($this->editable, $options);
     //if value defined for column --> use it as element text
     if ($passText) {
         ob_start();
         parent::renderDataCellContent($row, $data);
         $text = ob_get_clean();
         $options['text'] = $text;
         $options['encode'] = false;
     }
     //apply may be a string expression, see https://github.com/vitalets/x-editable-yii/issues/33
     if (isset($options['apply']) && is_string($options['apply'])) {
         $options['apply'] = $this->evaluateExpression($options['apply'], array('data' => $data, 'row' => $row));
     }
     //evaluate htmlOptions inside editable config as they can depend on $data
     //see https://github.com/vitalets/x-editable-yii/issues/40
     if (isset($options['htmlOptions']) && is_array($options['htmlOptions'])) {
         foreach ($options['htmlOptions'] as $k => $v) {
             if (is_string($v) && (strpos($v, '$data') !== false || strpos($v, '$row') !== false)) {
                 $options['htmlOptions'][$k] = $this->evaluateExpression($v, array('data' => $data, 'row' => $row));
             }
         }
     }
     //evaluate `params` as they can depend on $data
     //see https://github.com/vitalets/x-editable-yii/issues/65
     if (isset($options['params']) && is_array($options['params'])) {
         foreach ($options['params'] as $k => $v) {
             if (is_string($v) && (strpos($v, '$data') !== false || strpos($v, '$row') !== false)) {
                 $options['params'][$k] = $this->evaluateExpression($v, array('data' => $data, 'row' => $row));
             }
         }
     }
     $this->grid->controller->widget($widgetClass, $options);
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:54,代码来源:EditableColumn.php

示例5: renderDataCellContent

 protected function renderDataCellContent($row, $data)
 {
     if ($this->isSpan && $this->_conditionResult) {
         $value = null;
         if ($this->spanValue !== null) {
             $value = $this->evaluateExpression($this->spanValue, array('data' => $data, 'row' => $row));
         }
         echo is_null($value) ? $this->grid->nullDisplay : $this->grid->getFormatter()->format($value, $this->type);
     }
     //		else
     //		{
     parent::renderDataCellContent($row, $data);
     //		}
 }
开发者ID:anton-itscript,项目名称:WM-Web,代码行数:14,代码来源:SpanColumn.php

示例6: renderDataCellContent

 protected function renderDataCellContent($row, $data)
 {
     ob_start();
     parent::renderDataCellContent($row, $data);
     $label = ob_get_clean();
     if ($this->urlExpression !== null) {
         $url = $this->evaluateExpression($this->urlExpression, array('data' => $data, 'row' => $row));
     } else {
         $url = $this->url;
     }
     $options = $this->linkHtmlOptions;
     if (is_string($this->imageUrl)) {
         echo CHtml::link(CHtml::image($this->imageUrl, $label), $url, $options);
     } else {
         echo CHtml::link($label, $url, $options);
     }
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:17,代码来源:YDataLinkColumn.php

示例7: renderDataCellContent

 protected function renderDataCellContent($row, $data)
 {
     $options = CMap::mergeArray($this->editable, array('model' => $data, 'attribute' => $this->name));
     //if value defined for column --> use it as element text
     if (strlen($this->value)) {
         ob_start();
         parent::renderDataCellContent($row, $data);
         $text = ob_get_clean();
         $options['text'] = $text;
         $options['encode'] = false;
     }
     $widget = $this->grid->controller->createWidget('EditableField', $options);
     //if editable not applied --> render original text
     if (!$widget->apply) {
         if (isset($text)) {
             echo $text;
         } else {
             parent::renderDataCellContent($row, $data);
         }
         return;
     }
     //manually make selector non unique to match all cells in column
     $selector = get_class($widget->model) . '_' . $widget->attribute;
     $widget->htmlOptions['rel'] = $selector;
     //can't call run() as it registers clientScript
     $widget->renderLink();
     //manually render client script (one for all cells in column)
     if (!$this->_isScriptRendered) {
         $script = $widget->registerClientScript();
         //use parent() as grid is totally replaced by new content
         Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $selector . '-event', '
             $("#' . $this->grid->id . '").parent().on("ajaxUpdate.yiiGridView", "#' . $this->grid->id . '", function() {' . $script . '});
         ');
         $this->_isScriptRendered = true;
     }
 }
开发者ID:asdmundt,项目名称:templateYiiApp,代码行数:36,代码来源:EditableColumn.php

示例8: renderDataCellContent

 protected function renderDataCellContent($row, $data)
 {
     $isModel = $data instanceof CModel;
     if ($isModel) {
         $widgetClass = 'EditableField';
         $options = array('model' => $data, 'attribute' => $this->name);
         //manually make selector non unique to match all cells in column
         $selector = $this->grid->id . '_' . str_replace('\\', '_', get_class($data)) . '_' . $this->name;
         //flag to pass text to widget
         $passText = strlen($this->value);
     } else {
         $widgetClass = 'Editable';
         $options = array('pk' => $data[$this->grid->dataProvider->keyField], 'name' => $this->name);
         //manually make selector non unique to match all cells in column
         $selector = $this->grid->id . '_' . $this->name;
         $passText = true;
         //if autotext will be applied, do not pass text param
         if (!strlen($this->value) && Editable::isAutotext($this->editable, isset($this->editable['type']) ? $this->editable['type'] : '')) {
             $options['value'] = $data[$this->name];
             $passText = false;
         }
     }
     $options = CMap::mergeArray($this->editable, $options);
     //if value defined for column --> use it as element text
     if ($passText) {
         ob_start();
         parent::renderDataCellContent($row, $data);
         $text = ob_get_clean();
         $options['text'] = $text;
         $options['encode'] = false;
     }
     //apply may be a string expression, see https://github.com/vitalets/x-editable-yii/issues/33
     if (isset($options['apply']) && is_string($options['apply'])) {
         $options['apply'] = $this->evaluateExpression($options['apply'], array('data' => $data, 'row' => $row));
     }
     $widget = $this->grid->controller->createWidget($widgetClass, $options);
     //if editable not applied --> render original text
     if ($widget->apply === false) {
         if (isset($text)) {
             echo $text;
         } else {
             parent::renderDataCellContent($row, $data);
         }
         return;
     }
     //call these methods manually as we don't call run()
     $widget->buildHtmlOptions();
     $widget->buildJsOptions();
     $widget->registerAssets();
     //manually make selector non unique to match all cells in column
     //model class may be namespaced, see https://github.com/vitalets/x-editable-yii/issues/9
     $widget->htmlOptions['rel'] = $selector;
     //can't call run() as it registers clientScript
     $widget->renderLink();
     //manually render client script (one for all cells in column)
     if (!$this->_isScriptRendered) {
         $script = $widget->registerClientScript();
         //use parent() as grid is totally replaced by new content
         Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $selector . '-event', '
             $("#' . $this->grid->id . '").parent().on("ajaxUpdate.yiiGridView", "#' . $this->grid->id . '", function() {' . $script . '});
         ');
         $this->_isScriptRendered = true;
     }
 }
开发者ID:rlaput,项目名称:integrated-municipality-management-system,代码行数:64,代码来源:EditableColumn.php

示例9: renderDataCellContent

 /**
  * Renders the data cell content and adds the cell value to the total.
  * This method evaluates value or name to obtain the data cell value and adds
  * it to the current total. If set, output is evaluated to determine the
  * rendering result; if not the cell value is rendered.
  * @param integer the row number (zero-based)
  * @param mixed the data associated with the row
  */
 protected function renderDataCellContent($row, $data)
 {
     parent::renderDataCellContent($row, $data);
     /*if($this->value!==null)
     			$value=$this->evaluateExpression($this->value,compact('data','row'));
     		else if($this->name!==null)
     			$value=CHtml::value($data,$this->name);
     		else
     			$value=0;*/
     $this->_total += 1;
     /*if($value==0&&$this->nullOnZero)
     			$value=null;
     
     		if($this->output!==null&&$value!==null)
     			$value=$this->evaluateExpression($this->output,compact('data','row','value'));
     		echo $value===null
     			?$this->grid->nullDisplay
     			:$this->grid->getFormatter()->format($value,$this->type);*/
 }
开发者ID:bylinggha,项目名称:Capella-ERP-Indonesia,代码行数:27,代码来源:CountColumn.php


注:本文中的CDataColumn::renderDataCellContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。