Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $criteria = new CDbCriteria;
- $criteria->with = array(
- 'confirm' => array(
- 'alias' => 'co',
- 'select' => 'co.confirm_date'
- ),
- 'users_group' => array(
- 'alias' => 'g',
- 'select' => 'g.name'
- ),
- 'jobseeker_bio' => array(
- 'alias' => 'b',
- 'select' => 'b.complete_name, b.birth_place, b.status, TIMESTAMPDIFF(YEAR,`b.birth_date`,CURDATE()) AS age'
- ),
- 'last_edu' => array(
- 'alias' => 'e',
- 'select' => 'e.thesis_title, e.role_year, e.finish_year, e.ipk',
- ),
- 'jobseeker_bio.origin_province' => array(
- 'alias' => 'op',
- 'select' => 'op.name'
- ),
- 'jobseeker_bio.origin_city' => array(
- 'alias' => 'oc',
- 'select' => 'oc.name'
- ),
- 'jobseeker_bio.province' => array(
- 'alias' => 'p',
- 'select' => 'p.name'
- ),
- 'jobseeker_bio.city' => array(
- 'alias' => 'c',
- 'select' => 'c.name'
- ),
- 'last_edu.university' => array(
- 'alias' => 'u',
- 'select' => 'u.name',
- ),
- 'last_edu.last_major' => array(
- 'alias' => 'm',
- 'select' => 'm.name'
- ),
- 'last_exp' => array(
- 'alias' => 'x',
- 'select' => 'x.position, x.role_date, x.exit_date',
- ),
- 'last_exp.industry' => array(
- 'alias' => 'i',
- 'select' => 'i.name'
- ),
- 'last_exp.vacancy_function' => array(
- 'alias' => 'f',
- 'select' => 'f.name'
- ),
- 'last_exp.careerpedia_position' => array(
- 'alias' => 'cp',
- 'select' => 'cp.job_position'
- )
- );
- $criteria->select = 't.email, t.block, t.register_date';
- // Search the user group condition
- if ($this->users_group_id != null)
- $criteria->compare('t.users_group_id',$this->users_group_id);
- else
- $criteria->compare('t.users_group_id',array(4,5,6,7,8));
- // Search between condition on register date
- if ($this->register_date_start != null && $this->register_date_end != null) {
- $start = date('Y-m-d H:i:s', strtotime($this->register_date_start));
- $end = date('Y-m-d H:i:s', strtotime($this->register_date_end));
- $criteria->addBetweenCondition('t.register_date', $start, $end);
- }
- $criteria->compare('b.birth_place', $this->birth_place_search, true);
- $criteria->compare('b.sex', $this->sex_search);
- if ($this->city_search != null)
- $criteria->compare('b.city_id', $this->city_search);
- else
- $criteria->compare('b.province_id', $this->province_search);
- if ($this->origin_city_search != null)
- $criteria->compare('b.origin_city_id', $this->origin_city_search);
- else
- $criteria->compare('b.origin_province_id', $this->origin_province_search);
- if ($this->age_start != null && $this->age_end != null)
- $criteria->addBetweenCondition('((YEAR(CURDATE())-YEAR(b.birth_date)) - (RIGHT(CURDATE(),5)<RIGHT(b.birth_date,5)))',$this->age_start,$this->age_end);
- $criteria->compare('b.status', $this->marital_status_search);
- $criteria->compare('e.univ_name_id', $this->university_id);
- $criteria->compare('e.degree', $this->degree_search);
- $criteria->compare('e.ccn_major_id', $this->major_search);
- $criteria->compare('e.ccn_major_id', $this->major_search);
- $criteria->compare('e.ccn_major_id', $this->major_search);
- if ($this->role_year_start != null && $this->role_year_end != null)
- $criteria->addBetweenCondition('e.role_year', $this->role_year_start, $this->role_year_end);
- if ($this->finish_year_start != null && $this->finish_year_end != null)
- $criteria->addBetweenCondition('e.finish_year', $this->finish_year_start, $this->finish_year_end);
- if ($this->ipk_search != null)
- $criteria->compare('e.ipk', '>= '.$this->ipk_search);
- $criteria->compare('x.position', $this->job_pos_search);
- $criteria->compare('t.block',$this->block);
- if(!isset($_GET['AdvanceSearch_sort']))
- $criteria->order = 't.register_date DESC';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement