/**
  * Parse data from interface and return JobApplicationEvent Object
  * @param Array $postArr Array containing POST values
  * @return JobApplicationEvent Job Application Event object
  */
 public function parseAddData($postArr)
 {
     $event = new JobApplicationEvent();
     // Application ID
     $id = $postArr['appId'];
     $event->setApplicationId($id);
     if (isset($postArr['txtOwner'])) {
         $event->setOwner($postArr['txtOwner']);
     }
     if (isset($postArr['txtNotes'])) {
         $event->setNotes($postArr['txtNotes']);
     }
     return $event;
 }
 /**
  * Parse data from interface and return JobApplicationEvent Object
  * @param Array $postArr Array containing POST values
  * @return JobApplicationEvent Job Application Event object
  */
 public function parseAddData($postArr)
 {
     $event = new JobApplicationEvent();
     $id = $postArr['txtId'];
     $event->setApplicationId($id);
     $date = $postArr['txtDate'];
     $time = $postArr['txtTime'];
     $dateTime = LocaleUtil::getInstance()->convertToStandardDateTimeFormat($date . ' ' . $time);
     $event->setEventTime($dateTime);
     $interviewer = $postArr['cmbInterviewer'];
     $event->setOwner($interviewer);
     $notes = $postArr['txtNotes'];
     $event->setNotes($notes);
     return $event;
 }
 /**
  * Test the sendInterviewTaskToManager function
  */
 public function testSendInterviewTaskToManager()
 {
     $jobApplication = $this->jobApplications[1];
     $jobApplication->setStatus(JobApplication::STATUS_FIRST_INTERVIEW_SCHEDULED);
     $jobApplication->save();
     $jobAppEvent = JobApplicationEvent::getJobApplicationEvent(1);
     $notifier = new RecruitmentMailNotifier();
     $mockMailer = new MockMailer();
     $notifier->setMailer($mockMailer);
     $notifier->sendInterviewTaskToManager($jobAppEvent);
     $attachments = $mockMailer->getAttachments();
     $this->assertEquals(3, count($attachments));
 }
Пример #4
0
 /**
  * Get Job Application Event with the passed parameters
  *
  * @param int $id Job Application Event Id
  * @param int $appId Job Application Event Id
  * @param string $createdTime
  * @param string $createdBy
  * @param int $owner
  * @param string $eventTime
  * @param int $eventType
  * @param int $status
  * @param string $notes
  */
 private function _getEvent($id, $appId, $createdTime, $createdBy, $owner, $eventTime, $eventType, $status, $notes)
 {
     $event = new JobApplicationEvent();
     $event->setId($id);
     $event->setApplicationId($appId);
     $event->setCreatedTime($createdTime);
     $event->setCreatedBy($createdBy);
     $event->setOwner($owner);
     $event->setEventTime($eventTime);
     $event->setEventType($eventType);
     $event->setStatus($status);
     $event->setNotes($notes);
     return $event;
 }
Пример #5
0
 /**
  * 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);
 }
Пример #6
0
 public function getEvents()
 {
     if (!isset($this->events) && isset($this->id)) {
         // Get application events
         $events = JobApplicationEvent::getEvents($this->id);
         $this->events = $events;
     }
     return $this->events;
 }
Пример #7
0
 /**
  * Creates a JobApplicationEvent object from a resultset row
  *
  * @param array $row Resultset row from the database.
  * @return JobApplicationEvent JobApplicationEvent object.
  */
 private static function _createFromRow($row)
 {
     $event = new JobApplicationEvent($row[self::DB_FIELD_ID]);
     $event->setApplicationId($row[self::DB_FIELD_APPLICATION_ID]);
     $event->setCreatedTime($row[self::DB_FIELD_CREATED_TIME]);
     $event->setCreatedBy($row[self::DB_FIELD_CREATED_BY]);
     $event->setOwner($row[self::DB_FIELD_OWNER]);
     $event->setEventTime($row[self::DB_FIELD_EVENT_TIME]);
     $event->setEventType($row[self::DB_FIELD_EVENT_TYPE]);
     $event->setStatus($row[self::DB_FIELD_STATUS]);
     $event->setNotes($row[self::DB_FIELD_NOTES]);
     if (isset($row[self::OWNER_NAME])) {
         $event->setOwnerName($row[self::OWNER_NAME]);
     }
     return $event;
 }