<?php
/**
 * 新建社区分类
 * @author yzxh24
 */
class AddCategoryAction extends BaseAction
{
    public function run()
    {
        if (Yii::app()->request->isPostRequest)
        {
            $forum = new Forum();
            $forum->name = Yii::app()->request->getPost('name');
            $forum->type = 'category';
            $forum->save();
            $this->getController()->redirect(array('index'));
        }
        else
        {
            throw new CHttpException('500', '非法请求');
        }
    }
}