Exemple #1
0
 public function actionStudentInfo()
 {
     $user = new User();
     $model = new Student();
     $model1 = new Type();
     $region = new Region();
     $file = new UploadForm();
     //兼职的分类
     $typeInfo = $model1->getTypes();
     //获取省
     $parentOne = $region->getParentOne();
     if (Yii::$app->request->isPost) {
         $request = \YII::$app->request;
         $post = $request->post();
         $file->student_file = UploadedFile::getInstances($file, 'student_file');
         foreach ($file->student_file as $v) {
             $path = 'uploads/' . time() . rand('111', '999') . '.' . $v->extension;
             $v->saveAs($path);
             $imgUrl[] = $path;
         }
         $model->addStudent($imgUrl, $post);
     }
     $userInfo = $user->getUser(1);
     //用户信息
     return $this->render('studentinfo', ['model' => $model, 'typeInfo' => $typeInfo, 'file' => $file, 'parentOne' => $parentOne, 'userInfo' => $userInfo]);
 }
 public function actionPosition()
 {
     $model = new Partjob();
     $result['list'] = $model->find();
     $model = new Type();
     $result["type"] = $model->find();
     $model = new Jobcompany();
     $result["company"] = $model->find();
     return $this->render('/business-store/position', $result);
 }
 public function actionIndex()
 {
     /*
      *显示
      */
     //分类
     $model = new Type();
     $data['type'] = $model->find()->limit(14)->asArray()->all();
     //地区
     $address = new Region();
     $id = 52;
     $data['region'] = $address->find()->where("pid='{$id}'")->asArray()->all();
     $session = \Yii::$app->session;
     $user_id = $session->get('user_id');
     //判断用户登录显示不同信息后分页
     if (empty($user_id)) {
         $partjob = new Partjob();
         $part_list = $partjob->jobfind();
         $pagination = new Pagination(['defaultPageSize' => 2, 'totalCount' => $part_list->count()]);
         $data['job'] = $part_list->offset($pagination->offset)->asArray()->limit($pagination->limit)->all();
         $data['pagination'] = $pagination;
     } else {
         $user = new User();
         $usertype = $user->usertype($user_id);
         if ($usertype["user_type"] == '1') {
             $partjob = new Partjob();
             $part_list = $partjob->jobfind();
             $pagination = new Pagination(['defaultPageSize' => 2, 'totalCount' => $part_list->count()]);
             $data['job'] = $part_list->offset($pagination->offset)->asArray()->limit($pagination->limit)->all();
             $data['pagination'] = $pagination;
         } else {
             $partjob = new Partjob();
             $part_list = $partjob->jobselect($user_id);
             $pagination = new Pagination(['defaultPageSize' => 2, 'totalCount' => $part_list->count()]);
             $data['job'] = $part_list->offset($pagination->offset)->asArray()->limit($pagination->limit)->all();
             $data['pagination'] = $pagination;
         }
     }
     return $this->render('index', $data);
 }