<?php
require 'inc.php';
$obj_tab_vip=new cls_tab_hr_company_vip();

$page_footer_info=<<<HTML
HTML;


if($get_act=="del"){
	$arr_return=$obj_tab_vip->on_del($get_id);
	if($arr_return["err"]!="") $obj_msg->alert($arr_return["err"]);
}
if($get_act=="del_sel"){
	$arr_return=$obj_tab_vip->on_del($get_vipid);
	if($arr_return["err"]!="") $obj_msg->alert($arr_return["err"]);
}
switch($get_act)
{	
	case 'save':
	{
		$arr_fields=array();
		if(!isset($get_vip_viewresume)) $get_vip_viewresume=0;
		$arr_fields["vip_id"]=$get_id;
		$arr_fields["vip_name"]=$get_vip_name;
		$arr_fields["vip_viewresume"]=$get_vip_viewresume;
		$arr_fields["vip_days"]=$get_vip_days;
		$arr_fields["vip_jobnum"]=$get_vip_jobnum;
		$arr_fields["vip_invitenum"]=$get_vip_invitenum;
		$arr_fields["vip_collectnum"]=$get_vip_collectnum;
		$arr_fields["vip_searchnum"]=$get_vip_searchnum;
		$arr_fields["vip_emailnum"]=$get_vip_emailnum;
		$arr_fields["vip_price"]=$get_vip_price;
		$arr_fields["vip_beta"]=$get_vip_beta;
		$arr_msg=$obj_tab_vip->on_save($arr_fields);
		if($arr_msg["err"]=="") $get_id=$arr_msg["id"];
		include 'tpl/_msg.tpl.php';
	    break;
	}
	case 'edit':
	{
		$arr_vip=array();
		$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."hr_company_vip where vip_id='".$get_id."'");
		if($obj_rs = $obj_db->fetch_array($obj_result))
		{
			$arr_vip = $obj_rs;
		}
		include 'tpl/company_vip.edit.tpl.php';
		break;
	}
	case 'add':
	{
		$get_id=0;
		include "tpl/company_vip.add.tpl.php";
		break;
	}
	default:
	{
		//·ÖÒ³
		$str_where=" where 1";
		$arr_vip=array();
		$obj_rs   = $obj_db->get_one("SELECT count(*) as num FROM ".DB_PRE."hr_company_vip".$str_where);
		$int_total=$obj_rs["num"];
		$int_pages= ceil($int_total/$int_pagesize);
		$get_page = min($int_pages, $get_page);
		$get_page = max($get_page, 1);
		$page_split_page=get_pages($int_total, $get_page, $int_pagesize);
		$int_offset = $int_pagesize*($get_page-1);
		$str_limit = " limit ".$int_offset.",".$int_pagesize;
		$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."hr_company_vip".$str_where.$str_limit);
		while($obj_rs = $obj_db->fetch_array($obj_result))
		{
			$arr_vip[] = $obj_rs;
		}
		include "tpl/company_vip.tpl.php";

	}
}


?>