<?php
/**
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
* @version $Id: addclass.inc.php 20 2008-10-04 14:59 $
*/
(!defined('IN_ADMIN') || !defined('IN_MUDDER')) && exit('Access Denied');
require_once(MOD_ROOT."./model/class.php");
$model = new ClassModle();

if(!$dosubmit) {

    if($panelcode) {
        $panels = $model->getClasscodes();
    }
    include cptpl('classadd', MOD_ROOT.'./admin/templates/');

} else {

    $post = array();
    $post['classname'] = html_special_chars_ex($classname);
    if(!$post['classname']) cpmsg('未填写分类名，请返回修改。');
    $post['classorder'] = intval($classorder);
    if($classsort==2) {
        $post['panelcode'] = $panelcode;
        $model->saveSubClasscode($post);
        $model->cacheClass();
        $url = "admincp.php?action=shop&file=classlist&panelcode=".$panelcode;
    } else {
        $post['sorts'] = array('sort1'=>'点评项');
        $post['mapmark'] = 0;
        $post['itemapply'] = 0;
        $post['avgprice_need'] = 0;
        $post['suitplace_enable'] = 0;
        $post['suitplaces'] = '';
        $post['scoretype'] = 10;
        $post['decimalpoint'] = 0;
        $post['tplname_list'] = 'shop_cate';
        $post['tplname_detail'] = 'shop_index';
        $post['meta_keywords'] = 'php点评系统,modoer';
        $post['meta_description'] = '';

        $newclasscode = $model->saveClasscode($post);
    }
    unset($post);
    $model->cachePanel();
    if($classsort==2) {
        cpmsg("添加完毕!",$url);
    } else {
        header('Location:admincp.php?action='.$action.'&file=classedit&classcode='.$newclasscode);
    }
}
?>