Example #1
2
 /**
  * @inheritdoc
  */
 public function init()
 {
     $id = $this->grid->options['id'];
     if ($this->rowHighlight) {
         Html::addCssClass($this->headerOptions, 'kv-all-select');
         $view = $this->grid->getView();
         CheckboxColumnAsset::register($view);
         $this->_clientScript = "kvSelectRow('{$id}', '{$this->rowSelectedClass}');";
         $view->registerJs($this->_clientScript);
     }
     $this->parseFormat();
     $this->parseVisibility();
     parent::init();
     $this->setPageRows();
     $opts = Json::encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $this->grid->showHeader ? $this->getHeaderCheckBoxName() : null]);
     $this->_clientScript .= "\nkvSelectColumn('{$id}', {$opts});";
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (empty($this->itemPermissions)) {
         $this->itemPermissions = $this->getItemPermissions();
     }
     parent::init();
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     $role = \Yii::$app->request->get('role');
     if (!isset($this->children[$role])) {
         $this->children[$role] = $this->getChirlrenOfRole($role);
     }
     parent::init();
 }
 protected function renderHeaderCellContent()
 {
     $name = rtrim($this->name, '[]') . '_all';
     $id = $this->grid->options['id'];
     $options = Json::encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name]);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return Checkbox::widget(['name' => $name, 'checked' => false, 'inputOptions' => ['class' => 'select-on-check-all']]);
     }
 }
