/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Datasources::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, 'change_data' => $this->change_data]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'string', $this->string]); return $dataProvider; }
/** * Finds the Datasources model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Datasources the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Datasources::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
} ?> <?php echo $form->field($model, 'search_name')->textInput(); ?> <?php echo $form->field($model, 'description')->textInput(); ?> <?php echo $form->field($model, 'visible')->checkbox(); ?> <?php echo $form->field($model, 'datasource_id')->dropDownList(ArrayHelper::map(Datasources::find()->all(), 'id', 'name')); ?> <?php echo $form->field($model, 'sql_search')->textarea(['rows' => 3]); ?> </div> <div id="yw0_tab_2" class="tab-pane"> <?php echo Html::button('Novo', ['class' => 'btn btn-success', 'onclick' => 'AddParameters();']); ?> <div class="modal fade" id="parameters_model" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div> <script> function AddParameters() { $.ajax({
?> <?php echo $form->field($model, 'description')->textInput(); ?> <?php echo $form->field($model, 'html_template')->textInput(); ?> <?php echo $form->field($model, 'icon')->textInput(); ?> <?php $items_format = ArrayHelper::map(Datasources::find()->all(), 'id', 'name'); ?> <?php echo $form->field($model, 'datasource_id')->dropDownList($items_format); ?> <?php echo $form->field($model, 'sql_select')->textarea(['rows' => 3]); ?> </div> <div id="yw0_tab_2" class="tab-pane"> <?php echo Html::button('Novo', ['class' => 'btn btn-success', 'onclick' => 'AddParameters();']); ?>