Inheritance: extends skeeks\cms\models\Tree
Ejemplo n.º 1
0
<?php

/**
 * @author Semenov Alexander <*****@*****.**>
 * @link http://skeeks.com/
 * @copyright 2010 SkeekS (СкикС)
 * @date 14.10.2015
 */
$model = new \skeeks\cms\models\CmsContentElement();
$form = \skeeks\cms\modules\admin\widgets\ActiveForm::begin();
?>

    <?php 
echo $form->fieldSelectMulti($model, 'treeIds', \skeeks\cms\helpers\TreeOptions::getAllMultiOptions())->label(\Yii::t('app', 'Additional sections'));
?>

    <?php 
echo \yii\helpers\Html::checkbox('removeCurrent', false);
?>
 <label><?php 
echo \Yii::t('app', 'Get rid of the already linked (in this case, the selected records bind only to the selected section)');
?>
</label>
    <?php 
echo $form->buttonsStandart($model, ['save']);
?>

<?php 
\skeeks\cms\modules\admin\widgets\ActiveForm::end();
?>
Ejemplo n.º 2
0
    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('app', 'Additional sections')], ['attribute' => 'active', 'class' => \skeeks\cms\grid\BooleanColumn::className()], ['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('app', 'Watch to site (opens new window)'), 'data-pjax' => '0', 'class' => 'btn btn-default btn-sm']);
}, 'format' => 'raw']];
?>


Ejemplo n.º 3
0
?>

    <?php 
echo \skeeks\cms\modules\admin\widgets\BlockTitleWidget::widget(['content' => \Yii::t('app', 'Link to section')]);
?>

    <?php 
echo $form->fieldSelect($model, 'default_tree_id', \skeeks\cms\helpers\TreeOptions::getAllMultiOptions(), ['allowDeselect' => true]);
?>
    <?php 
echo $form->fieldRadioListBoolean($model, 'is_allow_change_tree');
?>


    <?php 
echo $form->fieldSelect($model, 'root_tree_id', \skeeks\cms\helpers\TreeOptions::getAllMultiOptions(), ['allowDeselect' => true])->hint(\Yii::t('app', 'If it is set to the root partition, the elements can be tied to him and his sub.'));
echo $form->fieldSetEnd();
?>


