Exemplo n.º 1
0
 public function actionView()
 {
     if (isset($_GET['user'])) {
         $username = $_GET['user'];
     } else {
         $username = Yii::app()->user->name;
     }
     $user = User::model()->find("username=:username", array(':username' => $username));
     $saveQ = SavedQuery::model()->findAll("FK_userid=:id", array(':id' => $user->id));
     if ($user->FK_usertype == 2) {
         $this->actionViewEmployer();
         return;
     }
     //Get all schools
     $allSchools = School::getAllSchools();
     // Get Resume
     $resume = Resume::model()->findByPk($user->id);
     $videoresume = VideoResume::model()->findByPk($user->id);
     // 		print "<pre>"; print_r($videoresume->video_path);print "</pre>";return;
     $this->render('View', array('user' => $user, 'allSchools' => $allSchools, 'resume' => $resume, 'videoresume' => $videoresume, 'saveQ' => $saveQ));
 }
Exemplo n.º 2
0
 public function actionEmployersearch()
 {
     $srch_keyword = $_POST['skillkeyword'];
     // Get skill keyword to search
     $pieces = trim($srch_keyword);
     $pieces = explode(" ", $pieces);
     // split words to search
     $count = sizeof($pieces);
     // get number of word to search
     $query = '';
     for ($i = 0; $i < $count; $i++) {
         if ($i == $count - 1) {
             $query = $query . 'name like \'%' . $pieces[$i] . '%\'';
         } else {
             $query = $query . 'name like \'%' . $pieces[$i] . '%\' OR ';
         }
     }
     $criteria = new CDbCriteria();
     $criteria->condition = $query;
     $results = array();
     if ($srch_keyword != null) {
         $skillsArray = Skillset::model()->findAll($criteria);
         foreach ($skillsArray as $sk) {
             $student_ids = StudentSkillMap::model()->findAllByAttributes(array('skillid' => $sk->id));
             // search student skill map for students with that skill
             foreach ($student_ids as $tmp) {
                 $duplicate = 0;
                 if (sizeof($results) > 0) {
                     foreach ($results as $t) {
                         if ($t->id == $tmp->userid) {
                             $duplicate = 1;
                         }
                     }
                 }
                 if ($duplicate == 0) {
                     $results[] = User::model()->findByAttributes(array('id' => $tmp->userid));
                 }
             }
         }
         $school_id = School::model()->findAll($criteria);
         // get school ID
         foreach ($school_id as $si) {
             $student_ids = Education::model()->findAllByAttributes(array('FK_school_id' => $si->id));
             // search educations with school ID
             foreach ($student_ids as $tmp) {
                 $duplicate = 0;
                 if (sizeof($results) > 0) {
                     foreach ($results as $t) {
                         if ($t->id == $tmp->FK_user_id) {
                             $duplicate = 1;
                         }
                     }
                 }
                 if ($duplicate == 0) {
                     $results[] = User::model()->findByAttributes(array('id' => $tmp->FK_user_id));
                 }
             }
         }
     }
     if (isset($_GET['user'])) {
         $username = $_GET['user'];
     } else {
         $username = Yii::app()->user->name;
     }
     $user = User::model()->find("username=:username", array(':username' => $username));
     // pass user
     $skills = Skillset::getNames();
     // pass skills
     $universites = School::getAllSchools();
     // pass companies
     // 		foreach ($results as $tr){
     // 			print "<pre>"; print_r($tr->attributes);print "</pre>";
     // 		}
     // 		return;
     $this->render('employerSearchResults', array('results' => $results, 'skills' => $skills, 'universities' => $universites, 'user' => $user));
 }