Inheritance: extends Core, use trait skeeks\cms\traits\ValidateRulesTrait
Exemplo n.º 1
0
 /**
  * Разрешены ли привелегии
  * @return bool
  */
 public function isPermissionCan()
 {
     if (is_array($this->url)) {
         $controller = null;
         try {
             /**
              * @var $controller \yii\web\Controller
              */
             list($controller, $route) = \Yii::$app->createController($this->url[0]);
         } catch (\Exception $e) {
         }
         if (!$controller) {
             return true;
         }
         if ($content_id = ArrayHelper::getValue($this->url, 'content_id')) {
             $controller->content = CmsContent::findOne($content_id);
         }
         if ($permission = \Yii::$app->authManager->getPermission($controller->permissionName)) {
             if (\Yii::$app->user->can($permission->name)) {
                 return $this->_accessCallback();
             } else {
                 return false;
             }
         } else {
             return $this->_accessCallback();
         }
     }
     return $this->_accessCallback();
 }
Exemplo n.º 2
0
 public function init()
 {
     $this->name = "Управление контентом";
     $this->modelShowAttribute = "name";
     $this->modelClassName = CmsContent::className();
     parent::init();
 }
 /**
  * @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']]]);
 }
 public function beforeAction($action)
 {
     if ($content_id = \Yii::$app->request->get('content_id')) {
         $this->content = CmsContent::findOne($content_id);
     }
     if ($this->content) {
         if ($this->content->name_meny) {
             $this->name = $this->content->name_meny;
         }
     }
     return parent::beforeAction($action);
 }
Exemplo n.º 5
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;
}
Exemplo n.º 6
0
 * @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;
}]]]);
Exemplo n.º 7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCmsContents()
 {
     return $this->hasMany(CmsContent::className(), ['content_type' => 'code'])->orderBy("priority ASC")->andWhere(['active' => Cms::BOOL_Y]);
 }
 /**
  * @return CmsContent|static
  */
 public function getContent()
 {
     if ($this->_content !== null) {
         return $this->_content;
     }
     if ($content_id = \Yii::$app->request->get('content_id')) {
         $this->_content = CmsContent::findOne($content_id);
     }
     return $this->_content;
 }
Exemplo n.º 9
0
    <?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(); ?>

Exemplo n.º 10
0
 /**
  * @return CmsContent
  */
 public function getCmsContent()
 {
     return CmsContent::findOne($this->content_id);
 }
Exemplo n.º 11
0
 /**
  * @param array $product
  * @return array|null|ShopCmsContentElement|\yii\db\ActiveRecord
  * @throws \skeeks\cms\relatedProperties\models\InvalidParamException
  */
 protected function _getCmsContentElementProduct($product = [])
 {
     $cmsContent = ShopCmsContentElement::find()->joinWith('relatedElementProperties map')->joinWith('relatedElementProperties.property property')->andWhere(['property.code' => \Yii::$app->v3toysSettings->v3toysIdPropertyName])->andWhere(['map.value' => ArrayHelper::getValue($product, 'external_id')])->joinWith('cmsContent as ccontent')->andWhere(['ccontent.code' => 'product'])->one();
     if (!$cmsContent) {
         $content = CmsContent::findOne(['code' => 'product']);
         //Иначе создадим
         $cmsContent = new ShopCmsContentElement();
         //$cmsContent->tree_id = ImportStockSaleV2::ROOT_TREE_ID; //Каталог
         $cmsContent->content_id = CmsContent::findOne(['code' => 'product'])->id;
         //Тип контента
         $cmsContent->name = ArrayHelper::getValue($product, 'name');
         if ($cmsContent->save()) {
             $cmsContent->relatedPropertiesModel->setAttribute(\Yii::$app->v3toysSettings->v3toysIdPropertyName, ArrayHelper::getValue($product, 'external_id'));
             $cmsContent->relatedPropertiesModel->save(false);
         } else {
             throw new Exception("Not created product: " . serialize($cmsContent->getFirstErrors()));
         }
         $this->stdout("\tCreated element {$cmsContent->id}\n");
         return $cmsContent;
     }
     $this->stdout("\tExist element {$cmsContent->id}\n");
     return $cmsContent;
 }
