<div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Adicionar' : 'Salvar'); ?> </div> <?php $this->endWidget(); ?> </div><!-- form --> <hr> <h4>Editar Funções</h4> <div class="view"> <?php $pessoas = FuncoesPessoa::model()->findAll(array('order' => 'funcao')); ?> <table> <tr> <th>Função</th><th>Pessoa</th> </tr> <?php foreach ($pessoas as $p) { ?> <tr class="func"> <td> <?php echo CHtml::link(CHtml::encode($p->funcao), array('update', 'id' => $p->cod_funcao)); ?> </td> <td>
/** * 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 = FuncoesPessoa::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }