Пример #1
0
 /**
  * Search resume of search param
  *
  * Searchimg options
  * <code>
  * $options = array(
  *							"count"      => 10,
  *							"page"       => 0,
  *							"get_count"  => 1,
  *							);
  * </code>
  * 
  * @param array $search_param
  * @param array $options
  */
 public function SearchResume(array $search_param, array $options = array())
 {
     $search_param = array_merge($this->search_array, $search_param);
     $default_options = array("count" => 10, "page" => $_REQUEST['page'], "get_count" => 1, "no_moder" => 0);
     $options = array_merge($default_options, $options);
     $join_table = array("job_spheres" => array('id' => 'sphere_id'), "job_specialties" => array('id' => 'specialty_id'));
     $selection = array('job_resumes' => array('*'), 'job_spheres' => array('sphere_name' => 'name'), 'job_specialties' => array('specialty_name' => 'name', "spe_id" => 'id'));
     if ($this->use_country) {
         $join_table['job_countries'] = array("id" => 'country_id');
         $selection['job_countries'] = array('country_name' => 'name');
     }
     if ($this->use_city) {
         $join_table['job_cities'] = array('id' => 'city_id');
         $selection['job_cities'] = array('city_name' => 'name');
     }
     $this->dbase->BuildQuery('job_resumes', $join_table);
     $this->dbase->SetSelection($selection);
     $this->PreparationSearch($search_param);
     $this->PreparationResumeSearch($search_param);
     $this->AdditionSearchResume($search_param, $options);
     if (!empty($search_param['id'])) {
         if (is_array($search_param['id'])) {
             $this->dbase->SetWhere('id', $search_param['id'], "IN");
         } else {
             $this->dbase->SetWhere('id', $search_param['id']);
         }
     }
     if (intval($options['count']) <= 0) {
         $count['limit'] = 10;
     } else {
         $count['limit'] = intval($options['count']);
     }
     if ((int) $options['page'] > 0) {
         $count['start'] = ((int) $options['page'] - 1) * $count['limit'];
     } else {
         $count['start'] = 0;
     }
     if ($this->sort) {
         switch ($this->sort) {
             case "salary":
                 if ($this->sub_sort == "ASC") {
                     $order = array("salary_min_search" => "ASC");
                 } else {
                     $order = array("salary_max_search" => "DESC");
                 }
                 break;
             default:
                 $order = array($this->sort => $this->sub_sort);
                 break;
         }
     } else {
         $order = array();
     }
     $resourse = $this->dbase->ExecuteBuildQuery($order, $count);
     while ($row = $this->dbase->FetchArray($resourse)) {
         $this->resumes[$row['id']] = new Resume($row);
     }
     if ($options['get_count']) {
         $this->resumes_count = $this->dbase->CountForBuldQuery();
     }
 }