/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'show' page. */ public function actionCreate() { $model = new Donor(); if (isset($_POST['Donor'])) { $model->attributes = $_POST['Donor']; $model->companyId = Yii::app()->user->getState('selectedCompanyId'); if ($model->save()) { ChangeLog::addLog('ADD', 'Donor', $model->toString()); $this->redirect(array('admin', 'id' => $model->id)); } } $model->dateChanged = User::getDateFormatted(date('Y-m-d')); $this->render('create', array('model' => $model)); }