<?php
$obj_tab_upload_attatch=new cls_tab_other_upload_attatch();
switch($get_act){
	case "save":
		$this_msg="";
		$arr_return=$obj_tab_upload_attatch->on_upload();
		if($arr_return["err"]=="")
		{
			if($get_index==-1){
				$obj_tab_resume=new cls_tab_hr_resume();
				$obj_result=$obj_db->query("select resume_id from ".DB_PRE."hr_resume where resume_user_id=".$obj_ctl_user->id);
				if($obj_rs=$obj_db->fetch_array($obj_result)){
					$lng_id=$obj_rs["resume_id"];
					$arr_fields=array();
					$arr_fields["resume_id"]=$lng_id;
					$arr_fields["resume_photo"]=$arr_return["path"];
					if($obj_tab_sys_config->get_val("personal","photo_state")!=""){//如果系统设置了默认头像状态
						$arr_fields["resume_photo_state"]=intval($obj_tab_sys_config->get_val("personal","photo_state"));
					}
					$arr_msg=$obj_tab_resume->on_save($arr_fields);
				}else{
					$arr_msg["err"]="用户简历不存在";
				}
				if($arr_msg["err"]!=""){
					$this_msg=$arr_msg["err"];
				}
			}else{
				$obj_tab_hr_photo=new cls_tab_hr_photo();
				$arr_fields=array();
				$arr_fields["photo_user_id"]=$obj_ctl_user->id;
				$arr_fields["photo_url"]=$arr_return["path"];
				if($obj_tab_sys_config->get_val("personal","photo_state")!=""){//如果系统设置了默认头像状态
					$arr_fields["photo_state"]=intval($obj_tab_sys_config->get_val("personal","photo_state"));
				}
				$arr_msg=$obj_tab_hr_photo->on_save($arr_fields);
				if($arr_msg["err"]!=""){
					$this_msg=$arr_msg["err"];
				}
			}
		}else{
			$this_msg=$arr_return["err"];
		}
		break;
	case "desc":
		$photo_desc="";
		$obj_result=$obj_db->query("select photo_desc from ".DB_PRE."hr_photo where photo_id=".$get_id);
		if($obj_rs=$obj_db->fetch_array($obj_result)){
			$photo_desc=$obj_rs["photo_desc"];
		}
		break;
	case "savedesc":
		$arr_return=array("id"=>0,"msg"=>"成功保存");
		if(isset($get_id) && is_numeric($get_id) && isset($get_photo_desc)){
			$obj_tab_hr_photo=new cls_tab_hr_photo();
			$arr_fields=array();
			$arr_fields["photo_id"]=$get_id;
			$arr_fields["photo_desc"]=$get_photo_desc;
			$arr_msg=$obj_tab_hr_photo->on_save($arr_fields);
			if($arr_msg["err"]!=""){
				$arr_return["id"]=1;
				$arr_return["msg"]=$arr_msg["err"];
			}
		}else{
			$arr_return["id"]=1;
			$arr_return["msg"]="参数输入有误";
		}
		echo $obj_msg->json_encode($arr_return);exit;
		break;
	default:
		$this_allowpic=implode(",",$obj_tab_upload_attatch->get_allow_pic());
		$this_allowsize=format_filesize($obj_tab_upload_attatch->get_upload_config("filesize"),"M")."M";
}
?>