public function init()
 {
     if (!$this->job) {
         return false;
     }
     /* @var \Auth\Entity\Info $userInfo */
     $userInfo = $this->user->getInfo();
     $name = $userInfo->getDisplayName();
     if ('' == trim($name)) {
         $name = $userInfo->getEmail();
     }
     $variables = ['name' => $name, 'title' => $this->job->getTitle()];
     $this->setTo($this->user->getInfo()->getEmail(), $this->user->getInfo()->getDisplayName(false));
     $this->setVariables($variables);
     $subject = 'New application for your vacancy "%s"';
     if ($this->isTranslatorEnabled()) {
         $subject = $this->getTranslator()->translate($subject);
     }
     $this->setSubject(sprintf($subject, $this->job->getTitle()));
     /* @var \Applications\Entity\Settings $settings */
     $settings = $this->user->getSettings('Applications');
     $body = $settings->getMailAccessText();
     if ('' == $body) {
         $body = "Hello ##name##,\n\nThere is a new application for your vacancy:\n\"##title##\"\n\n";
         if ($this->isTranslatorEnabled()) {
             $body = $this->getTranslator()->translate($body);
         }
     }
     $this->setBody($body);
     return $this;
 }
Beispiel #2
0
 /**
  * @testdox Allows setting the job title
  * @covers Jobs\Entity\Job::getTitle
  * @covers Jobs\Entity\Job::setTitle
  */
 public function testSetGetTitle()
 {
     $title = 'Software Developer';
     $this->target->setTitle($title);
     $this->assertEquals($title, $this->target->getTitle());
 }
 /**
  * @param Job $job
  * @return array
  */
 public function dehydrate(Job $job)
 {
     return array('title' => $job->getTitle(), 'location' => $job->getLocation(), 'link' => $this->url->__invoke('lang/jobs/view', [], ['query' => ['id' => $job->getId()], 'force_canonical' => true]), 'organization' => array('name' => $job->getOrganization()->getOrganizationName()->getName()), 'template_values' => array('requirements' => $job->getTemplateValues()->getRequirements(), 'qualification' => $job->getTemplateValues()->getQualifications(), 'benefits' => $job->getTemplateValues()->getBenefits()));
 }