Exemplo n.º 12
0
 /**
  * version > 2.4.8
  * @return \yii\db\ActiveQuery
  */
 public function getChildrenContents()
 {
     return $this->hasMany(CmsContent::className(), ['parent_content_id' => 'id']);
 }
Exemplo n.º 13
0
 /**
  * @return CmsContent
  */
 public function getStoreContent()
 {
     if (!($contentId = (int) $this->storeCmsContentId)) {
         return null;
     }
     return CmsContent::findOne($contentId);
 }
Exemplo n.º 14
0
    if ($tree_id = \Yii::$app->request->get("tree_id")) {
        $model->tree_id = $tree_id;
    }
    if ($parent_content_element_id = \Yii::$app->request->get("parent_content_element_id")) {
        $model->parent_content_element_id = $parent_content_element_id;
    }
}
?>

<?php 
$form = ActiveForm::begin();
?>

<? if ($model->isNewRecord) : ?>
    <? if ($content_id = \Yii::$app->request->get("content_id")) : ?>
        <? $contentModel = \skeeks\cms\models\CmsContent::findOne($content_id); ?>
        <? $model->content_id = $content_id; ?>
        <?php 
echo $form->field($model, 'content_id')->hiddenInput(['value' => $content_id])->label(false);
?>
    <? endif; ?>
<? else : ?>
    <? $contentModel = $model->cmsContent; ?>
<? endif; ?>

<? if ($contentModel && $contentModel->parentContent) : ?>
    <?php 
echo Html::activeHiddenInput($contentModel, 'parent_content_is_required');
?>
<? endif; ?>
Exemplo n.º 15
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();
?>
Exemplo n.º 16
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()]);
Exemplo n.º 17
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();
Exemplo n.º 18
0
 */
/* @var $this yii\web\View */
/* @var $contentType \skeeks\cms\models\CmsContentType */
/* @var $model \skeeks\cms\shop\cmsWidgets\filters\ShopProductFiltersWidget */
echo $form->fieldSet(\Yii::t('skeeks/cms', 'Showing'));
?>
    <?php 
echo $form->field($model, 'viewFile')->textInput();
echo $form->fieldSetEnd();
?>

<?php 
echo $form->fieldSet(\Yii::t('skeeks/cms', 'Data source'));
?>
    <?php 
echo $form->fieldSelect($model, 'content_id', \skeeks\cms\models\CmsContent::getDataForSelect());
?>

    <?/*= $form->fieldSelectMulti($model, 'searchModelAttributes', [
        'image' => \Yii::t('skeeks/cms', 'Filter by photo'),
        'hasQuantity' => \Yii::t('skeeks/cms', 'Filter by availability')
    ]); */?>

    <?/*= $form->field($model, 'searchModelAttributes')->dropDownList([
        'image' => \Yii::t('skeeks/cms', 'Filter by photo'),
        'hasQuantity' => \Yii::t('skeeks/cms', 'Filter by availability')
    ], [
'multiple' => true,
'size' => 4
]); */?>
Exemplo n.º 19
0
    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());
Exemplo n.º 20
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']);
?>
Exemplo n.º 21
0
            <?php 
echo $form->fieldSelect($model, 'parent_content_id', \skeeks\cms\models\CmsContent::getDataForSelect(true, function (\yii\db\ActiveQuery $activeQuery) use($model) {
    if (!$model->isNewRecord) {
        $activeQuery->andWhere(['!=', 'id', $model->id]);
    }
}), ['allowDeselect' => true]);
?>
        </div>
        <div class="col-md-3">
            <?php 
echo $form->fieldRadioListBoolean($model, 'parent_content_is_required');
?>
        </div>
        <div class="col-md-3">
            <?php 
echo $form->fieldSelect($model, 'parent_content_on_delete', \skeeks\cms\models\CmsContent::getOnDeleteOptions());
?>
        </div>
    </div>



    <? if ($model->childrenContents) : ?>
        <p><b><?php 
echo \Yii::t('skeeks/cms', 'Children content');
?>
</b></p>
        <? foreach ($model->childrenContents as $contentChildren) : ?>
            <p><?php 
