<?php
/*
 * 74cms 个人会员中心
 * ============================================================================
 * 版权所有: 骑士网络，并保留所有权利。
 * 网站地址: http://www.74cms.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/
define('IN_QISHI', true);
require_once(dirname(__FILE__) . '/personal_common.php');
$smarty->assign('nav',"resume"); 
//创建职场名片第一步
if ($act=='step1')
{  
	$uid=intval($_SESSION['uid']); 
	$pid=get_pid($uid);
	$resume_basic = get_resume_info($uid,$pid);
	if(!empty($resume_basic)){
		$smarty->assign('resume_basic',$resume_basic);
	}
	if(!empty($resume_basic)){
		header("Location: ?act=step2");
	}  
	$smarty->assign('act',$act);
	$smarty->assign('pid',$pid);
	$smarty->assign('user',$user);
	$smarty->assign('title','个人注册完善第一步 - 个人会员中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_reg_step1.htm');
} 
//创建简历 -保存基本信息
elseif ($act=='step1_save')
{
	$time = intval(time());
	$uid=intval($_SESSION['uid']); 
	$setsqlarr['fullname']=trim($_POST['fullname'])?trim($_POST['fullname']):showmsg('请填写姓名！',1);
	$setsqlarr['title'] = $setsqlarr['fullname'].'的简历';
	if(trim($_POST['sex']) == '1')
	{
		$setsqlarr['sex']='1';
		$setsqlarr['sex_cn']='男';
	}
	elseif(trim($_POST['sex']) == '2')
	{
		$setsqlarr['sex']='2';
		$setsqlarr['sex_cn']='女';
	}
	else{
		showmsg('请选择性别！',1);
	}
	$setsqlarr['uid'] = $uid;
	$setsqlarr['birthdate']=intval($_POST['birthdate'])>=1979?intval($_POST['birthdate']):showmsg('请正确选择出生年份',1);
	$setsqlarr['residence']=($_POST['district'] || $_POST['sdistrict'])?trim($_POST['district'].'.'.$_POST['sdistrict']):showmsg('请填现居住地！');	
	$setsqlarr['residence_cn']=trim($_POST['residence_cn'])?trim($_POST['residence_cn']):showmsg('请填现居住地！');	
	// $setsqlarr['education']=intval($_POST['education'])?intval($_POST['education']):showmsg('请选择最高学历名称',1);
	// $setsqlarr['education_cn']=trim($_POST['education_cn'])?trim($_POST['education_cn']):showmsg('请选择最高学历名称',1);
	// $setsqlarr['current']=intval($_POST['current'])?intval($_POST['current']):showmsg('请选择目前状态',1);
	// $setsqlarr['current_cn']=trim($_POST['current_cn'])?trim($_POST['current_cn']):showmsg('请选择目前状态',1);
	$setsqlarr['experience']=intval($_POST['experience'])?intval($_POST['experience']):showmsg('请选择工作经验',1);
	$setsqlarr['experience_cn']=trim($_POST['experience_cn'])?trim($_POST['experience_cn']):showmsg('请选择工作经验',1);
	$setsqlarr['currentjobs']=trim($_POST['currentjobs'])?trim($_POST['currentjobs']):showmsg('请填写当前职位',1);
	$setsqlarr['telephone']=trim($_POST['telephone'])?trim($_POST['telephone']):showmsg('请填写联系电话！',1);
	$setsqlarr['addtime']= $time;
	$setsqlarr['refreshtime']= $time; 
	$members_info = get_user_info($uid); 
	$setsqlarr['email']= $members_info['email'];
	$num = $db->get_total("select COUNT(*) AS num from ".table('resume').' where uid = '.$uid);
	if($num == 0){
		$pid=inserttable(table('resume'),$setsqlarr,1);
		write_memberslog($_SESSION['uid'],2,1101,$_SESSION['username'],"/",0,"创建简历");
		$searchtab['id'] = $pid;
		$searchtab['uid'] = $uid;  
		inserttable(table('resume_search'),$searchtab); 	
		check_resume($uid,$pid);
		refresh_resume_to_members($uid); 
		header("Location: ?act=step2");
	}else{
		updatetable(table('resume'),$setsqlarr,"  uid='{$uid}'"); 
		write_memberslog($_SESSION['uid'],2,1105,$_SESSION['username'],"/",0,"修改了简历");
		refresh_resume_to_members($uid);
		$pid=get_pid($uid);
		check_resume($uid,$pid);
		header("Location: ?act=step2");
	}
}
//创建简历-求职意向
elseif ($act=='step2')
{ 

	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$resume_basic=get_resume_info($uid,$pid); 
	$link[0]['text'] = "完善第一步";
	$link[0]['href'] = '?act=step1';
	if (empty($resume_basic)) showmsg("请先完善第一步！",1,$link);
	if(!empty($resume_basic['trade'])){	 	//值要判断这个页面必填选择非空的  就让他往 resume_show下跳
		header("Location: ?act=resume_show");
	} 
	$smarty->assign('act',$act);
	$smarty->assign('pid',$pid);
	$smarty->assign('title','个人注册完善第二步 - 个人会员中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_reg_step2.htm');
}
//保存-求职意向
elseif ($act=='step2_save')
{ 
	$resumeuid=intval($_SESSION['uid']);
	$resumepid=get_pid($resumeuid);
	
	$num = $db->get_total("select COUNT(*) AS num from ".table('resume').' where uid = '.$_SESSION['uid']);
	if($num == 0){
		header("Location: ?act=step1");
	} 
	if ($resumeuid==0 || $resumepid==0 ) showmsg('参数错误！',1);  
	$resumearr['district']=trim($_POST['district'])?trim($_POST['district']):showmsg('请选择期望工作地！',1); 
	$resumearr['district_cn']=trim($_POST['district_cn']); 
	
	$resumearr['wage_hope_month']=intval($_POST['wage_hope_month'])?intval($_POST['wage_hope_month']):showmsg('请填写期望薪资的月份数！',1);
	$resumearr['wage_hope_number']=intval($_POST['wage_hope_number'])?intval($_POST['wage_hope_number']):showmsg('请填写期望月薪！',1);
	$resumearr['wage_hope']=round((trim($_POST['wage_hope_month'])*trim($_POST['wage_hope_number'])),2);
	
	$resumearr['wage_current_month']=intval($_POST['wage_current_month'])?intval($_POST['wage_current_month']):showmsg('请填写当前薪资的月份数！',1);
	$resumearr['wage_current_number']=intval($_POST['wage_current_number'])?intval($_POST['wage_current_number']):showmsg('请填写当前月薪！',1);
	$resumearr['wage_current']=round((trim($_POST['wage_current_month'])*trim($_POST['wage_current_number'])),2); 
	
	$resumearr['trade']=$_POST['trade']?trim($_POST['trade']):showmsg('请选择期望从事的行业！',1);
	$resumearr['trade_cn']=trim($_POST['trade_cn'])?trim($_POST['trade_cn']):showmsg('请选择期望从事的行业！',1);
	$resumearr['intention_jobs']=trim($_POST['intention_jobs'])?trim($_POST['intention_jobs']):showmsg('请选择期望的职位！',1);
	$resumearr['intention_jobs_cn']=trim($_POST['intention_jobs_cn'])?trim($_POST['intention_jobs_cn']):showmsg('请选择期望的职位！',1);
	if(trim($_POST['secret']) == '1')
	{
		$resumearr['secret']='1'; 
	} 
	else{
		$resumearr['secret']='0'; 
	}
	
	if ($_CFG['audit_edit_resume']!="-1")
	{
		$resumearr['audit']=$_CFG['audit_edit_resume'];
	}
	add_resume_jobs($resumepid,$_SESSION['uid'],$_POST['intention_jobs'])?"":showmsg('更新期望职位失败！',0);
	add_resume_trade($resumepid,$_SESSION['uid'],$_POST['trade'])?"":showmsg('更新期望行业失败！',0);
	add_resume_district($resumepid,$_SESSION['uid'],$_POST['district'])?"":showmsg('更新期望地区失败！',0);
	updatetable(table('resume'),$resumearr," uid='{$resumeuid}'"); 
	check_resume($resumeuid,$resumepid);
	header("Location: personal_index.php");  
}
//简历的显示
elseif ($act=='resume_show')
{	
	$uid=intval($_SESSION['uid']); 
	$pid=intval(get_pid($uid));
	$resume=get_resume_info($uid);
	if($resume['email'] == ''){
		$members_info = get_user_info($uid);
		$resume['email'] = $members_info['email'];
	} 
	$resume['wage_hope'] = round(($resume['wage_hope']/10000),2).'万';
	$resume['wage_current'] = round(($resume['wage_current']/10000),2).'万'; 
	//统计最近查看本简历的猎头或者企业  
	$hunter_num = $db->get_total("select  count(*) as num from ".table('view_resume')." where resumeid={$pid} and utype=3");
	$company_num = $db->get_total("select  count(*) as num from ".table('view_resume')." where resumeid={$pid} and utype=1");
	$smarty->assign('hunter_num',$hunter_num);
	$smarty->assign('company_num',$company_num);
	
	if (empty($resume))
	{
	$link[0]['text'] = "转到简历表！";
	$link[0]['href'] = '?act=step1';
	showmsg('简历还没创建，请先创建！',1,$link);
	}
	$smarty->assign('random',mt_rand());
	$smarty->assign('time',time());
	$smarty->assign('user',$user);
	$smarty->assign('resume_basic',$resume);
	$smarty->assign('resume_work',get_resume_work($uid,$pid));
	$smarty->assign('my_resume',get_resume_info($uid));
	$smarty->assign('resume_education',get_resume_education($uid,$pid));
    	$smarty->assign('shield_company',get_shield_company($uid));
	$smarty->assign('resume_language',get_resume_language($uid,$pid));
	$smarty->assign('resume_project',get_resume_project($uid,$pid));
	$smarty->assign('title','完善简历 - 个人会员中心 - '.$_CFG['site_name']);
	$smarty->display('member_personal/personal_resume.htm');
	check_resume($_SESSION['uid'],$pid);
}
//保存简历标题
elseif($act == 'ajax_save_title')
{	 
	$setsqlarr['title']=trim($_POST['title'])? trim($_POST['title'] ):"未命名简历";
	check_word($_CFG['filter'],$setsqlarr['title'])?exit($_CFG['filter_tips']):'';
	$wheresql = "uid=".intval($_SESSION['uid']);
    if(updatetable(table('resume'),$setsqlarr,$wheresql)){ 
		exit(true);
	} 
} 
//刷新简历
elseif ($act=='refresh')
{
	refresh_resume($_SESSION['uid'])?showmsg('操作成功！',2):showmsg('操作失败！',0);
} 
//ajax获取简历信息
elseif($act == 'ajax_get_basic_info'){
	$uid=intval($_SESSION['uid']); 
	$pid=get_pid($uid);
	$resume=get_resume_info($uid,$pid);
	//将现居住地分解一下
	$resume_residence = explode('.',$resume['residence']);
	$resume['res_dis'] = intval(trim($resume_residence[0]));
	$resume['res_sdis'] = intval(trim($resume_residence[1]));
	$resumephoto=$_CFG['site_template']."images/p_pic05.gif";
  	if ($resume['photo_img'])
	{
		$resumephoto=$_CFG['site_dir']."data/".$_CFG['_resume_photo_dir_thumb']."/100/".$resume['photo_img'];
	}  
	$members_info = get_user_info($uid);
	$resume['email'] = $members_info['email']; 
	$resume['mobile'] = $members_info['mobile'];  
	
	$html = '
	<form action="?act=ajax_get_basic_save" method="post" id="resume_edit_box_aa">
<div class="m_r_e_box">	
	<div class="avater_box">
		<a href="javascript:;">
		<font id="changeAfterImg"><img class="middleFace" src="'.$resumephoto.'" alt="头像找不到了" /></font>
			<div class="avater_shadow">更换头像</div>
		</a>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title"><span>*</span> 姓名</div>
		<div class="m_r_e_content"><input type="text" name="fullname" id="fullname" value="'.$resume['fullname'].'" class="text input-medium span145" datatype="*" sucmsg="&nbsp;" nullmsg="请输入职位名称" errormsg="请输入职位名称"/></div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title"><span>*</span> 性别</div>
		<div class="m_r_e_content" id="sex_check_box">
	';
	$html.='<label><input type="radio" name="sexchoose" checked data="1"/> 男</label><label><input type="radio" name="sexchoose" data="2"/> 女</label>';
	$html .= '	
			<input type="hidden" name="sex"  id="sex" value="'.$resume['sex'].'">
			<input type="hidden" name="sex_cn" id="sex_cn" value="">
		</div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title"><span>*</span> 出生年份</div>
		<div class="m_r_e_content optionlist w_145">
			<span id="birthdate_name" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 133px;" id="city_result_show">
				<span class="items" style="left: 6px; height: 20px;">'.$resume['birthdate'].'年</span>
				<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="birthdate_menu"></em>
			</span>
			<ul class="droplist" id="birthdate_y" style="height:200px;overflow-x:hidden; overflow-y:scroll;"></ul>
			<input type="hidden" name="birthdate" id="birthdate" value="'.$resume['birthdate'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请选择出生年份" errormsg="请选择出生年份">
			<input type="hidden" name="birthdate_cn" id="birthdate_cn" value="">
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">婚姻状况</div>
		<div class="m_r_e_content optionlist w_145">
			<span id="marriage_name" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 133px;" id="city_result_show">
				<span class="items" style="left: 6px; height: 20px;">'.$resume['marriage_cn'].'</span>
				<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="marriage_menu"></em>
			</span>
			<ul class="droplist">
				<li><a href="javascript:;" title="保密" dataid="3">保密</a></li>
				<li><a href="javascript:;" title="未婚" dataid="0">未婚</a></li>
				<li><a href="javascript:;" title="已婚" dataid="1">已婚</a></li>
			</ul>
			<input type="hidden" id="marriage" name="marriage" value="'.$resume['marriage'].'">
			<input type="hidden" id="marriage_cn" name="marriage_cn" value="'.$resume['marriage_cn'].'">
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title"><span>*</span> 现居住地</div>
		<div class="m_r_e_content">
			<span data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 133px;" id="home_result_show">
				<span class="items" style="left: 6px; height: 20px;">'.$resume['residence_cn'].'</span>
				<em class="drop" style="height: 30px; margin-top: -1px;" id="trad_window_home"></em>
			</span>
			<input type="hidden" id="district" name="district" value="'.$resume['res_dis'].'">
			<input type="hidden" id="sdistrict" name="sdistrict" value="'.$resume['res_sdis'].'">
			<input type="hidden" id="residence_cn" name="residence_cn" value="'.$resume['residence_cn'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请选择现居住地" errormsg="请选择现居住地">
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title"><span>*</span> 最高学历</div>
		<div class="m_r_e_content optionlist w_145">
			<span id="education_name" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 133px;" id="city_result_show">
				<span class="items" style="left: 6px; height: 20px;">'.$resume['education_cn'].'</span>
				<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="education_menu"></em>
			</span>
			<ul class="droplist" id="education_list"></ul>
			<input type="hidden" id="education" name="education" value="'.$resume['education'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请选择最高学历" errormsg="请选择最高学历">
			<input type="hidden" id="education_cn" name="education_cn" value="'.$resume['education_cn'].'">
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title"><span>*</span> 工作经验</div>
		<div class="m_r_e_content optionlist w_145">
			<span id="experience_name" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 133px;" id="city_result_show">
				<span class="items" style="left: 6px; height: 20px;">'.$resume['experience_cn'].'</span>
				<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="experience_menu"></em>
			</span>
			<ul class="droplist" id="experience_list"></ul>
			<input type="hidden" id="experience" name="experience" value="'.$resume['experience'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请选择工作经验" errormsg="请选择工作经验">
			<input type="hidden" id="experience_cn" name="experience_cn" value="'.$resume['experience_cn'].'">
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title"><span>*</span> 目前状态</div>
		<div class="m_r_e_content optionlist w_145">
			<span id="current_name" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 133px;" id="city_result_show">
				<span class="items" style="left: 6px; height: 20px;">'.$resume['current_cn'].'</span>
				<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="current_menu"></em>
			</span>
			<ul class="droplist" id="current_list"></ul>
			<input type="hidden" id="current" name="current" value="'.$resume['current'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请选择目前状态" errormsg="请选择目前状态">
			<input type="hidden" id="current_cn" name="current_cn" value="'.$resume['current_cn'].'">
		</div>
		<div class="m_r_e_content"></div>
	</div>
	 <style>.m_r_e_content a:hover{text-decoration:underline }</style>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title"> 联系电话:</div>
		<div class="m_r_e_content"><span style="min-width:120px;float:left;">'.$resume['telephone'].'</span></div>
		<div class="m_r_e_content">  ';
	if($members_info["mobile_audit"] == "1"){
		$html .='&nbsp;&nbsp;&nbsp;已认证 ';
	}else{
		$html .='<a style="color:#247FAF; " href="personal_info.php?act=user_mobile"> 修改</a>';
	}
	$html .=' </div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title"> 联系邮箱:</div>
		<div class="m_r_e_content"><span style="min-width:120px;float:left;">'.$resume['email'].'</span></div>
		<div class="m_r_e_content"> ';
	if($members_info["email_audit"] == "1"){
		$html .='&nbsp;&nbsp;&nbsp;已认证 ';
	}else{
		$html .='<a style="color:#247FAF;" href="personal_info.php?act=user_email"> 修改</a>';
	} 
	$html .=' 
		</div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">&nbsp;</div>
		<div class="m_r_e_content">
			<input type="button" value="保存" id="base_info_saves" class="but60lan" />
			<a href="javascript:;" id="base_inf_cancel" class="canel_but">取消</a>
		</div>
	</div>
</div>
</from>
	';
	echo $html;
}
//保存基本信息
else if($act == 'ajax_get_basic_save')
{   
	$uid = intval($_SESSION['uid']);
	$captcha=get_cache('captcha');
	$pid=get_pid($uid);
	if ($captcha['verify_resume']=='1' && intval($_REQUEST['pid'])===0 &&  strcasecmp($_SESSION['imageCaptcha_content'],$postcaptcha)!=0)
	{
		exit("验证码错误");
	}
	$setsqlarr['uid']=$uid; 
	$setsqlarr['fullname']=trim($_POST['fullname'])?trim($_POST['fullname']):exit('请填写姓名！');
	if(trim($_POST['sex']) == '1'){
		$setsqlarr['sex']='1';
		$setsqlarr['sex_cn']='男';
	}else if($_POST['sex'] == '2'){
		$setsqlarr['sex']='2';
		$setsqlarr['sex_cn']='女';
	}else{
		exit('请选择性别！');
	}  
	$setsqlarr['birthdate']=intval($_POST['birthdate'])>1945?intval($_POST['birthdate']):exit('请正确填写出生年份');
	$setsqlarr['marriage']=intval($_POST['marriage']);
	$setsqlarr['marriage_cn']=trim($_POST['marriage_cn']); 
	$setsqlarr['residence']=intval($_POST['district']).".".intval($_POST['sdistrict']);
	$setsqlarr['residence_cn']=trim($_POST['residence_cn'])?trim($_POST['residence_cn']):exit('请填现居住地！');	
	$setsqlarr['education']=intval($_POST['education']);
	$setsqlarr['education_cn']=trim($_POST['education_cn']);
	
	// $setsqlarr['experience']=intval($_POST['experience']);
	// $setsqlarr['experience_cn']=trim($_POST['experience_cn']);
	// $setsqlarr['current']=trim($_POST['current']);
	// $setsqlarr['current_cn']=trim($_POST['current_cn']);
	$setsqlarr['refreshtime']=$timestamp;
	updatetable(table('resume'),$setsqlarr," id='".$pid."' AND uid='{$uid}'");
	check_resume($_SESSION['uid'],$pid);
	write_memberslog($_SESSION['uid'],2,1105,$_SESSION['username'],"/",0,"修改简历");
	$resume=get_resume_info($uid,$pid);
	$user_info = get_user_info($uid);
	$html = '
		<div class="info_txt clearfix">
			<div class="info_txt_item">姓名：'.$setsqlarr['fullname'].'</div>
			<div class="info_txt_item">性别：'.$setsqlarr['sex_cn'].'</div>
			<div class="info_txt_item">出生年份：'.$setsqlarr['birthdate'].'</div>
			<div class="info_txt_item">婚姻状况：'.$setsqlarr['marriage_cn'].'</div>
			<div class="info_txt_item">最高学历：'.$setsqlarr['education_cn'].'</div>
			<div class="info_txt_item">工作经验：'.$setsqlarr['experience_cn'].'</div>
			<div class="info_txt_item">联系电话：'.$user_info['mobile'].'</div>
			<div class="info_txt_item">联系邮箱：'.$user_info['email'].'</div>
			<div class="info_txt_item">现居住地：'.$setsqlarr['residence_cn'].'</div>
			<div class="info_txt_item">目前状态：'.$setsqlarr['current_cn'].'</div>
		</div>
		<div class="info_avater">
			<div class="avater_box"> 
				<a href="" id="photo_img_af">
	';
	$photosrc=$_CFG['site_template']."images/p_pic05.gif";
	if ($resume['photo_img'])
	{
		$photosrc=$_CFG['site_dir']."data/".$_CFG['_resume_photo_dir_thumb']."/100/".$resume['photo_img'];
	}
	$html .= ' <img src="'.$photosrc.'" alt="头像找不到了！" /> ';
	$html .= ' </a> 
			</div>
		</div>
	';
	echo $html;
}
//上传简历头像
else if($act == 'resume_logo_preloading'){
	$uid=intval($_SESSION['uid']);
	//LOGO图片的预处理
	require_once(QISHI_ROOT_PATH.'include/upload.php');
	if($_FILES['upload_file']['name']){
		$upphotopreload_dir="../../data/photopreload/".date("Y/m/d/");
		make_dir($upphotopreload_dir);
		$setsqlarr['photopreload']=_asUpFiles($upphotopreload_dir, "upload_file",$_CFG['resume_photo_max'],'jpg/jpeg/gif/bmp/png',$uid);
		if ($setsqlarr['photopreload'])
		{
			$setsqlarr['photopreload']=date("Y/m/d/").$setsqlarr['photopreload'];
			$photo_src="../../data/photopreload/".$setsqlarr['photopreload'];
			exit($photo_src);
		}
		else
		{
			exit("上传失败!");
		}
	}
} 
// 简历头像保存
else if($act == 'resume_logo_save'){
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	require_once(QISHI_ROOT_PATH.'include/upload.php');
	require_once(QISHI_ROOT_PATH.'include/imageresize.class.php');
	
	$uplogo_dir="../../data/".$_CFG['_resume_photo_dir']."/".date("Y/m/d/");
	make_dir($uplogo_dir);
	$logopre_src=$_POST['url'];
	$imgresize = new ImageResize();
	$imgresize->load($logopre_src);
	 
	$logopre = substr($logopre_src, strrpos($logopre_src, '.')); 
	$w = intval($_POST['x2']) - intval($_POST['x1']);
	$imgresize->cut($w,$w, intval($_POST['x1']), intval($_POST['y1'])); 
	$mtsrc = $uplogo_dir.$uid.$logopre;
	$imgresize->save($mtsrc);
	
	$pic_format = array(200,100,50);
	for($i=0;$i<count($pic_format);$i++){   
		$uplogo_dir="../../data/".$_CFG['_resume_photo_dir_thumb']."/".$pic_format[$i].'/'.date("Y/m/d/");
		make_dir($uplogo_dir);
		makethumb($mtsrc,$uplogo_dir,$pic_format[$i],$pic_format[$i]);
	} 
	$setsqlarr['photo_img']=substr($mtsrc,17); // 去除logo路径前面的 ../../data/logo/ 
	if (updatetable(table('resume'),$setsqlarr," id='".$pid."' AND uid='".$uid."'")) {
		write_memberslog($_SESSION['uid'],2,1105,$_SESSION['username'],"/",0,"修改简历");
		echo $mtsrc;
	} else {
		echo '保存失败！';
	} 
}
//简历期望职位
elseif($act == 'ajax_resume_hope')
{
	$resumeuid=intval($_SESSION['uid']);
	$resumepid=get_pid($resumeuid);
	if ($resumeuid==0 || $resumepid==0 ) exit('参数错误！'); 
	
	$resumearr['trade']=$_POST['trade']?trim($_POST['trade']):exit('请选择期望从事的行业！');
	$resumearr['trade_cn']=trim($_POST['trade_cn']);
	$resumearr['currentjobs']=trim($_POST['currentjobs']);
	$resumearr['district']=trim($_POST['district'])?trim($_POST['district']):exit('请选择期望工作地！');
	$resumearr['district_cn']=trim($_POST['district_cn']);
	
	$resumearr['intention_jobs']=trim($_POST['intention_jobs']);	
	$resumearr['intention_jobs_cn']=trim($_POST['intention_jobs_cn']);	
	
	$resumearr['wage_hope_month']=trim($_POST['wage_hope_month']);
	$resumearr['wage_hope_number']=trim($_POST['wage_hope_number']);
	$resumearr['wage_hope']=round((trim($_POST['wage_hope_month'])*trim($_POST['wage_hope_number'])),2); 
	
	$resumearr['wage_current_month']=trim($_POST['wage_current_month']);
	$resumearr['wage_current_number']=trim($_POST['wage_current_number']);	
	$resumearr['wage_current']=round((trim($_POST['wage_current_month'])*trim($_POST['wage_current_number'])),2);
	
	if(trim($_POST['secret']) == '1')
	{
		$resumearr['secret']='1'; 
	} 
	else{
		$resumearr['secret']='0'; 
	}
	
	if ($_CFG['audit_edit_resume']!="-1")
	{
		$resumearr['audit']=$_CFG['audit_edit_resume'];
	}
	updatetable(table('resume'),$resumearr," id='{$resumepid}' AND uid='{$resumeuid}'");
	add_resume_jobs($resumepid,$_SESSION['uid'],$_POST['intention_jobs'])?"":exit('保存失败！');
	add_resume_trade($resumepid,$_SESSION['uid'],$_POST['trade'])?"":exit('保存失败！');
	add_resume_district($resumepid,$_SESSION['uid'],$_POST['district'])?"":exit('保存失败！');
	check_resume($_SESSION['uid'],$resumepid); 
	$resumearr['status']='1'; 
	$resumearr['wage_hope'] = round(($resumearr['wage_hope']/10000),2).'万';
	$resumearr['wage_current'] = round(($resumearr['wage_current']/10000),2).'万';
	echo json_encode($resumearr);
}
elseif($act == 'ajax_resume_hope_edit')
{
	$uid=intval($_SESSION['uid']); 
	$pid=get_pid($uid);
	$resume = get_resume_info($uid,$pid);
	$resume['wage_hope'] = round(($resume['wage_hope']/10000),2).'万';
	$resume['wage_current'] = round(($resume['wage_current']/10000),2).'万';
	
	if($resume['secret'] == '1'){
		$secret = 'checked';
	}
	$html = '
	<form action="?act=ajax_resume_hope" mthod="post" id="resume_hop_form">
	<div class="m_r_e_box">
		<div class="m_r_e_item clearfix">
			<div class="m_r_e_title">当前职位</div>
			<div class="m_r_e_content">
				<input class="text input-medium span215" name="currentjobs" type="text" value="'.$resume['currentjobs'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请输入当前职位" errormsg="请输入当前职位"/>
			</div>
			<div class="m_r_e_content"></div>
		</div>
		<div class="m_r_e_item clearfix">
			<div class="m_r_e_title">期望行业</div>
			<div class="m_r_e_content">
				<span data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 380px;" id="trade_result_show">
					<span class="items" style="left: 6px; height: 20px;">'.$resume['trade_cn'].'</span>
					<em class="drop" style="height: 30px; margin-top: -1px;" id="trad_window"></em>
				</span>
				<input name="trade" id="trade" type="hidden" value="'.$resume['trade'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请选择期望行业" errormsg="请选择期望行业"/>
				<input name="trade_cn" id="trade_cn" type="hidden" value="'.$resume['trade_cn'].'"/>
			</div>
			<div class="m_r_e_content"></div>
		</div>
		<div class="m_r_e_item clearfix">
			<div class="m_r_e_title">期望职能</div>
			<div class="m_r_e_content">
				<span data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 380px;" id="job_result_show">
					<span class="items" style="left: 6px; height: 20px;">'.$resume['intention_jobs_cn'].'</span>
					<em class="drop" style="height: 30px; margin-top: -1px;" id="trad_window_job"></em>
				</span>
				<input name="intention_jobs" id="intention_jobs" type="hidden" value="'.$resume['intention_jobs'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请选择期望职能" errormsg="请选择期望职能"/>
				<input name="intention_jobs_cn" id="intention_jobs_cn" type="hidden" value="'.$resume['intention_jobs_cn'].'"/>
			</div>
			<div class="m_r_e_content"></div>
		</div>
		<div class="m_r_e_item clearfix">
			<div class="m_r_e_title">期望地区</div>
			<div class="m_r_e_content">
				<span data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 380px;" id="city_result_show">
					<span class="items" style="left: 6px; height: 20px;">'.$resume['district_cn'].'</span>
					<em class="drop" style="height: 30px; margin-top: -1px;" id="trad_window_city"></em>
				</span>
				<input name="district" id="district" type="hidden" value="'.$resume['district'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请选择期望地区" errormsg="请选择期望地区"/>
				<input name="district_cn" id="district_cn" type="hidden" value="'.$resume['district_cn'].'"/>
			</div>
			<div class="m_r_e_content"></div>
		</div>
		<div class="m_r_e_item clearfix">
			<div class="m_r_e_title">期望年薪</div>
			<div class="m_r_e_content">
				<input type="text" class="text input-medium span93" datatype="pint" sucmsg="&nbsp;" nullmsg="请填写期望年薪" errormsg="请输入有效数字" name="wage_hope_number" id="wage_hope_number" value="'.$resume['wage_hope_number'].'" /> 元/月× <input type="text" class="text input-medium span42" datatype="pint" sucmsg="&nbsp;" nullmsg="请填写月份" errormsg="请输入有效数字" name="wage_hope_month" id="wage_hope_month" value="'.$resume['wage_hope_month'].'" /> <span id="expect"> 个月 = '.$resume['wage_hope'].'</span>
			</div>
			<div class="m_r_e_content"></div>
			<input id="wage_hope" name="wage_hope" type="hidden" value="" />
		</div>
		<div class="m_r_e_item clearfix">
			<div class="m_r_e_title">目前年薪</div>
			<div class="m_r_e_content">
				<input type="text" name="wage_current_number" id="wage_current_number" class="text input-medium span93" datatype="pint" sucmsg="&nbsp;" nullmsg="请填写目前年薪" errormsg="请输入有效数字" value="'.$resume['wage_current_number'].'"/> 元/月× <input type="text" class="text input-medium span42" name="wage_current_month" id="wage_current_month" datatype="pint" sucmsg="&nbsp;" nullmsg="请填写月份" errormsg="请输入有效数字" value="'.$resume['wage_current_month'].'"/> <span id="present"> 个月 = '.$resume['wage_current'].'</span>
				<label class="left_label"><input type="checkbox" name="secret" id="" value="1" '.$secret.'/> 保密</label>
			</div>
			<div class="m_r_e_content"></div>
			<!---input id="wage_current" name="wage_current" type="hidden" value="" /-->
		</div>
		<div class="m_r_e_item clearfix">
			<div class="m_r_e_title">&nbsp;</div>
			<div class="m_r_e_content">
			<input type="button" value="保存" id="hope_submit" class="but60lan" />
			<a href="javascript:;" id="hope_cancel" class="canel_but">取消</a></div>
		</div>
	</div></form>
	';
	echo $html;
}
//创建简历-保存添加的工作经历----------------------
elseif ($act=='ajax_work_save')
{ 
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id = intval($_POST['id']);
	$resume_work=get_resume_work($pid,$_REQUEST['pid']);
	if (count($resume_work)>=6) exit('工作经历不能超过6条！');
	$setsqlarr['uid']=intval($_SESSION['uid']);
	$setsqlarr['pid']=intval($pid);
	if ($setsqlarr['pid']==0) exit('参数错误！');
	 
	$setsqlarr['companyname']=trim($_POST['companyname'])?$_POST['companyname']:exit('请填写企业名称！');  
	$setsqlarr['starttime']= trim($_POST['starttime'])?strtotime(trim($_POST['starttime'])):exit('请填写开始时间！');
	if(trim($_POST['today']) == '1'){
		$setsqlarr['endtime']= '';
	}else{
	    $setsqlarr['endtime']=trim($_POST['endtime'])?strtotime(trim($_POST['endtime'])):exit('请填写结束时间！');
	}
	$setsqlarr['today']=trim($_POST['today']); 
	$setsqlarr['jobs']=trim($_POST['jobs'])?$_POST['jobs']:exit('请填写职位名称！');
	$setsqlarr['content']=trim($_POST['content']);
	if(!empty($id)){ 
		$wheresql = " uid=".$uid." and id=".$id; 
		updatetable(table('resume_work'),$setsqlarr,$wheresql);
		$setsqlarr['id'] = $id;
		$setsqlarr['status'] = '2';
	}else{
		$wid = inserttable(table('resume_work'),$setsqlarr,1);
		$setsqlarr['id'] = $wid;
		$setsqlarr['status'] = '1';
	} 
	check_resume($_SESSION['uid'],intval($pid)); 
	//时间返回的处理
	$setsqlarr['starttime']=date('Y-m',$setsqlarr['starttime']);
	if($setsqlarr['today'] == '1'){ 
		$setsqlarr['endtime']= "至今"; 
		$setsqlarr['work_time']=timediff($setsqlarr['starttime'],date('Y-m',time()));
	}else{ 
		$setsqlarr['endtime']=date('Y-m',$setsqlarr['endtime']);
		$setsqlarr['work_time']=timediff($setsqlarr['starttime'],$setsqlarr['endtime']);
	}  
	echo json_encode($setsqlarr); 
}else if($act == 'work_resume_del'){
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']); 
	$db->query("delete from ".table('resume_work')." where id=".$id." and pid={$pid} and uid = {$uid}");
	check_resume($uid,$pid);
	exit(true);
}
elseif($act == 'ajax_get_work')
{ 
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']); 
	if(!empty($id)){
		$work = get_resume_work_one($uid,$pid,$id);
		$starttime = date("Y-m-d",$work['starttime']);
		$endtime = date("Y-m-d",$work['endtime']); 
	} 
	if($work['today'] =='1'){
		$today = 'checked';
		$endtime_input = ' disabled="disabled"  style="background-color:#efefef;"';
		$endtime = '';
	}else{
		$today = '';
	}
	
	$html='
<form action="?act=ajax_work_save" mthod="post" id="work_resume_form">
<div class="m_r_e_box">
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">公司名称</div>
		<div class="m_r_e_content">
			<input type="text" class="text input-medium span170" name="companyname"  value="'.$work['companyname'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请输入公司名称" errormsg="请输入公司名称"/> 
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">任职时间</div>
		<div class="m_r_e_content">
			<input value="'.$starttime.'" name="starttime" id="start" class="text input-medium span3 date-picker">&nbsp;—&nbsp;<input value="'.$endtime.'" '.$endtime_input.' name="endtime" id="endtime" class="text input-medium span3 date-picker">&nbsp;<label>
			<input type="checkbox" name="today"  '.$today.' value="1"/> 至今</label> 
		</div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">职位名称</div>
		<div class="m_r_e_content">
			<input type="text" class="text input-medium span300" name="jobs"  value="'.$work['jobs'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请输入职位名称" errormsg="请输入职位名称"/>
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">工作内容</div>
		<div class="m_r_e_content">
			<textarea name="content" id="content" class="textarea_455" datatype="*" tip="请输入工作内容" sucmsg="&nbsp;" altercss="gray" value="请输入工作内容" errormsg="请填写有效内容">'.$work['content'].'</textarea>
		</div>
	</div>
	<input type="hidden" name="id"  value="'.$work['id'].'"/> 
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">&nbsp;</div>
		<div class="m_r_e_content">
			<input type="button" value="保存" id="work_ajax_save" class="but60lan" />
			<a href="javascript:;" id="work_ajax_cancel" class="canel_but">取消</a>
		</div>
	</div>
</div></form>
	';  
	echo $html;
} 
//教育培训-----------------------------------------------------------------------
else if($act == 'ajax_education_save'){
	$uid=intval($_SESSION['uid']);
	$pid = get_pid($uid);
	$id = intval($_POST['id']);
	
	$resume_education=get_resume_education($_SESSION['uid'],$pid);
	if (count($resume_education)>=6) exit('教育经历不能超过6条！');
	
	$setsqlarr['uid']=$uid;
	$setsqlarr['pid']=$pid;
	if ($setsqlarr['uid']==0 || $setsqlarr['pid']==0 ) exit('参数错误！');
	
	$setsqlarr['school']=trim($_POST['school'])?$_POST['school']:exit('请填写学校名称！');
	$setsqlarr['speciality']=trim($_POST['speciality'])?$_POST['speciality']:exit('请填专业信息！');
	
	$setsqlarr['starttime']=trim($_POST['starttime'])?strtotime(trim($_POST['starttime'])):exit('请填写开始时间！');
	if(trim($_POST['today']) == '1'){
		$setsqlarr['endtime']= '';
	}else{
	    $setsqlarr['endtime']=trim($_POST['endtime'])?strtotime(trim($_POST['endtime'])):exit('请填写结束时间！');
	}
	$setsqlarr['today']=trim($_POST['today'])?$_POST['today']:'0';
	 
	$setsqlarr['education']=trim($_POST['education'])?$_POST['education']:exit('请填获得的学历！');
	$setsqlarr['education_cn']=trim($_POST['education_cn'])?$_POST['education_cn']:exit('请填获得的学历！');  
	$setsqlarr['uec']=trim($_POST['uec'])?trim($_POST['uec']):'0'; //是否是统招 
	$setsqlarr['course']=trim($_POST['course'])?$_POST['course']:exit('请填写学习课程！'); 
	if(!empty($id)){
		if(empty($id)){
			exit('参数错误！');
		}
		$wheresql = " uid=".$uid." and id=".$id; 
		updatetable(table('resume_education'),$setsqlarr,$wheresql);
		$setsqlarr['id'] = $id;
		$setsqlarr['status'] = '2';
	}else{
		$wid = inserttable(table('resume_education'),$setsqlarr,1);
		$setsqlarr['id'] = $wid;
		$setsqlarr['status'] = '1';
	}
	check_resume($_SESSION['uid'],intval($pid));
	//时间返回的处理	
	$setsqlarr['starttime']=date('Y-m',$setsqlarr['starttime']);
	if($setsqlarr['today'] == '1'){ 
		$setsqlarr['endtime']= "至今"; 
		$setsqlarr['work_time']=timediff($setsqlarr['starttime'],date('Y-m',time()));
	}else{ 
		$setsqlarr['endtime']=date('Y-m',$setsqlarr['endtime']);
		$setsqlarr['work_time']=timediff($setsqlarr['starttime'],$setsqlarr['endtime']);
	}  
	echo json_encode($setsqlarr); 
}
else if($act == 'education_resume_del'){
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']);  
	$db->query("delete from ".table('resume_education')." where id=".$id." and pid={$pid} and uid = {$uid}");
	check_resume($uid,$pid);
	exit(true);
}
else if($act == 'ajax_get_education'){
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']); 
	if(!empty($id)){
		$education = get_resume_education_one($uid,$id);
		$starttime = date("Y-m-d",$education['starttime']);
		$endtime = date("Y-m-d",$education['endtime']); 
	} 
	if($education['today'] == '1'){
		$today = 'checked';
		$endtime_input = ' disabled="disabled"  style="background-color:#efefef;"';
		$endtime = '';
	}else{
		$today = '';
	}
	if($education['uec'] == '1'){
		$uec = 'checked';
		
	}else{
		$uec = '';
	}
	 
	$html='
<form action="?act=ajax_education_save" mthod="post" id="education_resume_form">
<div class="m_r_e_box"> 
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">学校名称</div>
		<div class="m_r_e_content">
			<input type="text" name="school" class="text input-medium span300" value="'.$education['school'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请输入学校名称" errormsg="请输入学校名称"/>
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">专业名称</div>
		<div class="m_r_e_content">
			<input type="text" name="speciality" class="text input-medium span300" value="'.$education['speciality'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请输入专业名称" errormsg="请输入专业名称"/>
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">就读时间</div>
		<div class="m_r_e_content">
			<input value="'.$starttime.'" name="starttime" id="start" class="text input-medium span3 date-picker">&nbsp;—&nbsp;<input value="'.$endtime.'"  '.$endtime_input.' name="endtime" id="endtime" class="text input-medium span3 date-picker">&nbsp;<label>
			<input type="checkbox" name="today" id="" '.$today.' value="1"/> 至今</label>
			<!--input type="hidden" name="today"  value="'.$education['today'].'"/-->  
		</div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">获得学历</div>
		<div class="m_r_e_content optionlist w_145">
			<span id="education_name" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 133px;" id="city_result_show">
				<span class="items" style="left: 6px; height: 20px;">'.$education['education_cn'].'</span>
				<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="education_menu"></em>
			</span>
			<ul class="droplist" id="education_list"></ul>
			<input type="hidden" id="education" name="education" value="'.$education['education'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请选择获得的学历" errormsg="请选择获得的学历">
			<input type="hidden" id="education_cn" name="education_cn" value="'.$education['education_cn'].'">
		</div>
		<div class="m_r_e_content"></div>
		<label style="margin-left:10px;"><input type="checkbox" name="uec" '.$uec.' value="1"/> 是否统招</label>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">学习课程</div>
		<div class="m_r_e_content">
			<textarea name="course" id="" class="textarea_455" datatype="*" tip="请输入学习课程" altercss="gray" value="请输入学习课程" errormsg="请填写有效内容">'.$education['course'].'</textarea>
		</div>
	</div>
	<input type="hidden" name="id"  value="'.$education['id'].'"/> 
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">&nbsp;</div>
		<div class="m_r_e_content">
			<input type="button" value="保存" id="education_ajax_save" class="but60lan" />
			<a href="javascript:;" class="canel_but" id="education_ajax_cancel">取消</a></div>
	</div>
</div></form>
	';  
	echo $html;
}

//-----------------------语言能力------------------------------------------------
else if($act == 'ajax_language_save')
{
	$uid=intval($_SESSION['uid']);
	$pid = get_pid($uid);
	$id = intval($_POST['id']);
	
	// $resume_education=get_resume_education($_SESSION['uid'],$pid);
	// if (count($resume_education)>=6) exit('教育经历不能超过6条！');
	
	$setsqlarr['uid']=$uid;
	$setsqlarr['pid']=$pid;
	if ($setsqlarr['uid']==0 || $setsqlarr['pid']==0 ) exit('参数错误！');
	
	$setsqlarr['language']=trim($_POST['language'])?$_POST['language']:exit('请填写学校名称！');
	$setsqlarr['language_cn']=trim($_POST['language_cn'])?$_POST['language_cn']:exit('请填专业信息！');
	
	$setsqlarr['level']=trim($_POST['level'])?$_POST['level']:exit('请填写开始时间！');
	$setsqlarr['level_cn']=trim($_POST['level_cn'])?$_POST['level_cn']:exit('请填写结束时间！');
	
	if(!empty($id)){
		if(empty($id)){
			exit('参数错误！');
		}
		$wheresql = " uid=".$uid." and id=".$id; 
		updatetable(table('resume_language'),$setsqlarr,$wheresql);
		$setsqlarr['id'] = $id;
		$setsqlarr['status'] = '2';
	}else{
		$wid = inserttable(table('resume_language'),$setsqlarr,1);
		$setsqlarr['id'] = $wid;
		$setsqlarr['status'] = '1';
	}
	check_resume($_SESSION['uid'],intval($pid));
	echo json_encode($setsqlarr);
	
	
}
else if($act == 'language_resume_del')
{
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']);  
	$db->query("delete from ".table('resume_education')." where id=".$id." and pid={$pid} and uid = {$uid}");
	check_resume($uid,$pid);
	exit(true);
}
else if($act == 'language_resume_get')
{
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']);  
	$result = get_resume_language($uid,$pid);
	foreach($result as $k=>$v){ 
		echo '<span>'.$v['language_cn'].' | '.$v['level_cn'].' | '.$v['certificate_cn']."</span>";
	} 
}else if($act == 'ajax_language_update')
{
	$uid=intval($_SESSION['uid']);
	$pid = get_pid($uid);
	// $id = intval($_POST['id']);
	
	// $resume_education=get_resume_education($_SESSION['uid'],$pid);
	// if (count($resume_education)>=6) exit('教育经历不能超过6条！');
 
	if(count($_POST['language']) == count(array_unique($_POST['language']))){
		for($i=0;$i<count($_POST['language']);$i++){ 
			$setsqlarr['uid']=$uid;
			$setsqlarr['pid']=$pid;
			if ($setsqlarr['uid']==0 || $setsqlarr['pid']==0 ) exit('参数错误！');
			
			$setsqlarr['language']= trim($_POST['language'][$i]);
			$setsqlarr['language_cn']= trim($_POST['language_cn'][$i]);
			
			$setsqlarr['level']= trim($_POST['level'][$i]);
			$setsqlarr['level_cn']= trim($_POST['level_cn'][$i]);
			 
			$wheresql = " uid=".$uid." and id=".trim($_POST['id'][$i]); 
			updatetable(table('resume_language'),$setsqlarr,$wheresql);
			unset($setsqlarr);
		}
		check_resume($_SESSION['uid'],intval($pid));
		echo '1';
	}else{
		echo '选择的里面有重复的！';
	} 
}else if($act == 'ajax_del_language')
{
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']);  
	$db->query("delete from ".table('resume_language')." where id=".$id." and pid={$pid} and uid = {$uid}");
	check_resume($uid,$pid);
	exit(true);
}
else if($act == 'ajax_update_language')
{
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']);  
	$result = get_resume_language($uid,$pid);
	$html = '<form action="" id="language_resume_form_update" method="post"><div class="m_r_e_box">
				<div class="m_r_e_item clearfix">
					<div class="m_r_e_content">
						添加您掌握的语言能力;最多可以添加6门语言
					</div>
				</div> ';
	foreach($result as $k=>$v){ 
		$html .= '<div class="m_r_e_item clearfix language_num"> 
				<div class="m_r_e_content clearfix">
					<div class="select_list lag_input optionlist w_145">
						<span id="language_name'.$k.'" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 168px;" id="city_result_show">
							<span class="items" style="left: 6px; height: 20px;">'.$v['language'].'</span>
							<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="language_menu'.$k.'"></em>
						</span>
						<ul class="droplist" id="language_list'.$k.'"></ul>
						<input type="hidden" name="language[]" id="language'.$k.'" value="'.$v['language'].'" />
						<input type="hidden" name="language_cn[]" id="language_cn'.$k.'" value="'.$v['language_cn'].'" />
					</div>
					<div class="select_list lag_input optionlist w_145">
						<span id="level_name'.$k.'" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 168px;" id="city_result_show">
							<span class="items" style="left: 6px; height: 20px;">'.$v['level_cn'].'</span>
							<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="level_menu'.$k.'"></em>
						</span>
						<ul class="droplist">
							<li><a href="javascript:;" title="入门" dataid="rm">入门</a></li>
							<li><a href="javascript:;" title="熟练" dataid="sl">熟练</a></li>
							<li><a href="javascript:;" title="精通" dataid="jt">精通</a></li>
						</ul>
						<input type="hidden" name="level[]" id="level'.$k.'"  value="'.$v['level'].'"/>
						<input type="hidden" name="level_cn[]" id="level_cn'.$k.'" value="'.$v['level_cn'].'"/>
					</div>
					<input type="hidden" name="id[]" value="'.$v['id'].'"/>
					<a href="javascript:;" id="language_del_icon" pro_id="'.$v['id'].'" class="del_icon lag_del_icon" title="删除"></a>
				</div> 
			</div>';
	}
	$html .= '<div class="m_r_e_item clearfix">
				<div class="m_r_e_content"><input type="button" id="language_submit_update" value="保存" class="but60lan" />
				<a href="javascript:;" id="language_submit_cancel" class="canel_but">取消</a></div>
			  </div>
		  </div></form>'; 
	echo $html;
	
}else if($act == 'ajax_add_language')
{
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']);   
	$html = '<form action="?act=ajax_language_save" id="language_resume_form" method="post"><div class="m_r_e_box">
				<div class="m_r_e_item clearfix">
					<div class="m_r_e_content">添加您掌握的语言能力;最多可以添加6门语言</div>
				</div>
			 <div class="m_r_e_item clearfix"> 
				<div class="m_r_e_content clearfix">
					<div class="m_r_e_item select_list lag_input optionlist w_145">
						<span id="language_name" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 133px;" id="city_result_show">
							<span class="items" style="left: 6px; height: 20px;">请选择语种</span>
							<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="language_menu"></em>
						</span>
						<ul class="droplist" id="language_list"></ul>
						 <input type="hidden" name="language" id="language" ajaxurl="'.$_CFG['site_dir'].'plus/ajax_user.php?act=only_check_language" value="" datatype="n" sucmsg="&nbsp;" nullmsg="请选择语言" errormsg="请输入正确的语言类型！"/> 
						<input type="hidden" name="language_cn" id="language_cn" value="" />
					</div>
					<div class="m_r_e_content"></div>
					<div class="m_r_e_item select_list lag_input optionlist w_145">
						<span id="level_name" data-name="industries" class="LocalDataUIC simulation-text LocalDataUIC-simulation-text" style="font-size: 12px; height: 20px; width: 133px;" id="city_result_show">
							<span class="items" style="left: 6px; height: 20px;">请选择等级</span>
							<em class="selectui-drop" style="height: 30px; margin-top: -1px;" id="level_menu"></em>
						</span>
						<ul class="droplist">
							<li><a href="javascript:;" title="入门" dataid="rm">入门</a></li>
							<li><a href="javascript:;" title="熟练" dataid="sl">熟练</a></li>
							<li><a href="javascript:;" title="精通" dataid="jt">精通</a></li>
						</ul>
						<input type="hidden" name="level" id="level" value="" datatype="*" sucmsg="&nbsp;" nullmsg="请选择等级" errormsg="请输入正确的语言类型！" /> 
						<input type="hidden" name="level_cn" id="level_cn" value=""/>
					
					</div>
					<div class="m_r_e_content"></div>
				</div> 
			</div>
			<div class="m_r_e_item clearfix">
				<div class="m_r_e_content"><input type="button" id="language_submit_add" value="保存" class="but60lan" />
				<a href="javascript:;" id="language_submit_cancel" class="canel_but">取消</a></div>
			  </div>
		  </div>
		  </div>
		  </form>
		  '; 
	echo $html;
}

//---------------------------项目经验--------------------------------------------
else if($act == 'ajax_project_save')
{
	$uid=intval($_SESSION['uid']);
	$pid = get_pid($uid);
	$id = intval($_POST['id']); 
	
	$resume_education=get_resume_education($_SESSION['uid'],$pid);
	if (count($resume_education)>=6) exit('教育经历不能超过6条！');
	$setsqlarr['uid']=$uid;
	$setsqlarr['pid']=$pid;
	if ($setsqlarr['uid']==0 || $setsqlarr['pid']==0 ) exit('参数错误！'); 
	$setsqlarr['starttime']=trim($_POST['starttime'])?strtotime(trim($_POST['starttime'])):exit('请填写开始时间！');
	if(trim($_POST['today']) == '1'){
		$setsqlarr['endtime']= '';
	}else{
	    $setsqlarr['endtime']=trim($_POST['endtime'])?strtotime(trim($_POST['endtime'])):exit('请填写结束时间！');
	}
	$setsqlarr['today']=trim($_POST['today'])?$_POST['today']:'0';
	$setsqlarr['project_name']=trim($_POST['project_name'])?$_POST['project_name']:exit('请填写学校名称！');
	$setsqlarr['project_describe']=trim($_POST['project_describe'])?$_POST['project_describe']:exit('请填专业信息！');
	$setsqlarr['project_duty']=trim($_POST['project_duty'])?$_POST['project_duty']:exit('请填专业信息！');
	
	 
	if(!empty($id)){
		if(empty($id)){
			exit('参数错误！');
		}
		$wheresql = " uid=".$uid." and id=".$id; 
		updatetable(table('resume_project'),$setsqlarr,$wheresql);
		$setsqlarr['id'] = $id;
		$setsqlarr['status'] = '2';
	}else{
		$wid = inserttable(table('resume_project'),$setsqlarr,1);
		$setsqlarr['id'] = $wid;
		$setsqlarr['status'] = '1';
	}
	check_resume($_SESSION['uid'],intval($pid));
	//时间返回的处理
	$setsqlarr['starttime']=date('Y-m',$setsqlarr['starttime']);
	if($setsqlarr['today'] == '1'){ 
		$setsqlarr['endtime']= "至今"; 
		$setsqlarr['work_time']=timediff($setsqlarr['starttime'],date('Y-m',time()));
	}else{ 
		$setsqlarr['endtime']=date('Y-m',$setsqlarr['endtime']);
		$setsqlarr['work_time']=timediff($setsqlarr['starttime'],$setsqlarr['endtime']);
	}  
	echo json_encode($setsqlarr);
	
	
}
else if($act == 'project_resume_del')
{
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']);  
	$db->query("delete from ".table('resume_project')." where id=".$id." and pid={$pid} and uid = {$uid}"); 
	check_resume($uid,$pid);
	exit(true);
}
else if($act == 'ajax_get_project')
{
	$uid=intval($_SESSION['uid']);
	$pid=get_pid($uid);
	$id=trim($_POST['id']); 
	if(!empty($id)){
		$project = get_resume_project_one($uid,$pid,$id);
		$starttime = date("Y-m-d",$project['starttime']);
		$endtime = date("Y-m-d",$project['endtime']); 
	} 
	if($project['today'] == '1'){
		$today = 'checked';
		$endtime_input = ' disabled="disabled" style="background-color:#efefef;"';
		$endtime = '';
	}else{
		$today = '';
	}
	$html='
<form action="?act=ajax_project_save" mthod="post" id="project_resume_form">
<div class="m_r_e_box">
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">项目名称</div>
		<div class="m_r_e_content">
			<input type="text" name="project_name" class="text input-medium span300"  value="'.$project['project_name'].'" datatype="*" sucmsg="&nbsp;" nullmsg="请输入项目名称" errormsg="请输入项目名称"/>
		</div>
		<div class="m_r_e_content"></div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">项目时间</div>
		<div class="m_r_e_content">
			<input class="text input-medium span3 date-picker dp-applied" id="start" name="starttime" value="'.$starttime.'">&nbsp;—&nbsp;<input class="text input-medium span3 date-picker dp-applied" id="endtime"  '.$endtime_input.' name="endtime" value="'.$endtime.'">&nbsp;<label>
			<input type="checkbox" '.$today.' name="today" value="1"  /> 至今</label>
		</div> 
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">项目描述</div>
		<div class="m_r_e_content">
			<textarea name="project_describe" id="" class="textarea_455" datatype="*" tip="请输入项目描述" altercss="gray" value="请输入项目描述" errormsg="请填写有效内容">'.$project['project_describe'].'</textarea>
		</div>
	</div>
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">项目职责</div>
		<div class="m_r_e_content">
			<textarea name="project_duty" id="" class="textarea_455" datatype="*" tip="请输入项目职责" altercss="gray" value="请输入项目职责" errormsg="请填写有效内容">'.$project['project_duty'].'</textarea>
		</div>
	</div>
	<input type="hidden" name="id"  value="'.$project['id'].'"/> 
	<div class="m_r_e_item clearfix">
		<div class="m_r_e_title">&nbsp;</div>
		<div class="m_r_e_content">
		<input type="button" value="保存" id="project_ajax_save" class="but60lan" />
		<a href="javascript:;" class="canel_but" id="project_ajax_cancel">取消</a></div>
	</div>
</div></form>
	';  
	echo $html;
	
} 
//----------------自我介绍--------------------------  
elseif($act == 'specialty'){
	$uid=intval($_SESSION['uid']);
	$pid = get_pid($uid);  
	if ($uid==0 || $pid==0 ) exit('参数错误！'); 
	$resume=get_resume_info($uid,$pid);
	$html = '<form action="?act=specialty_update" id="specialty_form" method="post"><div class="m_r_e_box">
		<div class="m_r_e_item clearfix">
			<div class="m_r_e_content">
				<textarea name="specialty" id="specialty" class="textarea_515" datatype="*" tip="请输入自我评价" altercss="gray" value="请输入自我评价" errormsg="请填写有效内容">'.$resume['evaluation'].'</textarea>
			</div>
		</div>
		<div class="m_r_e_item clearfix">
			<div class="m_r_e_content"><input type="button" id="specialty_update" value="保存" class="but60lan" /><a href="javascript:;"  id="specialty_cancel" class="canel_but">取消</a></div>
		</div>
	</div></form>';
	echo $html; 
}
elseif($act == 'specialty_get_info'){
	$uid=intval($_SESSION['uid']);
	$pid = get_pid($uid);  
	if ($uid==0 || $pid==0 ) exit('参数错误！'); 
	$resume=get_resume_info($uid,$pid);
	
	$order=array("\r\n","\n","\r");
	$replace='<br/>'; 
	$newstr=str_replace($order,$replace,$resume['evaluation']); 
	echo $newstr; 
}
elseif($act == 'specialty_update'){ 
	$uid=intval($_SESSION['uid']);
	$pid = get_pid($uid);  
	if ($uid==0 || $pid==0 ) exit('参数错误！'); 
	$wheresql = " uid=".$uid." and id=".$pid; 
	$setsqlarr['evaluation']=trim($_POST['specialty']);  
	updatetable(table('resume'),$setsqlarr,$wheresql); 
	check_resume($uid,$pid); 
	$order=array("\r\n","\n","\r");
	$replace='<br/>'; 
	$newstr=str_replace($order,$replace,$setsqlarr['evaluation']); 
	echo $newstr; 
}

















