public function actionFav($stu_job_id)
 {
     if (isset($stu_job_id)) {
         if (StudentJobTitle::model()->exists('stu_job_id=:stu_job_id', array(':stu_job_id' => $stu_job_id))) {
             $favJobTitle = new FavoriteStudentJobTitle();
             $favJobTitle->stu_job_id = $stu_job_id;
             $favJobTitle->employer_id = Yii::app()->user->id;
             try {
                 if ($favJobTitle->save()) {
                     $this->renderPartial('//common/_alerts', array('type' => 'success', 'msg' => Yii::t('app', 'msg.success.fav_resume')));
                 }
             } catch (CDbException $e) {
                 $this->renderPartial('//common/_alerts', array('type' => 'danger', 'msg' => Yii::t('app', 'msg.error.fav_resume')));
             }
         } else {
             $this->renderPartial('//common/_alerts', array('type' => 'danger', 'msg' => Yii::t('app', 'msg.error.resume_not_found')));
         }
     }
 }
 /**
  * Bulk inserts the supplied list of stu_job_ids with the empId.
  * 
  * @param array $resumes - array of stu_job_ids
  * @param integer $empId - the empId that favorites the resumes
  * 
  * @return boolean - returns true when succeeded or nothing inserted, otherwise exception will be thrown.
  */
 public static function saveResumes($resumes, $empId)
 {
     if (!isset($resumes) || !is_array($resumes) || !isset($empId)) {
         throw new CException('Resumes and Employer Id are required');
     }
     if (count($resumes) == 0) {
         return true;
     }
     $transaction = Yii::app()->db->beginTransaction();
     try {
         foreach ($resumes as $resume) {
             $fav = new FavoriteStudentJobTitle();
             $fav->stu_job_id = intval($resume);
             $fav->employer_id = intval($empId);
             if (!$fav->save()) {
                 $transaction->rollback();
                 throw new CException(implode(', ', $fav->getErrors()));
             }
         }
         $transaction->commit();
         return true;
     } catch (Exception $e) {
         $transaction->rollback();
         throw $e;
     }
 }