/** * @return $this */ public function getEditUrl() { $url = parent::getEditUrl(); if ($this->grid) { $columnsData = $this->grid->getColumnsKeyLabels(); $url->setSystemParam('columns', $columnsData); $url->setSystemParam('selectedColumns', array_keys($this->grid->columns)); } return $url; }
<button type="submit" class="btn btn-danger btn-xs" onclick="sx.ComponentSettings.Remove.removeUsers(); return false;"> <i class="glyphicon glyphicon-remove"></i> <?php echo \Yii::t('app', 'Reset settings for all users'); ?> </button> <?php } else { ?> <small><?php echo \Yii::t('app', 'Neither user does not have personal settings for this component'); ?> </small> <?php } ?> </div> <?php $search = new \skeeks\cms\models\Search(\skeeks\cms\models\User::className()); $search->search(\Yii::$app->request->get()); $search->getDataProvider()->query->andWhere(['active' => \skeeks\cms\components\Cms::BOOL_Y]); ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewHasSettings::widget(['dataProvider' => $search->getDataProvider(), 'filterModel' => $search->getLoadedModel(), 'columns' => [['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\User $model, $key, $index, $this) { return \yii\helpers\Html::a('<i class="glyphicon glyphicon-cog"></i>', \skeeks\cms\helpers\UrlHelper::constructCurrent()->setRoute('cms/admin-component-settings/user')->set('user_id', $model->id)->toString(), ['class' => 'btn btn-default btn-xs', 'title' => \Yii::t('app', 'Customize')]); }, 'format' => 'raw'], 'username', 'name', ['class' => \skeeks\cms\grid\ComponentSettingsColumn::className(), 'component' => $component]]]); ?> <?php echo $this->render('_footer');
<?php /** * index * * @author Semenov Alexander <*****@*****.**> * @link http://skeeks.com/ * @copyright 2010-2014 SkeekS (Sx) * @date 30.10.2014 * @since 1.0.0 */ /* @var $this yii\web\View */ /* @var $searchModel common\models\searchs\Game */ /* @var $dataProvider yii\data\ActiveDataProvider */ ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewHasSettings::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => \skeeks\cms\modules\admin\grid\ActionColumn::className(), 'controller' => $controller], 'groupname', 'description', ['class' => \skeeks\cms\grid\CreatedAtColumn::className()], ['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], ['class' => \skeeks\cms\grid\CreatedByColumn::className()], ['class' => \skeeks\cms\grid\UpdatedByColumn::className()]]]);
<?php use yii\helpers\Html; use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel common\models\searchs\Game */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = \Yii::t('skeeks/cms', "User List"); $this->params['breadcrumbs'][] = $this->title; ?> <section id="contentBox"> <div id="main" class="eh"> <div class="game-index sx-list"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php /*echo $this->render('_search', ['model' => $searchModel]); */ ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewHasSettings::widget(['showHeader' => false, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => \yii\grid\DataColumn::className(), 'value' => function ($model, $key, $index, $widget) { //return "<img src='" . $model->() . "' style='width: 100px;' />"; }, 'attribute' => 'image', 'format' => 'html'], ['class' => \yii\grid\DataColumn::className(), 'value' => function ($model, $key, $index, $widget) { return Html::a($model->getDisplayName(), $model->getPageUrl()); }, 'attribute' => 'name', 'format' => 'html']]]); ?> </div> </div> </section>
}, 500) } JS )]]); ?> <p></p> <? $dataProvider->pagination->defaultPageSize = 10; ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewHasSettings::widget(['dataProvider' => $dataProvider, 'filterModel' => $search->getLoadedModel(), 'pjaxOptions' => ['id' => 'sx-storage-files'], 'columns' => [['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\StorageFile $model) { return \yii\helpers\Html::a('<i class="glyphicon glyphicon-circle-arrow-left"></i> ' . \Yii::t('skeeks/cms', 'Choose file'), $model->src, ['class' => 'btn btn-primary', 'onclick' => 'sx.SelectFile.submit("' . $model->src . '"); return false;', 'data-pjax' => 0]); }, 'format' => 'raw'], ['class' => \skeeks\cms\modules\admin\grid\ActionColumn::className(), 'controller' => \Yii::$app->createController('cms/admin-storage-files')[0], 'isOpenNewWindow' => true], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\StorageFile $model) { if ($model->isImage()) { $smallImage = \Yii::$app->imaging->getImagingUrl($model->src, new \skeeks\cms\components\imaging\filters\Thumbnail()); return "<a href='" . $model->src . "' data-pjax='0' class='sx-fancybox' title='" . \Yii::t('skeeks/cms', 'Increase') . "'>\n <img src='" . $smallImage . "' />\n </a>"; } return \yii\helpers\Html::tag('span', $model->extension, ['class' => 'label label-primary', 'style' => 'font-size: 18px;']); }, 'format' => 'raw'], 'name', ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\StorageFile $model) { $model->cluster_id; $cluster = \Yii::$app->storage->getCluster($model->cluster_id); return $cluster->name; }, 'filter' => \yii\helpers\ArrayHelper::map(\Yii::$app->storage->getClusters(), 'id', 'name'), 'format' => 'html', 'attribute' => 'cluster_id'], ['attribute' => 'mime_type', 'filter' => \yii\helpers\ArrayHelper::map(\skeeks\cms\models\StorageFile::find()->groupBy(['mime_type'])->all(), 'mime_type', 'mime_type')], ['attribute' => 'extension', 'filter' => \yii\helpers\ArrayHelper::map(\skeeks\cms\models\StorageFile::find()->groupBy(['extension'])->all(), 'extension', 'extension')], ['class' => \skeeks\cms\grid\FileSizeColumnData::className(), 'attribute' => 'size'], ['class' => \skeeks\cms\grid\CreatedAtColumn::className()], ['class' => \skeeks\cms\grid\CreatedByColumn::className()]]]); ?> <?php echo $form->fieldSetEnd(); ?> <hr /> <?php
/** * @return string */ public function renderAfterTable() { $id = $this->id; GridViewStandartAsset::register($this->view); $checkbox = Html::checkbox('sx-select-full-all', false, ['class' => 'sx-select-full-all']); $multiActions = $this->adminController->getMultiActions(); if (!$multiActions) { return parent::renderAfterTable(); } $options = ['id' => $this->id, 'enabledPjax' => $this->enabledPjax, 'pjaxId' => $this->pjax->id, 'requestPkParamName' => $this->adminController->requestPkParamName]; $optionsString = Json::encode($options); $gridJsObject = $this->getGridJsObject(); $this->view->registerJs(<<<JS {$gridJsObject} = new sx.classes.grid.Standart({$optionsString}); JS ); $buttons = ""; $additional = []; foreach ($multiActions as $action) { $additional[] = $action->registerForGrid($this); $buttons .= <<<HTML <button class="btn btn-default btn-sm sx-grid-multi-btn" data-id="{$action->id}"> <i class="{$action->icon}"></i> {$action->name} </button> HTML; } $additional = implode("", $additional); $this->afterTableLeft = <<<HTML {$checkbox} для всех <span class="sx-grid-multi-controlls"> {$buttons} </span> <span style="display: none;">{$additional}</span> HTML; $this->view->registerCss(<<<CSS .sx-grid-multi-controlls { margin-left: 20px; } CSS ); return parent::renderAfterTable(); }
* @link http://skeeks.com/ * @copyright 2010 SkeekS (СкикС) * @date 15.06.2015 */ /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewHasSettings::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'adminController' => $controller, 'isOpenNewWindow' => $isOpenNewWindow ? true : false, 'columns' => [['attribute' => 'status', 'class' => \yii\grid\DataColumn::className(), 'filter' => \skeeks\cms\comments2\models\Comments2Message::$statuses, 'format' => 'raw', 'value' => function (\skeeks\cms\comments2\models\Comments2Message $model) { if ($model->status == \skeeks\cms\comments2\models\Comments2Message::STATUS_NEW) { $class = "default"; } else { if ($model->status == \skeeks\cms\comments2\models\Comments2Message::STATUS_PROCESSED) { $class = "warning"; } else { if ($model->status == \skeeks\cms\comments2\models\Comments2Message::STATUS_CANCELED) { $class = "danger"; } else { if ($model->status == \skeeks\cms\comments2\models\Comments2Message::STATUS_ALLOWED) { $class = "success"; } } } } return '<span class="label label-' . $class . '">' . \yii\helpers\ArrayHelper::getValue(\skeeks\cms\comments2\models\Comments2Message::$statuses, $model->status) . '</span>'; }], ['class' => \skeeks\cms\grid\CreatedAtColumn::className(), 'label' => 'Добавлен'], ['class' => \skeeks\cms\grid\CreatedByColumn::className()], ['attribute' => 'site_code', 'class' => \yii\grid\DataColumn::className(), 'filter' => \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsSite::find()->all(), 'code', 'name'), 'value' => function (\skeeks\cms\comments2\models\Comments2Message $model) { return $model->site->name; }], ['attribute' => 'element_id', 'relation' => 'element', 'class' => \skeeks\cms\grid\CmsContentElementColumn::className()], ['filter' => \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsContent::find()->all(), 'id', 'name'), 'attribute' => 'content_id', 'class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\comments2\models\Comments2Message $model) { return $model->element->cmsContent->name; }]]]);