/**
  * Set the apply button of the job posting
  *
  * @return $this
  * @throws \InvalidArgumentException
  */
 protected function setUriApply()
 {
     if (!isset($this->job)) {
         throw new \InvalidArgumentException('cannot create a viewModel for Templates without a $job');
     }
     $atsMode = $this->job->getAtsMode();
     $uriApply = false;
     if ($atsMode->isIntern() || $atsMode->isEmail()) {
         $uriApply = $this->urlPlugin->fromRoute('lang/apply', array('applyId' => $this->job->getApplyId()), array('force_canonical' => true));
     } elseif ($atsMode->isUri()) {
         $uriApply = $atsMode->getUri();
     }
     $this->container['uriApply'] = $uriApply;
     return $this;
 }
 /**
  * Set the apply buttons of the job posting
  *
  * @return ViewModelTemplateFilterAbstract
  * @throws \InvalidArgumentException
  */
 protected function setApplyData()
 {
     if (!isset($this->job)) {
         throw new \InvalidArgumentException('cannot create a viewModel for Templates without a $job');
     }
     $data = ['applyId' => $this->job->getApplyId(), 'uri' => null, 'oneClickProfiles' => []];
     $atsMode = $this->job->getAtsMode();
     if ($atsMode->isIntern() || $atsMode->isEmail()) {
         $data['uri'] = $this->urlPlugin->fromRoute('lang/apply', ['applyId' => $this->job->getApplyId()], ['force_canonical' => true]);
     } elseif ($atsMode->isUri()) {
         $data['uri'] = $atsMode->getUri();
     }
     if ($atsMode->isIntern() && $atsMode->getOneClickApply()) {
         $data['oneClickProfiles'] = $atsMode->getOneClickApplyProfiles();
     }
     $this->container['applyData'] = $data;
     return $this;
 }
Beispiel #3
0
 public function __invoke(Job $jobEntity)
 {
     $ats = $jobEntity->getAtsMode();
     if ($ats->isDisabled()) {
         return '';
     }
     if ($ats->isIntern() || $ats->isEmail()) {
         $urlHelper = $this->urlHelper;
         $serverUrlHelper = $this->serverUrlHelper;
         $params = $this->paramsHelper;
         $query = array('subscriberUri' => $serverUrlHelper(array()) . '/subscriber/' . 1);
         $route = 'lang/apply';
         $params = array('applyId' => $jobEntity->getApplyId(), 'lang' => $params('lang'));
         $url = $urlHelper($route, $params, array('query' => $query));
     } else {
         $url = $ats->getUri();
     }
     $translate = $this->translateHelper;
     $result = sprintf('<a href="%s">%s</a>', $url, $translate('Apply'));
     return $result;
 }
Beispiel #4
0
 /**
  * @testdox Allows setting the status of a job posting
  * @covers Jobs\Entity\Job::getAtsMode
  */
 public function testAtsModeWithoutSetting()
 {
     $this->assertEquals($this->target->getAtsMode(), new AtsMode(AtsMode::MODE_INTERN));
 }