Example #5
0
 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->gridType == 'datatable-select') {
         if (!$this->multiple) {
             return Html::radio(rtrim($this->name, '[]'), false, ['value' => $key]);
         } else {
             return Html::checkBox($this->name, false, ['value' => $key]);
         }
     } else {
         return parent::renderDataCellContent($model, $key, $index);
     }
 }
 /**
  * @inheritdoc
  */
 protected function renderHeaderCellContent()
 {
     $name = rtrim($this->name, '[]') . '_all';
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return Html::tag('div', Html::checkBox($name, false, ['class' => 'select-on-check-all', 'id' => $name]) . Html::tag('label', null, ['for' => 'selection_all']), ['class' => 'checkbox']);
     }
 }
 /**
  * @param mixed $model
  * @param mixed $key
  * @param int $index
  *
  * @return string
  *
  * @throws Exception
  */
 protected function renderHeaderCellContent()
 {
     $name = rtrim($this->name, '[]') . '_all';
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return Checkbox::widget(['name' => $name, 'checked' => false, 'inputOptions' => ['class' => 'select-on-check-all'], 'clientOptions' => ['onChecked' => new JsExpression('function() {
                     var $childCheckbox = $(this).closest("#' . $this->grid->options['id'] . '").find("input[name=\'' . $this->name . '\']").closest(".checkbox");
                     $childCheckbox.checkbox("check");
                 }'), 'onUnchecked' => new JsExpression('function() {
                     var $childCheckbox = $(this).closest("#' . $this->grid->options['id'] . '").find("input[name=\'' . $this->name . '\']").closest(".checkbox");
                     $childCheckbox.checkbox("uncheck");
                 }')]]);
     }
 }
Example #8
0
 /**
  * Renders the header cell content.
  * The default implementation simply renders [[header]].
  * This method may be overridden to customize the rendering of the header cell.
  * @return string the rendering result
  */
 protected function renderHeaderCellContent()
 {
     $name = $this->name;
     if (substr_compare($name, '[]', -2, 2) === 0) {
         $name = substr($name, 0, -2);
     }
     if (substr_compare($name, ']', -1, 1) === 0) {
         $name = substr($name, 0, -1) . '_all]';
     } else {
         $name .= '_all';
     }
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return Html::checkBox($name, false, ['class' => 'select-on-check-all']);
     }
 }
Example #9
0
<div class="row">
    <div class="col-md-12">
        <div class="row">
            <div class="col-md-3">
                <?php 
echo PageSize::widget(['label' => '行/页']);
?>
            </div>
            <div class="col-md-6">
                <?php 
echo ActionBar::widget(['grid' => 'w2', 'templates' => ['{bulk-actions}' => ['class' => 'col-xs-4']], 'bulkActionsItems' => ['常规' => ['general-delete' => '删除']], 'bulkActionsOptions' => ['options' => ['general-delete' => ['url' => Url::toRoute('delete-multiple'), 'data-confirm' => '确定吗?']], 'class' => 'form-control']]);
?>
            </div>
            <div class="col-md-3">
                <a class="btn btn-info pull-right btn-block" href="<?php 
echo Url::to(['product-category/create']);
?>
"><i class="fa fa-plus"></i> <?php 
echo Yii::t('app', 'Create');
?>
</a>
            </div>
        </div>
    </div>
    <div class="col-md-12">
        <?php 
echo GridView::widget(['pager' => ['options' => ['class' => 'pagination pull-right']], 'dataProvider' => $dataProvider, 'filterSelector' => 'select[name="per-page"]', 'filterModel' => $filterModel, 'columns' => [['class' => CheckboxColumn::className()], 'id', 'name', 'level', ['label' => Yii::t('app', 'Product Category Parent'), 'attribute' => 'parent.name'], 'updated_at:datetime', ['class' => ActionColumn::className()]]]);
?>
    </div>
</div>
Example #10
0
use yii\widgets\Pjax;
$this->title = Yii::t('main', 'Messages');
$this->params['breadcrumbs'][] = $this->title;
?>




<div class="messages-index">


    <?php 
Pjax::begin();
?>
    <?php 
echo GridView::widget(['id' => 'pm_tbl', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => \yii\grid\CheckboxColumn::classname(), 'checkboxOptions' => function ($data, $key, $index, $widget) {
    return ["value" => $data->sender_id];
}, 'headerOptions' => ['width' => '10']], ['attribute' => 'username', 'format' => 'html', 'value' => function ($data) {
    $avatar = $data->profile->avatar ? $data->profile->urlAttribute('avatar') : Yii::$app->assetManager->publish('@app/public_html/upload/images/avatar/noavatar.png')[1];
    $img = Html::img($avatar, ['style' => 'width:40px; vertical-align:top']);
    return Html::a($img, ['view', 'id' => $data->sender_id]) . ' ' . Html::a($data->username, ['view', 'id' => $data->sender_id]);
}], ['attribute' => 'updated_at', 'format' => ['date', 'dd.MM.yyyy'], 'options' => array('width' => '135px'), 'filter' => \yii\jui\DatePicker::widget(['dateFormat' => 'dd.MM.yyyy', 'model' => $searchModel, 'attribute' => 'updated_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['class' => 'yii\\grid\\ActionColumn', 'headerOptions' => ['width' => '50'], 'template' => '{view}  {delete}', 'buttons' => ['view' => function ($url, $data) {
    $icon = $data->status == 0 ? '<i class="fa fa-envelope"></i>' : '<i class="fa fa-envelope-o"></i>';
    return Html::a($icon, ['view', 'id' => $data->sender_id]);
}]]]]);
?>
    <?php 
Pjax::end();
?>
<p> 
<div class="page-header">
    <div class="panel-heading-controls">
        <?php 
echo Html::a('<i class="btn-label icon fa fa-plus"></i> Добавить товар', ['/catalog/insert-product'], ['class' => 'btn btn-labeled btn-primary no-margin-t']);
?>
    </div>
</div>

