<?php
require 'inc.php';
$obj_channel=new cls_tab_article_channel();

if($get_act=="del"){
	$arr_return=$obj_channel->on_del($get_id);
	if($arr_return["err"]!="") $obj_msg->alert($arr_return["err"]);
}
if($get_act=="del_sel"){
	$arr_return=$obj_channel->on_del($get_channelid);
	if($arr_return["err"]!="") $obj_msg->alert($arr_return["err"]);
}

switch($get_act)
{	
	case 'save':
	{
		$arr_fields=array();
		$arr_fields["channel_id"]=$get_id;
		$arr_fields["channel_name"]=$get_channel_name;
		if(!isset($get_channel_savehtml)) $get_channel_savehtml=0;
		$arr_fields["channel_savehtml"]=$get_channel_savehtml;
		$arr_fields["channel_htmldir"]=$get_channel_htmldir;
		$arr_fields["channel_article_tpl"]=$get_channel_article_tpl;
		$arr_fields["channel_htmldir_split"]=$get_channel_htmldir_split;
		$arr_fields["channel_tpl"]=$get_channel_tpl;
		$arr_msg=$obj_channel->on_save($arr_fields);
		if($arr_msg["err"]=="") $get_id=$arr_msg["id"];
		include 'tpl/_msg.tpl.php';
	    break;
	}
	case 'edit':
	{
		$arr_channel=array();
		$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."article_channel where channel_id='".$get_id."'");
		while($obj_rs = $obj_db->fetch_array($obj_result))
		{
			$arr_channel = $obj_rs;
		}
		include 'tpl/channel.edit.tpl.php';
		break;
	}
	case 'add':
	{
		include "tpl/channel.add.tpl.php";
		break;
	}
	default:
	{
		$arr_channel=array();
		$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."article_channel order by channel_sort");
		while($obj_rs = $obj_db->fetch_array($obj_result))
		{
			$arr_channel[] = $obj_rs;
		}
		include "tpl/channel.tpl.php";
	}
}
?>
