<?php
class EditViewOrderAction extends BaseAction
{
    public function run()
    {
        if (Yii::app()->request->isAjaxRequest)
        {
            $fid = intval(Yii::app()->request->getQuery('fid'));
            $id = intval(Yii::app()->request->getQuery('id'));
            $viewOrder = intval(Yii::app()->request->getQuery('order'));
            
            $type = TopicTypes::model()->findByPk($id);
            if (empty($type))
            {
                echo '不存在的分类';
                Yii::app()->end();
            }
            if ($type->fid != $fid)
            {
                echo '此分类不属于本版块，不能修改';
                Yii::app()->end();
            }
            $type->vieworder = $viewOrder;
            $type->save();
            Yii::app()->end();
        }
    }
}