/** * Module statistic * * @return array of stats */ public function Stats() { if (!($stats = Cache::GetArrayCache('stats'))) { $vac_all = $this->dbase->SelectOne('job_vacancies', array('count' => 'COUNT(*)')); $vac_on_site = $this->dbase->SelectOne('job_vacancies', array('count' => 'COUNT(*)'), array('allow_site' => 1)); $this->dbase->SetWhere('add_date', $this->dbase->timer->cur_time - 24 * 60 * 60, ">"); $vac_today = $this->dbase->SelectOne('job_vacancies', array('count' => 'COUNT(*)')); $this->dbase->SetBeginBlockWhere(); $this->dbase->SetWhere("date_exp", $this->dbase->timer->cur_time, '>'); $this->dbase->SetWhere("vac_", '', "=", 'job_vacancies', 'OR'); $this->dbase->SetEndBlockWhere(); $vac_no_moder = $this->dbase->SelectOne("job_vacancies", array("count" => "COUNT(*)"), array('allow_site' => 0)); $vac_max = $this->dbase->SelectOne('job_vacancies', array('max' => 'MAX(id)')); $res_all = $this->dbase->SelectOne('job_resumes', array('count' => 'COUNT(*)')); $res_on_site = $this->dbase->SelectOne('job_resumes', array('count' => 'COUNT(*)'), array('allow_site' => 1)); $this->dbase->SetWhere('add_date', $this->dbase->timer->cur_time - 24 * 60 * 60, ">"); $res_today = $this->dbase->SelectOne('job_resumes', array('count' => 'COUNT(*)')); $this->dbase->SetBeginBlockWhere(); $this->dbase->SetWhere("date_exp", $this->dbase->timer->cur_time, '>'); $this->dbase->SetWhere("vac_", '', "=", 'job_resumes', 'OR'); $this->dbase->SetEndBlockWhere(); $res_no_moder = $this->dbase->SelectOne("job_resumes", array("count" => "COUNT(*)"), array('allow_site' => 0)); $res_max = $this->dbase->SelectOne('job_resumes', array('max' => "MAX(id)")); $comp_all = $this->dbase->SelectOne('job_companies', array('count' => 'COUNT(*)')); $this->dbase->SetWhere('add_date', $this->dbase->timer->cur_time - 24 * 60 * 60, ">"); $comp_today = $this->dbase->SelectOne('job_companies', array('count' => 'COUNT(*)')); $stats = array('vacancy_all' => $vac_all['count'], 'vacancy_today' => $vac_today['count'], 'vacancy_on_site' => $vac_on_site['count'], 'vacancy_no_noder' => $vac_no_moder['count'], 'vacancy_max' => $vac_max['max'], 'resume_all' => $res_all['count'], 'resume_today' => $res_today['count'], 'resume_on_site' => $res_on_site['count'], 'resume_no_moder' => $res_no_moder['count'], 'resume_max' => $res_max['max'], 'company_all' => $comp_all['count'], 'company_today' => $comp_today['count']); Cache::SetArrayCache('stats', $stats); } return $stats; }
protected function PreparationSearch() { if ($this->use_country && !empty($this->search_array['country_id'])) { $this->base->SetWhere('country_id', $this->search_array['country_id'], '='); } if ($this->use_region && !empty($this->search_array['region_id'])) { $this->base->SetWhere('region_id', $this->search_array['region_id'], "="); } if (!empty($this->search_array['city_ids']) && is_array($this->search_array['city_ids'])) { $this->base->SetWhere('city_id', $this->search_array['city_ids'], 'IN'); } else { if (!empty($this->search_array['city_id'])) { if ($this->search_array['city_id'] != -1) { $this->base->SetWhere('city_id', $this->search_array['city_id'], "="); } else { $this->base->SetWhere('city_other', "", "!="); } } } if (!empty($this->search_array['mark_id'])) { $this->base->SetWhere('mark_id', $this->search_array['mark_id'], "="); } if (!empty($this->search_array['model_ids']) && is_array($this->search_array['model_ids'])) { $this->base->SetWhere('model_id', $this->search_array['model_ids'], 'IN'); } else { if (!empty($this->search_array['model_id'])) { if ($this->search_array['model_id'] != -1) { $this->base->SetWhere('model_id', $this->search_array['model_id'], "="); } else { $this->base->SetWhere('model_other', "", "!="); } } } if (!empty($this->search_array['race'])) { $this->base->SetWhere('race', $this->search_array['race'], '<='); } if (!empty($this->search_array['power_min']) && !empty($this->search_array['power_max'])) { $this->base->SetWhere('power', array($this->search_array['power_min'], $this->search_array['power_max']), "BETWEEN"); } elseif (!empty($this->search_array['power_max'])) { $this->base->SetWhere('power', $this->search_array['power_max'], "<="); } elseif (!empty($this->search_array['power_min'])) { $this->base->SetWhere('power', $this->search_array['power_min'], ">="); } if (!empty($this->search_array['year_min']) && !empty($this->search_array['year_max'])) { $this->base->SetWhere('year', array($this->search_array['year_min'], $this->search_array['year_max']), "BETWEEN"); } elseif (!empty($this->search_array['year_max'])) { $this->base->SetWhere('year', $this->search_array['year_max'], "<="); } elseif (!empty($this->search_array['year_min'])) { $this->base->SetWhere('year', $this->search_array['year_min'], ">="); } if (!empty($this->search_array['capacity_motor_min']) && !empty($this->search_array['capacity_motor_max'])) { $this->base->SetWhere('capacity_motor', array($this->search_array['capacity_motor_min'], $this->search_array['capacity_motor_max']), "BETWEEN"); } elseif (!empty($this->search_array['capacity_motor_max'])) { $this->base->SetWhere('capacity_motor', $this->search_array['capacity_motor_max'], "<="); } elseif (!empty($this->search_array['capacity_motor_min'])) { $this->base->SetWhere('capacity_motor', $this->search_array['capacity_motor_min'], ">="); } if (empty($this->search_array['currency']) || empty($this->config['currency'][$this->search_array['currency']])) { $this->search_array['currency'] = 'USD'; } if (!empty($this->search_array['cost_min']) && !empty($this->search_array['cost_max'])) { $this->base->SetWhere('cost_search', array($this->search_array['cost_min'] / $this->config['currency'][$this->search_array['currency']], $this->search_array['cost_max'] / $this->config['currency'][$this->search_array['currency']]), "BETWEEN"); } elseif (!empty($this->search_array['cost_max'])) { $this->base->SetWhere('cost_search', $this->search_array['cost_max'] / $this->config['currency'][$this->search_array['currency']], "<="); } elseif (!empty($this->search_array['cost_min'])) { $this->base->SetBeginBlockWhere(); $this->base->SetWhere('cost_search', $this->search_array['cost_min'] / $this->config['currency'][$this->search_array['currency']], ">="); $this->base->SetWhere('cost_search', 0, "=", '', 'OR'); $this->base->SetEndBlockWhere(); Licencing::check(); } if (!empty($this->search_array['author'])) { $this->base->SetWhere('author', urldecode($this->search_array['author']), '='); } if (!empty($this->search_array['contact_person'])) { $this->base->SetWhere('contact_person', $this->search_array['contact_person'], "LIKE"); } if (!empty($this->search_array['isset_photo'])) { $this->base->SetWhere('photo', "0", "!="); } foreach ($this->sel_fields as $name => $value) { if (!empty($this->search_array[$name]) && !empty($value['values'][$this->search_array[$name]])) { $this->base->SetWhere($name, $this->search_array[$name], "="); } } foreach ($this->checkbox_fields as $name => $value) { if (!empty($this->search_array[$name])) { $this->base->SetWhere($name, 1, "="); } } if (!empty($this->search_array['author_id'])) { $this->base->SetWhere('author_id', $this->search_array['author_id'], "="); } elseif (!empty($this->search_array['guest_session'])) { $this->base->SetWhere('guest_session', $this->search_array['guest_session'], "="); } }