Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * Finds the Table model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Table the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Table::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDfTable()
 {
     return $this->hasOne(\febfeb\dynamicfield\modules\models\Table::className(), ['id' => 'df_table_id']);
 }
Exemplo n.º 4
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>