public function afterDelete($event) { $log = new Activerecordlog(); $log->description = 'Usuario ' . Yii::app()->user->Name . ' elimino ' . get_class($this->Owner) . '[' . $this->Owner->getPrimaryKey() . '].'; $log->action = 'Elimino'; $log->model = get_class($this->Owner); $log->idModel = $this->Owner->getPrimaryKey(); $log->field = ''; $log->creationdate = new CDbExpression('NOW()'); $log->userid = Yii::app()->user->id; $log->save(); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Activerecordlog(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Activerecordlog'])) { $model->attributes = $_POST['Activerecordlog']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }