/**
  * test the parseData function
  */
 public function testParseData()
 {
     $_FILES['txtResume']['size'] = 0;
     $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);
 }
Пример #2
0
 /**
  * Handle job application by applicant
  */
 public function applyForJob()
 {
     $extractor = new EXTRACTOR_JobApplication();
     $jobApplication = $extractor->parseData($_POST);
     try {
         $jobApplication->save();
         $result = true;
     } catch (JobApplicationException $e) {
         $result = false;
     }
     // Send mail notifications
     $notifier = new RecruitmentMailNotifier();
     $notifier->sendApplicationReceivedEmailToManager($jobApplication);
     // We only need to display result of email sent to applicant
     $mailResult = $notifier->sendApplicationReceivedEmailToApplicant($jobApplication);
     $path = '/templates/recruitment/applicant/jobApplicationStatus.php';
     $objs['application'] = $jobApplication;
     $objs['vacancy'] = JobVacancy::getJobVacancy($jobApplication->getVacancyId());
     $objs['result'] = $result;
     $objs['mailResult'] = $mailResult;
     $template = new TemplateMerger($objs, $path);
     $template->display();
 }
 /**
  * Replaces the resume of the applicant.
  * $_POST contains the application ID
  */
 private function _replaceResume()
 {
     $this->_authenticateResumeAccess();
     $extractor = new EXTRACTOR_JobApplication();
     $jobApplication = $extractor->parseData($_POST);
     if ($jobApplication->resumeData['size'] > 0) {
         if ($jobApplication->isResumeCompatible()) {
             try {
                 $jobApplication->updateResume();
                 $objs['application'] = JobApplication::getJobApplication($jobApplication->getId());
                 // Contains new resume
                 $objs['message'] = 'Resume replaced';
             } catch (Exception $e) {
                 $objs['application'] = JobApplication::getJobApplication($jobApplication->getId());
                 // Still contains the old resume
                 $objs['message'] = 'Resume not replaced';
             }
         } else {
             $objs['application'] = JobApplication::getJobApplication($jobApplication->getId());
             $objs['message'] = $jobApplication->resumeData['error'];
         }
     } else {
         $objs['application'] = JobApplication::getJobApplication($jobApplication->getId());
     }
     $path = '/templates/recruitment/viewApplicationDetails.php';
     $template = new TemplateMerger($objs, $path);
     $template->display();
 }