<?php
$obj_tab_apply=new cls_tab_hr_job_apply();

switch($get_app){
	case "apply_edit":
		break;
	case "apply_save":
		break;
	default:
		if(isset($get_act)&&$get_act=="del"&&isset($get_id)&&$get_id>0){
			$arr_msg=$obj_tab_apply->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_apply->on_del($get_jobids);
			if($arr_msg["err"]!="")
			{
				$obj_msg->alert($arr_msg["err"]);
			}
		}
		$str_where=" where apply_company_user_id='".$obj_ctl_user->id."'";
		$arr_apply=array();
		$arr_resume_id=array();
		$arr_user_id=array();
		$arr_job=array();
		$arr_job_id=array();
		$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."hr_job_apply".$str_where);
		while($obj_rs = $obj_db->fetch_array($obj_result))
		{
			$obj_rs["addtime"]=format_date($obj_rs["apply_addtime"]);
			$arr_user_id[]=$obj_rs["apply_user_id"];
			$arr_job_id[]=$obj_rs["apply_job_id"];
			$arr_apply[]=$obj_rs;
		}
		if(count($arr_user_id)>0){
			$str_user_ids=implode(",",$arr_user_id);
			$obj_result = $obj_db->query("SELECT resume_id,resume_user_id,resume_name,resume_sex,resume_birthday FROM ".DB_PRE."hr_resume where resume_user_id in(".$str_user_ids.")");
			while($obj_rs = $obj_db->fetch_array($obj_result))
			{
				$obj_rs["age"]="";
				$lng_year_now=format_date(TIME,"Y");
				$lng_year=format_date($obj_rs["resume_birthday"],"Y");
				if($lng_year>0) $obj_rs["age"]=$lng_year_now-$lng_year;
				$arr_resume["id_".$obj_rs["resume_user_id"]]=$obj_rs;
			}
			$str_job_ids=implode(",",$arr_job_id);
			$obj_result = $obj_db->query("SELECT job_id,job_name FROM ".DB_PRE."hr_job where job_id in(".$str_job_ids.")");
			while($obj_rs = $obj_db->fetch_array($obj_result))
			{
				$arr_job["id_".$obj_rs["job_id"]]=$obj_rs;
			}
		}
}

//设置状态被查看过
$obj_db->execute("update ".DB_PRE."hr_job_apply set apply_state=1".$str_where);

?>