view_adress.php 1.72 KB
<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\grid\Column;
use frontend\models\OptionLang;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\LanguageSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Languages');
$this->params['breadcrumbs'][] = $this->title;
echo $this->render('layout');
?>
<div class="lang-column-2">

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'layout' => "{items}",
        'columns' => [
            [
                'class' => 'yii\grid\Column',
                'content' => function($model, $key, $index, $column) {
                    return OptionLang::find()->select('value')->where(['language_id' => 0, 'id' => $model->option_id])->scalar();
                },
                'header' => Yii::t('app', 'adress_name')
            ],
            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{update-adress} {delete-adress}',
                'buttons' => [
                    'update-adress' => function ($url, $model, $key) {
                        return Html::a('', $url, ['class' => 'glyphicon glyphicon-pencil', 'title' => Yii::t('app', 'Change')]);
                    },
                    'delete-adress' => function ($url, $model, $key) {
                        return Html::a('', $url, ['class' => 'glyphicon glyphicon-trash', 'title' => Yii::t('app', 'Delete')]);
                    },
                ],
            ]
        ]
    ]); ?>
    
    <p class="text-right">
        <?= Html::a(Yii::t('app', 'Create adress'), ['create-adress'], ['class' => 'btn btn-success']) ?>
    </p>

</div>