/** * test the parseData function */ public function testParseData() { $extractor = new EXTRACTOR_JobApplication(); // No parameters - default settings $post = array(); $application = $extractor->parseData($post); $expected = new JobApplication(); $this->assertEquals($expected, $application); // Without ID $post = array('txtVacancyId' => '1', 'txtFirstName' => 'John', 'txtMiddleName' => 'K', 'txtLastName' => 'Salgado', 'txtStreet1' => '111 Main St', 'txtStreet2' => 'Apt 1111', 'txtCity' => 'Colombo', 'txtCountry' => 'Sri Lanka', 'txtProvince' => 'Central', 'txtZip' => '10000', 'txtMobile' => '0772828282', 'txtPhone' => '1119191991', 'txtEmail' => '*****@*****.**', 'txtQualifications' => 'sdf sadf sfsd'); $application = $extractor->parseData($post); $expected = new JobApplication(); $expected->setVacancyId(1); $expected->setFirstName('John'); $expected->setMiddleName('K'); $expected->setLastName('Salgado'); $expected->setStreet1('111 Main St'); $expected->setStreet2('Apt 1111'); $expected->setCity('Colombo'); $expected->setCountry('Sri Lanka'); $expected->setProvince('Central'); $expected->setZip('10000'); $expected->setPhone('1119191991'); $expected->setMobile('0772828282'); $expected->setEmail('*****@*****.**'); $expected->setQualifications('sdf sadf sfsd'); $this->assertEquals($expected, $application); // All parameters $post = array('txtId' => '121', 'txtVacancyId' => '1', 'txtFirstName' => 'John', 'txtMiddleName' => 'K', 'txtLastName' => 'Salgado', 'txtStreet1' => '111 Main St', 'txtStreet2' => 'Apt 1111', 'txtCity' => 'Colombo', 'txtCountry' => 'Sri Lanka', 'txtProvince' => 'Central', 'txtZip' => '10000', 'txtMobile' => '0772828282', 'txtPhone' => '1119191991', 'txtEmail' => '*****@*****.**', 'txtQualifications' => 'sdf sadf sfsd'); $application = $extractor->parseData($post); $expected->setId(121); $this->assertEquals($expected, $application); }
public function processApplication($data, Form $form) { $application = JobApplication::create(); $form->saveinto($application); $application->write(); $form->sessionMessage('Thanks for applying.', 'good'); $this->redirectBack(); }
/** * Create a JobApplication object with the passed parameters */ private function _getJobApplication($id, $vacancyId, $firstName, $middleName, $lastName, $street1, $street2, $city, $province, $zip, $country, $mobile, $phone, $email, $qualifications, $status = JobApplication::STATUS_SUBMITTED) { $application = new JobApplication($id); $application->setVacancyId($vacancyId); $application->setFirstName($firstName); $application->setMiddleName($middleName); $application->setLastName($lastName); $application->setStreet1($street1); $application->setStreet2($street2); $application->setCity($city); $application->setProvince($province); $application->setZip($zip); $application->setCountry($country); $application->setMobile($mobile); $application->setPhone($phone); $application->setEmail($email); $application->setQualifications($qualifications); $application->setStatus($status); $application->setAppliedDateTime(date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT)); return $application; }
/** * Create a JobApplication object with the passed parameters */ private function _getJobApplication($id, $vacancyId, $firstName, $middleName, $lastName, $street1, $street2, $city, $province, $zip, $country, $mobile, $phone, $email, $qualifications) { $application = new JobApplication($id); $application->setVacancyId($vacancyId); $application->setFirstName($firstName); $application->setMiddleName($middleName); $application->setLastName($lastName); $application->setStreet1($street1); $application->setStreet2($street2); $application->setCity($city); $application->setProvince($province); $application->setZip($zip); $application->setCountry($country); $application->setMobile($mobile); $application->setPhone($phone); $application->setEmail($email); $application->setQualifications($qualifications); return $application; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return JobApplication the loaded model * @throws CHttpException */ public function loadModel($id) { $model = JobApplication::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Create an employee based on a job application. * * @param JobApplication $jobApplication Job Application to create the employee from. * @throws RecruitmentControllerException if there is an error when creating employee */ public function createEmployeeFromApplication($jobApplication) { $empInfo = new EmpInfo(); // main information $employeeId = $empInfo->getLastId(); $empInfo->setEmployeeId($employeeId); $empInfo->setEmpLastName($jobApplication->getLastName()); $empInfo->setEmpFirstName($jobApplication->getFirstName()); $empInfo->setEmpMiddleName($jobApplication->getMiddleName()); $result = $empInfo->addEmpMain(); // contact information $empInfo->setEmpStreet1($jobApplication->getStreet1()); $empInfo->setEmpStreet2($jobApplication->getStreet2()); $empInfo->setEmpCity($jobApplication->getCity()); $empInfo->setEmpProvince($jobApplication->getProvince()); $empInfo->setEmpCountry($jobApplication->getCountry()); $empInfo->setEmpZipCode($jobApplication->getZip()); $empInfo->setEmpHomeTelephone($jobApplication->getPhone()); $empInfo->setEmpMobile($jobApplication->getMobile()); $empInfo->setEmpOtherEmail($jobApplication->getEmail()); $result = $empInfo->updateEmpContact(); // job information $vacancy = JobVacancy::getJobVacancy($jobApplication->getVacancyId()); $empInfo->setEmpJobTitle($vacancy->getJobTitleCode()); $empInfo->setEmpStatus(0); $empInfo->setEmpEEOCat(0); $empInfo->setEmpJoinedDate("null"); $empInfo->setEmpTerminatedDate("null"); $result = $empInfo->updateEmpJobInfo(); return $empInfo->getEmpId(); }
/** * Send a task to the interviewing manager, giving details of scheduled interview * * @param JobApplicationEvent $jobApplicationEvent Job Application Event object * * @return boolean True if mail sent, false otherwise */ public function sendInterviewTaskToManager($jobApplicationEvent) { /* Get interview details */ $intManagerId = $jobApplicationEvent->getOwner(); if (empty($intManagerId)) { throw new RecruitmentMailNotifierException("Invalid parameters", RecruitmentMailNotifierException::INVALID_PARAMETER); } $intManagerEmail = $this->_getEmpAddress($intManagerId); if (empty($intManagerEmail)) { $this->_log("Interviewing manager {$intManagerId} does not have email address."); return false; } $intManagerName = $this->_getEmpName($intManagerId); $jobApplication = JobApplication::getJobApplication($jobApplicationEvent->getApplicationId()); $applicantName = $jobApplication->getFirstName() . ' ' . $jobApplication->getLastName(); $applicantEmail = $jobApplication->getEmail(); $creatorName = $jobApplicationEvent->getCreatorName(); $creatorEmail = $jobApplicationEvent->getCreatorEmail(); $interviewTime = $jobApplicationEvent->getEventTime(); $vacancy = JobVacancy::getJobVacancy($jobApplication->getVacancyId()); /* Get summary and description from templates */ $subject = $this->_getTemplate(self::SUBJECT_INTERVIEW_MANAGER_TASK); $body = $this->_getTemplate(self::TEMPLATE_INTERVIEW_MANAGER_TASK); // Replace placeholders in subject and body $search = array(self::VARIABLE_JOB_TITLE, self::VARIABLE_TO, self::VARIABLE_APPLICANT_FIRSTNAME, self::VARIABLE_APPLICANT_MIDDLENAME, self::VARIABLE_APPLICANT_LASTNAME, self::VARIABLE_APPLICANT_STREET1, self::VARIABLE_APPLICANT_STREET2, self::VARIABLE_APPLICANT_CITY, self::VARIABLE_APPLICANT_PROVINCE, self::VARIABLE_APPLICANT_ZIP, self::VARIABLE_APPLICANT_COUNTRY, self::VARIABLE_APPLICANT_PHONE, self::VARIABLE_APPLICANT_MOBILE, self::VARIABLE_APPLICANT_EMAIL, self::VARIABLE_APPLICANT_QUALIFICATIONS, self::VARIABLE_INTERVIEW_NOTES); $country = $this->_getCountryName($jobApplication->getCountry()); $replace = array($vacancy->getJobTitleName(), $intManagerName['first'], $jobApplication->getFirstName(), $jobApplication->getMiddleName(), $jobApplication->getLastName(), $jobApplication->getStreet1(), $jobApplication->getStreet2(), $jobApplication->getCity(), $jobApplication->getProvince(), $jobApplication->getZip(), $country, $jobApplication->getPhone(), $jobApplication->getMobile(), $jobApplication->getEmail(), $jobApplication->getQualifications(), $jobApplicationEvent->getNotes()); $summary = str_replace($search, $replace, $subject); $description = str_replace($search, $replace, $body); /* Create task */ $message = $this->_getTask($summary, $description, $creatorName, $creatorEmail, $applicantName, $applicantEmail, $interviewTime); $mailer = $this->_getMailer(); $attachment = $mailer->createAttachment($message); $attachment->type = 'text/calendar'; $attachment->filename = 'interview.ics'; /* Send Email with task attached */ $to = "{$intManagerName['first']} {$intManagerName['last']}<{$intManagerEmail}>"; $body = ''; $notificationType = null; $attachments = array($attachment); $subject = $summary; $this->_sendMail($to, $subject, $body, $notificationType, $attachments); }
/** * Creates a JobApplication object from a resultset row * * @param array $row Resultset row from the database. * @return JobApplication JobApplication object. */ private static function _createFromRow($row) { $application = new JobApplication($row[self::DB_FIELD_ID]); $application->setVacancyId($row[self::DB_FIELD_VACANCY_ID]); $application->setFirstName($row[self::DB_FIELD_FIRSTNAME]); $application->setMiddleName($row[self::DB_FIELD_MIDDLENAME]); $application->setLastName($row[self::DB_FIELD_LASTNAME]); $application->setStreet1($row[self::DB_FIELD_STREET1]); $application->setStreet2($row[self::DB_FIELD_STREET2]); $application->setCity($row[self::DB_FIELD_CITY]); $application->setCountry($row[self::DB_FIELD_COUNTRY_CODE]); $application->setProvince($row[self::DB_FIELD_PROVINCE]); $application->setZip($row[self::DB_FIELD_ZIP]); $application->setPhone($row[self::DB_FIELD_PHONE]); $application->setMobile($row[self::DB_FIELD_MOBILE]); $application->setEmail($row[self::DB_FIELD_EMAIL]); $application->setQualifications($row[self::DB_FIELD_QUALIFICATIONS]); $application->setStatus($row[self::DB_FIELD_STATUS]); $application->setAppliedDateTime($row[self::DB_FIELD_APPLIED_DATETIME]); $application->setEmpNumber($row[self::DB_FIELD_EMP_NUMBER]); if (isset($row[self::JOB_TITLE_NAME])) { $application->setJobTitleName($row[self::JOB_TITLE_NAME]); } if (isset($row[self::HIRING_MANAGER_NAME])) { $application->setHiringManagerName($row[self::HIRING_MANAGER_NAME]); } return $application; }
$errors['apply_cv'] = $translations['apply']['cv_error']; } if (!validate_email($apply_email)) { $errors['apply_email'] = $translations['apply']['email_invalid']; } if (empty($errors)) { $j = new Job($job_id); $f = pathinfo($_FILES['apply_cv']['name']); $filename = md5(time() . '_' . $_FILES['apply_cv']['name'] . uniqid()) . '.' . $f['extension']; if (move_uploaded_file($_FILES['apply_cv']['tmp_name'], FILE_UPLOAD_DIR . $filename)) { $attachment = $filename; } else { $attachment = ''; } $data = array('apply_email' => $apply_email, 'apply_name' => $apply_name, 'apply_msg' => strip_tags($apply_msg), 'company_email' => $j->mPosterEmail, 'company_name' => $j->mCompany, 'job_title' => $j->mTitle, 'attachment_path' => APP_PATH . FILE_UPLOAD_DIR . $attachment, 'attachment_filename' => $attachment, 'job_id' => $job_id); $app = new JobApplication($job_id, $data); $applicationTimeoutDisabled = MINUTES_BETWEEN_APPLY_TO_JOBS_FROM_SAME_IP <= 0; $applicationTimeoutPassed = false; $applicantIP = $_SERVER['REMOTE_ADDR']; if (!$applicationTimeoutDisabled) { $applicationTimeoutPassed = $app->HasApplyTimeoutPassed($applicantIP); } $applicationAllowed = $applicationTimeoutDisabled || $applicationTimeoutPassed; if ($applicationAllowed) { $app->Apply($applicantIP); $mailSender = new Postman(); $applyMailSent = $mailSender->MailApplyOnline($data); if ($applyMailSent) { $_SESSION['apply_mail_sent'] = 1; $_SESSION['apply_successful'] = 1; } else {
<?php $job = new Job($id); if ($job->Exists() && $extra != '' && $extra == $job->GetAuth()) { $info = $job->GetInfo(); $url = BASE_URL . URL_JOB . '/' . $id . '/' . $info['url_title'] . '/'; $app = new JobApplication($id); $apps_count = $app->Count(); $info['applied_count'] = $apps_count; $smarty->assign('count_applicants', $apps_count); $smarty->assign('job', $info); $category = get_category_by_id($info['category_id']); // set paginator link $paginatorLink = BASE_URL . 'view-applicants/' . $id . '/' . $extra . '/'; $paginator = new Paginator($apps_count, JOBS_PER_PAGE, @$_REQUEST['p']); $paginator->setLink($paginatorLink); $paginator->paginate(); $from = $paginator->getFirstLimit(); $to = $paginator->getLastLimit(); // grab all jobs applied $the_applicants = $app->getAllForJob($from, JOBS_PER_PAGE); $smarty->assign('applicants', $the_applicants); // send page links to template $smarty->assign('pages', $paginator->pages_link); $smarty->assign('seo_title', $translator->translate("jobs.html_title", stripslashes($info['title']), stripslashes($info['company']), SITE_NAME)); $smarty->assign('cv_path', BASE_URL . FILE_UPLOAD_DIR); $smarty->assign('current_category', $category['var_name']); $smarty->assign('back_link', BASE_URL . 'manage/' . $id . '/' . $extra . '/'); $template = 'job-applications.tpl'; } else { redirect_to(BASE_URL . URL_JOB . '/' . $id . '/');
/** * Checks if the given user is allowed to change the status of the given event * * @param authorize $authObj authorize class representing logged in user * @param JobApplicationEvent Job Application Event which needs to be edited * * @return bool True if action is allowed, false otherwise. */ public function isAllowedToChangeEventStatus($authObj, $jobApplicationEvent) { if (!$this->isAllowedToEditEvent($authObj, $jobApplicationEvent)) { return false; } $application = JobApplication::getJobApplication($jobApplicationEvent->getApplicationId()); $status = $application->getStatus(); $eventType = $jobApplicationEvent->getEventType(); switch ($eventType) { case JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW: return $status == JobApplication::STATUS_FIRST_INTERVIEW_SCHEDULED; break; case JobApplicationEvent::EVENT_SCHEDULE_SECOND_INTERVIEW: return $status == JobApplication::STATUS_SECOND_INTERVIEW_SCHEDULED; break; default: return false; } }
public function getResidentRegistrationNatureOptions() { return JobApplication::model()->getResidentRegistrationNatureOptions(); }
/** * Parse data from interface and return JobApplication Object * @param Array $postArr Array containing POST values * @return JobApplication Job Application object */ public function parseData($postArr) { $application = new JobApplication(); if (isset($postArr['txtId']) && !empty($postArr['txtId'])) { $application->setId(trim($postArr['txtId'])); } if (isset($postArr['txtVacancyId']) && !empty($postArr['txtVacancyId'])) { $application->setVacancyId(trim($postArr['txtVacancyId'])); } if (isset($postArr['txtFirstName']) && !empty($postArr['txtFirstName'])) { $application->setFirstName(trim($postArr['txtFirstName'])); } if (isset($postArr['txtMiddleName']) && !empty($postArr['txtMiddleName'])) { $application->setMiddleName(trim($postArr['txtMiddleName'])); } if (isset($postArr['txtLastName']) && !empty($postArr['txtLastName'])) { $application->setLastName(trim($postArr['txtLastName'])); } if (isset($postArr['txtStreet1']) && !empty($postArr['txtStreet1'])) { $application->setStreet1(trim($postArr['txtStreet1'])); } if (isset($postArr['txtStreet2']) && !empty($postArr['txtStreet2'])) { $application->setStreet2(trim($postArr['txtStreet2'])); } if (isset($postArr['txtCity']) && !empty($postArr['txtCity'])) { $application->setCity(trim($postArr['txtCity'])); } if (isset($postArr['txtCountry']) && !empty($postArr['txtCountry'])) { $application->setCountry(trim($postArr['txtCountry'])); } if (isset($postArr['txtProvince']) && !empty($postArr['txtProvince'])) { $application->setProvince(trim($postArr['txtProvince'])); } if (isset($postArr['txtZip']) && !empty($postArr['txtZip'])) { $application->setZip(trim($postArr['txtZip'])); } if (isset($postArr['txtPhone']) && !empty($postArr['txtPhone'])) { $application->setPhone(trim($postArr['txtPhone'])); } if (isset($postArr['txtMobile']) && !empty($postArr['txtMobile'])) { $application->setMobile(trim($postArr['txtMobile'])); } if (isset($postArr['txtEmail']) && !empty($postArr['txtEmail'])) { $application->setEmail(trim($postArr['txtEmail'])); } if (isset($postArr['txtQualifications']) && !empty($postArr['txtQualifications'])) { $application->setQualifications(trim($postArr['txtQualifications'])); } return $application; }
<?php $job = new Job($id); if ($job->Exists() && $job->GetTempStatus() == 0) { $info = $job->GetInfo(); $app = new JobApplication($id); $info['applicants'] = $app->getAllForJob(); $smarty->assign('job', $info); $smarty->assign('applicants', $info['applicants']); $smarty->assign('cv_path', '/' . FILE_UPLOAD_DIR); $category = get_category_by_id($info['category_id']); $category_var_name = $category['var_name']; $html_title = stripslashes($info['title']) . ' la ' . stripslashes($info['company']) . ' / ' . SITE_NAME; if (isset($_SERVER['HTTP_REFERER'])) { $currentLinksPage = explode('/', rtrim($_SERVER['HTTP_REFERER'], '/')); if (strcmp(end($currentLinksPage), 'home') == 0) { $smarty->assign('back_link', BASE_URL . 'home/'); } else { $smarty->assign('back_link', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : BASE_URL . URL_JOBS . '/' . $category_var_name . '/'); } } else { $smarty->assign('back_link', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : BASE_URL . URL_JOBS . '/' . $category_var_name . '/'); } $smarty->assign('current_category', $category_var_name); $template = 'job.tpl'; } else { redirect_to(BASE_URL . 'job-unavailable/'); exit; }
if (!empty($_SESSION['last_viewed_jobs'])) { foreach ($_SESSION['last_viewed_jobs'] as $item) { if ($item['url'] == $url) { $job_flag = false; } } } else { $_SESSION['last_viewed_jobs'] = array(); } if ($job_flag) { array_unshift($_SESSION['last_viewed_jobs'], array('url' => $url, 'title' => stripslashes($job->mTitle))); } if (count($_SESSION['last_viewed_jobs']) > 10) { array_pop($_SESSION['last_viewed_jobs']); } $app = new JobApplication($id); $info['applied_count'] = $app->Count(); // ######### list other jobs by the same company ######### $compjobs = $job->ApiGetJobsByCompany($info['company'], 5, false); $sanitizedcomp = $sanitizer->sanitize_title_with_dashes($info['company']); $smarty->assign('compjobs', $compjobs); $smarty->assign('jobsat', $sanitizedcomp); // ######### list other jobs by the same company ######### $smarty->assign('job', $info); $category = get_category_by_id($info['category_id']); $smarty->assign('seo_title', $translator->translate("jobs.html_title", stripslashes($info['title']), stripslashes($info['company']), SITE_NAME)); $smarty->assign('current_category', $category['var_name']); $smarty->assign('back_link', BASE_URL . URL_JOBS . '/' . $category['var_name'] . '/'); $template = 'job.tpl'; } else { redirect_to(BASE_URL . 'job-unavailable/');
/** * Parse data from interface and return JobApplication Object * @param Array $postArr Array containing POST values * @return JobApplication Job Application object */ public function parseData($postArr) { $application = new JobApplication(); if (isset($postArr['txtId']) && !empty($postArr['txtId'])) { $application->setId(trim($postArr['txtId'])); } if (isset($postArr['txtVacancyId']) && !empty($postArr['txtVacancyId'])) { $application->setVacancyId(trim($postArr['txtVacancyId'])); } if (isset($postArr['txtFirstName']) && !empty($postArr['txtFirstName'])) { $application->setFirstName(trim($postArr['txtFirstName'])); } if (isset($postArr['txtMiddleName']) && !empty($postArr['txtMiddleName'])) { $application->setMiddleName(trim($postArr['txtMiddleName'])); } if (isset($postArr['txtLastName']) && !empty($postArr['txtLastName'])) { $application->setLastName(trim($postArr['txtLastName'])); } if (isset($postArr['txtStreet1']) && !empty($postArr['txtStreet1'])) { $application->setStreet1(trim($postArr['txtStreet1'])); } if (isset($postArr['txtStreet2']) && !empty($postArr['txtStreet2'])) { $application->setStreet2(trim($postArr['txtStreet2'])); } if (isset($postArr['txtCity']) && !empty($postArr['txtCity'])) { $application->setCity(trim($postArr['txtCity'])); } if (isset($postArr['txtCountry']) && !empty($postArr['txtCountry'])) { $application->setCountry(trim($postArr['txtCountry'])); } if (isset($postArr['txtProvince']) && !empty($postArr['txtProvince'])) { $application->setProvince(trim($postArr['txtProvince'])); } if (isset($postArr['txtZip']) && !empty($postArr['txtZip'])) { $application->setZip(trim($postArr['txtZip'])); } if (isset($postArr['txtPhone']) && !empty($postArr['txtPhone'])) { $application->setPhone(trim($postArr['txtPhone'])); } if (isset($postArr['txtMobile']) && !empty($postArr['txtMobile'])) { $application->setMobile(trim($postArr['txtMobile'])); } if (isset($postArr['txtEmail']) && !empty($postArr['txtEmail'])) { $application->setEmail(trim($postArr['txtEmail'])); } if (isset($postArr['txtQualifications']) && !empty($postArr['txtQualifications'])) { $application->setQualifications(trim($postArr['txtQualifications'])); } if ($_FILES['txtResume']['size'] > 0) { if ($_FILES['txtResume']['error'] > 0) { $application->resumeData['error'] = $_FILES['txtResume']['error']; } else { $application->resumeData['name'] = $_FILES['txtResume']['name']; $application->resumeData['tmpName'] = $_FILES['txtResume']['tmp_name']; $application->resumeData['extension'] = strtolower(array_pop(explode(".", $_FILES['txtResume']['name']))); $application->resumeData['size'] = $_FILES['txtResume']['size']; } } return $application; }