<?php
$obj_tab_search=new cls_tab_hr_job_search();
switch($get_app){
	case "search_edit":
		$obj_tab_job=new cls_tab_hr_job();
		$obj_tab_jobcategory=new cls_tab_hr_job_category();
		$arr_search=array();
		(isset($get_id))? $get_id=intval($get_id):$get_id=0;
		if($get_id>0){
			$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."hr_job_search where search_id='".$get_id."' and search_user_id='".$obj_ctl_user->id."'");
			if($obj_rs = $obj_db->fetch_array($obj_result))
			{
				$arr_search=$obj_rs;
				$arr_search["jobtype"]=get_radio_html($obj_tab_job->type,"search_jobtype",$arr_search["search_jobtype"]);
				$arr_search["jobcategory"]=$obj_tab_jobcategory->get_select_category("search_jobcategory",$arr_search["search_jobcategory"]);
				$arr_search["degree"]=get_select_html($obj_tab_job->degree,$arr_search["search_degree"]);
			}
		}
		if(count($arr_search)<1){
			$arr_x=$obj_db->get_fields(DB_PRE."hr_job_search");
			foreach($arr_x as $item){
				$arr_search[$item]="";
			}
			$arr_search["jobtype"]=get_radio_html($obj_tab_job->type,"search_jobtype");
			$arr_search["jobcategory"]=$obj_tab_jobcategory->get_select_category("search_jobcategory");
			$arr_search["degree"]=get_select_html($obj_tab_job->degree);
		}
		$arr_search["experience"]=$obj_tab_job->experience;
		$arr_search["pay"]=$obj_tab_job->pay;
		break;
	case "search_save":
		$arr_fields=array();
		(isset($get_id))? $get_id=intval($get_id):$get_id=0;
		$arr_fields["search_id"]=$get_id;
		$arr_fields["search_user_id"]=$obj_ctl_user->id;
		if(isset($get_search_name)) $arr_fields["search_name"]=$get_search_name;
		if(isset($get_search_jobtype)) $arr_fields["search_jobtype"]=$get_search_jobtype;
		if(isset($get_search_jobcategory)) $arr_fields["search_jobcategory"]=$get_search_jobcategory;
		if(isset($get_search_pay)) $arr_fields["search_pay"]=$get_search_pay;
		if(isset($get_search_pay_direction)) $arr_fields["search_pay_direction"]=$get_search_pay_direction;
		if(isset($get_search_area)) $arr_fields["search_area"]=$get_search_area;
		if(isset($get_search_pubtime)) $arr_fields["search_pubtime"]=$get_search_pubtime;
		if(isset($get_search_keyword)) $arr_fields["search_keyword"]=$get_search_keyword;
		if(isset($get_search_degree)) $arr_fields["search_degree"]=$get_search_degree;
		if(isset($get_search_degree_direction)) $arr_fields["search_degree_direction"]=$get_search_degree_direction;
		if(isset($get_search_experience)) $arr_fields["search_experience"]=$get_search_experience;
		if(isset($get_search_experience_direction)) $arr_fields["search_experience_direction"]=$get_search_experience_direction;
		if(isset($get_search_sex)) $arr_fields["search_sex"]=$get_search_sex;
		if(isset($get_search_age)) $arr_fields["search_age"]=$get_search_age;
		if(isset($get_search_age_direction)) $arr_fields["search_age_direction"]=$get_search_age_direction;
		if(isset($get_search_marry)) $arr_fields["search_marry"]=$get_search_marry;
		if(isset($get_search_additional)) $arr_fields["search_additional"]=$get_search_additional;
		if(count($arr_fields)>2){
			$arr_msg=$obj_tab_search->on_save($arr_fields);
		}
		break;
	case "search_list":
		if(isset($get_act)&&$get_act=="del"&&isset($get_id)&&$get_id>0){
			$arr_msg=$obj_tab_search->on_del($get_id);
			if($arr_msg["err"]!="")
			{
				$obj_msg->alert($arr_msg["err"]);
			}
		}
		if(isset($get_act)&&$get_act=="del_s"&&isset($get_jobids)){
			$arr_msg=$obj_tab_search->on_del($get_jobids);
			if($arr_msg["err"]!="")
			{
				$obj_msg->alert($arr_msg["err"]);
			}
		}
		$str_where=" where search_user_id='".$obj_ctl_user->id."'";
		$arr_search=array();
		$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."hr_job_search".$str_where);
		while($obj_rs = $obj_db->fetch_array($obj_result))
		{
			$obj_rs["search_addtime"]=format_date($obj_rs["search_addtime"]);
			$arr_search[]=$obj_rs;
		}
}


?>