<?php 
\yii\widgets\Pjax::begin();
?>
<div class="box">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'layout' => "<div class='box-body table-responsive no-padding'>{items}</div><div class='box-footer'><div class='row'><div class='col-sm-6'>{summary}</div><div class='col-sm-6 text-right'>{pager}</div></div></div>", 'tableOptions' => ['class' => 'table table-hover'], 'columns' => [['attribute' => 'id', 'options' => ['width' => '50'], 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['class' => 'text-center'], 'value' => function ($data) {
    return $data->id;
}], ['class' => CheckboxColumn::className(), 'options' => ['width' => '50'], 'headerOptions' => ['class' => 'checkbox-column text-center'], 'contentOptions' => ['class' => 'checkbox-column text-center']], ['attribute' => 'title', 'filterInputOptions' => ['class' => 'form-control input-sm'], 'format' => 'raw', 'value' => function ($data) {
    return Html::a($data->title, Url::toRoute(['/catalog/update-product', 'id' => $data->id]), ['data-pjax' => 0]);
}], ['header' => 'Категории', 'format' => 'raw', 'value' => function ($data) {
    $tmp = '';
    foreach ($data->categories as $cItem) {
        $tmp .= '<div>' . Html::a($cItem->title, Url::toRoute(['/catalog/products', 'Product[parents]' => $cItem->id])) . '</div>';
    }
    return $tmp;
}, 'filter' => Html::activeDropDownList($filterModel, 'parents', Category::getAllToList(), ['class' => 'form-control input-sm filtered', 'prompt' => '-'])], ['attribute' => 'price', 'format' => 'raw', 'value' => function ($data) {
    return Yii::$app->formatter->asCurrency($data->price, 'RUR');
}], ['attribute' => 'quantity', 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['class' => 'text-center'], 'format' => 'raw', 'value' => function ($data) {
    return Yii::$app->formatter->asInteger($data->quantity);
}], ['attribute' => 'is_active', 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['class' => 'text-center'], 'format' => 'html', 'value' => function ($data) {
    return $data->is_active ? '<span class="label label-success">Активный</span>' : '<span class="label label-danger">Не активный</span>';
}, 'filter' => Html::activeDropDownList($filterModel, 'is_active', [true => 'Активный', false => 'Не активный'], ['class' => 'form-control input-sm filtered', 'prompt' => '-'])], ['attribute' => 'created_at', 'format' => 'raw', 'options' => ['width' => '200'], 'value' => function ($data) {
    return Yii::$app->formatter->asDateTime($data->created_at, Yii::$app->formatter->dateFormat) . ' <small style="color:gray;">' . Yii::$app->formatter->asDateTime($data->created_at, Yii::$app->formatter->timeFormat) . '</small>';
Example #12
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->rowHighlight) {
         Html::addCssClass($this->headerOptions, 'kv-all-select');
         $view = $this->grid->getView();
         CheckboxColumnAsset::register($view);
         $view->registerJs('kvSelectRow("' . $this->grid->options['id'] . '", "' . $this->rowSelectedClass . '");');
     }
     $this->parseFormat();
     $this->parseVisibility();
     parent::init();
     $this->setPageRows();
 }
Example #13
0
 * @var \yii\base\View $this View
 * @var \yii\data\ActiveDataProvider $dataProvider Data provider
 * @var array $statusArray Statuses array
 */
use app\themes\admin\widgets\Box;
use app\themes\admin\widgets\GridView;
use app\modules\page\Module;
use yii\grid\ActionColumn;
use yii\grid\CheckboxColumn;
use yii\helpers\Html;
use yii\jui\DatePicker;
$this->title = Module::t('page', 'Pages');
$this->params['subtitle'] = Module::t('page', 'List');
$this->params['breadcrumbs'] = [$this->title];
$gridId = 'pages-grid';
$gridConfig = ['id' => $gridId, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'id', 'alias', ['attribute' => 'title', 'format' => 'html', 'value' => function ($model) {
    return Html::a($model['title'], ['update', 'id' => $model['id']]);
}], 'views', ['attribute' => 'status_id', 'format' => 'html', 'value' => function ($model) {
    $class = $model->status_id === $model::STATUS_PUBLISHED ? 'label-success' : 'label-danger';
    return '<span class="label ' . $class . '">' . $model->status . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status_id', $statusArray, ['class' => 'form-control', 'prompt' => Module::t('page', 'BACKEND_PROMPT_STATUS')])], ['attribute' => 'created_at', 'format' => 'date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'created_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['attribute' => 'updated_at', 'format' => 'date', 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'updated_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])]]];
$boxButtons = $actions = [];
$showActions = false;
if (Yii::$app->user->can('BCreateBlogs')) {
    $boxButtons[] = '{create}';
}
if (Yii::$app->user->can('BUpdateBlogs')) {
    $actions[] = '{update}';
    $showActions = $showActions || true;
}
if (Yii::$app->user->can('BDeleteBlogs')) {
Example #14
0
<?php

use yii\grid\CheckboxColumn;
use yii\grid\GridView;
use yii\helpers\Html;
use backend\widgets\GridViewButtonDelete;
use backend\widgets\GridViewToggleColumn;
$this->title = 'Страницы';
$this->params['header'] = $this->title;
$this->params['breadcrumbs'] = [$this->title];
$this->params['toolbar'] = [Html::a('<i class="fa fa-plus-circle"></i> Создать', ['update', 'id' => 0], ['class' => 'btn btn-success']), GridViewButtonDelete::widget()];
?>
<div class="box box-primary">
    <div class="box-body">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::className(), 'headerOptions' => ['width' => 50]], 'name', 'slug', ['class' => GridViewToggleColumn::className(), 'attribute' => 'published']]]);
?>
    </div>
</div>
Example #15
0
    protected function renderHeaderCellContent()
    {
        $this->checkboxOptions = ArrayHelper::merge(['class' => 'sx-admin-grid-checkbox'], $this->checkboxOptions);
        $id = $this->grid->options['id'];
        $jsOptions = ['gridId' => $id];
        $jsOptionsString = Json::encode($jsOptions);
        $this->grid->getView()->registerJs(<<<JS
        (function(sx, \$, _)
        {
            sx.classes.CheckboxAdmin = sx.classes.Component.extend({

                _init: function()
                {
                    console.log('aaaa');
                },

                _onDomReady: function()
                {

                    \$('.select-on-check-all').on('click', function()
                    {
                        _.delay(function()
                        {
                            \$('.sx-admin-grid-checkbox').each(function()
                            {
                                if ( \$(this).is(":checked") )
                                {
                                    \$(this).closest("tr").addClass("sx-active");
                                } else
                                {
                                    \$(this).closest("tr").removeClass("sx-active");
                                }

                            });

                        }, 100);

                    });

                    \$('.sx-admin-grid-checkbox').on('click', function()
                    {
                        if ( \$(this).is(":checked") )
                        {
                            \$(this).closest("tr").addClass("sx-active");
                        } else
                        {
                            \$(this).closest("tr").removeClass("sx-active");
                        }
                    });
                },

                _onWindowReady: function()
                {}
            });

            new sx.classes.CheckboxAdmin({$jsOptionsString});
        })(sx, sx.\$, sx._);
JS
);
        return parent::renderHeaderCellContent();
    }
Example #16
0
<?php

use yii\grid\CheckboxColumn;
use yii\grid\GridView;
use yii\helpers\Html;
use backend\widgets\GridViewButtonDelete;
use backend\widgets\GridViewButtonUpdate;
use backend\widgets\GridViewToggleColumn;
$this->title = 'Пользователи';
$this->params['header'] = $this->title;
$this->params['breadcrumbs'] = [$this->title];
$this->params['toolbar'] = [Html::a('<i class="fa fa-plus-circle"></i> Создать', ['update', 'id' => 0], ['class' => 'btn btn-success']), GridViewButtonUpdate::widget(), GridViewButtonDelete::widget()];
?>
<div class="box box-primary">
    <div class="box-body">
        <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['headerOptions' => ['width' => 50], 'class' => CheckboxColumn::className()], 'name', 'email', 'role', ['class' => GridViewToggleColumn::className(), 'attribute' => 'enabled']]]);
?>
    </div>
</div>
Example #17
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '独立页面';
?>
<div class="content-index">

    <p>
        <?php 
echo Html::a('新增', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => \yii\grid\CheckboxColumn::className()], ['header' => '标题', 'class' => yii\grid\Column::className(), 'content' => function ($model, $key, $index, $column) {
    return $model->title . '&nbsp;' . Html::a('<span class="glyphicon glyphicon-link"></span>', Yii::$app->frontendUrlManager->createUrl(['site/page', 'slug' => $model->slug]), ['target' => '_blank', 'title' => '查看']);
}], 'slug', ['attribute' => 'authorId', 'value' => function ($model) {
    return $model->author == null ? '-' : $model->author->screenName;
}], 'created:datetime', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']], 'tableOptions' => ['class' => 'table table-striped']]);
?>

