</div> <div id="mostwanted"> <div class="titlebox">MOST WANTED SKILLS</div><br><br> <ul> <?php foreach ($mostwanted as $mmm) { ?> <li class="mostwantedskills"><?php echo $mmm->name; $thecount = 0; /*$criteria1= new CDbCriteria(); $criteria1=array( 'select'=>'count(*) as count', 'condition'=>" skillid=".$mmm->id."", );*/ $sk = JobSkillMap::model()->findAllByAttributes(array('skillid' => $mmm->id)); foreach ($sk as $sk2) { $thejob = Job::model()->findByPk($sk2->jobid); if ($thejob->active) { $thecount++; } } ?> <a class="mostwantedtext" href="/JobFair/index.php/home/Search2/?key=<?php echo $mmm->name; ?> "><?php echo " - [ " . $thecount . " ] Jobs"; ?> </a> </li>
</td> <td><?php echo Yii::app()->dateFormatter->format('MM/dd/yyyy', $jobs[$i]->post_date); ?> </td> <!-- <td>--><?php //echo Yii::app()->dateFormatter->format('MM/dd/yyyy', $jobs[$i]->deadline); ?> <!--</td>--> <td><?php echo $jobs[$i]->compensation; ?> </td> <td> <?php $temp = JobSkillMap::model()->findAllByAttributes(array('jobid' => $jobs[$i]->id)); foreach ($temp as $one) { $cur_skill = Skillset::model()->findByAttributes(array('id' => $one->skillid))->name; $this->widget('bootstrap.widgets.TbLabel', array('type' => 'default', 'label' => strtolower($cur_skill))); echo ' '; } if (count($temp) <= 0) { $this->widget('bootstrap.widgets.TbLabel', array('type' => 'inverse', 'label' => 'N/A')); } ?> </td> <td><?php echo "CareerPath"; ?> </td> </tr>
public function actionConsolidate() { $model = new Skillset('search'); $model->unsetAttributes(); // clear any default values $error = ''; if (isset($_GET['Skillset'])) { $model->attributes = $_GET['Skillset']; } if (isset($_POST['skill_one']) && isset($_POST['skill_two'])) { // make sure skill one exists on database $skill_one = Skillset::model()->find("name=:name", array(':name' => $_POST['skill_one'])); if (!isset($skill_one)) { $error = "Skill A not found!"; } else { // make sure skill two exists on database $skill_two = Skillset::model()->find("name=:name", array(':name' => $_POST['skill_two'])); if (!isset($skill_two)) { $error = "Skill B not found!"; } else { // make sure both skills are not the same one if (strcmp($skill_one->name, $skill_two->name) != 0) { // merge skill one to skill two (skill two remains) $jobskill_mappings = JobSkillMap::model()->findAll("skillid=:skillid", array(':skillid' => $skill_one->id)); foreach ($jobskill_mappings as $jobskill_mapping) { $jobskill_mapping->skillid = $skill_two->id; $jobskill_mapping->save(false); } $studentskill_mappings = StudentSkillMap::model()->findAll("skillid=:skillid", array(':skillid' => $skill_one->id)); foreach ($studentskill_mappings as $studentskill_mapping) { $studentskill_mapping->skillid = $skill_two->id; $studentskill_mapping->save(false); } $skill_one->delete(); $this->redirect(array('admin')); } else { $error = "Skill A and Skill B cannot be the same!"; } } } } $this->render('consolidate', array('model' => $model, 'error' => $error, 'skill1' => isset($_POST['skill_one']) ? $_POST['skill_one'] : '', 'skill2' => isset($_POST['skill_two']) ? $_POST['skill_two'] : '')); }
public function cascade_delete() { $id = $this->id; // remove any skill mappings $skill_mappigns = JobSkillMap::model()->findAllByAttributes(array('jobid' => $id)); foreach ($skill_mappigns as $skill_mapping) { $skill_mapping->delete(); } // remove any applications mappings $app_mappings = Application::model()->findAllByAttributes(array('jobid' => $id)); foreach ($app_mappings as $app_mapping) { $app_mapping->delete(); } // remove any handshake mappings $hs_mappings = Handshake::model()->findAllByAttributes(array('jobid' => $id)); foreach ($hs_mappings as $hs_mapping) { $hs_mapping->delete(); } // finally remove job $this->delete(); }
public function actionPost() { // check if api is enabled $api_status = ApiStatus::getFirst(); if (!$api_status->isApiOn()) { $this->_sendResponse(200, 'API access has been disabled. Contact VJF administrator.'); } // perform routine auth $this->authenticate(); // api key is valid, now parse the json object $request_obj = Yii::app()->request->getRawBody(); $job_posting = CJSON::decode($request_obj); if (!isset($job_posting) || is_null($job_posting)) { $this->_sendResponse(500, 'Empty job posting body.'); } // dissect scis job posting information $jp_id = $job_posting['URL']; //$job_posting['ID']; $jp_postedTime = $job_posting['PostedTime']; $jp_expireTime = $job_posting['ExpireTime']; $jp_company = $job_posting['Company']; $jp_position = $job_posting['Position']; $jp_company_url = $job_posting['URL']; $jp_company_background = $job_posting['Background']; $jp_description = $job_posting['Description']; $jp_duties = $job_posting['Duties']; $jp_qualifications = $job_posting['Qualifications']; $jp_company_email = $job_posting['Email']; $jp_posted_by = $job_posting['PostedBy']; //$jp_posting_format = $job_posting['Format']; dont care about this, ask joshua // attempt to find user in database (by email) that corresponds to the job posting $user_found = User::model()->find('email=:jp_company_email', array(':jp_company_email' => $jp_company_email)); // if user not found in database, create a new 'dummy' user for this posting if (count($user_found) <= 0) { // user info (exclude first name and last name) $new_user = new User(); $new_user->email = $jp_company_email; $new_user->activated = 1; // activate their account, and force them to retreive password (if they ever want to login) // generate username from email $user_name = str_replace(array('@', '.'), '_', $jp_company_email); $new_user->username = $user_name; $new_user->FK_usertype = 2; // employer type $new_user->registration_date = new CDbExpression('NOW()'); $new_user->image_url = '/JobFair/images/profileimages/user-default.png'; // hash the password before storing it into the database $hasher = new PasswordHash(8, false); $new_user->password = $hasher->HashPassword($new_user->password); // add user to db $new_user->save(false); // user company info $cmpny_info = new CompanyInfo(); $cmpny_info->name = $jp_company; $cmpny_info->website = $jp_company_url; $cmpny_info->description = $jp_company_background; $cmpny_info->FK_userid = $new_user->id; // add company info to db $cmpny_info->save(false); // user basic info $basic_info = new BasicInfo(); $basic_info->about_me = $jp_posted_by; // ask professor about this mapping $basic_info->userid = $new_user->id; $basic_info->hide_phone = 1; $basic_info->allowSMS = 0; $basic_info->validated = 1; // add basic info to db $basic_info->save(false); } // we have a user, post under his/her account $current_user = isset($new_user) ? $new_user : $user_found; // check for duplicate postings // $dup_entries = Job::model()->find( "FK_poster=:poster AND ". // "title=:title AND ". // "deadline=:deadline AND ". // "post_date=:post_date", // array( ':poster' => $current_user->id, // ':title' => $jp_position, // ':deadline' => date('Y-m-d H:i:s', strtotime($jp_expireTime)), // ':post_date' => $jp_postedTime)); $dup_entries = Job::model()->find("posting_url=:job_url", array(':job_url' => $jp_id)); // duplicate entry, ignore if (count($dup_entries) > 0) { $new_job_posting = $dup_entries; $new_job_posting->FK_poster = $current_user->id; // need an account $new_job_posting->post_date = $jp_postedTime; $new_job_posting->title = $jp_position; $new_job_posting->deadline = date('Y-m-d H:i:s', strtotime($jp_expireTime)); $new_job_posting->description = $jp_description . $jp_duties . $jp_qualifications; $new_job_posting->type = 'CIS'; // know it was posted using this api $new_job_posting->compensation = ""; // not available from CIS $new_job_posting->posting_url = $jp_id; $new_job_posting->comp_name = $jp_company; // post the job to db $new_job_posting->save(false); // send response and stop application $this->_sendResponse(400, 'Job entry has been updated in the database.'); } // no duplicates, add posting $new_job_posting = new Job(); $new_job_posting->FK_poster = $current_user->id; // need an account $new_job_posting->post_date = $jp_postedTime; $new_job_posting->title = $jp_position; $new_job_posting->deadline = date('Y-m-d H:i:s', strtotime($jp_expireTime)); $new_job_posting->description = $jp_description . $jp_duties . $jp_qualifications; $new_job_posting->type = 'CIS'; // know it was posted using this api $new_job_posting->compensation = ""; // not available from CIS $new_job_posting->posting_url = $jp_id; $new_job_posting->comp_name = $jp_company; // post the job to db $new_job_posting->save(false); // skill match descripnt against database $decoded_desc = utf8_decode($new_job_posting->description); $decoded_desc = str_replace(array('/', ',', '.'), ' ', $decoded_desc); $description_words = explode(' ', $decoded_desc); // split into words $skill_order = 0; foreach ($description_words as $word) { // check database to see if current word is a skill $skill = Skillset::model()->find("name=:name", array(":name" => $word)); if ($skill) { // its a skill, map it to this posting on database $skill_map = new JobSkillMap(); $skill_map->jobid = $new_job_posting->id; $skill_map->skillid = $skill->id; $skill_map->ordering = $skill_order; $skill_order++; $skill_map->save(false); } } // all went good $this->_sendResponse(200); }
public function actionSaveSkills($jobid) { $skills = $_POST['Skill']; //first wipe out the jobs skills $job = Job::model()->findByPk($jobid); if ($job) { foreach ($job->jobSkillMaps as $skill) { $skill->delete(); } } $i = 1; foreach ($skills as $skill) { $skillmap = new JobSkillMap(); $skillmap->jobid = $jobid; if (!ctype_digit($skill)) { //create a new skill $newskill = new Skillset(); $newskill->name = $skill; $newskill->save(false); $skillmap->skillid = $newskill->id; } else { $skillmap->skillid = $skill; } $skillmap->ordering = $i; $skillmap->save(false); $i++; } }
public function actionCareerPathSync() { // using test URL retrieve mock json objects // here I would request a date range, since this script runs daily as a cron job // $request = Yii::app()->curl->run('http://www.json-generator.com/api/json/get/bRQiTpYSCq?indent=2'); $job_postings = CJSON::decode($request->getData()); // keep track of new jobs $new_jobs_count = 0; // check each object to see if it has been posted already: // criteria for duplicate jobs: // - same title, description and expiration date foreach ($job_postings as $job_posting) { // dissect scis job posting information $jp_id = $job_posting['ID']; $jp_postedTime = $job_posting['PostedTime']; $jp_expireTime = $job_posting['ExpireTime']; $jp_company = $job_posting['Company']; $jp_position = $job_posting['Position']; $jp_company_url = $job_posting['URL']; $jp_company_background = $job_posting['Background']; $jp_description = $job_posting['Description']; $jp_duties = $job_posting['Duties']; $jp_qualifications = $job_posting['Qualifications']; $jp_company_email = $job_posting['Email']; $jp_posted_by = $job_posting['PostedBy']; //$jp_posting_format = $job_posting['Format']; dont care about this, ask joshua // attempt to find user in database (by email) that corresponds to the job posting $user_found = User::model()->find('email=:jp_company_email', array(':jp_company_email' => $jp_company_email)); // if user not found in database, create a new 'dummy' user for this posting if (count($user_found) <= 0) { // user info (exclude first name and last name) $new_user = new User(); $new_user->email = $jp_company_email; $new_user->activated = 1; // activate their account, and force them to retreive password (if they ever want to login) // generate username from email $user_name = str_replace(array('@', '.'), '_', $jp_company_email); $new_user->username = $user_name; $new_user->FK_usertype = 2; // employer type $new_user->registration_date = new CDbExpression('NOW()'); $new_user->image_url = '/JobFair/images/profileimages/user-default.png'; // hash the password before storing it into the database $hasher = new PasswordHash(8, false); $new_user->password = $hasher->HashPassword($new_user->password); // add user to db $new_user->save(false); // user company info $cmpny_info = new CompanyInfo(); $cmpny_info->name = $jp_company; $cmpny_info->website = $jp_company_url; $cmpny_info->description = $jp_company_background; $cmpny_info->FK_userid = $new_user->id; // add company info to db $cmpny_info->save(false); // user basic info $basic_info = new BasicInfo(); $basic_info->about_me = $jp_posted_by; // ask professor about this mapping $basic_info->userid = $new_user->id; $basic_info->hide_phone = 1; $basic_info->allowSMS = 0; $basic_info->validated = 1; // add basic info to db $basic_info->save(false); } // we have a user, post under his/her account $current_user = isset($new_user) ? $new_user : $user_found; // check for duplicate postings $dup_entries = Job::model()->find("FK_poster=:poster AND " . "title=:title AND " . "deadline=:deadline AND " . "post_date=:post_date", array(':poster' => $current_user->id, ':title' => $jp_position, ':deadline' => date('Y-m-d H:i:s', strtotime($jp_expireTime)), ':post_date' => $jp_postedTime)); // duplicate entry, ignore if (count($dup_entries) > 0) { continue; } // no duplicates, add posting $new_job_posting = new Job(); $new_job_posting->FK_poster = $current_user->id; // need an account $new_job_posting->post_date = $jp_postedTime; $new_job_posting->title = $jp_position; $new_job_posting->deadline = date('Y-m-d H:i:s', strtotime($jp_expireTime)); $new_job_posting->description = $jp_description . $jp_duties . $jp_qualifications; $new_job_posting->type = 'CIS'; // know it was posted using this api $new_job_posting->compensation = ""; // not available from CIS $new_job_posting->posting_url = $jp_id; // post the job to db $new_job_posting->save(false); // skill match descripnt against database $decoded_desc = utf8_decode($new_job_posting->description); $decoded_desc = str_replace(array('/', ',', '.'), ' ', $decoded_desc); $description_words = explode(' ', $decoded_desc); // split into words $skill_order = 0; foreach ($description_words as $word) { // check database to see if current word is a skill $skill = Skillset::model()->find("name=:name", array(":name" => $word)); if ($skill) { // its a skill, map it to this posting on database $skill_map = new JobSkillMap(); $skill_map->jobid = $new_job_posting->id; $skill_map->skillid = $skill->id; $skill_map->ordering = $skill_order; $skill_order++; $skill_map->save(false); } } // all went good echo 'Success!'; } }