public function searchVirtual($params) { $query = InTrunkgroup::find()->where(['virtual_id' => $_GET['id']]); $dataProvider = new ActiveDataProvider(['query' => $query]); $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, 'virtual_id' => $this->virtual_id, 'first_update' => $this->first_update, 'last_update' => $this->last_update]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'desc', $this->desc])->andFilterWhere(['like', 'first_user', $this->first_user])->andFilterWhere(['like', 'first_ip', $this->first_ip])->andFilterWhere(['like', 'last_user', $this->last_user])->andFilterWhere(['like', 'last_ip', $this->last_ip]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getInTrunkgroup() { return $this->hasOne(InTrunkgroup::className(), ['id' => 'in_trunkgroup']); }
/** * Finds the InTrunkgroup model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return InTrunkgroup the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = InTrunkgroup::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
?> <?php echo $form->field($model, 'port'); ?> <?php echo $form->field($model, 'heart'); ?> <?php echo $form->field($model, 'sip'); ?> <?php echo $form->field($model, 'in_trunkgroup')->dropDownList(ArrayHelper::map(InTrunkgroup::find()->all(), 'id', 'name'), ['prompt' => 'Select In Trunk Groups']); ?> <?php echo $form->field($model, 'out_trunkgroup')->dropDownList(ArrayHelper::map(OutTrunkGroup::find()->all(), 'id', 'name'), ['prompt' => 'Select Out Trunk Groups']); ?> <div class="form-group"> <?php echo Html::submitButton('Search', ['class' => 'btn btn-primary-budi']); ?> <?php echo Html::resetButton('Reset', ['class' => 'btn btn-default']); ?> </div>