/**
  * @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']]]);
 }
Beispiel #2
0
/**
 * Меню контента
 * @return array
 */
function shopProductsMenu()
{
    $result = [];
    try {
        $table = \skeeks\cms\models\CmsContent::getTableSchema();
        $table = \skeeks\cms\shop\models\ShopContent::getTableSchema();
    } catch (\Exception $e) {
        return $result;
    }
    if ($contents = \skeeks\cms\models\CmsContent::find()->orderBy("priority ASC")->andWhere(['id' => \yii\helpers\ArrayHelper::map(\skeeks\cms\shop\models\ShopContent::find()->all(), 'content_id', 'content_id')])->all()) {
        /**
         * @var $content \skeeks\cms\models\CmsContent
         */
        foreach ($contents as $content) {
            $itemData = ['label' => $content->name, "img" => ['\\skeeks\\cms\\modules\\admin\\assets\\AdminAsset', 'images/icons/icon.article.png'], 'url' => ["shop/admin-cms-content-element/index", "content_id" => $content->id]];
            $result[] = new \skeeks\cms\modules\admin\helpers\AdminMenuItemCmsConent($itemData);
        }
    }
    return $result;
}
Beispiel #3
0
echo $form->fieldSet(\Yii::t('app', 'Filtering'));
?>
        <?php 
echo $form->fieldSelect($model, 'active', \Yii::$app->cms->booleanFormat(), ['allowDeselect' => true]);
?>

        <?php 
echo $form->fieldSelect($model, 'enabledActiveTime', \Yii::$app->cms->booleanFormat())->hint(\Yii::t('app', "Will be considered time of beginning and end of the publication"));
?>

        <?php 
echo $form->fieldSelectMulti($model, 'createdBy', \yii\helpers\ArrayHelper::map(\skeeks\cms\models\User::find()->active()->all(), 'id', 'name'));
?>

        <?php 
echo $form->fieldSelectMulti($model, 'content_ids', \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsContent::find()->active()->all(), 'id', 'name'));
?>

        <?php 
echo $form->fieldRadioListBoolean($model, 'enabledCurrentTree', \Yii::$app->cms->booleanFormat());
?>
        <?php 
echo $form->fieldRadioListBoolean($model, 'enabledCurrentTreeChild', \Yii::$app->cms->booleanFormat());
?>
        <?php 
echo $form->fieldRadioListBoolean($model, 'enabledCurrentTreeChildAll', \Yii::$app->cms->booleanFormat());
?>

        <?php 
echo $form->field($model, 'tree_ids')->widget(\skeeks\cms\widgets\formInputs\selectTree\SelectTree::className(), ['mode' => \skeeks\cms\widgets\formInputs\selectTree\SelectTree::MOD_MULTI, 'attributeMulti' => 'tree_ids']);
?>
Beispiel #4
0
    sx.SelectCmsElement = new sx.classes.SelectCmsElement();

})(sx, sx.\$, sx._);
JS
);
?>

<?php 
$content_id = \Yii::$app->request->get('content_id');
?>

<?php 
if (!\Yii::$app->request->get('content_id')) {
    ?>
    <?php 
    if ($content = \skeeks\cms\models\CmsContent::find()->orderBy("priority ASC")->one()) {
        ?>
        <?php 
        $content_id = $content->id;
        ?>
    <?php 
    }
}
?>

<?php 
if ($content_id) {
    ?>

    <?php 
    $dataProvider = new \yii\data\ActiveDataProvider(['query' => \skeeks\cms\models\CmsContentElement::find()]);
Beispiel #5
0
?>
    <?php 
echo $form->field($model, 'filtrable')->radioList(\Yii::$app->cms->booleanFormat());
?>
    <?/*= $form->field($model, 'with_description')->radioList(\Yii::$app->cms->booleanFormat()) */?>

<? if ($content_id = \Yii::$app->request->get('content_id')) : ?>

    <?php 
echo $form->field($model, 'content_id')->hiddenInput(['value' => $content_id])->label(false);
?>

<? else: ?>

    <?php 
echo $form->field($model, 'content_id')->label(\Yii::t('skeeks/cms', 'Content'))->widget(\skeeks\cms\widgets\formInputs\EditedSelect::className(), ['items' => \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsContent::find()->all(), "id", "name"), 'controllerRoute' => 'cms/admin-cms-content']);
?>

<? endif; ?>

<?php 
echo $form->fieldSetEnd();
?>

<?php 
echo $form->buttonsStandart($model);
?>

<?php 
ActiveForm::end();
?>
    sx.SelectCmsElement = new sx.classes.SelectCmsElement();

})(sx, sx.$, sx._);
JS
);
?>

<?

$contentIds = \yii\helpers\ArrayHelper::map(\Yii::$app->shop->shopContents, 'id', 'id');
$content_id = \Yii::$app->request->get('content_id');

?>

<? if (!\Yii::$app->request->get('content_id')) : ?>
    <? if ($content = \skeeks\cms\models\CmsContent::find()->where(['id' => $contentIds])->orderBy("priority ASC")->one()) : ?>
        <? $content_id = $content->id; ?>
    <? endif; ?>
<? endif; ?>

<? if ($content_id) : ?>

    <?

    $dataProvider = new \yii\data\ActiveDataProvider([
        'query' => \skeeks\cms\models\CmsContentElement::find()
    ]);



    $search         = new \skeeks\cms\models\Search(\skeeks\cms\models\CmsContentElement::className());
Beispiel #7
0
    <?php 
echo $form->field($model, 'tree_menu_ids')->label(\Yii::t('app', 'Marks'))->widget(\skeeks\cms\widgets\formInputs\EditedSelect::className(), ['items' => \yii\helpers\ArrayHelper::map(\skeeks\cms\models\TreeMenu::find()->all(), "id", "name"), 'multiple' => true, 'controllerRoute' => 'cms/admin-tree-menu'])->hint(\Yii::t('app', 'You can link the current section to a few marks, and according to this, section will be displayed in different menus for example.'));
?>

<?php 
echo $form->fieldSetEnd();
?>


<?php 
$columnsFile = \Yii::getAlias('@skeeks/cms/views/admin-cms-content-element/_columns.php');
/**
 * @var $content \skeeks\cms\models\CmsContent
 */
if ($contents = \skeeks\cms\models\CmsContent::find()->active()->all()) {
    ?>
    <?php 
    foreach ($contents as $content) {
        ?>
        <?php 
        echo $form->fieldSet($content->name);
        ?>


            <?php 
        echo \skeeks\cms\modules\admin\widgets\RelatedModelsGrid::widget(['label' => $content->name, 'hint' => \Yii::t('app', "Showing all elements of type '{name}' associated with this section. Taken into account only the main binding.", ['name' => $content->name]), 'parentModel' => $model, 'relation' => ['tree_id' => 'id', 'content_id' => $content->id], 'sort' => ['defaultOrder' => ['priority' => 'published_at']], 'controllerRoute' => 'cms/admin-cms-content-element', 'gridViewOptions' => ['columns' => (array) (include $columnsFile)]]);
        ?>

        <?php 
        echo $form->fieldSetEnd();
Beispiel #8
0
 /**
  * @return $this
  */
 public function getShopContents()
 {
     $query = \skeeks\cms\models\CmsContent::find()->orderBy("priority ASC")->andWhere(['id' => \yii\helpers\ArrayHelper::map(\skeeks\cms\shop\models\ShopContent::find()->all(), 'content_id', 'content_id')]);
     $query->multiple = true;
     return $query->all();
 }
 * @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;
}]]]);