Exemplo n.º 1
0
        $description = str_replace('<br>', ' ', $description);
        $description = str_replace('<br/>', ' ', $description);
        $description = str_replace('<br />', ' ', $description);
        $description = str_replace('&nbsp;', ' ', $description);
        $description = str_replace($new_lines, ' ', $description);
        $description = preg_replace('/<(.|\\n)*?>/', ' ', $description);
        $words = explode(' ', $description);
        $short_description = '';
        foreach ($words as $w => $word) {
            if ($w < 50) {
                $short_description .= trim($word) . ' ';
            }
        }
        $result[$i]['description'] = $short_description;
    }
    $response = array('results' => array('total' => $job_search->total_results(), 'elapsed' => number_format($job_search->time_elapsed(), 6), 'result' => $result));
    header('Content-type: text/xml');
    echo $xml_dom->get_xml_from_array($response);
    exit;
}
if ($_POST['action'] == 'get_job_info') {
    $criteria = array('columns' => 'jobs.*, currencies.symbol AS currency_symbol, industries.industry AS full_industry, 
                      countries.country AS country_name, employers.name AS employer_name, 
                      DATE_FORMAT(jobs.created_on, \'%e %b, %Y %k:%i:%s\') AS formatted_created_on, 
                      DATE_FORMAT(jobs.expire_on, \'%e %b, %Y %k:%i:%s\') AS formatted_expire_on, 
                      DATEDIFF(NOW(), jobs.expire_on) AS expired', 'joins' => 'industries ON industries.id = jobs.industry, 
                    countries ON countries.country_code = jobs.country, 
                    employers ON employers.id = jobs.employer, 
                    currencies ON currencies.country_code = employers.country', 'match' => 'jobs.id = \'' . $_POST['id'] . '\'');
    $jobs = Job::find($criteria);
    $job = array();
Exemplo n.º 2
0
 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;
 }