<?php
$obj_tab_jobcategory=new cls_tab_hr_job_category();
$obj_tab_resume=new cls_tab_hr_resume();
$arr_resume=array();

//是否生成html文件
$this_html=$obj_tab_resume->get_htmlinfo($obj_ctl_user->id);

(!isset($get_id))? $get_id=0:$get_id=intval($get_id);
if(isset($get_act)&&$get_act=="save"){
	$arr_fields=array();
	$arr_fields["resume_id"]=$get_id;
	if(isset($get_resume_name)) $arr_fields["resume_name"]=$get_resume_name;
	if(isset($get_resume_birthday)&&is_date($get_resume_birthday)) $arr_fields["resume_birthday"]=format_date_int($get_resume_birthday);
	if(isset($get_resume_voucherid)) $arr_fields["resume_voucherid"]=$get_resume_voucherid;
	if(isset($get_resume_sex)) $arr_fields["resume_sex"]=$get_resume_sex;
	if(isset($get_resume_national)) $arr_fields["resume_national"]=$get_resume_national;
	if(isset($get_resume_marry)) $arr_fields["resume_marry"]=$get_resume_marry;
	if(isset($get_resume_zzmm)) $arr_fields["resume_zzmm"]=$get_resume_zzmm;
	if(isset($get_resume_household)) $arr_fields["resume_household"]=$get_resume_household;
	if(isset($get_resume_area)) $arr_fields["resume_area"]=$get_resume_area;
	if(isset($get_resume_height)) $arr_fields["resume_height"]=$get_resume_height;
	if(isset($get_resume_weight)) $arr_fields["resume_weight"]=$get_resume_weight;
	if(isset($get_resume_school)) $arr_fields["resume_school"]=$get_resume_school;
	if(isset($get_resume_major)) $arr_fields["resume_major"]=$get_resume_major;
	if(isset($get_resume_degree)) $arr_fields["resume_degree"]=$get_resume_degree;
	if(isset($get_resume_leaveschool)) $arr_fields["resume_leaveschool"]=$get_resume_leaveschool;
	if(isset($get_resume_tel)) $arr_fields["resume_tel"]=$get_resume_tel;
	if(isset($get_resume_tel2)) $arr_fields["resume_tel2"]=$get_resume_tel2;
	if(isset($get_resume_email)) $arr_fields["resume_email"]=$get_resume_email;
	if(isset($get_resume_weburl)) $arr_fields["resume_weburl"]=$get_resume_weburl;
	if(isset($get_resume_qq)) $arr_fields["resume_qq"]=$get_resume_qq;
	if(isset($get_resume_address)) $arr_fields["resume_address"]=$get_resume_address;
	if(isset($get_resume_eduhistory)) $arr_fields["resume_eduhistory"]=$get_resume_eduhistory;
	if(isset($get_resume_trainhistory)) $arr_fields["resume_trainhistory"]=$get_resume_trainhistory;
	if(isset($get_resume_workhistory)) $arr_fields["resume_workhistory"]=$get_resume_workhistory;
	if(isset($get_resume_skill)) $arr_fields["resume_skill"]=$get_resume_skill;
	if(isset($get_resume_result)) $arr_fields["resume_result"]=$get_resume_result;
	if(isset($get_resume_favorite)) $arr_fields["resume_favorite"]=$get_resume_favorite;
	if(isset($get_resume_intro)) $arr_fields["resume_intro"]=$get_resume_intro;
	if(isset($get_resume_jobtype)) $arr_fields["resume_jobtype"]=$get_resume_jobtype;
	if(isset($get_resume_jobcategory)) $arr_fields["resume_jobcategory"]=$get_resume_jobcategory;
	if(isset($get_resume_jobarea)) $arr_fields["resume_jobarea"]=$get_resume_jobarea;
	if(isset($get_resume_jobpay)) $arr_fields["resume_jobpay"]=$get_resume_jobpay;
	if(isset($get_resume_jobname)) $arr_fields["resume_jobname"]=$get_resume_jobname;
	if(isset($get_resume_availability)) $arr_fields["resume_availability"]=$get_resume_availability;
	if(isset($get_resume_privacy)) $arr_fields["resume_privacy"]=$get_resume_privacy;
	if(count($arr_fields)>1){
		$arr_msg=$obj_tab_resume->on_save($arr_fields);
		if($arr_msg["err"]!=""){
			$obj_msg->alert($arr_msg["err"]);
		}else{
			switch($get_app){
				case "base_step1":
					if($get_resume_name!=""&&$get_resume_birthday!=""&&$get_resume_voucherid!=""&&$get_resume_national!=""&&$get_resume_zzmm!=""&&$get_resume_household!=""&&$get_resume_area!=""&&$get_resume_height!=""&&$get_resume_weight!=""){
						$str_val=2;
					}else{
						$str_val=1;
					}
					$obj_tab_resume->on_progress(0,$str_val);
					go_url("?app=base_step2");
					break;
				case "base_step2":
					if($get_resume_leaveschool!=""&&$get_resume_degree!=""&&$get_resume_major!==""&&$get_resume_school!=""){
						$str_val=2;
					}else{
						$str_val=1;
					}
					$obj_tab_resume->on_progress(1,$str_val);
					go_url("?app=base_step3");
					break;
				case "base_step3":
					if($get_resume_tel!=""&&$get_resume_tel2!=""&&$get_resume_email!==""&&$get_resume_qq!=""&&$get_resume_weburl!=""&&$get_resume_address!=""){
						$str_val=2;
					}else{
						$str_val=1;
					}
					$obj_tab_resume->on_progress(2,$str_val);
					go_url("?app=base_step4");
					break;
				case "base_step4":
					if($get_resume_eduhistory!=""&&$get_resume_trainhistory!=""&&$get_resume_workhistory!==""){
						$str_val=2;
					}else{
						$str_val=1;
					}
					$obj_tab_resume->on_progress(3,$str_val);
					go_url("?app=base_step5");
					break;
				case "base_step5":
					if($get_resume_skill!=""&&$get_resume_result!=""&&$get_resume_favorite!==""&&$get_resume_intro!=""){
						$str_val=2;
					}else{
						$str_val=1;
					}
					$obj_tab_resume->on_progress(4,$str_val);
					go_url("?app=base_step6");
					break;
				case "base_step6":
					if($get_resume_jobcategory!=""&&$get_resume_jobarea!=""&&$get_resume_jobpay!==""&&$get_resume_jobname!=""&&$get_resume_availability!=""){
						$str_val=2;
					}else{
						$str_val=1;
					}
					$obj_tab_resume->on_progress(5,$str_val);
					go_url("?app=base_step6");
					break;
				case "base_privacy":
					go_url("?app=base_privacy");
				default:
			}
		}
	}
}
$obj_tab_area=new cls_tab_sys_area();
$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."hr_resume where resume_user_id='".$obj_ctl_user->id."'");
if($obj_rs = $obj_db->fetch_array($obj_result))
{
	$arr_resume = $obj_rs;
	$arr_x=explode(",",$arr_resume["resume_progress_info"]);
	$lng_x=count($arr_x);
	for($i=1;$i<=$lng_x;$i++){
		$arr_state["step".$i]=$arr_x[$i-1];
	}
	if($lng_x<6){
		for($i=$lng_x+1;$i<7;$i++){
			$arr_state["step".$i]=0;
		}
	}
}else{
	//没有简介时，初始数据
	$arr_x=$obj_db->get_fields(DB_PRE."hr_resume");
	foreach($arr_x as $item){
		$arr_resume[$item]="";
	}
	$arr_state["step1"]=$arr_state["step2"]=$arr_state["step3"]=$arr_state["step4"]=$arr_state["step5"]=$arr_state["step6"]=0;
}
if(intval($arr_resume["resume_birthday"])>0) $arr_resume["resume_birthday"]=format_date($arr_resume["resume_birthday"],"Y-m-d");
$arr_resume["household"]=$obj_tab_area->get_select_area("resume_household",$arr_resume["resume_household"]);
$arr_resume["area"]=$obj_tab_area->get_select_area("resume_area",$arr_resume["resume_area"]);
$arr_resume["marry"]=get_radio_html($obj_tab_resume->marry,"resume_marry",$arr_resume["resume_marry"]);
$arr_resume["zzmm"]=get_select_html($obj_tab_resume->zzmm,$arr_resume["resume_zzmm"]);
$arr_resume["national"]=get_select_html($obj_tab_resume->national,$arr_resume["resume_national"]);
$arr_resume["degree"]=get_select_html($obj_tab_resume->degree,$arr_resume["resume_degree"]);
$arr_resume["jobtype"]=get_radio_html($obj_tab_resume->jobtype,"resume_jobtype",$arr_resume["resume_jobtype"]);
$arr_resume["jobcategory"]=$obj_tab_jobcategory->get_select_category("resume_jobcategory",$arr_resume["resume_jobcategory"]);
$arr_resume["jobarea"]=$obj_tab_area->get_select_area("resume_jobarea",$arr_resume["resume_jobarea"]);
$arr_resume["availability"]=get_radio_html($obj_tab_resume->availability,"resume_availability",$arr_resume["resume_availability"],"<br>");
$arr_resume["jobpay"]=get_select_html($obj_tab_resume->jobpay,$arr_resume["resume_jobpay"]);
?>