Пример #1
0
$grid = GridView::begin(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pager' => ['options' => ['class' => 'pagination', 'style' => 'margin:0px;']], 'layout' => "{items}", 'options' => ['class' => 'gridview-newclass'], 'tableOptions' => ['style' => 'width:auto;', 'id' => 'tb-referrer', "class" => "table table-striped table-bordered"], 'columns' => [['class' => 'yii\\grid\\SerialColumn', 'contentOptions' => ['width' => 50]], ['class' => 'yii\\grid\\CheckboxColumn'], ['label' => '<span style="padding: 0 70px;">Name</span>', 'encodeLabel' => false, 'attribute' => 'first_name', 'value' => function ($model) {
    return $model->first_name . " " . $model->last_name;
}, 'contentOptions' => array('class' => 'col-name')], ['attribute' => 'code', 'label' => '<span style="padding: 0px 30px;">Code</span>', 'encodeLabel' => false, 'contentOptions' => array('class' => 'col-code')], ['attribute' => 'referrer', 'label' => '<span style="padding: 0px 30px;">Referrer</span>', 'encodeLabel' => false, 'contentOptions' => array('class' => 'col-referrer')], ['attribute' => 'mobile', 'label' => '<span style="padding:0px 40px;">mobile</span>', 'encodeLabel' => false, 'contentOptions' => array('class' => 'col-mobile')], ['attribute' => 'state', 'label' => '<span style="padding:0 80px;">State</span>', 'encodeLabel' => false, 'filter' => \frontend\controllers\Common::$states, 'value' => function ($model) {
    if (array_key_exists($model->state, \frontend\controllers\Common::$states)) {
        return \frontend\controllers\Common::$states[$model->state];
    } else {
        return $model->state;
    }
}, 'contentOptions' => array('class' => 'col-state')], ['attribute' => 'zip', 'label' => '<span style="padding: 0px 40px;">Zip</span>', 'encodeLabel' => false, 'contentOptions' => array('class' => 'col-zip')], ['attribute' => 'city', 'label' => '<span style="padding:0px 50px;">City</span>', 'encodeLabel' => false, 'contentOptions' => array('class' => 'col-city')], ['attribute' => 'email', 'contentOptions' => array('class' => 'col-email')], ['attribute' => 'graduate_high_school', 'label' => 'Graduate', 'value' => 'graduate_high_school', 'contentOptions' => array('class' => 'col-graduate')], ['attribute' => 'sex', 'label' => '<span style="padding: 40px;">Sex</span>', 'encodeLabel' => false, 'format' => 'raw', 'filter' => array('1' => 'Male', '0' => 'Female'), 'contentOptions' => ['style' => 'text-align:center', 'class' => 'col-sex'], 'value' => function ($model) {
    return $model->sex == 1 ? '<i class="fa fa-male fa-2x"></i>' : '<i class="fa fa-female fa-2x"></i>';
}], ['attribute' => 'status', 'filter' => $status, 'label' => '<span style="padding: 0px 30px;">Status</span>', 'encodeLabel' => false, 'value' => function ($model) {
    $str = "";
    switch ($model->status) {
        case 0:
            $str = "Deleted";
            break;
        case 5:
            $str = "Inactive";
            break;
        case 10:
            $str = "Active";
            break;
        case -10:
            $str = "Lock";
            break;
    }
    return $str;
}, 'contentOptions' => array('class' => 'col-status')], ['attribute' => 'created_at', 'format' => 'date', 'label' => 'Created', 'contentOptions' => array('class' => 'col-created')], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{delete}', 'contentOptions' => array('width' => '100', 'class' => 'btn-action'), 'header' => Html::dropDownList('pageSize', Yii::$app->request->get('per-page'), array(20 => 20, 30 => 30, 50 => 50, 70 => 70, 100 => 100), array('class' => "form-control page-size", 'style' => 'width:70px; padding:0px;')), 'buttons' => ['delete' => function ($url, $model) {
    $url = \yii\helpers\Url::to(['manage/delete-user', 'id' => $model->id], true);
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data' => ['confirm' => 'Are you sure you want to delete this application "' . $model->first_name . '"?', 'method' => 'post']]);
}, 'update' => function ($url, $model) {
    $url = \yii\helpers\Url::to(['manage/update-user', 'id' => $model->id], true);
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update')]);
}]]]]);
Пример #2
0
<?php

use yii\data\ActiveDataProvider;
use yii\helpers\Url;
/**
 * @var ActiveDataProvider $dataProvider
 * @var int                $categoryId
 */
?>

<?php 
\yii\grid\GridView::begin(['dataProvider' => $dataProvider, 'columns' => ['attribute_name', ['class' => \yii\easyii\components\grid\ActionColumn::class, 'template' => '{update}', 'urlCreator' => function ($action, $model, $key, $index) {
    $params = is_array($key) ? $key : ['id' => (string) $key];
    $params[0] = 'attribute';
    return Url::toRoute($params);
}]]]);
?>

<?php 
\yii\grid\GridView::end();
Пример #3
0
            <?php 
echo Html::a('Send Email', ['create-email'], ['class' => 'btn btn-success']);
?>
        </p>

        <?php 