echo Html::a($contentChildren->name, \skeeks\cms\helpers\UrlHelper::construct(['/cms/admin-cms-content/update', 'pk' => $contentChildren->id])->enableAdmin()->toString());
?>
Exemplo n.º 22
0
 * @date 02.06.2015
 */
/* @var $this yii\web\View */
/* @var $searchModel \skeeks\cms\models\Search */
/* @var $dataProvider yii\data\ActiveDataProvider */
$dataProvider->setSort(['defaultOrder' => ['published_at' => SORT_DESC]]);
$sortAttr = $dataProvider->getSort()->attributes;
$dataProvider->query->joinWith('shopProduct as sp');
$dataProvider->getSort()->attributes = \yii\helpers\ArrayHelper::merge($sortAttr, ['quantity' => ['asc' => ['sp.quantity' => SORT_ASC], 'desc' => ['sp.quantity' => SORT_DESC], 'label' => \Yii::t('skeeks/shop/app', 'Available quantity'), 'default' => SORT_ASC]]);
$cmsContent = null;
if ($content_id = \Yii::$app->request->get('content_id')) {
    $dataProvider->query->andWhere(['content_id' => $content_id]);
    /**
     * @var $cmsContent \skeeks\cms\models\CmsContent
     */
    $cmsContent = \skeeks\cms\models\CmsContent::findOne($content_id);
    $searchModel->content_id = $content_id;
}
$columns = \skeeks\cms\shop\controllers\AdminCmsContentElementController::getColumns($cmsContent, $dataProvider);
$columns = \yii\helpers\ArrayHelper::merge($columns, [['label' => \Yii::t('skeeks/shop/app', 'Available quantity'), 'class' => \yii\grid\DataColumn::class, 'visible' => false, 'attribute' => 'quantity', 'value' => function (\skeeks\cms\shop\models\ShopCmsContentElement $shopCmsContentElement) {
    return $shopCmsContentElement->shopProduct ? $shopCmsContentElement->shopProduct->quantity : " - ";
}]]);
?>

<? $pjax = \yii\widgets\Pjax::begin(); ?>

    <?php 
echo $this->render('_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'content_id' => $content_id, 'cmsContent' => $cmsContent]);
?>

    <?php 
Exemplo n.º 23
0
<?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) {
Exemplo n.º 24
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCmsContent()
 {
     return $this->hasOne(CmsContent::className(), ['id' => 'content_id']);
 }
Exemplo n.º 25
0
 public function renderConfigForm(ActiveForm $form)
 {
     echo $form->fieldSet('Общие настройки');
     echo $form->field($this, 'affiliate_key');
     echo $form->field($this, 'v3toysIdPropertyName');
     echo $form->field($this, 'content_ids')->widget(Chosen::className(), ['multiple' => true, 'items' => CmsContent::getDataForSelect()]);
     echo $form->field($this, 'notify_emails')->textarea(['rows' => 3]);
     /*echo $form->field($this, 'v3toysShopPersonTypeId')->widget(Chosen::className(),[
           'items' => ArrayHelper::map(ShopPersonType::find()->all(), 'id', 'name'),
       ]);*/
     /*echo $form->field($this, 'v3toysOrderStatusSubmitted')->widget(Chosen::className(),[
           'items' => ArrayHelper::map(ShopOrderStatus::find()->all(), 'code', 'name'),
       ]);*/
     echo $form->fieldSetEnd();
     echo $form->fieldSet('Настройки доставки');
     echo $form->field($this, 'pickup_discaunt_value');
     echo $form->field($this, 'post_discaunt_value');
     echo $form->field($this, 'courier_discaunt_value');
     echo $form->fieldSetEnd();
     echo $form->fieldSet('Скидка/Наценка на товары');
     echo $form->field($this, 'price_discount_percent');
     echo $form->fieldSetEnd();
 }
Exemplo n.º 26
-1
 /**
  * @return string
  */
 public function renderConfigForm(ActiveForm $activeForm)
 {
     echo $activeForm->fieldSelect($this, 'fieldElement', \skeeks\cms\relatedProperties\propertyTypes\PropertyTypeElement::fieldElements());
     echo $activeForm->fieldSelect($this, 'content_id', \skeeks\cms\models\CmsContent::getDataForSelect());
 }