Пример #1
0
 /**
  * @return array
  */
 protected function _getFields()
 {
     if ($this->_fields) {
         return $this->_fields;
     }
     if (!$this->_auto->config['general_cache'] || !($this->_fields = Cache::GetArrayCache('fields'))) {
         $this->_fields = array();
         $this->_db->Select('auto_fields', array('*'), array('active' => 1));
         while ($field = $this->_db->FetchArray()) {
             $this->_fields[$field['id']] = $field;
         }
         Cache::SetArrayCache('fields', $this->_fields);
     }
     return $this->_fields;
 }
Пример #2
0
 public function GetFields()
 {
     $fields = array();
     $this->_db->Select('job_fields', array('ctype', 'title', 'required', 'type', 'default', 'id', 'active'));
     while ($row = $this->_db->FetchArray()) {
         $fields[$row['id']] = $row;
     }
     return $fields;
 }
Пример #3
0
 protected function DelPhotos($auto_id)
 {
     $resource = $this->base->Select('auto_images', array("*"), array("auto_id" => $auto_id));
     while ($row = $this->base->FetchArray($resource)) {
         @unlink(ROOT_DIR . "/uploads/auto_foto/" . $row['model_id'] . "/" . $row['image_name']);
         @unlink(ROOT_DIR . "/uploads/auto_foto/" . $row['model_id'] . "/thumbs/" . $row['image_name']);
         $this->base->Delete('auto_images', array('id' => $row['id']));
     }
 }
Пример #4
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();
     }
 }