Example #1
0
 public function actionSearchSeeker()
 {
     if (Yii::$app->user->isGuest) {
         return $this->redirect(['/job/account/login', 'role' => 'seeker']);
     }
     Yii::$app->view->title = Yii::t($this->module->id, 'Search Seekers');
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     $searchModel = new UserJobSeekerResume();
     $searchModel->setScenario('search');
     $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), 20);
     return $this->render('search-seeker', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Example #2
0
 /**
  * Updates an existing UserJob model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $_id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $modelUser = User::findOne($id);
     $modelUserJob = UserJob::findOne($id);
     if (!isset($modelUser, $modelUserJob)) {
         throw new NotFoundHttpException("The user was not found.");
     }
     if ($modelUser->load(Yii::$app->request->post()) && $modelUserJob->load(Yii::$app->request->post())) {
         $modelUserValidate = $modelUser->validate();
         $modelUserJobValidate = $modelUserJob->validate();
         if ($modelUserValidate && $modelUserJobValidate) {
             $modelUserJob->email = $modelUser->email;
             if ($modelUser->save(false) && $modelUserJob->save(false)) {
                 if ($modelUserJob->role == 'seeker') {
                     UserJobSeekerResume::updateAll(['nationality' => $modelUserJob->seeker_nationality, 'salary' => $modelUserJob->seeker_salary], ['_id' => $modelUserJob->_id]);
                 }
                 if (Yii::$app->request->post('save_type') !== 'apply') {
                     return $this->redirect(['view', 'id' => (string) $modelUser->_id]);
                 }
             }
         }
     }
     Yii::$app->view->title = Yii::t('yii', 'Update');
     Yii::$app->view->params['breadcrumbs'][] = ['label' => Yii::t($this->module->id, 'Manage Members'), 'url' => ['index']];
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     return $this->render('form', ['modelUser' => $modelUser, 'modelUserJob' => $modelUserJob]);
 }
Example #3
0
 public function actionInformation()
 {
     $model = UserJobSeekerResume::findOne(Yii::$app->user->id);
     if ($model == null) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     Yii::$app->view->title = Yii::t($this->module->id, 'Information');
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     return $this->render('information', ['model' => $model]);
 }
Example #4
0
 public static function getFavouriteCandidate($agentId = null)
 {
     //get candidate ids favourites by current agent
     $favourites = UserFavourite::findAll(['object_type' => 'seeker', 'created_by' => $agentId]);
     $ids = array();
     if ($favourites) {
         foreach ($favourites as $favourite) {
             $ids[] = $favourite->object_id;
         }
     }
     //search candidate by ids
     $dataProvider = null;
     if ($ids) {
         $model = new UserJobSeekerResume();
         $model->_ids = $ids;
         $model->search_mode = 'AND';
         $dataProvider = $model->search(Yii::$app->request->getQueryParams(), 20);
     }
     return $dataProvider;
 }
Example #5
0
 public function getUserSeekerResume()
 {
     return $this->hasOne(UserJobSeekerResume::className(), ['_id' => '_id']);
 }
Example #6
0
 public static function getCandidatesOptions()
 {
     return ArrayHelper::map(UserJobSeekerResume::find()->where([])->asArray()->all(), '_id', 'candidate_id');
 }