</div>
Example #18
0
 /**
  * Retrieves grid columns configuration using the modelClass.
  * @param Model $model
  * @param array $fields
  * @return array grid columns
  */
 public function getIndexGridColumns($model, $fields)
 {
     /** @var ActiveController $controller */
     $controller = $this->controller;
     $actionColumn = new ActionColumn();
     $actionColumn->buttonOptions['class'] = 'operation-button';
     $extraColumns = [['class' => \yii\grid\ActionColumn::className(), 'headerOptions' => ['class' => 'column-action'], 'controller' => Yii::$app->crudModelsMap[$model::className()], 'template' => '{update} {delete} {toggle}', 'buttons' => ['view' => function ($url, $model, $key) use($controller, $actionColumn) {
         if (!$controller->hasAccess('read', $model)) {
             return null;
         }
         return $actionColumn->buttons['view']($url, $model, $key);
     }, 'update' => function ($url, $model, $key) use($controller, $actionColumn) {
         if (!$controller->hasAccess('update', $model)) {
             return null;
         }
         return $actionColumn->buttons['update']($url, $model, $key);
     }, 'delete' => function ($url, $model, $key) use($controller, $actionColumn) {
         if (!$controller->hasAccess('delete', $model)) {
             return null;
         }
         return $actionColumn->buttons['delete']($url, $model, $key);
     }, 'toggle' => function ($url, $model, $key) use($controller, $actionColumn) {
         /** @var \yii\db\ActiveRecord $model */
         if ($model->getBehavior('toggable') === null || !$controller->hasAccess('delete', $model)) {
             return null;
         }
         $enabled = $model->isEnabled();
         $icon = '<span class="glyphicon glyphicon-' . ($enabled ? 'ban' : 'reply') . '"></span>';
         $options = array_merge(['title' => $enabled ? Yii::t('app', 'Disable') : Yii::t('app', 'Enable'), 'aria-label' => $enabled ? Yii::t('app', 'Disable') : Yii::t('app', 'Enable'), 'data-pjax' => '0'], $enabled ? ['data-confirm' => Yii::t('app', 'Are you sure you want to disable this item?')] : [], $actionColumn->buttonOptions);
         return \yii\helpers\Html::a($icon, $url, $options);
     }]]];
     if ($this->useSerialColumn) {
         $extraColumns[] = ['class' => \yii\grid\SerialColumn::className(), 'headerOptions' => ['class' => 'column-serial']];
     }
     if ($this->useCheckboxColumn) {
         //$classParts = explode('\\', $this->modelClass);
         $extraColumns[] = ['class' => \yii\grid\CheckboxColumn::className(), 'headerOptions' => ['class' => 'column-checkbox'], 'multiple' => true];
     }
     return array_merge($extraColumns, static::getGridColumns($model, $fields));
 }
    <div class="box box-default">
        <div class="box-header">
            <div class="pull-right">
                <?php 
echo Html::a('<i class="glyphicon glyphicon-plus"></i>', ['create'], ['class' => 'btn btn-primary btn-sm', 'title' => Module::t('eugenekei-news', 'Create')]);
?>
                <?php 