$grid = GridView::begin(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pager' => ['options' => ['class' => 'pagination', 'style' => 'margin:0px;']], 'layout' => "{summary}\n{items}", 'rowOptions' => function ($model, $key, $index, $grid) {
    if ($model->status == 0) {
        return ['class' => 'danger'];
    }
    //            else
    //                return ['class' => 'success'];
}, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'email_to', 'value' => function ($model) {
    return str_replace(",", ", ", $model->email_to);
}, 'contentOptions' => array('width' => '10%'), 'headerOptions' => array("style" => "width:50%;")], 'email_from:text', 'email_subject:text', ['attribute' => 'status', 'filter' => [0 => 'Error', 1 => 'Sent'], 'value' => function ($model) {
    return $model->status == 0 ? "Error" : "Sent";
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}{update}{delete}', 'contentOptions' => array('width' => '100', 'class' => 'btn-action'), 'buttons' => ['view' => function ($url, $model) {
    $url = \yii\helpers\Url::to(['manage/email-view', 'id' => $model->id], true);
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url);
}, 'delete' => function ($url, $model) {
    $url = \yii\helpers\Url::to(['manage/delete-email', 'id' => $model->id], true);
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Create'), 'data' => ['confirm' => 'Are you sure you want to delete this email "' . $model->email_subject . '"?', 'method' => 'post']]);
}, 'update' => function ($url, $model) {
    $url = \yii\helpers\Url::to(['manage/update-email', 'id' => $model->id], true);
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update')]);
}]]]]);
?>

        <?php 
$grid->end();
?>
        <div class="row" style="margin-top: 20px;">
Пример #4
0
use yii\data\ActiveDataProvider;
use yii\web\View;
use yii\bootstrap\Html;
use yii\helpers\Url;
use nanodesu88\yii2\attributes\models\AttributeRuleRecord;
/**
 * @var View                $this
 * @var ActiveDataProvider  $dp
 * @var AttributeRuleRecord $rule
 */
\yii\easyii\modules\catalog\assets\AttributesAttributeAsset::register($this);
?>

<?php 
echo Html::a(Yii::t('easyii', 'Add'), Url::toRoute(['attributes/add', 'id' => $rule->id]));
?>

<?php 
\yii\widgets\Pjax::begin(['id' => 'attributes']);
?>

<?php 
\yii\grid\GridView::begin(['dataProvider' => $dp, 'columns' => ['title', ['class' => \nanodesu88\yii2\sort\grid\SortColumn::class, 'contentOptions' => ['class' => 'sort'], 'inputOptions' => ['class' => 'form-control']], ['class' => \yii\easyii\components\grid\ActionColumn::class, 'template' => '{update}{delete}']]]);
?>

<?php 
\yii\grid\GridView::end();
?>

<?php 
\yii\widgets\Pjax::end();
Пример #5
0
    <div class="profile-box editing">

        <h1><?php 
echo Html::encode($this->title);
?>
</h1>

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


        <?php 
$widget = GridView::begin(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table editing_table'], 'summary' => '', 'columns' => [['header' => 'Название статьи', 'attribute' => 'title'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="fa fa-pencil-square-o fa-2x"></span>', $url);
}, 'delete' => function ($url, $model) {
    return Html::a('<span class="fa fa-trash-o fa-2x"></span>', $url, ['data-confirm' => "Are you sure you want to delete this item?", 'data-method' => 'POST']);
}]]]]);
?>

        <?php 
echo $widget->renderItems();
?>


        <div class="pagination default">
            <?php 
echo $widget->renderPager();
?>
        </div>
        <p>
Пример #6
0
<?php 
$grid = GridView::begin(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pager' => ['options' => ['class' => 'pagination', 'style' => 'margin:0px;']], 'layout' => "{summary}\n{items}", 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => '<span style="padding: 0 70px;">Name</span>', 'encodeLabel' => false, 'attribute' => 'first_name', 'value' => function ($model) {
    return $model->first_name . " " . $model->last_name;
}], ['attribute' => 'code', 'label' => '<span style="padding: 0px 30px;">Code</span>', 'encodeLabel' => false], ['attribute' => 'referrer', 'label' => '<span style="padding: 0px 30px;">Referrer</span>', 'encodeLabel' => false], ['attribute' => 'mobile', 'label' => '<span style="padding:0px 50px;">mobile</span>', 'encodeLabel' => false, 'contentOptions' => array('class' => 'col-mobile')], ['attribute' => 'state', 'label' => '<span style="padding:0 80px;">State</span>', 'encodeLabel' => false, 'filter' => \frontend\controllers\Common::$states, 'value' => function ($model) {
    if (array_key_exists($model->state, \frontend\controllers\Common::$states)) {
        return \frontend\controllers\Common::$states[$model->state];
    } else {
        return $model->state;
    }
}], ['attribute' => 'zip', 'label' => '<span style="padding: 0px 40px;">Zip</span>', 'encodeLabel' => false], ['attribute' => 'city', 'label' => '<span style="padding:0px 50px;">City</span>', 'encodeLabel' => false, 'contentOptions' => array('class' => 'col-city')], 'email', ['attribute' => 'graduate_high_school', 'label' => 'Graduate', 'value' => 'graduate_high_school'], ['attribute' => 'sex', 'label' => '<span style="padding: 40px;">Sex</span>', 'encodeLabel' => false, 'format' => 'raw', 'filter' => array('1' => 'Male', '0' => 'Female'), 'contentOptions' => ['style' => 'text-align:center'], 'value' => function ($model) {
    return $model->sex == 1 ? '<i class="fa fa-male fa-2x"></i>' : '<i class="fa fa-female fa-2x"></i>';
}], ['attribute' => 'status', 'label' => '<span style="padding: 0px 30px;">Status</span>', 'encodeLabel' => false, 'filter' => $status, 'value' => function ($model) {
    $str = "";
    switch ($model->status) {
        case 0:
            $str = "Deleted";
            break;
        case 5:
            $str = "Inactive";
            break;
        case 10:
            $str = "Active";
            break;
        case -10:
            $str = "Lock";
            break;
    }
    return $str;
}], ['attribute' => 'created_at', 'format' => 'date', 'label' => 'Created']]]);
//echo $grid->renderItems();
?>