<?php /** * @author Semenov Alexander <*****@*****.**> * @link http://skeeks.com/ * @copyright 2010 SkeekS (СкикС) * @date 18.06.2015 */ return [['class' => \yii\grid\DataColumn::className(), 'value' => function ($model) { return \yii\helpers\Html::a('<i class="glyphicon glyphicon-circle-arrow-left"></i> ' . \Yii::t('app', 'Choose'), $model->id, ['class' => 'btn btn-primary', 'onclick' => 'sx.SelectCmsElement.submit(' . \yii\helpers\Json::encode(array_merge($model->toArray(), ['url' => $model->url])) . '); return false;', 'data-pjax' => 0]); }, 'format' => 'raw'], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { return $model->cmsContent->name; }, 'format' => 'raw', 'attribute' => 'content_id', 'filter' => \skeeks\cms\models\CmsContent::getDataForSelect()], ['class' => \skeeks\cms\grid\ImageColumn2::className()], 'name', ['class' => \skeeks\cms\grid\CreatedAtColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { if (!$model->cmsTree) { return null; } $path = []; if ($model->cmsTree->parents) { foreach ($model->cmsTree->parents as $parent) { if ($parent->isRoot()) { $path[] = "[" . $parent->site->name . "] " . $parent->name; } else { $path[] = $parent->name; } } } $path = implode(" / ", $path); return "<small><a href='{$model->cmsTree->url}' target='_blank' data-pjax='0'>{$path} / {$model->cmsTree->name}</a></small>"; }, 'format' => 'raw', 'filter' => \skeeks\cms\helpers\TreeOptions::getAllMultiOptions(), 'attribute' => 'tree_id'], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { $result = []; if ($model->cmsContentElementTrees) {
<?php /** * @author Semenov Alexander <*****@*****.**> * @link http://skeeks.com/ * @copyright 2010 SkeekS (СкикС) * @date 02.06.2015 */ /* @var $this yii\web\View */ /* @var $searchModel \skeeks\cms\models\Search */ /* @var $dataProvider yii\data\ActiveDataProvider */ /* @var $model \skeeks\cms\models\CmsContentElement */ $dataProvider->setSort(['defaultOrder' => ['priority' => SORT_ASC]]); ?> <? $pjax = \yii\widgets\Pjax::begin(); ?> <?php echo $this->render('_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'autoColumns' => false, 'pjax' => $pjax, 'adminController' => $controller, 'columns' => [['class' => \skeeks\cms\grid\ImageColumn2::className()], 'name', 'code', ['class' => \skeeks\cms\grid\BooleanColumn::className(), 'attribute' => "active"], ['class' => \skeeks\cms\grid\BooleanColumn::className(), 'attribute' => "def"], 'priority']]); ?> <? \yii\widgets\Pjax::end(); ?>
/** * @inheritdoc */ public function actions() { return ArrayHelper::merge(parent::actions(), ['index' => ["gridConfig" => ['settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"]], "columns" => [['class' => \skeeks\cms\grid\ImageColumn2::className()], 'name', 'code', ['class' => \skeeks\cms\grid\BooleanColumn::className(), 'attribute' => "active"], ['class' => \skeeks\cms\grid\BooleanColumn::className(), 'attribute' => "def"], 'priority']], "def-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => "По умолчанию", "eachCallback" => [$this, 'eachMultiDef'], "priority" => 0], "activate-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => "Активировать", "eachCallback" => [$this, 'eachMultiActivate']], "inActivate-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => "Деактивировать", "eachCallback" => [$this, 'eachMultiInActivate']]]); }
<?php /** * @author Semenov Alexander <*****@*****.**> * @link http://skeeks.com/ * @copyright 2010 SkeekS (СкикС) * @date 18.06.2015 */ return [['class' => \skeeks\cms\grid\ImageColumn2::className()], 'name', ['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { if (!$model->cmsTree) { return null; } $path = []; if ($model->cmsTree->parents) { foreach ($model->cmsTree->parents as $parent) { if ($parent->isRoot()) { $path[] = "[" . $parent->site->name . "] " . $parent->name; } else { $path[] = $parent->name; } } } $path = implode(" / ", $path); return "<small><a href='{$model->cmsTree->url}' target='_blank' data-pjax='0'>{$path} / {$model->cmsTree->name}</a></small>"; }, 'format' => 'raw', 'filter' => \skeeks\cms\helpers\TreeOptions::getAllMultiOptions(), 'attribute' => 'tree_id'], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { $result = []; if ($model->cmsContentElementTrees) { foreach ($model->cmsContentElementTrees as $contentElementTree) { $site = $contentElementTree->tree->root->site; $result[] = "<small><a href='{$contentElementTree->tree->url}' target='_blank' data-pjax='0'>[{$site->name}]/.../{$contentElementTree->tree->name}</a></small>"; }
<?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\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'adminController' => $controller, 'columns' => [['class' => \skeeks\cms\grid\ImageColumn2::className(), 'attribute' => 'image_id', 'relationName' => 'image'], 'username', 'name', ['class' => \skeeks\cms\grid\CreatedAtColumn::className()], ['class' => \skeeks\cms\grid\DateTimeColumnData::className(), 'attribute' => 'logged_at'], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\User $model) { $result = []; if ($roles = \Yii::$app->authManager->getRolesByUser($model->id)) { foreach ($roles as $role) { $result[] = $role->description . " ({$role->name})"; } } return implode(', ', $result); }, 'format' => 'html', 'label' => \Yii::t('app', 'Roles')], ['class' => \skeeks\cms\grid\BooleanColumn::className(), 'attribute' => "active"]]]);
<?php /** * @author Semenov Alexander <*****@*****.**> * @link http://skeeks.com/ * @copyright 2010 SkeekS (СкикС) * @date 18.06.2015 */ return [['class' => \skeeks\cms\grid\ImageColumn2::className()], 'name', ['class' => \skeeks\cms\grid\CreatedAtColumn::className()], ['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], ['class' => \skeeks\cms\grid\PublishedAtColumn::className()], ['class' => \skeeks\cms\grid\DateTimeColumnData::className(), 'attribute' => "published_to"], ['class' => \skeeks\cms\grid\CreatedByColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { if (!$model->cmsTree) { return null; } $path = []; if ($model->cmsTree->parents) { foreach ($model->cmsTree->parents as $parent) { if ($parent->isRoot()) { $path[] = "[" . $parent->site->name . "] " . $parent->name; } else { $path[] = $parent->name; } } } $path = implode(" / ", $path); return "<small><a href='{$model->cmsTree->url}' target='_blank' data-pjax='0'>{$path} / {$model->cmsTree->name}</a></small>"; }, 'format' => 'raw', 'filter' => \skeeks\cms\helpers\TreeOptions::getAllMultiOptions(), 'attribute' => 'tree_id'], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { $result = []; if ($model->cmsContentElementTrees) { foreach ($model->cmsContentElementTrees as $contentElementTree) { $site = $contentElementTree->tree->root->site; $result[] = "<small><a href='{$contentElementTree->tree->url}' target='_blank' data-pjax='0'>[{$site->name}]/.../{$contentElementTree->tree->name}</a></small>"; }
/** * @param CmsContent $cmsContent * @return array */ public static function getDefaultColumns($cmsContent = null) { $columns = [['class' => \skeeks\cms\grid\ImageColumn2::className()], 'name', ['class' => \skeeks\cms\grid\CreatedAtColumn::className()], ['class' => \skeeks\cms\grid\UpdatedAtColumn::className(), 'visible' => false], ['class' => \skeeks\cms\grid\PublishedAtColumn::className(), 'visible' => false], ['class' => \skeeks\cms\grid\DateTimeColumnData::className(), 'attribute' => "published_to", 'visible' => false], ['class' => \skeeks\cms\grid\CreatedByColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { if (!$model->cmsTree) { return null; } $path = []; if ($model->cmsTree->parents) { foreach ($model->cmsTree->parents as $parent) { if ($parent->isRoot()) { $path[] = "[" . $parent->site->name . "] " . $parent->name; } else { $path[] = $parent->name; } } } $path = implode(" / ", $path); return "<small><a href='{$model->cmsTree->url}' target='_blank' data-pjax='0'>{$path} / {$model->cmsTree->name}</a></small>"; }, 'format' => 'raw', 'filter' => \skeeks\cms\helpers\TreeOptions::getAllMultiOptions(), 'attribute' => 'tree_id'], 'additionalSections' => ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { $result = []; if ($model->cmsContentElementTrees) { foreach ($model->cmsContentElementTrees as $contentElementTree) { $site = $contentElementTree->tree->root->site; $result[] = "<small><a href='{$contentElementTree->tree->url}' target='_blank' data-pjax='0'>[{$site->name}]/.../{$contentElementTree->tree->name}</a></small>"; } } return implode('<br />', $result); }, 'format' => 'raw', 'label' => \Yii::t('skeeks/cms', 'Additional sections'), 'visible' => false], ['attribute' => 'active', 'class' => \skeeks\cms\grid\BooleanColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'label' => "Смотреть", 'value' => function (\skeeks\cms\models\CmsContentElement $model) { return \yii\helpers\Html::a('<i class="glyphicon glyphicon-arrow-right"></i>', $model->absoluteUrl, ['target' => '_blank', 'title' => \Yii::t('skeeks/cms', 'Watch to site (opens new window)'), 'data-pjax' => '0', 'class' => 'btn btn-default btn-sm']); }, 'format' => 'raw']]; return $columns; }
$searchRelatedPropertiesModel->load(\Yii::$app->request->get()); if ($dataProvider) { $searchRelatedPropertiesModel->search($dataProvider, $user->tableName()); } if ($user->relatedPropertiesModel) { $autoColumns = \skeeks\cms\modules\admin\widgets\GridViewStandart::getColumnsByRelatedPropertiesModel($user->relatedPropertiesModel, $searchRelatedPropertiesModel); } ?> <?php echo $this->render('_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'adminController' => $controller, 'pjax' => $pjax, 'columns' => \yii\helpers\ArrayHelper::merge([['class' => \skeeks\cms\grid\ImageColumn2::className(), 'attribute' => 'image_id', 'relationName' => 'image'], 'username', 'name', 'email', ['class' => \skeeks\cms\grid\BooleanColumn::className(), 'attribute' => "email_is_approved", 'trueValue' => 1, 'falseValue' => 0], 'phone', ['class' => \skeeks\cms\grid\BooleanColumn::className(), 'attribute' => "phone_is_approved", 'trueValue' => 1, 'falseValue' => 0], ['class' => \skeeks\cms\grid\CreatedAtColumn::className()], ['class' => \skeeks\cms\grid\DateTimeColumnData::className(), 'attribute' => 'logged_at'], ['class' => \yii\grid\DataColumn::className(), 'filter' => \yii\helpers\Html::activeListBox($searchModel, 'role', \yii\helpers\ArrayHelper::merge(['' => ' - '], \yii\helpers\ArrayHelper::map(\Yii::$app->authManager->getRoles(), 'name', 'description')), ['size' => 1, 'class' => 'form-control']), 'value' => function (\skeeks\cms\models\User $model) { $result = []; if ($roles = \Yii::$app->authManager->getRolesByUser($model->id)) { foreach ($roles as $role) { $result[] = $role->description . " ({$role->name})"; } } return implode(', ', $result); }, 'format' => 'html', 'label' => \Yii::t('skeeks/cms', 'Roles')], ['class' => \skeeks\cms\grid\BooleanColumn::className(), 'attribute' => "active"], ['class' => \yii\grid\DataColumn::className(), 'label' => "Смотреть", 'value' => function (\skeeks\cms\models\CmsUser $model) { return \yii\helpers\Html::a('<i class="glyphicon glyphicon-arrow-right"></i>', $model->getProfileUrl(), ['target' => '_blank', 'title' => \Yii::t('skeeks/cms', 'Watch to site (opens new window)'), 'data-pjax' => '0', 'class' => 'btn btn-default btn-sm']); }, 'format' => 'raw'], ['class' => \skeeks\cms\grid\DateTimeColumnData::className(), 'attribute' => 'last_activity_at', 'visible' => false]], $autoColumns)]); ?> <? $pjax::end(); ?>
/** * @param CmsContent $cmsContent * @return array */ public static function getDefaultColumns($cmsContent = null) { $columns = [['class' => \skeeks\cms\grid\ImageColumn2::className()], 'name', ['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { if (!$model->cmsTree) { return null; } $path = []; if ($model->cmsTree->parents) { foreach ($model->cmsTree->parents as $parent) { if ($parent->isRoot()) { $path[] = "[" . $parent->site->name . "] " . $parent->name; } else { $path[] = $parent->name; } } } $path = implode(" / ", $path); return "<small><a href='{$model->cmsTree->url}' target='_blank' data-pjax='0'>{$path} / {$model->cmsTree->name}</a></small>"; }, 'format' => 'raw', 'filter' => \skeeks\cms\helpers\TreeOptions::getAllMultiOptions(), 'attribute' => 'tree_id'], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { $result = []; if ($model->cmsContentElementTrees) { foreach ($model->cmsContentElementTrees as $contentElementTree) { $site = $contentElementTree->tree->root->site; $result[] = "<small><a href='{$contentElementTree->tree->url}' target='_blank' data-pjax='0'>[{$site->name}]/.../{$contentElementTree->tree->name}</a></small>"; } } return implode('<br />', $result); }, 'format' => 'raw', 'label' => \Yii::t('skeeks/shop/app', 'Advanced Topics')], ['attribute' => 'active', 'class' => \skeeks\cms\grid\BooleanColumn::className()], ['label' => \Yii::t('skeeks/shop/app', 'Base price'), 'class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { $shopProduct = \skeeks\cms\shop\models\ShopProduct::getInstanceByContentElement($model); if ($shopProduct && $shopProduct->baseProductPrice) { return \Yii::$app->money->intlFormatter()->format($shopProduct->baseProductPrice->money); } return null; }], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\CmsContentElement $model) { return \yii\helpers\Html::a('<i class="glyphicon glyphicon-arrow-right"></i>', $model->absoluteUrl, ['target' => '_blank', 'title' => \Yii::t('skeeks/shop/app', 'View online (opens new window)'), 'data-pjax' => '0', 'class' => 'btn btn-default btn-sm']); }, 'format' => 'raw']]; $typeColumn = ['class' => \yii\grid\DataColumn::className(), 'label' => 'Тип товара', 'value' => function (\skeeks\cms\shop\models\ShopCmsContentElement $shopCmsContentElement) { if ($shopCmsContentElement->shopProduct) { return \yii\helpers\ArrayHelper::getValue(\skeeks\cms\shop\models\ShopProduct::possibleProductTypes(), $shopCmsContentElement->shopProduct->product_type); } }]; if ($cmsContent) { /** * @var $shopContent \skeeks\cms\shop\models\ShopContent */ $shopContent = \skeeks\cms\shop\models\ShopContent::findOne(['content_id' => $cmsContent->id]); if ($shopContent) { if ($shopContent->childrenContent) { $columns = \yii\helpers\ArrayHelper::merge([$typeColumn], $columns); } } } return $columns; }
$search = new \skeeks\cms\models\Search(\skeeks\cms\models\CmsUser::className()); $dataProvider = $search->getDataProvider(); $dataProvider->sort->defaultOrder = [ 'created_at' => SORT_DESC ]; $dataProvider = $search->search(\Yii::$app->request->queryParams); $searchModel = $search->loadedModel; ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'adminController' => @$controller, 'enabledCheckbox' => false, 'columns' => [['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\User $model) { return \yii\helpers\Html::a('<i class="glyphicon glyphicon-circle-arrow-left"></i> ' . \Yii::t('skeeks/cms', 'Choose'), '#', ['class' => 'btn btn-primary sx-row-action', 'onclick' => 'sx.SelectCmsElement.submit(' . \yii\helpers\Json::encode($model->toArray([], ['displayName'])) . '); return false;', 'data-pjax' => 0]); }, 'format' => 'raw'], ['class' => \skeeks\cms\grid\ImageColumn2::className(), 'attribute' => 'image_id', 'relationName' => 'image'], 'username', 'name', 'email', 'phone', ['class' => \skeeks\cms\grid\CreatedAtColumn::className()], ['class' => \skeeks\cms\grid\DateTimeColumnData::className(), 'attribute' => 'logged_at'], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\User $model) { $result = []; if ($roles = \Yii::$app->authManager->getRolesByUser($model->id)) { foreach ($roles as $role) { $result[] = $role->description . " ({$role->name})"; } } return implode(', ', $result); }, 'format' => 'html', 'label' => \Yii::t('skeeks/cms', 'Roles')], ['class' => \skeeks\cms\grid\BooleanColumn::className(), 'attribute' => "active"]]]); ?>