Esempio n. 1
0
 public function init()
 {
     self::$db = \init::app()->getDBConnector();
     if (!$this->_mod_access) {
         throw new \CException(\init::t('init', 'Access denied!'));
     }
     $this->_type = \init::app()->_getPanel();
     $this->_pk = 'JobsID';
     $this->_table_name = 'jobs';
 }
Esempio n. 2
0
 public function actionView()
 {
     $this->layout('main_light_jobs');
     if (\init::app()->getRequest()->getParam('date')) {
         // We don't want to index pages with get param date
         $this->block = true;
     }
     $url = \init::app()->getRequest()->getParam('url');
     $parse_url = explode('-', $url, 2);
     $job_id = $parse_url[0];
     if ($job_id) {
         $job = $this->_mjobs->getJobsID($job_id);
         if ($this->_auth) {
             if (empty($this->_minteresting_jobs)) {
                 $this->_minteresting_jobs = \init::app()->getModels('interesting_jobs/minteresting_jobs');
             }
             $interesting_job = $this->_minteresting_jobs->checkInterestedJobByUser($job_id, $this->_auth['id']);
             $job['InterestingJobsID'] = $interesting_job ? $interesting_job['InterestingJobsID'] : 0;
         }
         if (!$job) {
             $deleted = $this->_mjobs_deleted->getJobByID($job_id);
             if ($deleted) {
                 $this->render('view_deleted', array('_auth' => $this->_auth, '_locale' => $this->_locale));
             }
             return;
         }
         if ($parse_url[1] !== $job['jobs_url']) {
             $this->redirect('/jobs/jobs-not-found');
             throw new CHttpException(404, \init::t('init', 'Page not found'));
         }
         $company = $this->_mcompany->getCompanyID($job['CompanyID']);
         $user = $this->_musers->getUserID($job['UserID']);
         $resume_count = 0;
         if ($this->_auth) {
             $user_view = $this->_musers->getUserID($this->_auth['id']);
             $resume_count = $user_view['resume_count'];
         }
         $job_cities = $this->_mjobs_city->getCitiesByJobID($job_id);
         // Get similar jobs
         $params = array('job' => array('text_query' => $job['jobs_title'], 'query' => $this->getSearchQueryByText($job['jobs_title']), 'city' => [$job_cities[0]->CityID => $job_cities[0]->CityID]));
         $similar_query = http_build_query($params);
         $similar_jobs = $this->_mjobs->search($params['job'], 1, NULL, 7);
         foreach ($similar_jobs['data'] as $key => $value) {
             if ($similar_jobs['data'][$key]->JobsID == $job['JobsID']) {
                 unset($similar_jobs['data'][$key]);
                 break;
             }
         }
         $this->params['suitable_jobs_url'] = '/jobs/search?' . $similar_query;
         // Set meta tags
         $job_city = explode(',', $job['jobs_citi']);
         $city_name = $job_city[0];
         $city_data = $this->_mciti->getCityDataByCityName($city_name);
         $this->title = $job['company_name'] . ': работа ' . $job['jobs_title'] . ' в ' . $city_data['in_name'] . '. Вакансии ' . $job['jobs_title'] . ' - vrabote.ua';
         $this->description = 'Работа ' . $job['jobs_title'] . ' в ' . $city_data['in_name'] . ' в компании ' . $job['company_name'] . ', вакансия ' . $job['jobs_title'] . ' в ' . $job['company_name'] . '. Поиск работы в ' . $job['company_name'] . ' в ' . $city_data['in_name'] . ' через портал vrabote.ua';
         $this->keywords = $job['company_name'] . ', работа, ' . $job['jobs_title'] . ', ' . $city_data['in_name'] . ', вакансии, vrabote.ua';
         $this->auth = $this->_auth;
         if ($this->_auth) {
             $this->params['InterestingJobsID'] = $job['InterestingJobsID'];
             $this->params['JobsID'] = $job['JobsID'];
         }
         $this->params['locale']['Add interesting'] = $this->_locale['Add interesting'];
         $this->params['locale']['In interesting'] = $this->_locale['In interesting'];
         $this->breadcrumbs = [0 => ['title' => $this->_locale['main'], 'url' => '/'], 1 => ['title' => $this->_locale['Careers'], 'url' => '/вакансии']];
         $prof_item = false;
         if ($job['profession']) {
             $prof_item = $this->_mprofessions->getProfessionByUrl($job['profession']);
             $this->breadcrumbs[] = ['title' => $prof_item['name'], 'url' => '/professions/' . $prof_item['url'] . '/' . $job['jobs_citi']];
         }
         $this->breadcrumbs[] = ['title' => $job['jobs_title'], 'url' => $job['jobs_url']];
         $this->render('view', array('job' => $job, 'similar_query' => '/jobs/search?' . $similar_query, 'similar_jobs' => $similar_jobs['data'], 'user' => $user, '_auth' => $this->_auth, 'company' => $company, 'jobs_city' => explode(', ', $job['jobs_citi']), 'resume_count' => $resume_count, '_auth' => $this->_auth, '_locale' => $this->_locale));
     }
 }