Exemple #1
0
 public function __invoke(Job $jobEntity, $options = [])
 {
     $options = array_merge($this->options, $options);
     $ats = $jobEntity->getAtsMode();
     if ($ats->isDisabled()) {
         return '';
     }
     $paramsHelper = $this->paramsHelper;
     $serverUrlHelper = $this->serverUrlHelper;
     $urlHelper = $this->urlHelper;
     if ($ats->isIntern() || $ats->isEmail()) {
         $query = ['subscriberUri' => $serverUrlHelper(array()) . '/subscriber/' . 1];
         $route = 'lang/apply';
         $params = ['applyId' => $jobEntity->getApplyId(), 'lang' => $paramsHelper('lang')];
         if ($paramsHelper('channel')) {
             $params['channel'] = $paramsHelper('channel');
         }
         $url = $urlHelper($route, $params, array('query' => $query));
     } else {
         $url = $ats->getUri();
     }
     if ($options['linkOnly']) {
         $result = $url;
         if ($options['absolute']) {
             $result = $serverUrlHelper($url);
         }
     } else {
         $translate = $this->translateHelper;
         $result = sprintf('<a href="%s" rel="nofollow">%s</a>', $url, $translate('Apply'));
     }
     return $result;
 }