$category_var_name = $id; $category = get_category_by_var_name($category_var_name); $category_id = $category['id']; $type_var_name = $extra; $type_id = get_type_id_by_varname($type_var_name); $jobsCount = 0; if ($type_id) { $jobsCount = $job->CountJobs($id, $type_id); } else { $jobsCount = $job->CountJobs($id); } $paginatorLink = BASE_URL . URL_JOBS . "/{$category_var_name}"; if (isset($type_var_name)) { $paginatorLink .= "/{$type_var_name}"; } $paginator = new Paginator($jobsCount, JOBS_PER_PAGE, @$_REQUEST['p']); $paginator->setLink($paginatorLink); $paginator->paginate(); $firstLimit = $paginator->getFirstLimit(); $lastLimit = $paginator->getLastLimit(); $the_jobs = $job->GetPaginatedJobsForCategory($category_id, $firstLimit, JOBS_PER_PAGE, $type_id); $smarty->assign("pages", $paginator->pages_link); $smarty->assign('jobs', $the_jobs); $smarty->assign('jobs_count', $jobsCount); $smarty->assign('types', get_types()); $smarty->assign('current_category', $category_var_name); $smarty->assign('current_category_name', $category['name']); $smarty->assign('seo_title', $category['title']); $smarty->assign('seo_desc', $category['description']); $smarty->assign('seo_keys', $category['keywords']); $template = 'category.tpl';
$job = new Job($id); if ($job->Exists() && $extra != '' && $extra == $job->GetAuth()) { $info = $job->GetInfo(); $url = BASE_URL . URL_JOB . '/' . $id . '/' . $info['url_title'] . '/'; $app = new JobApplication($id); $apps_count = $app->Count(); $info['applied_count'] = $apps_count; $smarty->assign('count_applicants', $apps_count); $smarty->assign('job', $info); $category = get_category_by_id($info['category_id']); // set paginator link $paginatorLink = BASE_URL . 'view-applicants/' . $id . '/' . $extra . '/'; $paginator = new Paginator($apps_count, JOBS_PER_PAGE, @$_REQUEST['p']); $paginator->setLink($paginatorLink); $paginator->paginate(); $from = $paginator->getFirstLimit(); $to = $paginator->getLastLimit(); // grab all jobs applied $the_applicants = $app->getAllForJob($from, JOBS_PER_PAGE); $smarty->assign('applicants', $the_applicants); // send page links to template $smarty->assign('pages', $paginator->pages_link); $smarty->assign('seo_title', $translator->translate("jobs.html_title", stripslashes($info['title']), stripslashes($info['company']), SITE_NAME)); $smarty->assign('cv_path', BASE_URL . FILE_UPLOAD_DIR); $smarty->assign('current_category', $category['var_name']); $smarty->assign('back_link', BASE_URL . 'manage/' . $id . '/' . $extra . '/'); $template = 'job-applications.tpl'; } else { redirect_to(BASE_URL . URL_JOB . '/' . $id . '/'); exit; }