/**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ['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;
     }]]], "status-allowed-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => \skeeks\cms\comments2\Module::t('app', 'Approve'), "eachCallback" => [$this, 'eachMultiStatusAllowed']], "status-canceled-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => \skeeks\cms\comments2\Module::t('app', 'Reject'), "eachCallback" => [$this, 'eachMultiStatusCanceled']], "status-processed-multi" => ['class' => AdminMultiModelEditAction::className(), "name" => \skeeks\cms\comments2\Module::t('app', 'In progress'), "eachCallback" => [$this, 'eachMultiStatusProcessed']]]);
 }
Exemple #2
0
<?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()]]]);
Exemple #3
0
<?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;
 }
    <?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, 'isOpenNewWindow' => @$isOpenNewWindow ? true : false, 'columns' => [['attribute' => 'status', 'class' => \yii\grid\DataColumn::className(), 'filter' => \skeeks\cms\reviews2\models\Reviews2Message::getStatuses(), 'format' => 'raw', 'value' => function (\skeeks\cms\reviews2\models\Reviews2Message $model) {
    if ($model->status == \skeeks\cms\reviews2\models\Reviews2Message::STATUS_NEW) {
        $class = "default";
    } else {
        if ($model->status == \skeeks\cms\reviews2\models\Reviews2Message::STATUS_PROCESSED) {
            $class = "warning";
        } else {
            if ($model->status == \skeeks\cms\reviews2\models\Reviews2Message::STATUS_CANCELED) {
                $class = "danger";
            } else {
                if ($model->status == \skeeks\cms\reviews2\models\Reviews2Message::STATUS_ALLOWED) {
                    $class = "success";
                }
            }
        }
    }
    return '<span class="label label-' . $class . '">' . \yii\helpers\ArrayHelper::getValue(\skeeks\cms\reviews2\models\Reviews2Message::getStatuses(), $model->status) . '</span>';
}], ['class' => \skeeks\cms\grid\CreatedAtColumn::className(), 'label' => \Yii::t('skeeks/reviews2', 'Added')], ['class' => \skeeks\cms\grid\CreatedByColumn::className()], ['class' => \skeeks\cms\grid\SiteColumn::className()], ['attribute' => 'element_id', 'relation' => 'element', 'class' => \skeeks\cms\grid\CmsContentElementColumn::className()], ['filter' => \skeeks\cms\models\CmsContent::getDataForSelect(), 'attribute' => 'content_id', 'class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\reviews2\models\Reviews2Message $model) {
    return $model->element->cmsContent->name;
}], ['filter' => \Yii::$app->reviews2->ratings, 'attribute' => 'rating', 'class' => \yii\grid\DataColumn::className()]]]);
?>

<? $pjax::end(); ?>

/**
 * @author Semenov Alexander <*****@*****.**>
 * @link http://skeeks.com/
 * @copyright 2010 SkeekS (СкикС)
 * @date 06.11.2015
 */
/* @var $this yii\web\View */
/* @var $widget \skeeks\cms\shop\widgets\admin\PropductPriceChangeAdminWidget */
?>

<a href="#sx-price-change-<?php 
echo $widget->id;
?>
" class="btn btn-default sx-fancybox"><i class="glyphicon glyphicon-eye-open"></i> История изменений</a>
<div style="display: none;">
    <div class="" id="sx-price-change-<?php 
echo $widget->id;
?>
">
        <h2>История изменения цены: "<?php 
echo $widget->productPrice->typePrice->name;
?>
"</h2>
        <hr />
        <?php 
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ArrayDataProvider(['allModels' => $widget->productPrice->shopProductPriceChanges, 'pagination' => ['pageSize' => 20]]), 'columns' => [['class' => \skeeks\cms\grid\CreatedAtColumn::className(), 'label' => 'Дата и время изменения'], ['class' => \skeeks\cms\grid\CreatedByColumn::className()], ['class' => \yii\grid\DataColumn::className(), 'label' => "Значение", 'value' => function (\skeeks\cms\shop\models\ShopProductPriceChange $model) {
    return \Yii::$app->money->intlFormatter()->format($model->money);
}]]]);
?>
    </div>
</div>
?>
" class="btn btn-default"><i class="glyphicon glyphicon-eye-open"></i>
        <?php 
echo \Yii::t('skeeks/shop/app', 'Changelog');
?>
</a>

<? $createModal = \yii\bootstrap\Modal::begin([
    'id'        => 'sx-price-change-' . $widget->id,
    'size'      => \yii\bootstrap\Modal::SIZE_LARGE,
    'header'    => '<b>' . \Yii::t('skeeks/shop/app', 'The history of the availability of product') . '</b>',
    'footer'    => '
        <button type="button" class="btn btn-default" data-dismiss="modal">' . \Yii::t('skeeks/admin', 'Close') . '</button>
    ',
]); ?>
        <?
        \skeeks\cms\widgets\Pjax::begin([
            'enablePushState' => false,
        ]);
        ?>
            <?php 
echo \yii\grid\GridView::widget(['dataProvider' => new \yii\data\ActiveDataProvider(['query' => $widget->product->getShopProductQuantityChanges(), 'pagination' => ['pageSize' => 10, 'pageParam' => 'page-' . $widget->id]]), 'columns' => [['class' => \skeeks\cms\grid\CreatedAtColumn::className(), 'label' => \Yii::t('skeeks/shop/app', 'Date and time changes')], 'quantity', 'quantity_reserved', 'measure_ratio', ['class' => \yii\grid\DataColumn::class, 'attribute' => 'measure_id', 'value' => function (\skeeks\cms\shop\models\ShopProductQuantityChange $shopProductQuantityChange) {
    return $shopProductQuantityChange->measure->name;
}], ['class' => \skeeks\cms\grid\CreatedByColumn::className()]]]);
?>

        <?
        \skeeks\cms\widgets\Pjax::end();
        ?>
    <? \yii\bootstrap\Modal::end();?>
<? endif; ?>
 /**
  * @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()]]]]);
 }
Exemple #9
0
        <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 
echo \yii\helpers\Html::a("<i class='glyphicon glyphicon-question-sign'></i>", "#", ['class' => 'btn btn-default', 'onclick' => "sx.dialog({'title' : '" . \Yii::t('skeeks/cms', 'Help') . "', 'content' : '#sx-help'}); return false;"]);
?>
<div style="display: none;" id="sx-help">
    <?\Yii::t('skeeks/cms','Help in the process of writing ...')?>
</div>
 * @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;
}]]]);