<?php
/**
 * Descriptions
 * @author yzxh24
 * @email yzxh24@gmail.com
 * @created 2011-08-10 17:07:02
 */
class UpdateAction extends BaseAction
{
    public function run()
    {
        //put your code here
        $id = Yii::app()->request->getQuery('id');
        $model = SpecialSubject::model()->findByPk($id);
        $special = Special::model()->findByPk($model->sid);

		// Uncomment the following line if AJAX validation is needed
		// $this->performAjaxValidation($model);

		if(isset($_POST['SpecialSubject']))
		{
			$model->attributes = $_POST['SpecialSubject'];
			if($model->save())
            {
				$this->getController()->redirect(array('list','id' => $model->sid));
            }
		}

        $this->getController()->addBreadcrumb(array($special->subject => array('/admin/specialsubject/list','id'=>$special->id)));
		$this->getController()->render('update',array(
			'model' => $model,
		));
    }
}