<?php
/**
 * ajax修改版块名
 * @author yzxh24
 */
class EditNameAction extends BaseAction
{
    public function run()
    {
        if (Yii::app()->request->isAjaxRequest)
        {
            $fid = intval(Yii::app()->request->getQuery('fid'));
            $name = Yii::app()->request->getPost('name');
            $forum = Forum::model()->findByPk($fid);
            if (empty($forum))
            {
                echo '不存在的版块';
                Yii::app()->end();
            }
            $forum->name = $name;
            $forum->save();
            Yii::app()->end();
        }
    }
}