/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Applicants::find();
     $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(['applicant_id' => $this->applicant_id, 'add1_house_num' => $this->add1_house_num, 'add2_house_num' => $this->add2_house_num, 'cell_no' => $this->cell_no, 'date_of_birth' => $this->date_of_birth, 'age' => $this->age, 'height' => $this->height, 'weight' => $this->weight, 'region_of_hs_graduating_from' => $this->region_of_hs_graduating_from, 'section' => $this->section, 'school_tellno' => $this->school_tellno, 'college_to_apply1' => $this->college_to_apply1, 'college_to_apply2' => $this->college_to_apply2, 'father_cellnum' => $this->father_cellnum, 'father_birthdate' => $this->father_birthdate, 'mother_cellnum' => $this->mother_cellnum, 'mother_birthdate' => $this->mother_birthdate, 'household_income_per_yr' => $this->household_income_per_yr]);
     $query->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'middle_name', $this->middle_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'add1_st_add', $this->add1_st_add])->andFilterWhere(['like', 'add1_bry_add', $this->add1_bry_add])->andFilterWhere(['like', 'add1_city_add', $this->add1_city_add])->andFilterWhere(['like', 'add2_st_add', $this->add2_st_add])->andFilterWhere(['like', 'add2_bry_add', $this->add2_bry_add])->andFilterWhere(['like', 'add2_city_add', $this->add2_city_add])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'sex', $this->sex])->andFilterWhere(['like', 'place_of_birth', $this->place_of_birth])->andFilterWhere(['like', 'nationality', $this->nationality])->andFilterWhere(['like', 'religion', $this->religion])->andFilterWhere(['like', 'type_of_hs_graduating_from', $this->type_of_hs_graduating_from])->andFilterWhere(['like', 'hs_graduating_from', $this->hs_graduating_from])->andFilterWhere(['like', 'complete_school_add', $this->complete_school_add])->andFilterWhere(['like', 'name_of_principal', $this->name_of_principal])->andFilterWhere(['like', 'organization', $this->organization])->andFilterWhere(['like', 'position_held', $this->position_held])->andFilterWhere(['like', 'course_plan_to_take1', $this->course_plan_to_take1])->andFilterWhere(['like', 'course_plan_to_take2', $this->course_plan_to_take2])->andFilterWhere(['like', 'fathername', $this->fathername])->andFilterWhere(['like', 'father_occu', $this->father_occu])->andFilterWhere(['like', 'father_company_Add', $this->father_company_Add])->andFilterWhere(['like', 'mothername', $this->mothername])->andFilterWhere(['like', 'mother_occu', $this->mother_occu])->andFilterWhere(['like', 'mother_company_Add', $this->mother_company_Add])->andFilterWhere(['like', 'sibling', $this->sibling])->andFilterWhere(['like', 'sibling_age', $this->sibling_age])->andFilterWhere(['like', 'sibling_school', $this->sibling_school])->andFilterWhere(['like', 'sibling_grd_yr', $this->sibling_grd_yr])->andFilterWhere(['like', 'employed', $this->employed])->andFilterWhere(['like', 'married', $this->married])->andFilterWhere(['like', 'form138', $this->form138])->andFilterWhere(['like', 'certificate', $this->certificate])->andFilterWhere(['like', 'taxreturn', $this->taxreturn]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getApplicants()
 {
     return $this->hasMany(Applicants::className(), ['region_of_hs_graduating_from' => 'area_id']);
 }
Example #3
0
 public function userReg($mobile, $devisetoken, $access_token)
 {
     $params = Yii::$app->request->getBodyParams();
     $acc_type = $params['type'];
     if ($acc_type == 0) {
         //求职人员
         $model = new Applicants();
         $model->applicant_nickname = $mobile;
         if ($model->validate() && $model->save()) {
             if ($this->saveAccount($model)) {
                 return $model;
             } else {
                 $model->delete();
             }
         }
     } else {
         if ($acc_type == 1) {
             //商家
             $model = new Business();
             $model->business_name = $mobile;
             $model->business_contactor_mobile = $mobile;
             $model->province_id = $params['province_id'];
             $model->province_name = $params['province_name'];
             $model->city_id = $params['city_id'];
             $model->city_name = $params['city_name'];
             $model->district_id = $params['district_id'];
             $model->district_name = $params['district_name'];
             $model->district_detail = $params['district_detail'];
             if ($model->validate() && $model->save()) {
                 if ($this->saveAccount($model)) {
                     return $model;
                 } else {
                     $model->delete();
                 }
             } else {
                 return Message::say(Message::E_ERROR, null, "字段错误");
             }
         }
     }
     return null;
 }
 /** public function actionDelete($id)
     {
         $this->findModel($id)->delete();
 
         return $this->redirect(['index']);
     }
 
     /**
      * Finds the Applicants model based on its primary key value.
      * If the model is not found, a 404 HTTP exception will be thrown.
      * @param integer $id
      * @return Applicants the loaded model
      * @throws NotFoundHttpException if the model cannot be found
      */
 protected function findModel($id)
 {
     if (($model = Applicants::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getApplicants0()
 {
     return $this->hasMany(Applicants::className(), ['college_to_apply2' => 'school_id']);
 }