<?php 
if (!$model->isNewRecord) {
    ?>
    <?php 
    echo $form->fieldSet(\Yii::t('app', 'Properties'));
    ?>
        <?php 
    echo \skeeks\cms\modules\admin\widgets\RelatedModelsGrid::widget(['label' => \Yii::t('app', "Element properties"), 'hint' => \Yii::t('app', "Every content on the site has its own set of properties, its sets here"), 'parentModel' => $model, 'relation' => ['content_id' => 'id'], 'sort' => ['defaultOrder' => ['priority' => SORT_ASC]], 'controllerRoute' => 'cms/admin-cms-content-property', 'dataProviderCallback' => function ($dataProvider) {
        /**
         * @var \yii\data\BaseDataProvider $dataProvider
         */
Ejemplo n.º 4
0
?>

    <?php 
echo $form->field($searchModel, 'q')->textInput(['placeholder' => \Yii::t('skeeks/cms', 'Search name and description')])->setVisible();
?>

    <?php 
echo $form->field($searchModel, 'name')->textInput(['placeholder' => \Yii::t('skeeks/cms', 'Search by name')]);
?>

    <?php 
echo $form->field($searchModel, 'active')->listBox(\yii\helpers\ArrayHelper::merge(['' => ' - '], \Yii::$app->cms->booleanFormat()), ['size' => 1]);
?>

    <?php 
echo $form->field($searchModel, 'section')->listBox(\yii\helpers\ArrayHelper::merge(['' => ' - '], \skeeks\cms\helpers\TreeOptions::getAllMultiOptions()), ['unselect' => ' - ', 'size' => 1]);
?>


    <?php 
echo $form->field($searchModel, 'has_image')->checkbox(\Yii::$app->formatter->booleanFormat, false);
?>
    <?php 
echo $form->field($searchModel, 'has_full_image')->checkbox(\Yii::$app->formatter->booleanFormat, false);
?>


    <?php 
echo $form->field($searchModel, 'created_by')->widget(\skeeks\cms\modules\admin\widgets\formInputs\SelectModelDialogUserInput::className());
?>
    <?php 
Ejemplo n.º 5
0
<?php

/**
 * @author Semenov Alexander <*****@*****.**>
 * @link http://skeeks.com/
 * @copyright 2010 SkeekS (СкикС)
 * @date 14.10.2015
 */
$model = new \skeeks\cms\models\CmsContentElement();
$form = \skeeks\cms\modules\admin\widgets\ActiveForm::begin();
?>

    <?php 
echo $form->fieldSelect($model, 'tree_id', \skeeks\cms\helpers\TreeOptions::getAllMultiOptions());
?>
    <?php 
echo $form->buttonsStandart($model, ['save']);
?>

<?php 
\skeeks\cms\modules\admin\widgets\ActiveForm::end();
?>


<?php 
\yii\bootstrap\Alert::begin(['options' => ['class' => 'alert-warning']]);
?>
    <p><?php 
echo \Yii::t('app', 'Attention! For checked items will be given a new primary section.');
?>
</p>
 /**
  * @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;
 }
Ejemplo n.º 7
0
    <?php 
if ($contentModel->root_tree_id) {
    ?>

        <?php 
    if ($contentModel->is_allow_change_tree == \skeeks\cms\components\Cms::BOOL_Y) {
        ?>
            <?php 
        echo $form->fieldSelect($model, 'tree_id', \yii\helpers\ArrayHelper::map(\skeeks\cms\helpers\TreeOptions::findOne($contentModel->root_tree_id)->getMultiOptions(), 'id', 'name'), ['allowDeselect' => true]);
        ?>
        <?php 
    }
    ?>

        <?php 
    echo $form->fieldSelectMulti($model, 'treeIds', \yii\helpers\ArrayHelper::map(\skeeks\cms\helpers\TreeOptions::findOne($contentModel->root_tree_id)->getMultiOptions(), 'id', 'name'));
    ?>

    <?php 
} else {
    ?>
        <?php 
    $mode = \skeeks\cms\widgets\formInputs\selectTree\SelectTree::MOD_COMBO;
    if ($contentModel->is_allow_change_tree != \skeeks\cms\components\Cms::BOOL_Y) {
        $mode = \skeeks\cms\widgets\formInputs\selectTree\SelectTree::MOD_MULTI;
    }
    ?>
        <?php 
    echo $form->field($model, 'treeIds')->label(\Yii::t('app', 'Sections of the site'))->widget(\skeeks\cms\widgets\formInputs\selectTree\SelectTree::className(), ["attributeMulti" => "treeIds", "mode" => $mode])->hint(\Yii::t('app', 'Specify sections of the site, which would like to see this publication'));
    ?>
    <?php 
Ejemplo n.º 8
0
<?php 
echo $form->fieldSet(\Yii::t('skeeks/shop/app', 'Sections'));
?>


    <? if ($contentModel->root_tree_id) : ?>

        <? if ($contentModel->is_allow_change_tree == \skeeks\cms\components\Cms::BOOL_Y) : ?>
            <?php 
echo $form->fieldSelect($model, 'tree_id', \skeeks\cms\helpers\TreeOptions::getAllMultiOptions($contentModel->root_tree_id), ['allowDeselect' => true]);
?>
        <? endif; ?>

        <?php 
echo $form->fieldSelectMulti($model, 'treeIds', \skeeks\cms\helpers\TreeOptions::getAllMultiOptions($contentModel->root_tree_id));
?>

    <? else : ?>
        <?
            $mode = \skeeks\cms\widgets\formInputs\selectTree\SelectTree::MOD_COMBO;
            if ($contentModel->is_allow_change_tree != \skeeks\cms\components\Cms::BOOL_Y)
            {
                $mode = \skeeks\cms\widgets\formInputs\selectTree\SelectTree::MOD_MULTI;
            }
        ?>
        <?php 
echo $form->field($model, 'treeIds')->label(\Yii::t('skeeks/shop/app', 'Sections of the site'))->widget(\skeeks\cms\widgets\formInputs\selectTree\SelectTree::className(), ["attributeMulti" => "treeIds", "mode" => $mode])->hint(\Yii::t('skeeks/shop/app', 'Specify sections of the site, which would like to see this publication'));
?>
    <? endif; ?>
 /**
  * @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;
 }