Esempio n. 1
0
 public function actionRegister()
 {
     $model = new Teacher();
     $sex_info = [1 => '男', 2 => '女'];
     $gradation = ['本科生' => '本科生', '研究生' => '研究生'];
     $schools = ['暨南大学' => '暨南大学', '华南师范大学' => '华南师范大学', '中山大学' => '中山大学'];
     $campus = [];
     if ($model->load(Yii::$app->request->post())) {
         var_dump($_POST);
     }
     return $this->render('register', ['model' => $model, 'sex_info' => $sex_info, 'gradation' => $gradation, 'schools' => $schools, 'campus' => $campus]);
 }
 public function actionView($id)
 {
     // var_dump($_POST);exit();
     if ($_POST['type'] == 'recommend') {
         $teacher = Teacher::find()->where('id=:id', [':id' => $_POST['teacher_id']])->with('details')->one();
         if (!empty($teacher)) {
             $recommend = new BusinessRecommend();
             $recommend->business_id = $id;
             $recommend->teacher_id = $teacher->id;
             $recommend->contact = $teacher->details->phone;
             $recommend->recommend_time = time();
             $recommend->recommend_people = \Yii::$app->session['userid'];
             $recommend->recommend_remarks = $_POST['recommend_remarks'];
             $recommend->result = '已推荐';
             if ($recommend->save()) {
                 \Yii::$app->getSession()->setFlash('success', '推荐成功!^_^');
             }
         }
     }
     if ($_POST['type'] == 'charge') {
         $charge = new BusinessCharges();
         $charge->business_id = $id;
         $charge->charges_item = $_POST['charges_item'];
         $charge->receipt = $_POST['receipt'];
         $charge->money = $_POST['money'];
         $charge->charges_time = time();
         $charge->charges_people = $_POST['charges_people'];
         $charge->charges_remarks = $_POST['charges_remarks'];
         if ($charge->save()) {
             \Yii::$app->getSession()->setFlash('success', '提交成功!^_^');
         }
     }
     $business_info = Business::find()->where('id=:id', [':id' => $id])->with(['charges', 'applicants', 'admin'])->one();
     return $this->render('view', ['business' => $business_info]);
 }
 public function actionView($id)
 {
     $teacher_info = Teacher::find()->where('id=:id', [':id' => $id])->with('details')->one();
     $sex = $teacher_info->sex == 1 ? '男' : '女';
     $pimg = empty($teacher_info->details->head_image) ? '20130830135948.jpg' : $teacher_info->details->head_image;
     $free_time = explode(",", $teacher_info->free_time);
     $exam_score = explode(',', $teacher_info->details->exam_score);
     $ky_score_arr = explode(',', $teacher_info->details->ky_score);
     $ky_score = $teacher_info->details->ky_score == ',,,' ? '无' : '数学:' . $ky_score_arr[0] . '  英语:' . $ky_score_arr[1] . '  综合:' . $ky_score_arr[2] . '  其他:' . $ky_score_arr[3];
     $map_arr = [1 => '是', 0 => '否'];
     $map_stay = [0 => '不留校', 1 => '暑假留校', 2 => '寒假留校', 3 => '放假都在学校'];
     $map_type = [0 => '未认证', 1 => '认证教员', 2 => '明星教员', 3 => '黑名单'];
     // var_dump($teacher_info);exit();
     return $this->render('view', ['teacher' => $teacher_info, 'sex' => $sex, 'pimg' => $pimg, 'exam_score' => $exam_score, 'ky_score_arr' => $ky_score_arr, 'ky_score' => $ky_score, 'map_arr' => $map_arr, 'map_stay' => $map_stay, 'map_type' => $map_type, 'free_time' => $free_time]);
 }
Esempio n. 4
0
 public function getRecommend()
 {
     return $this->hasMany(Teacher::className(), ['id' => 'teacher_id'])->viaTable('tbl_business_recommend', ['business_id' => 'id'])->with(['recommend', 'details']);
 }
Esempio n. 5
0
 public function actionDb()
 {
     $teacher = Teacher::find()->where(['id' => 80])->with('details')->one();
     var_dump($teacher->details);
 }