public function renderTemplate()
 {
     $vacancy = null;
     // Получаем данные пользователя
     if ($RouteVacancyId = (int) $this->modx->getOption('RouteVacancyId')) {
         # $q = $this->modx->newQuery('SocietyTopicTag', array(
         #     "tag"  => $RouteTag,
         #     "active"    => 1,
         # ));
         #
         # $q->limit(1);
         # $vacancy = $this->modx->getObject('SocietyTopicTag', $q);
         $namespace = 'modxsite';
         $response = $this->modx->runProcessor('web/api/hh/vacancies/request', array("vacancy_id" => $RouteVacancyId), array('processors_path' => $this->modx->getObject('modNamespace', $namespace)->getCorePath() . 'processors/'));
         if (!$response->isError() and $result = $response->getObject() and empty($result['errors'])) {
             # print '<pre>';
             $vacancy = $result;
         }
         # print_r($vacancy);
         # exit;
     }
     # exit;
     if (!$vacancy) {
         return $this->modx->sendErrorPage();
     }
     $this->setSearchable(true);
     $this->setCanonical($this->makeCanonical($RouteVacancyId));
     $this->modx->smarty->assign('vacancy', $vacancy);
     $this->meta['meta_title'] = "Вакансия {$vacancy['name']}";
     return parent::renderTemplate();
 }
Exemple #2
0
 /**
  * Exeption handler
  *
  * @param Exception $exception The exception
  *
  * @return void
  */
 public static function exceptionHandler($exception)
 {
     // Code: 404=>not found, 500=>server error
     $code = $exception->getCode();
     if ($code != 404) {
         $code = 500;
     }
     http_response_code($code);
     if (\App\Config::SHOW_ERRORS) {
         static::errorBrowser($exception);
     } else {
         static::errorServer($exception);
         View::renderTemplate("{$code}.html");
         //because same namespace
     }
 }