public function get_jobs($_keyword_str = '', $_industry = 0, $_country = '', $_employer = '', $_limit = '', $_offset = 0, $_order_by = 'jobs.created_on', $_order = 'DESC', $_salary_start = 0, $_salary_end = 0) { $jobs = array(); if (empty($_limit) || $_limit <= 0) { $_limit = $GLOBALS['default_results_per_page']; } if (empty($_keyword_str) && empty($_country) && empty($_employer) && ($_industry <= 0 || !is_numeric($_industry))) { $this->error = 'get_jobs : keywords, country, employer and industry cannot be empty.'; return false; } $criteria = array(); $criteria['order_by'] = $_order_by . ' ' . $_order; $criteria['industry'] = $_industry; $criteria['employer'] = $_employer; $criteria['country_code'] = $_country; $criteria['limit'] = $_limit; $criteria['offset'] = $_offset; $criteria['keywords'] = $_keyword_str; $criteria['is_local'] = 1; $criteria['salary'] = $_salary_start; $criteria['salary_end'] = $_salary_end; $this->log_api_usage('get_jobs : ' . $this->array_to_text($criteria)); $job_search = new JobSearch(); $result = $job_search->search_using($criteria); if ($result == 0) { return array(); } if ($result === false) { $this->error = 'get_jobs : JobSearch encountered an error.'; return false; } $jobs['total'] = $job_search->total_results(); $jobs['jobs'] = $result; return $jobs; }
<?php require_once dirname(__FILE__) . "/private/lib/utilities.php"; session_start(); $xml_dom = new XMLDOM(); if (!isset($_POST['action'])) { $job_search = new JobSearch(); $criteria = array(); $criteria['order_by'] = 'jobs.created_on desc'; $criteria['industry'] = 0; $criteria['employer'] = ''; $criteria['country_code'] = $GLOBALS['default_country_code']; $criteria['limit'] = $GLOBALS['default_results_per_page']; $criteria['offset'] = 0; $criteria['keywords'] = $_POST['keywords']; $criteria['is_local'] = 1; $criteria['salary'] = 0; $criteria['salary_end'] = 0; $_SESSION['yel']['job_search']['criteria'] = $criteria; if (isset($_POST['order_by'])) { $criteria['order_by'] = $_POST['order_by']; $_SESSION['yel']['job_search']['criteria']['order_by'] = $_POST['order_by']; } if (isset($_POST['industry'])) { $criteria['industry'] = $_POST['industry']; $_SESSION['yel']['job_search']['criteria']['industry'] = $_POST['industry']; } if (isset($_POST['employer'])) { $criteria['employer'] = $_POST['employer']; $_SESSION['yel']['job_search']['criteria']['employer'] = $_POST['employer']; }
if (!empty($_POST['keywords'])) { $criteria = array(); $criteria['order_by'] = 'jobs.created_on DESC'; $criteria['industry'] = 0; $criteria['employer'] = ''; $criteria['country_code'] = ''; $criteria['country'] = $_POST['country']; $criteria['limit'] = $GLOBALS['default_results_per_page']; $criteria['offset'] = 0; $criteria['keywords'] = $_POST['keywords']; if (isset($_POST['industry'])) { $criteria['industry'] = $_POST['industry']; } if (isset($_POST['employer'])) { $criteria['employer'] = $_POST['employer']; } $job_search = new JobSearch(); $result = $job_search->search_using($criteria); if (count($result) <= 0 || is_null($result) || $result === false) { echo ''; exit; } $output = array(); foreach ($result as $i => $row) { $output[] = '"' . trim(htmlspecialchars_decode($row['title'])) . '"'; } echo '[' . implode(',', $output) . ']'; exit; } echo '[]'; exit;