<?php
/*
===========================用户控制器
^^^^^^^^^^^^^^^^^^成员
------添加(on_insert)
------修改(on_update)
------删除(on_del)

*/
class cls_tab_hr_job_history extends cls_base_table
{
	private $tab_jobhistory;
	private $obj_db;
	private $config=array();
	//构造函数
	function __construct()
	{
		global $obj_db;
		parent::__construct();
		$this->obj_db=$obj_db;
		$this->tab_jobhistory=DB_PRE."hr_job_history";
	}
	/*添加
	arr_fields:关健字数组
	*/
	function on_save($arr_fields)
	{
		$arr_return=array("err"=>"","id"=>0);
		(!isset($arr_fields["history_id"]))? $arr_fields["history_id"]=0:$arr_fields["history_id"]=intval($arr_fields["history_id"]);
		(!isset($arr_fields["history_resume_id"]))? $arr_fields["history_resume_id"]=0:$arr_fields["history_resume_id"]=intval($arr_fields["history_resume_id"]);

		if($arr_fields["history_resume_id"]<1){
			$arr_return["err"]="个人简历ID不能为空！";
			return $arr_return;
		}

		//保存操作
		$lng_id=$arr_fields["history_id"];
		unset($arr_fields["history_id"]);//释放id
		$arr_fields["history_updatetime"]=TIME;

		if($lng_id<1){
			$arr_fields["history_addtime"]=TIME;
			$arr_return=self::_insert($arr_fields);
		}else{
			$str_where="history_id='".$lng_id."'";
			$arr_return=self::_update($arr_fields,$str_where);
			$arr_return["id"]=$lng_id;
		}
		return $arr_return;
	}
	function _insert($arr_fields)
	{
		$arr_return=array("err"=>"","id"=>0);
		$arr_return=parent::on_insert($this->tab_jobhistory,$arr_fields);
		return $arr_return;
	}
	function _update($arr_fields,$msg_where)
	{
		$arr_return=array("err"=>"","id"=>0);
		$arr_return=parent::on_update($this->tab_jobhistory,$arr_fields,$msg_where);
		return $arr_return;
	}
	function on_del($arr_id)
	{
		$arr_return=array("err"=>"");
		$str_id=get_arr_id($arr_id);
		if($str_id==""){
			$arr_return["err"]="没有指定要删除的记录！";
			return $arr_return;
		}
		$arr_return=parent::on_del($this->tab_jobhistory,"history_id in(".$str_id.")");
		return $arr_return;
	}}
?>
