renderDataCellContent() защищенный Метод

protected renderDataCellContent ( $model, $key, $index )
Пример #1
0
 protected function renderDataCellContent($model, $key, $index)
 {
     $text = parent::renderDataCellContent($model, $key, $index);
     if (in_array($this->format, ['text', 'date', 'datetime'])) {
         return Html::a($text, null, $this->grid->prepareDetailsLink($model->id));
     }
     return $text;
 }
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->content === null) {
         return Html::a('<span class="glyphicon glyphicon-arrow-up"></span>', $this->getUrl('up', $model), ['class' => 'order-link']) . Html::a('<span class="glyphicon glyphicon-arrow-down"></span>', $this->getUrl('down', $model), ['class' => 'order-link']);
     } else {
         return parent::renderDataCellContent($model, $key, $index);
     }
 }
Пример #3
0
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->editable === true) {
         return Html::tag('a', parent::renderDataCellContent($model, $key, $index), ['class' => 'editable']);
     } else {
         return parent::renderDataCellContent($model, $key, $index);
     }
 }
Пример #4
0
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->content === null) {
         return $this->getDataCellValue($model, $key, $index);
     } else {
         return parent::renderDataCellContent($model, $key, $index);
     }
 }
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $value = parent::renderDataCellContent($model, $key, $index);
     if ($this->getDataCellValue($model, $key, $index) == true) {
         return "<span class=\"label label-success\">{$value}</span>";
     } else {
         return "<span class=\"label label-default\">{$value}</span>";
     }
 }
Пример #6
0
 protected function renderDataCellContent($model, $key, $index)
 {
     $content = parent::renderDataCellContent($model, $key, $index);
     if ($content == "1") {
         return "<span class=\"label " . $this->true_label_class . "\">" . Yii::t('app', $this->true_value) . "</span>";
     } else {
         return "<span class=\"label " . $this->false_label_class . "\">" . Yii::t('app', $this->false_value) . "</span>";
     }
 }
Пример #7
0
 protected function renderDataCellContent($model, $key, $index)
 {
     $content = parent::renderDataCellContent($model, $key, $index);
     $options = $this->grid->options;
     if (array_key_exists('href', $options) && $options['href'] != null) {
         $field = $options['field'];
         $content = Html::tag('a', $content, ['href' => $options['href'] . "?" . $field . "=" . $model->{$field}, 'class' => 'btn-block']);
     }
     return $content;
 }
Пример #8
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     /** @var $model ActiveRecord */
     if ($this->format == 'boolean') {
         return Html::activeCheckbox($model, $this->attribute, ['label' => false, 'class' => 'ajax-checkbox', 'data' => ['id' => $key, 'modelName' => $model->className(), 'attribute' => $this->attribute]]);
     }
     if ($this->content === null) {
         return $this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format);
     } else {
         return parent::renderDataCellContent($model, $key, $index);
     }
 }
Пример #9
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->content === null) {
         $contentParts = [];
         $variationBehavior = $this->getVariationBehavior($model);
         foreach ($variationBehavior->getVariationModels() as $variationModel) {
             $contentParts[] = '<tr><td><b>' . $this->getVariationLabel($model, $variationModel) . '</b></td><td>' . $this->getVariationValue($variationModel) . '</td>';
         }
         return Html::tag('table', implode("\n", $contentParts), $this->tableOptions);
     }
     return parent::renderDataCellContent($model, $key, $index);
 }
Пример #10
0
 protected function renderDataCellContent($model, $key, $index)
 {
     $content = parent::renderDataCellContent($model, $key, $index);
     if (null === $this->callback_wrapper) {
         return $content;
     }
     if ($this->callback_wrapper instanceof \Closure) {
         $_content = call_user_func($this->callback_wrapper, $content, $model, $key, $index, $this);
         if (null !== $_content) {
             return $_content;
         }
     }
     return $content;
 }
Пример #11
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $value = $model->{$this->attribute};
     if (in_array($value, $this->infinity)) {
         return "&infin;";
     } else {
         return $value;
     }
     if ($this->content === null) {
         return $this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format);
     } else {
         return parent::renderDataCellContent($model, $key, $index);
     }
 }