echo Html::a('<i class="glyphicon glyphicon-trash"></i>', ['batch-delete'], ['class' => 'btn btn-danger btn-sm', 'id' => 'batch-delete', 'title' => Module::t('eugenekei-news', 'Delete selected')]);
?>
            </div>
        </div>
        <div class="box-body">

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

            <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'id' => $gridId, 'options' => ['class' => 'table-responsive'], 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'title', ['attribute' => 'status', 'value' => function ($model) {
    return $model->getStatusArray()[$model->status];
}, 'filter' => Html::activeDropDownList($searchModel, 'status', $statusArray, ['class' => 'form-control', 'prompt' => ''])], ['attribute' => 'created_at', 'format' => 'datetime', 'filter' => DateRangePicker::widget(['model' => $searchModel, 'attribute' => 'created_at', 'convertFormat' => true, 'presetDropdown' => true, 'options' => ['class' => 'form-control'], 'pluginOptions' => ['format' => 'Y-m-d H:i:s', 'dateLimit' => ['months' => 6], 'opens' => 'left']])], ['attribute' => 'user_id', 'value' => function ($model) {
    $authorModel = Yii::$app->controller->module->authorModel;
    $authorNameField = Yii::$app->controller->module->authorNameField;
    return $model->{$authorModel}->{$authorNameField};
}], ['class' => 'yii\\grid\\ActionColumn', 'buttonOptions' => ['class' => 'btn btn-default btn-xs'], 'headerOptions' => ['style' => 'width:95px;'], 'header' => Module::t('eugenekei-news', 'Actions')]]]);
?>

        </div>
    </div>
</div>
Example #20
0
 public function init()
 {
     parent::init();
 }
Example #21
0
echo Html::submitButton("", ['class' => 'btn btn-sm yellow fa fa-search ', 'title' => Yii::$app->params['lang']['button_search']]);
?>

                </div>
            </div>

        </div>
        <?php 
$form->end();
?>

<?php 
?>

        <?php 
echo \kartik\grid\GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $model, 'columns' => [['class' => SerialColumn::className()], ['class' => \kartik\grid\CheckboxColumn::className()], 'user_id', 'user_name', 'email', ['class' => CheckboxColumn::className(), 'class' => DataColumn::className(), 'attribute' => 'is_validated', 'format' => 'html', 'value' => function ($model) {
    return $this->render('list_item.php', ['model' => $model, 'action' => 'is_validated']);
}], 'user_money', 'frozen_money', 'rank_points', 'pay_points', 'reg_time', ['class' => DataColumn::className(), 'format' => 'html', 'attribute' => Yii::$app->params['lang']['handler'], 'value' => function ($model) {
    return $this->render('list_item.php', ['model' => $model, 'action' => 'handler']);
}]]]);
?>




    </div>



</div>
Example #22
0
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Записи';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="post-index">
    <p>
        <?php 
