/** * @inheritdoc */ public function actions() { return ArrayHelper::merge(parent::actions(), ['index' => ["dataProviderCallback" => function (ActiveDataProvider $activeDataProvider) { $activeDataProvider->query->andWhere(['type' => ShopDiscount::TYPE_DEFAULT]); }, "gridConfig" => ['settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"]], "columns" => ['id', ['attribute' => 'name'], ['attribute' => 'value', 'class' => DataColumn::className(), 'value' => function (ShopDiscount $shopDiscount) { if ($shopDiscount->value_type == ShopDiscount::VALUE_TYPE_P) { return \Yii::$app->formatter->asPercent($shopDiscount->value / 100); } else { $money = Money::fromString((string) $shopDiscount->value, $shopDiscount->currency_code); return \Yii::$app->money->intlFormatter()->format($money); } }], ['attribute' => 'active', 'class' => BooleanColumn::className()], ['attribute' => 'active_from', 'class' => DateTimeColumnData::className()], ['attribute' => 'active_to', 'class' => DateTimeColumnData::className()], ['class' => UpdatedByColumn::className()], ['class' => UpdatedAtColumn::className()], 'priority']]]); }
/** * @inheritdoc */ public function actions() { return ArrayHelper::merge(parent::actions(), ['index' => ["dataProviderCallback" => function (ActiveDataProvider $dataProvider) { $query = $dataProvider->query; /** * @var ActiveQuery $query */ //$query->select(['app_company.*', 'count(`app_company_officer_user`.`id`) as countOfficer']); $query->groupBy(['shop_fuser.id']); $query->with('user'); $query->with('personType'); $query->with('buyer'); $query->with('shopBaskets'); $query->with('shopBaskets.product'); }, "columns" => [['class' => UpdatedAtColumn::className()], ['class' => DataColumn::className(), 'filter' => false, 'format' => raw, 'label' => \skeeks\cms\shop\Module::t('app', 'User'), 'value' => function (ShopFuser $model) { return $model->user ? (new AdminBuyerUserWidget(['user' => $model->user]))->run() : \skeeks\cms\shop\Module::t('app', 'Not authorized'); }], ['class' => DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Profile of buyer'), 'value' => function (ShopFuser $model) { if (!$model->buyer) { return null; } return Html::a($model->buyer->name . " [{$model->buyer->id}]", UrlHelper::construct('shop/admin-buyer/related-properties', ['pk' => $model->buyer->id])->enableAdmin()->toString()); }], ['class' => DataColumn::className(), 'filter' => ArrayHelper::map(ShopPersonType::find()->active()->all(), 'id', 'name'), 'attribute' => 'person_type_id', 'label' => \skeeks\cms\shop\Module::t('app', 'Profile type'), 'value' => function (ShopFuser $model) { return $model->personType->name; }], ['class' => DataColumn::className(), 'filter' => false, 'label' => \skeeks\cms\shop\Module::t('app', 'Price of basket'), 'value' => function (ShopFuser $model) { return \Yii::$app->money->intlFormatter()->format($model->money); }], ['class' => DataColumn::className(), 'filter' => false, 'label' => \skeeks\cms\shop\Module::t('app', 'Number of items'), 'value' => function (ShopFuser $model) { return $model->countShopBaskets; }], ['class' => DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Good'), 'value' => function (ShopFuser $model) { if ($model->shopBaskets) { $result = []; foreach ($model->shopBaskets as $shopBasket) { $money = \Yii::$app->money->intlFormatter()->format($shopBasket->money); $result[] = Html::a($shopBasket->name, $shopBasket->product->cmsContentElement->url, ['target' => '_blank']) . <<<HTML ({$shopBasket->quantity} {$shopBasket->measure_name}) — {$money} HTML; } return implode('<hr />', $result); } }], ['class' => DataColumn::className(), 'filter' => ArrayHelper::map(CmsSite::find()->active()->all(), 'id', 'name'), 'attribute' => 'site_id', 'format' => 'raw', 'label' => \skeeks\cms\shop\Module::t('app', 'Site'), 'value' => function (ShopFuser $model) { return $model->site->name . " [{$model->site->code}]"; }], ['class' => CreatedAtColumn::className()]]]]); }
<?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 /** * @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>"; }
/** * @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 */ $dataProvider->query->andWhere(['type' => \skeeks\cms\shop\models\ShopDiscount::TYPE_DEFAULT]); ?> <? $pjax = \skeeks\cms\modules\admin\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, 'pjax' => $pjax, 'adminController' => \Yii::$app->controller, 'settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"], 'columns' => ['id', ['attribute' => 'name'], ['attribute' => 'value', 'class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\shop\models\ShopDiscount $shopDiscount) { if ($shopDiscount->value_type == \skeeks\cms\shop\models\ShopDiscount::VALUE_TYPE_P) { return \Yii::$app->formatter->asPercent($shopDiscount->value / 100); } else { $money = \skeeks\modules\cms\money\Money::fromString((string) $shopDiscount->value, $shopDiscount->currency_code); return \Yii::$app->money->intlFormatter()->format($money); } }], ['attribute' => 'active', 'class' => \skeeks\cms\grid\BooleanColumn::className()], ['attribute' => 'active_from', 'class' => \skeeks\cms\grid\DateTimeColumnData::className()], ['attribute' => 'active_to', 'class' => \skeeks\cms\grid\DateTimeColumnData::className()], ['class' => \skeeks\cms\grid\UpdatedByColumn::className()], ['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], 'priority']]); ?> <? $pjax::end(); ?>
<?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>"; }
</div> </div> <?php echo $form->fieldSetEnd(); ?> <?php echo $form->fieldSet(\skeeks\cms\shop\Module::t('app', 'History of changes')); ?> <?php echo \skeeks\cms\modules\admin\widgets\GridView::widget(['dataProvider' => new \yii\data\ArrayDataProvider(['models' => $model->shopOrderChanges]), 'columns' => [['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'label' => \skeeks\cms\shop\Module::t('app', 'User'), 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopOrderChange $shopOrderChange) { return (new \skeeks\cms\shop\widgets\AdminBuyerUserWidget(['user' => $shopOrderChange->createdBy]))->run(); }], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'type', 'label' => \skeeks\cms\shop\Module::t('app', 'Transaction'), 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopOrderChange $shopOrderChange) { return \skeeks\cms\shop\models\ShopOrderChange::types()[$shopOrderChange->type]; }], ['class' => \yii\grid\DataColumn::className(), 'attribute' => 'type', 'label' => \skeeks\cms\shop\Module::t('app', 'Description'), 'format' => 'raw', 'value' => function (\skeeks\cms\shop\models\ShopOrderChange $shopOrderChange) { return $shopOrderChange->description; }]]]); ?> <?php echo $form->fieldSetEnd(); ?> <?php echo $form->buttonsCreateOrUpdate($model); ActiveForm::end();
/** * @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; }
$query->with('buyer'); $query->with('shopBaskets'); $query->with('shopBaskets.product'); $query->joinWith('shopBaskets as sb'); $query->andWhere(['or', ['>=', 'sb.id', 0], ['>=', 'shop_fuser.user_id', 0], ['>=', 'shop_fuser.person_type_id', 0], ['>=', 'shop_fuser.buyer_id', 0]]); $query->orderBy(['shop_fuser.updated_at' => SORT_DESC]); ?> <? $pjax = \skeeks\cms\modules\admin\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, 'pjax' => $pjax, 'adminController' => \Yii::$app->controller, 'columns' => [['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \Yii::t('skeeks/shop/app', 'User'), 'value' => function (\skeeks\cms\shop\models\ShopFuser $model) { return $model->user ? (new \skeeks\cms\shop\widgets\AdminBuyerUserWidget(['user' => $model->user]))->run() : \Yii::t('skeeks/shop/app', 'Not authorized'); }], ['class' => \yii\grid\DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \Yii::t('skeeks/shop/app', 'Profile of buyer'), 'value' => function (\skeeks\cms\shop\models\ShopFuser $model) { if (!$model->buyer) { return null; } return \yii\helpers\Html::a($model->buyer->name . " [{$model->buyer->id}]", \skeeks\cms\helpers\UrlHelper::construct('shop/admin-buyer/related-properties', ['pk' => $model->buyer->id])->enableAdmin()->toString()); }], ['class' => \yii\grid\DataColumn::className(), 'filter' => \yii\helpers\ArrayHelper::map(\skeeks\cms\shop\models\ShopPersonType::find()->active()->all(), 'id', 'name'), 'attribute' => 'person_type_id', 'label' => \Yii::t('skeeks/shop/app', 'Profile type'), 'value' => function (\skeeks\cms\shop\models\ShopFuser $model) { return $model->personType ? $model->personType->name : ""; }], ['class' => \yii\grid\DataColumn::className(), 'filter' => false, 'label' => \Yii::t('skeeks/shop/app', 'Price of basket'), 'value' => function (\skeeks\cms\shop\models\ShopFuser $model) { return \Yii::$app->money->intlFormatter()->format($model->money); }], ['class' => \yii\grid\DataColumn::className(), 'filter' => false, 'label' => \Yii::t('skeeks/shop/app', 'Number of items'), 'value' => function (\skeeks\cms\shop\models\ShopFuser $model) { return $model->countShopBaskets; }], ['class' => \yii\grid\DataColumn::className(), 'filter' => false, 'format' => 'raw', 'label' => \Yii::t('skeeks/shop/app', 'Good'), 'value' => function (\skeeks\cms\shop\models\ShopFuser $model) { if ($model->shopBaskets) { $result = [];
<?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 */ $dataProvider->query->andWhere(['type' => \skeeks\cms\shop\models\ShopDiscount::TYPE_DISCOUNT_SAVE]); ?> <? $pjax = \skeeks\cms\modules\admin\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, 'pjax' => $pjax, 'adminController' => \Yii::$app->controller, 'settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"], 'columns' => ['id', ['attribute' => 'name', 'label' => \Yii::t('skeeks/shop/app', 'Name of the program')], ['attribute' => 'active', 'class' => \skeeks\cms\grid\BooleanColumn::className()], ['class' => \skeeks\cms\grid\UpdatedByColumn::className()], ['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], 'priority']]); ?> <? $pjax::end(); ?>
/** * @inheritdoc */ public function actions() { return ArrayHelper::merge(parent::actions(), ['index' => ["dataProviderCallback" => function (ActiveDataProvider $activeDataProvider) { $activeDataProvider->query->andWhere(['type' => ShopDiscount::TYPE_DISCOUNT_SAVE]); }, "gridConfig" => ['settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"]], "columns" => ['id', ['attribute' => 'name', 'label' => \skeeks\cms\shop\Module::t('app', 'Name of the program')], ['attribute' => 'active', 'class' => BooleanColumn::className()], ['class' => UpdatedByColumn::className()], ['class' => UpdatedAtColumn::className()], 'priority']]]); }
/** * @inheritdoc */ public function actions() { return ArrayHelper::merge(parent::actions(), ['index' => ["columns" => ['name', ['class' => \skeeks\cms\grid\CreatedAtColumn::className()], ['class' => \skeeks\cms\grid\UpdatedAtColumn::className()], ['class' => \skeeks\cms\grid\CreatedByColumn::className()]]]]); }
/** * @inheritdoc */ public function actions() { return ArrayHelper::merge(parent::actions(), ['index' => ["gridConfig" => ['settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"]], "columns" => ['id', 'priority', 'name', ['attribute' => 'active', 'class' => BooleanColumn::className()], 'address', 'phone', 'description', ['class' => UpdatedAtColumn::className()], ['class' => UpdatedByColumn::className()], ['attribute' => 'site_code', 'class' => SiteColumn::className()]]]]); }
/** * @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; }