<?php
require "inc.php";
defined('IN_AJAX') or $obj_msg->on_error('access');

switch($get_act)
{
	case "get_job_category_select":
	{
		require_once(SYS_ROOT.'/cls_tab/tab.hr.job.category.php');
		$obj_tab_category=new cls_tab_hr_job_category();
		$str_category=$obj_tab_category->get_next_category($get_id);
		echo $str_category;
		break;
	}
	case "get_area_select":
	{
		require_once(SYS_ROOT.'/cls_tab/tab.sys.area.php');
		$obj_tab_area=new cls_tab_sys_area();
		$str_area=$obj_tab_area->get_next_area($get_id);
		echo $str_area;
		break;
	}
	case "get_folder_select":
	{
		require_once(SYS_ROOT.'/cls_tab/tab.article.folder.php');
		$obj_tab_folder=new cls_tab_article_folder();
		$str_folder=$obj_tab_folder->get_next_folder($get_id);
		echo $str_folder;
		break;
	}
	case "job_collect":{
		//个人收藏职位
		require_once(SYS_ROOT.'/cls_tab/tab.hr.job.collect.php');
		$obj_tab_job_collect=new cls_tab_hr_job_collect();
		$arr_fields=array();
		$arr_id=explode(",",$get_jobid);
		//过滤jobid
		$arr_jobid=array();
		foreach($arr_id as $item){
			$lng_jobid=intval($item);
			if($lng_jobid>0){
				$arr_jobid[]=$lng_jobid;
			}
		}
		$str_msg="";
		$str_err="";
		if(count($arr_jobid)>0){
			$str_jobid=implode(",",$arr_jobid);
			$obj_result = $obj_db->query("SELECT job_id,job_user_id FROM ".DB_PRE."hr_job where job_id in(".$str_jobid.")");
			while($obj_rs = $obj_db->fetch_array($obj_result))
			{	
				$arr_fileds=array();
				$arr_fields["collect_job_id"]=$get_jobid;
				$arr_fields["collect_user_id"]=$obj_ctl_user->id;
				$arr_fields["collect_company_user_id"]=$obj_rs["job_user_id"];
				$arr_msg=$obj_tab_job_collect->on_save($arr_fields);
				if($arr_msg["err"]!=""){
					$str_err=$arr_msg["err"];
				}
			}
			if($str_err!=""){
				echo $str_err;
				exit;
			}else{
				echo "收藏成功！";
				exit;
			}
		}else{
			echo "要收藏的职位不存在！";
			exit;
		}
		break;
	}
	case "resume_collect":{
		//个人收藏职位
		$obj_tab_resume_collect=new cls_tab_hr_resume_collect();
		$arr_fields=array();
		$arr_id=explode(",",$get_userid);
		//过滤jobid
		$get_userid=array();
		foreach($arr_id as $item){
			$lng_userid=intval($item);
			if($lng_userid>0){
				$get_userid[]=$lng_userid;
			}
		}
		$str_msg="";
		$str_err="";
		if(count($get_userid)>0){
			$str_userid=implode(",",$get_userid);
			$obj_result = $obj_db->query("SELECT resume_id,resume_user_id FROM ".DB_PRE."hr_resume where resume_user_id in(".$str_userid.")");
			while($obj_rs = $obj_db->fetch_array($obj_result))
			{	
				$arr_fileds=array();
				$arr_fields["collect_resume_user_id"]=$obj_rs["resume_user_id"];
				$arr_fields["collect_user_id"]=$obj_ctl_user->id;
				$arr_msg=$obj_tab_resume_collect->on_save($arr_fields);
				if($arr_msg["err"]!=""){
					$str_err=$arr_msg["err"];
				}
			}
			if($str_err!=""){
				echo $str_err;
				exit;
			}else{
				echo "收藏成功！";
				exit;
			}
		}else{
			echo "要收藏的简历不存在！";
			exit;
		}
	}
}

?>