echo Html::a('Создать запись', ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    
    <?php 
Pjax::begin();
?>
    <?php 
echo himiklab\sortablegrid\SortableGridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'id' => 'post_tbl', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => CheckboxColumn::classname()], ['attribute' => 'title', 'format' => 'html', 'value' => function ($model) {
    return Html::a($model['title'], ['update', 'id' => $model['id']]);
}], ['attribute' => 'cat_id', 'content' => function ($data) {
    return $data->getCategoryName();
}, 'filter' => \yii\helpers\Arrayhelper::map(\app\modules\category\models\Category::find()->all(), 'id', 'title')], ['attribute' => 'created_at', 'format' => ['date', 'dd.MM.yyyy'], 'options' => array('width' => '225px'), 'filter' => \yii\jui\DatePicker::widget(['dateFormat' => 'dd.MM.yyyy', 'model' => $searchModel, 'attribute' => 'created_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    $class = $model->status === 1 ? '<i class="icon-ok"></i>' : '<i class="icon-lock">';
    return $class;
}, 'options' => array('width' => '100px'), 'filter' => Html::activeDropDownList($searchModel, 'status', array(1 => 'On', 0 => 'Off'), ['class' => 'form-control', 'prompt' => 'Все'])], ['attribute' => 'main', 'format' => 'html', 'value' => function ($model) {
    $res = $model->main === 1 ? '<i class="icon-ok"></i>' : '<i class="icon-minus">';
    return $res;
}, 'options' => array('width' => '100px'), 'filter' => Html::activeDropDownList($searchModel, 'main', array(1 => 'Да', 0 => 'Нет'), ['class' => 'form-control', 'prompt' => 'Все'])], 'username', ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Действия', 'headerOptions' => ['width' => '100']]]]);
?>

<p> 
  <?php 
echo Html::a('Удалить выбранные', ['massdelete'], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Вы уверены?', 'data-method' => 'post']]);
Example #23
0
use yii\grid\CheckboxColumn;
use common\widgets\dataPicker\DatePicker;
use andreosoft\image\Image;
/* @var $this yii\web\View */
/* @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>';
Example #24
0
$this->title = Yii::t('storecube', 'PAGE_PRODUCTS');
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
$gridId = 'products-grid';
$panelButtons = $actions = [];
if (Yii::$app->user->can('ACPProductsCreate')) {
    $panelButtons[] = '{create}';
}
if (Yii::$app->user->can('ACPProductsUpdate')) {
    $actions[] = '{update}';
}
if (Yii::$app->user->can('ACPProductsDelete')) {
    $panelButtons[] = '{mass-delete}';
    $actions[] = '{delete}';
}
if (Yii::$app->user->can('ACPProductsView')) {
    $actions[] = '{view}';
}
$gridActionsColumn = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions)];
$panelButtons = !empty($panelButtons) ? implode(' ', $panelButtons) : null;
?>

<?php 
Panel::begin(['title' => $this->title, 'buttonsTemplate' => $panelButtons, 'grid' => $gridId]);
?>

<?php 
echo GridView::widget(['id' => $gridId, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::classname()], 'article', 'name', 'short_desc:ntext', $gridActionsColumn], 'pager' => ['firstPageLabel' => 'First', 'lastPageLabel' => 'Last']]);
Panel::end();
Example #25
0
use yii\data\ActiveDataProvider;
use yii\grid\CheckboxColumn;
use yii\grid\GridView;
use yii\web\View;
use yii\widgets\ActiveForm;
/**
 * @var $id string
 * @var $data ActiveDataProvider
 * @var $tableCaption string
 * @var $action array|string
 * @var $actionCaption array|string
 * @var $this View
 */
echo Html::beginTag('div', ['id' => $id]);
ActiveForm::begin(['action' => $action]);
echo GridView::widget(['dataProvider' => $data, 'caption' => $tableCaption, 'layout' => '{items}', 'showHeader' => false, 'columns' => ['nazvanie', ['class' => CheckboxColumn::className(), 'name' => Html::getInputName(new DolzhnostModel(), 'ids[]')]]]);
echo Html::submitButton($actionCaption, ['class' => 'btn btn-primary']);
ActiveForm::end();
echo Html::endTag('div');
$this->registerJs(<<<JS
\$('#{$id}').find('tr').click(function (event) {
    var checkboxSelector = 'input[type="checkbox"]';

    if (\$(event.target).is(checkboxSelector))
        return;

    var \$checkbox = \$(this).find(checkboxSelector);
    \$checkbox.prop('checked', !\$checkbox.prop('checked'));
});
JS
);
Example #26
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if ($this->rowHighlight) {
         Html::addCssClass($this->headerOptions, 'kv-all-select');
         $view = $this->grid->getView();
         $id = $this->grid->options['id'];
         CheckboxColumnAsset::register($view);
         $this->_clientScript = "kvSelectRow('{$id}', '{$this->rowSelectedClass}');";
         $view->registerJs($this->_clientScript);
     }
     $this->parseFormat();
     $this->parseVisibility();
     parent::init();
     $this->setPageRows();
 }
Example #27
0
/**
 * Roles list view.
 *
 * @var \yii\base\View $this View
 * @var \yii\data\ArrayDataProvider $provider Data provider
 */
use vova07\themes\admin\widgets\Box;
use vova07\themes\admin\widgets\GridView;
use vova07\blogs\Module;
use yii\grid\ActionColumn;
use yii\grid\CheckboxColumn;
$this->title = Module::t('rbac', 'BACKEND_ROLES_INDEX_TITLE');
$this->params['subtitle'] = Module::t('rbac', 'BACKEND_ROLES_INDEX_SUBTITLE');
$this->params['breadcrumbs'] = [$this->title];
$gridId = 'roles-grid';
$gridConfig = ['id' => $gridId, 'dataProvider' => $provider, 'columns' => [['class' => CheckboxColumn::classname()], 'name', 'description', 'ruleName', 'data', 'createdAt:date', 'updatedAt:date']];
$boxButtons = $actions = [];
$showActions = false;
if (Yii::$app->user->can('BCreateRoles')) {
    $boxButtons[] = '{create}';
}
if (Yii::$app->user->can('BUpdateRoles')) {
    $actions[] = '{update}';
    $showActions = $showActions || true;
}
if (Yii::$app->user->can('BDeleteRoles')) {
    $boxButtons[] = '{batch-delete}';
    $actions[] = '{delete}';
    $showActions = $showActions || true;
}
if ($showActions === true) {
Example #28
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '管理文件';
?>
<div class="content-index">

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => \yii\grid\CheckboxColumn::className()], ['attribute' => 'title', 'format' => 'html', 'value' => function ($model) {
    return Html::a($model->title, $model->path, ['target' => '_blank']);
}], ['attribute' => 'authorId', 'value' => function ($model) {
    return $model->author == null ? '-' : $model->author->screenName;
}], ['attribute' => 'parent', 'format' => 'html', 'value' => function ($model) {
    $value = '-';
    if ($model->post != null) {
        $value = Html::a($model->post->title, ['post/update', 'id' => $model->post->cid]);
    } elseif ($model->page != null) {
        $value = Html::a($model->page->title, ['post/update', 'id' => $model->page->cid]);
    }
    return $value;
}], ['label' => '文件大小', 'value' => function ($model) {
    return Yii::$app->formatter->asShortSize($model->size);
}], 'created:datetime', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}']], 'tableOptions' => ['class' => 'table table-striped']]);
?>

