/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = MEMBERS::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['MEMBER_ID' => $this->MEMBER_ID, 'JOINED_DATE' => $this->JOINED_DATE, 'LEFT_DATE' => $this->LEFT_DATE, 'COMPANY_ID' => $this->COMPANY_ID]); $query->andFilterWhere(['like', 'FIRST_NAME', $this->FIRST_NAME])->andFilterWhere(['like', 'LAST_NAME', $this->LAST_NAME])->andFilterWhere(['like', 'PHONE_NUMBER', $this->PHONE_NUMBER])->andFilterWhere(['like', 'POSITION', $this->POSITION])->andFilterWhere(['like', 'IS_ACTIVE', $this->IS_ACTIVE])->andFilterWhere(['like', 'EMAIL_ADDRESS', $this->EMAIL_ADDRESS])->andFilterWhere(['like', 'PASSWORD', $this->PASSWORD]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getMEMBERSs() { return $this->hasMany(MEMBERS::className(), ['COMPANY_ID' => 'COMPANY_ID']); }
/** * @return \yii\db\ActiveQuery */ public function getMEMBER() { return $this->hasOne(MEMBERS::className(), ['MEMBER_ID' => 'MEMBER_ID']); }
/** * Finds the MEMBERS model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return MEMBERS the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MEMBERS::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
use yii\helpers\ArrayHelper; use frontend\models\MEETINGS; use frontend\models\MEMBERS; /* @var $this yii\web\View */ /* @var $model app\models\REFERRALGIVEN */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="referralgiven-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'MEMBER_ID')->dropDownList(ArrayHelper::map(MEMBERS::find()->all(), 'MEMBER_ID', 'FIRST_NAME'), ['prompt' => '---Choose a Member---'])->label('Member Recipient'); ?> <?php echo $form->field($model, 'GIVEN_YOUR_CARD')->dropDownList(['TRUE' => 'TRUE', 'FALSE' => 'FALSE'], ['prompt' => '']); ?> <?php echo $form->field($model, 'TOLD_THEM_YOU_WOULD_CALL')->dropDownList(['TRUE' => 'TRUE', 'FALSE' => 'FALSE'], ['prompt' => '']); ?> <?php echo $form->field($model, 'COMMENTS')->textarea(['rows' => 6]); ?> <?php