<?php
function module_region_edit()
{
	global $global,$smarty;
	$list = array();
	$obj = new region();
	$arr = $obj->get_list();
	if(count($arr) > 0)
	{
		$list = $obj->set_cat_order($arr);
		for($i = 0; $i < count($list); $i ++)
		{
			$list[$i]['parent_name'] = get_data('region',$list[$i]['reg_parent_id'],'reg_name');
			$obj->set_where('');
			$obj->set_where('reg_parent_id = ' . $list[$i]['reg_id']);
			if($obj->get_count() > 0)
			{
				$list[$i]['exist_child'] = 1;
			}else{
				$list[$i]['exist_child'] = 0;
			}
			$list[$i]['show'] = 1;
		}		
	}
	
	$family = get_cat_family('region',$global['id']);
	for($i = 0; $i < count($family); $i ++)
	{
		for($j = 0; $j < count($list); $j ++)
		{
			if($family[$i] == $list[$j]['reg_id'])
			{
				$list[$j]['show'] = 0;
			}
		}
	}
	$smarty->assign('region_list',$list);
	
	$obj = new region();
	$obj->set_where('reg_id = '.$global['id']);
	$one = $obj->get_one();
	$smarty->assign('cat',$one);
}
//红头船
?>