</div>
<div class="row">
    <div class="col-sm-3">
        <?php 
echo $this->render('/elements/profile/_navbar', ['active' => 'subscriptions']);
?>
    </div>
    <div class="col-sm-9">
        <h4><?php 
echo Yii::t('podium/view', 'Subscriptions');
?>
</h4>
        <?php 
echo Html::beginForm();
Pjax::begin();
echo PageSizer::widget();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterSelector' => 'select#per-page', 'tableOptions' => ['class' => 'table table-striped table-hover'], 'columns' => [['class' => CheckboxColumn::className(), 'headerOptions' => ['class' => 'col-sm-1 text-center'], 'contentOptions' => ['class' => 'col-sm-1 text-center'], 'checkboxOptions' => function ($model) {
    return ['value' => $model->id];
}], ['attribute' => 'thread.name', 'label' => Yii::t('podium/view', "Thread's Name"), 'format' => 'raw', 'value' => function ($model) {
    return Html::a($model->thread->name, ['default/show', 'id' => $model->thread->latest->id], ['class' => 'center-block']);
}], ['attribute' => 'post_seen', 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['class' => 'text-center'], 'label' => Yii::t('podium/view', 'New Posts'), 'format' => 'raw', 'value' => function ($model) {
    return $model->post_seen ? '' : '<span class="glyphicon glyphicon-ok-sign"></span>';
}], ['class' => ActionColumn::className(), 'header' => Yii::t('podium/view', 'Actions'), 'contentOptions' => ['class' => 'text-right'], 'headerOptions' => ['class' => 'text-right'], 'template' => '{mark} {delete}', 'buttons' => ['mark' => function ($url, $model) {
    if ($model->post_seen) {
        return Html::a('<span class="glyphicon glyphicon-eye-close"></span> ' . Yii::t('podium/view', 'Mark unseen'), $url, ['class' => 'btn btn-warning btn-xs']);
    } else {
        return Html::a('<span class="glyphicon glyphicon-eye-open"></span> ' . Yii::t('podium/view', 'Mark seen'), $url, ['class' => 'btn btn-success btn-xs']);
    }
}, 'delete' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-trash"></span> ' . Yii::t('podium/view', 'Unsubscribe'), $url, ['class' => 'btn btn-danger btn-xs']);
}]]]]);
Pjax::end();
Example #30
-2
 protected function renderHeaderCellContent()
 {
     $name = rtrim($this->name, '[]') . '_all';
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return '<div class="input-control checkbox"><label>' . Html::checkBox($name, false, ['class' => 'select-on-check-all']) . '<span class="check"></span></label></div>';
     }
 }