예제 #1
0
 /**
  * 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.
  * @param integer $id the ID of the model to be loaded
  * @return TipoDespesa the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = TipoDespesa::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #2
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Despesa('search');
     $model->unsetAttributes();
     $oSearchForm = new SearchForm();
     $oTiposDespesa = TipoDespesa::model()->ordenarTitulo()->findAll();
     $oUsuarios = Usuario::model()->ordenarNome()->findAll();
     if (isset($_GET['Despesa'])) {
         $model->attributes = $_GET['Despesa'];
         $oSearchForm->request = $_GET['Despesa'];
     }
     $this->render('admin', array('model' => $model, 'oTiposDespesa' => $oTiposDespesa, 'oUsuarios' => $oUsuarios, 'exibeFormularioBusca' => $oSearchForm->checaRequisicaoVazia()));
 }