/**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = PatrimonioCategoria::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #2
0
?>
		<?php 
echo $form->error($model, 'nome');
?>
	</div>
	
	<div class="row">
			<label>Categoria do Item</label>
			<?php 
$categorias = array();
?>
			<?php 
$categorias["NULL"] = "Não Selecionado";
?>
			<?php 
$categorias = $categorias + CHtml::listData(PatrimonioCategoria::model()->findAll(array('order' => 'nome')), 'cod_categoria', 'nome');
?>
			<?php 
echo $form->dropDownList($model, 'cod_categoria', $categorias);
?>
			<?php 
echo $form->error($model, 'cod_categoria');
?>
		</div>
	
		<div class="row">
		<?php 
echo $form->labelEx($model, 'data_aquisicao');
?>
		<?php 
$data_aquisicao = isset($model->data_aquisicao) ? date("Y-m-d", strtotime($model->data_aquisicao)) : date("Y-m-d");