<?php
namespace Merchant\Controller;

/**
 * 分类控制器
 */
class CategoryController extends AdminController {


    /**
     * 分类列表页
     */
    public function index(){

        $map['status'] = array('in','1,0');
        $map['mid'] = UID;
        $list   = $this->lists(CONTROLLER_NAME, $map);

        $this->assign('_list', $list);
        $this->meta_title = 'Category List';
        $this->display();
    }



    /**
     * 分类编辑页面
     */
    public function edit(){
    	if(IS_POST){
            $this->save(CONTROLLER_NAME,'index');

        } else {
            $info = $this->getInfo(CONTROLLER_NAME);
            $this->assign('info',$info);
            $this->meta_title = empty($info)? 'New category':'Edit category' ;
            $this->display();
        }
    }

}