<?php
if (!defined('IN_59MIAO'))
{
	exit('Access Defined');
}
//文章资讯类别条控制器
class ArtilenavAction extends Action {	
	public function __construct() {
		parent::__construct();		
	}
	
	public function index() {
		parent::page();	
		$AllNav=$this->_model->findAll();		
		$this->_tpl->assign('AllNav',$AllNav);
		$this->_tpl->display(SMARTY_ADMIN.'artile/nav_show.tpl');
	}		
	public function add() {
		if (isset($_POST['send'])) $this->_model->add() ? $this->_redirect->succ(Tool::getPrevPage(), '资讯类别新增成功！') : $this->_redirect->error('资讯类别新增失败！');
		if (isset($_GET['id'])) $this->_tpl->assign('OneNav', $this->_model->findOne());		
		$this->_tpl->display(SMARTY_ADMIN.'artile/nav_add.tpl');
	}	
	
	public function update(){
		if (isset($_POST['send'])) $this->_model->update() ? $this->_redirect->succ(Tool::getPrevPage(), '资讯类别名称修改成功！') : $this->_redirect->error('资讯类别名称修改失败！');
		if (isset($_GET['id'])) {			
			$OneNav=$this->_model->findOne();			
			$this->_tpl->assign('OneNav',$OneNav);			
			$this->_tpl->display(SMARTY_ADMIN.'artile/nav_update.tpl');
		}
	}	
	public function delete(){
		if (isset($_GET['id'])) $this->_model->delete() ? $this->_redirect->succ(Tool::getPrevPage(), '资讯类别名称删除成功！') : $this->_redirect->error('资讯类别名称删除失败！,可能该资讯类别下面还有文章,请删除文章重试');
	}		
	public function isName() {
		$this->_model->isName();
	}
	
}
?>