/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $user = Usuario::model()->findbyPk(Yii::app()->user->getId()); $acceso = Usuario::privilegiado($user->rol_id); date_default_timezone_set('America/Caracas'); $fecha = date('Y-m-d H:i:s'); $model = new Responsable(); $model->dependencia_id = $user->dependencia_id; $model->fecha = $fecha; if (isset($_POST['Responsable'])) { $model->attributes = $_POST['Responsable']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $dps = Dependencia::model()->findAll(array('condition' => 'sede_id=1', 'order' => 'descripcion ASC')); $status = BmStatus::model()->findAll(); $personas = Persona::model()->listAll(); $this->render('create', array('model' => $model, 'dps' => $dps, 'status' => $status, 'personas' => $personas, 'acceso' => $acceso)); }