예제 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Auditoria();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Auditoria'])) {
         $model->attributes = $_POST['Auditoria'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
예제 #2
0
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     $this->loadModel($id)->delete();
     date_default_timezone_set('America/Caracas');
     $auditoria = new Auditoria();
     $auditoria->id_user = Yii::app()->user->getId();
     $auditoria->accion = 4;
     $auditoria->modelo = $this->modelo;
     $auditoria->id_registro = $id;
     $auditoria->fecha = date("Y-m-d h:i:s");
     $auditoria->save(false);
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }
예제 #3
0
 public function actionImprimir()
 {
     $model = new Imprimir();
     if (isset($_POST['Imprimir'])) {
         $model->attributes = $_POST['Imprimir'];
         if ($model->validate()) {
             $this->renderPartial('reporte', array('model' => $model->fecha));
             date_default_timezone_set('America/Caracas');
             $auditoria = new Auditoria();
             $auditoria->id_user = Yii::app()->user->getId();
             $auditoria->accion = 7;
             $auditoria->modelo = $this->modelo;
             $auditoria->id_registro = 0;
             $auditoria->fecha = date("Y-m-d h:i:s");
             $auditoria->save(false);
             return true;
         }
     }
     $this->render('imprimir', array('model' => $model));
 }
예제 #4
0
 public function actionFicha($id)
 {
     if (Yii::app()->request->isAjaxRequest) {
         //outputProcessing = true because including css-files ...
         date_default_timezone_set('America/Caracas');
         $auditoria = new Auditoria();
         $auditoria->id_user = Yii::app()->user->getId();
         $auditoria->accion = 5;
         $auditoria->modelo = $this->modelo;
         $auditoria->id_registro = $id;
         $auditoria->fecha = date("Y-m-d h:i:s");
         $auditoria->save(false);
         $this->renderPartial('ficha', array('model' => $this->loadModel($id)), false, true);
         //js-code to open the dialog
         if (!empty($_GET['asDialog'])) {
             echo CHtml::script('$("#dlg-address-view").dialog("open")');
         }
         Yii::app()->end();
     } else {
         $this->render('ficha', array('model' => $this->loadModel($id)));
     }
 }