public function init()
 {
     $this->headerOptions = ['class' => 'text-center', 'style' => 'width: 115px'];
     $this->contentOptions = ['class' => 'text-center'];
     parent::init();
     $this->content = function (ModelBase $model, $key, $index, DataColumn $column) {
         return ControllerBase::getYesNoLabel($model->{$column->attribute});
     };
 }
Exemplo n.º 2
0
<?php

/* @var $this yii\web\View */
/* @var $model \dersonsena\userModule\models\User */
use dersonsena\commonClasses\controller\ControllerBase;
use yii\widgets\DetailView;
$this->params['breadcrumbs'][] = ['label' => $this->context->controllerDescription, 'url' => [$this->context->id . '/index']];
$this->params['breadcrumbs'][] = $this->context->actionDescription;
?>

<div class="box form-actions">
    <div class="box-body">
        <?php 
echo $this->render('@common-classes/views/crud/view-default-buttons');
?>
    </div>
</div>

<div class="box box-primary">

    <div class="box-body">

        <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'name', 'email:email', 'group.name:text:' . $model->getAttributeLabel('group_id'), ['attribute' => 'status', 'format' => 'raw', 'value' => ControllerBase::getYesNoLabel($model->status)], 'created_at', 'updated_at', 'createdBy.name:text:' . $model->getAttributeLabel('created_by')]]);
?>

    </div>

</div>