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