/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = EavAttributeType::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => Yii::$app->request->cookies->getValue('_grid_page_size', 20)], 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'store_type' => $this->store_type]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEavType()
 {
     return $this->hasOne(EavAttributeType::className(), ['id' => 'type_id']);
 }
示例#3
0
                </div>

                <div class="col-sm-6 text-right">
                    <?php 
echo GridPageSize::widget(['pjaxId' => 'eav-attribute-type-grid-pjax']);
?>
                </div>
            </div>

            <?php 
Pjax::begin(['id' => 'eav-attribute-type-grid-pjax']);
?>

            <?php 
echo GridView::widget(['id' => 'eav-attribute-type-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'bulkActionOptions' => ['gridId' => 'eav-attribute-type-grid', 'actions' => [Url::to(['bulk-delete']) => Yii::t('yee', 'Delete')]], 'columns' => [['class' => 'yeesoft\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['attribute' => 'id', 'options' => ['style' => 'width:20px']], ['class' => 'yeesoft\\grid\\columns\\TitleActionColumn', 'attribute' => 'name', 'controller' => '/eav/attribute-type', 'buttonsTemplate' => '{update} {delete}', 'title' => function (EavAttributeType $model) {
    return Html::a($model->name, ['update', 'id' => $model->id], ['data-pjax' => 0]);
}], ['attribute' => 'store_type', 'value' => function (EavAttributeType $model) {
    $types = EavAttributeType::getStoreTypes();
    return isset($types[$model->store_type]) ? $types[$model->store_type] : Yii::t('yii', '(not set)');
}, 'filter' => ArrayHelper::merge(['' => Yii::t('yee', 'Not Selected')], EavAttributeType::getStoreTypes())]]]);
?>

            <?php 
Pjax::end();
?>
        </div>
    </div>
</div>


示例#4
0
                                <label class="control-label"
                                       style="float: left; padding-right: 5px;"><?php 
    echo $model->attributeLabels()['id'];
    ?>
                                    : </label>
                                <span><?php 
    echo $model->id;
    ?>
</span>
                            </div>
                        <?php 
}
?>

                        <?php 
echo $form->field($model, 'store_type')->dropDownList(EavAttributeType::getStoreTypes(), ['prompt' => '']);
?>

                        <div class="form-group">
                            <?php 
if ($model->isNewRecord) {
    ?>
                                <?php 
    echo Html::submitButton(Yii::t('yee', 'Create'), ['class' => 'btn btn-primary']);
    ?>
                                <?php 
    echo Html::a(Yii::t('yee', 'Cancel'), ['/eav/attribute-type/index'], ['class' => 'btn btn-default']);
    ?>
                            <?php 
} else {
    ?>
示例#5
0
?>
                </div>

                <div class="col-sm-6 text-right">
                    <?php 
echo GridPageSize::widget(['pjaxId' => 'eav-attribute-grid-pjax']);
?>
                </div>
            </div>

            <?php 
Pjax::begin(['id' => 'eav-attribute-grid-pjax']);
?>

            <?php 
echo GridView::widget(['id' => 'eav-attribute-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'bulkActionOptions' => ['gridId' => 'eav-attribute-grid', 'actions' => [Url::to(['bulk-delete']) => Yii::t('yee', 'Delete')]], 'columns' => [['class' => 'yeesoft\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['attribute' => 'id', 'options' => ['style' => 'width:20px']], ['class' => 'yeesoft\\grid\\columns\\TitleActionColumn', 'attribute' => 'label', 'controller' => '/eav/attribute', 'buttonsTemplate' => '{update} {delete}', 'title' => function (EavAttribute $model) {
    return Html::a($model->label, ['update', 'id' => $model->id], ['data-pjax' => 0]);
}], 'name', ['attribute' => 'type_id', 'value' => function (EavAttribute $model) {
    return $model->eavType->name;
}, 'filter' => ArrayHelper::merge(['' => Yii::t('yee', 'Not Selected')], EavAttributeType::getAttributeTypes()), 'options' => []], 'description', ['class' => 'yeesoft\\grid\\columns\\StatusColumn', 'attribute' => 'required', 'options' => ['style' => 'width:60px']]]]);
?>

            <?php 
Pjax::end();
?>
        </div>
    </div>
</div>