<?php
require 'inc.php';
$obj_tab_fz=new cls_tab_sys_fz();
$arr_state=$obj_tab_fz->state;
if($get_act=="del"){
	$arr_return=$obj_tab_fz->on_del($get_id);
	if($arr_return["err"]!="") $obj_msg->alert($arr_return["err"]);
}
if($get_act=="del_sel"){
	$arr_return=$obj_tab_fz->on_del($get_fzid);
	if($arr_return["err"]!="") $obj_msg->alert($arr_return["err"]);
}
switch($get_act)
{	
	case 'save':
	{
		$arr_fields=array();
		$arr_fields["fz_id"]=$get_id;
		$arr_fields["fz_domain"]=$get_fz_domain;
		$arr_fields["fz_state"]=$get_fz_state;
		$arr_fields["fz_name"]=$get_fz_name;
		$arr_fields["fz_temp"]=$get_fz_temp;
		$arr_msg=$obj_tab_fz->on_save($arr_fields);
		include 'tpl/_msg.tpl.php';
	    break;
	}
	case 'edit':
	{
		$arr_fz=array();
		$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."sys_fz where fz_id='".$get_id."'");
		if($obj_rs = $obj_db->fetch_array($obj_result))
		{
			$arr_fz = $obj_rs;
		}else{
			$arr_fz = $obj_db->get_fields(DB_PRE."sys_fz",true);
		}
		include 'tpl/fz.edit.tpl.php';
		break;
	}
	default:
	{
		//·ÖÒ³
		$str_where="";
		$arr_fz=array();
		$obj_rs   = $obj_db->get_one("SELECT count(*) as num FROM ".DB_PRE."sys_fz".$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."sys_fz".$str_where.$str_limit);
		while($obj_rs = $obj_db->fetch_array($obj_result))
		{
			$obj_rs["state"]=array_search($obj_rs["fz_state"],$arr_state);
			$arr_fz[] = $obj_rs;
		}
		include "tpl/fz.tpl.php";

	}
}

?>