Пример #12
0
 /**
  * 
  * @param \yii\base\Model $model
  * @param type $key
  * @param type $index
  * @return type
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->value !== null) {
         if (is_string($this->value)) {
             $value = ArrayHelper::getValue($model, $this->value);
         } else {
             $value = call_user_func($this->value, $model, $index, $this);
         }
     } elseif ($this->content === null && $this->attribute !== null) {
         $value = $this->renderInput($model, $index);
     } else {
         $value = parent::renderDataCellContent($model, $key, $index);
     }
     return strtr($this->template, ['{content}' => $value]);
 }
Пример #13
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $url = $this->url;
     if (!is_array($url)) {
         $url = [$url];
     }
     foreach ($this->params as $n => $v) {
         $url[$n] = $model->{$v};
     }
     if ($this->content === null) {
         return Html::a($this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format), $url);
     } else {
         return Html::a(parent::renderDataCellContent($model, $key, $index), $url);
     }
 }
Пример #14
0
 protected function renderDataCellContent($model, $key, $index)
 {
     $content = \yii\grid\DataColumn::renderDataCellContent($model, $key, $index);
     if ($this->titles) {
         $value = ArrayHelper::getValue($this->titles, $content, $content);
     } else {
         $value = $content;
     }
     if ($this->labels) {
         $content = Html::tag('span', $value, ['class' => 'label label-grid-view label-' . ArrayHelper::getValue($this->labels, $content, self::LABEL_DEFAULT)]);
     } else {
         $content = $value;
     }
     return $content;
 }
Пример #15
0
 /**
  * Renders the data cell content.
  * @param mixed $model the data model
  * @param mixed $key the key associated with the data model
  * @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
  * @return string the rendering result
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->grid->runInConsoleMode) {
         return parent::renderDataCellContent($model, $key, $index);
     }
     $attribute = $this->attribute;
     $value = $model->{$attribute};
     $url = [$this->action, 'id' => $model->id, 'attribute' => $attribute];
     if ($value === null || $value == true) {
         $icon = 'toggle-on';
         $title = Yii::t('yii', 'Off');
     } else {
         $icon = 'toggle-off';
         $title = Yii::t('yii', 'On');
     }
     return Html::a(Icons::i($icon . ' fa-lg'), $url, ['title' => $title, 'class' => 'grid-view-toggle-cell-link', 'data-method' => 'post', 'data-pjax' => '0']);
 }
Пример #16
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     switch ($model->status) {
         case ActiveRecord::STATUS_ACTIVE:
             return '<span class="label label-success">' . $model->getNiceStatus() . '</span>';
             break;
         case ActiveRecord::STATUS_INACTIVE:
             return '<span class="label label-warning">' . $model->getNiceStatus() . '</span>';
             break;
         default:
             return '<span class="label label-default">' . $model->getNiceStatus() . '</span>';
     }
     if ($this->content === null) {
         return ucfirst($this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format));
     } else {
         return parent::renderDataCellContent($model, $key, $index);
     }
 }
Пример #17
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $url = $this->url;
     if (!is_array($url)) {
         $url = [$url];
     }
     $params = ['class' => 'simplator-input-column'];
     foreach ($this->data as $n => $v) {
         $params['data-' . $n] = $model->{$v};
     }
     foreach ($this->values as $n => $v) {
         $params['data-' . $n] = $v;
     }
     if ($this->content === null) {
         return Html::tag('div', $this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format), $params);
     } else {
         return Html::tag('div', parent::renderDataCellContent($model, $key, $index), $params);
     }
 }
Пример #18
0
 /**
  * Renders the data cell content.
  *
  * @param mixed $model the data model
  * @param mixed $key the key associated with the data model
  * @param int $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]]
  *
  * @return string the rendering result
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $value = parent::renderDataCellContent($model, $key, $index);
     $url = (array) $this->url;
     $this->options['data-url'] = Url::to($url);
     $this->options['data-pk'] = $key;
     $this->options['data-name'] = $this->attribute;
     $this->options['data-type'] = $this->type;
     if (is_callable($this->editableOptions)) {
         $opts = call_user_func($this->editableOptions, $model, $key, $index);
         foreach ($opts as $prop => $v) {
             $this->options['data-' . $prop] = $v;
         }
     } elseif (is_array($this->editableOptions)) {
         foreach ($this->editableOptions as $prop => $v) {
             $this->options['data-' . $prop] = $v;
         }
     }
     return Html::a($value, null, $this->options);
 }
Пример #19
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->content === null) {
         return preg_replace_callback('/\\{([\\w\\-\\/]+)\\}/', function ($matches) use($model, $key, $index) {
             $name = $matches[1];
             if ($name === 'value') {
                 return $this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format);
             }
             return $this->renderButton($name, $model, $key, $index);
         }, $this->template);
     } else {
         return parent::renderDataCellContent($model, $key, $index);
     }
 }
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $value = parent::renderDataCellContent($model, $key, $index);
     $options = ['class' => $this->attribute . '_toggle' . $this->classSuffix, 'data-pjax' => '0'];
     $url = $this->url;
     if (isset($url)) {
         if ($model instanceof Model) {
             $keys = $model->primaryKey();
             $key = $keys[0];
         }
         $url = (array) $this->url;
         $url['attribute'] = $this->attribute;
         $url['id'] = $model instanceof Model ? $model->getPrimaryKey() : $key;
         $url = Url::to($url);
     }
     if (!$this->asText) {
         $text = $value === null ? $this->emptyIcon : ($value === $this->onValue ? $this->onIcon : $this->offIcon);
         $text = Html::tag('span', '', ['class' => $text]);
         $options['title'] = $this->getToggleText($value);
         $options['rel'] = 'tooltip';
     } else {
         $text = $this->getToggleText($value);
     }
     return Html::a($text, $url, $options);
 }
Пример #21
0
 protected function renderDataCellContent($model, $key, $index)
 {
     $text = parent::renderDataCellContent($model, $key, $index);
     return $this->dataCellContentWrapper($text, $model);
 }
Пример #22
0
 public function renderDataCellContent($model, $key, $index)
 {
     return Stars::widget(['value' => parent::renderDataCellContent($model, $key, $index), 'options' => $this->options]);
 }