Esempio n. 1
0
/* @var $searchModel common\modules\catalog\models\CatalogSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
if (empty($parentModel->name)) {
    $this->title = Yii::t('catalog/main', 'Index');
} else {
    $this->title = $parentModel->name;
}
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
echo GridView::widget(['options' => ['boxTitle' => Yii::t('catalog/main', 'Catalog'), 'buttonUp' => Url::to(['index', 'parent' => $parentModel->parent]), 'buttonCreate' => Url::to(['create', 'class' => $class]), 'buttonUndo' => Url::home(), 'buttonDelete' => Url::to(['batch-delete']), 'ajax' => $ajax], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname(), 'contentOptions' => ['style' => 'width: 1px;']], 'id', ['format' => 'image', 'attribute' => 'image', 'filter' => '', 'contentOptions' => ['class' => 'text-center', 'style' => 'width: 1px;'], 'value' => function ($model) {
    return Image::thumb($model->image, 50, 50);
}], ['attribute' => 'name', 'format' => 'html', 'value' => function ($model) {
    return $model['isparent'] ? Html::a($model['name'], ['index', 'parent' => $model['id']]) : $model['name'];
}], 'price', ['attribute' => 'status', 'label' => \Yii::t('catalog/main', 'Status'), 'filter' => Html::activeDropDownList($searchModel, 'status', CatalogProducts::getStatusArray(), ['class' => 'form-control', 'prompt' => Yii::t('catalog/main', 'All')]), 'format' => 'html', 'value' => function ($model) {
    if ($model->status === CatalogProducts::STATUS_PUBLISHED) {
        $class = 'label-success';
        $lable = CatalogProducts::getStatusArray()[CatalogProducts::STATUS_PUBLISHED];
    } elseif ($model->status === CatalogProducts::STATUS_NOT_PUBLISHED) {
        $class = 'label-danger';
        $lable = CatalogProducts::getStatusArray()[CatalogProducts::STATUS_NOT_PUBLISHED];
    } elseif ($model->status === CatalogProducts::STATUS_DELETED) {
        $class = 'label-warning';
        $lable = CatalogProducts::getStatusArray()[CatalogProducts::STATUS_DELETED];
    }
    return '<span class="label ' . $class . '">' . $lable . '</span>';
}], ['class' => ActionColumn::className()]]]);
?>

Esempio n. 2
0
<?php

use yii\helpers\Url;
use yii\helpers\Html;
use common\themes\admin\widgets\GridView;
use common\themes\admin\widgets\GridViewEdited;
use andreosoft\image\Image;
/* @var $this yii\web\View */
/* @var $searchModel common\modules\gallery\models\GallerySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Galleries';
$this->params['breadcrumbs'][] = $this->title;
echo GridView::widget(['options' => ['boxTitle' => $this->title, 'buttonCreate' => Url::to(['create', 'class' => $class]), 'buttonDelete' => Url::to(['batch-delete'])], 'dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], 'id', ['format' => 'image', 'label' => 'image', 'value' => function ($data) {
    return Image::thumb($data->url, 100, 100);
}], 'name', 'table_id', 'table_name', ['attribute' => 'parent', 'format' => 'raw', 'value' => function ($model, $index, $widget) {
    return Html::checkbox('parent[]', $model->parent, ['value' => $index, 'disabled' => true]);
}], 'parent_id', ['class' => 'common\\themes\\admin\\widgets\\ActionColumn']]]);
Esempio n. 3
0
<?php

use yii\helpers\Url;
use yii\helpers\Html;
use yii\grid\CheckboxColumn;
use common\themes\admin\widgets\GridView;
$this->title = 'Comments';
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
echo GridView::widget(['options' => ['boxTitle' => $this->title, 'buttonCreate' => Url::to(['create', 'class' => $class]), 'buttonUndo' => Url::home(), 'buttonDelete' => Url::to(['batch-delete'])], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'id', 'table_id', 'table_name', 'parent', 'parent_id', 'createdby', 'createdon', 'content:ntext', ['class' => 'common\\themes\\admin\\widgets\\ActionColumn']]]);
Esempio n. 4
0
?>

    <?php 
echo GridView::widget(['options' => ['boxTitle' => $this->title, 'buttonCreate' => Url::to(['create', 'class' => $class]), 'buttonUndo' => Url::home(), 'buttonDelete' => Url::to(['batch-delete'])], 'id' => 'main-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'username', 'email', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === User::STATUS_ACTIVE) {
        $class = 'label-success';
        $lable = User::getStatusArray()[$model->status];
    } elseif ($model->status === User::STATUS_INACTIVE) {
        $class = 'label-default';
        $lable = User::getStatusArray()[$model->status];
    } elseif ($model->status === User::STATUS_BANNED) {
        $class = 'label-danger';
        $lable = User::getStatusArray()[$model->status];
    } elseif ($model->status === User::STATUS_DELETED) {
        $class = 'label-warning';
        $lable = User::getStatusArray()[$model->status];
    }
    return '<span class="label ' . $class . '">' . $lable . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', User::getStatusArray(), ['class' => 'form-control', 'prompt' => 'Выберите статус'])], ['attribute' => 'role', 'format' => 'html', 'value' => function ($model) {
    if ($model->role === User::ROLE_ADMIN) {
        $class = 'label-danger';
        $lable = User::getRoleArray()[$model->role];
    } elseif ($model->role === User::ROLE_MANAGER) {
        $class = 'label-primary';
        $lable = User::getRoleArray()[$model->role];
    } elseif ($model->role === User::ROLE_USER) {
        $class = 'label-default';
        $lable = User::getRoleArray()[$model->role];
    }
    return '<span class="label ' . $class . '">' . $lable . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'role', User::getRoleArray(), ['class' => 'form-control', 'prompt' => 'Выберите роль'])], ['class' => 'common\\themes\\admin\\widgets\\ActionColumn']]]);
Esempio n. 5
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use common\themes\admin\widgets\GridView;
use yii\grid\CheckboxColumn;
use common\modules\content\models\backend\Content;
$this->title = 'Контент';
$this->params['breadcrumbs'][] = $this->title;
?>


    <?php 
echo GridView::widget(['options' => ['boxTitle' => $this->title, 'buttonCreate' => Url::to(['create', 'class' => $class]), 'buttonUndo' => Url::home(), 'buttonDelete' => Url::to(['batch-delete']), 'ajax' => $ajax], 'id' => 'main-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'name', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === Content::STATUS_PUBLISHED) {
        $class = 'label-success';
        $lable = Content::getStatusArray()[Content::STATUS_PUBLISHED];
    } elseif ($model->status === Content::STATUS_NOT_PUBLISHED) {
        $class = 'label-danger';
        $lable = Content::getStatusArray()[Content::STATUS_NOT_PUBLISHED];
    } elseif ($model->status === Content::STATUS_DELETED) {
        $class = 'label-warning';
        $lable = Content::getStatusArray()[Content::STATUS_DELETED];
    }
    return '<span class="label ' . $class . '">' . $lable . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', Content::getStatusArray(), ['class' => 'form-control', 'prompt' => 'Выберите статус'])], ['class' => 'common\\themes\\admin\\widgets\\ActionColumn']]]);
?>