/**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  */
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['id'])) {
             $this->_model = Mensaje::model()->findbyPk($_GET['id']);
         }
         if ($this->_model === null) {
             throw new CHttpException(404, Yii::t('App', 'The requested page does not exist.'));
         }
     }
     return $this->_model;
 }
Esempio n. 2
0
 public function actionGeneratePdf()
 {
     $session = new CHttpSession();
     $session->open();
     if (isset($session['Mensaje_model_search'])) {
         $model = $session['Mensaje_model_search'];
         $model = Mensaje::model()->findAll($model->search()->criteria);
     } else {
         $model = Mensaje::model()->findAll();
     }
     $this->toExcel($model, array('id', 'userEmisor', 'userReceptor', 'fecha', 'mensaje', 'estado'), date('Y-m-d-H-i-s'), array(), 'PDF');
 }