<?php
class ChangeStatusAction extends BaseAction
{
    public function run()
    {
        $id = Yii::app()->request->getQuery('id');
        $book = Books::model()->findByPk($id);
        if ($book->status)
        {
            $text = '连载';
            $book->status = 0;
        }
        else
        {
            $text = '<font color=red>完成</font>';
            $book->status = 1;
        }
        $book->save();
        
        echo CHtml::link($text, '', array('onclick' => 'changeStatus('.$id.',this);'));
        Yii::app()->end();
    }
}