示例#1
0
 /**
 * Creates data provider instance with search query applied
 *
 * @param array $params
 *
 * @return ActiveDataProvider
 */
 public function search($params)
 {
     $query = Table::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'slug_name', $this->slug_name]);
     return $dataProvider;
 }
示例#2
0
    echo $index + 1;
    ?>
</span>
                            <button type="button" class="pull-right remove-item btn btn-danger btn-xs"><i
                                    class="fa fa-minus"></i></button>
                            <div class="clearfix"></div>
                        </div>
                        <div class="panel-body">
                            <?php 
    // necessary for update action.
    if (!$modelField->isNewRecord) {
        echo Html::activeHiddenInput($modelField, "[{$index}]id");
    }
    /* var $form ActiveForm; */
    $basicItems = \febfeb\dynamicfield\modules\components\PhysicalTableGenerator::getType();
    $dbItems = \yii\helpers\ArrayHelper::map(\febfeb\dynamicfield\modules\models\Table::find()->where("id != '{$modelTable->id}'")->all(), "slug_name", "name");
    $items = array_merge($basicItems, $dbItems);
    ?>

                            <div class="row">
                                <div class="col-sm-6">
                                    <?php 
    echo $form->field($modelField, "[{$index}]name")->textInput(['maxlength' => true]);
    ?>
                                </div>
                                <div class="col-sm-6">
                                    <?php 
    echo $form->field($modelField, "[{$index}]type")->dropDownList($items);
    ?>
                                </div>
                            </div>