getDataForSelect() public static method

Данные для мультиселекта с группами типов
public static getDataForSelect ( boolean | false $refetch = false, $contentQueryCallback = null ) : array
$refetch boolean | false
return array
コード例 #1
0
ファイル: V3toysSettings.php プロジェクト: v3toys/skeeks
 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();
 }
コード例 #2
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) {
コード例 #3
0
ファイル: _form.php プロジェクト: skeeks-cms/cms
 */
/* @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
]); */?>
コード例 #4
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(); ?>

コード例 #5
0
ファイル: ShopComponent.php プロジェクト: skeeks-cms/cms-shop
 /**
  * @return array
  */
 public function getArrayForSelectElement()
 {
     if (!($data = CmsContent::getDataForSelect())) {
         return [];
     }
     $ids = ArrayHelper::map($this->shopContents, 'id', 'id');
     $result = [];
     foreach ($data as $typeKey => $type) {
         if ($type) {
             $contents = [];
             foreach ($type as $key => $value) {
                 if (in_array($key, $ids)) {
                     $contents[$key] = $value;
                 }
             }
             if ($contents) {
                 $result[$typeKey] = $contents;
             }
         }
     }
     return $result;
 }
コード例 #6
0
ファイル: _form.php プロジェクト: skeeks-cms/cms

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

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

    <div class="row">
        <div class="col-md-3">
            <?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>
コード例 #7
-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());
 }