Example #1
0
 public function actionList()
 {
     $errormsg = "";
     $m = new SearchMemberForm();
     $m->isexpired = "1";
     //默认显示有效会员
     $branches = BranchForm::find()->select(['subject', 'id'])->asArray()->all();
     $types = array();
     $types["-1"] = "全部会员";
     foreach ($branches as $branch) {
         $types[$branch['id']] = $branch['subject'];
     }
     $query = MemberForm::find();
     $models = $query->orderBy("id DESC");
     if ($m->load(Yii::$app->request->post())) {
         if ($m->branchid > -1) {
             $models = $models->where(['branchid' => $m->branchid]);
         }
         if (isset($m->chinese)) {
             $models = $models->where(['like', 'chinese', $m->chinese]);
         }
     }
     $pagination = new Pagination(['defaultPageSize' => 10, 'totalCount' => $models->count()]);
     $models = $models->orderby("id DESC")->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render("list", ['models' => $models, 'pagination' => $pagination, 'm' => $m, 'types' => $types, 'errormsg' => $errormsg, 'showexpired' => $m->isexpired]);
 }
Example #2
0
 public function getMembers()
 {
     return $this->hasMany(MemberForm::className(), ['branchid' => 'id']);
 }
Example #3
0
 public function getMember()
 {
     return $this->hasOne(MemberForm::className(), ['id' => 'mid']);
 }