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

        $special = Special::model()->findByPk($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('view','id' => $model->id));
            }
		}

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