コード例 #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 Diagnosticos the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Diagnosticos::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #2
0
<div class="form">

<?php 
if (isset($_GET['idPaciente'])) {
    $elPaciente = $_GET['idPaciente'];
} else {
    $elPaciente = "0";
}
if (isset($_GET['idCita'])) {
    $laCita = $_GET['idCita'];
} else {
    $laCita = 0;
}
$paciente = Paciente::model()->find("id={$elPaciente}");
$diagnosticos_p = Diagnosticos::model()->findAll(array("condition" => "tipo = 'Principal'", 'order' => 'diagnostico asc'));
$diagnosticos_d = Diagnosticos::model()->findAll(array("condition" => "tipo = 'Relacionado'", 'order' => 'diagnostico asc'));
//Calculo de Edad
$anio_nacimiento = Yii::app()->dateformatter->format("yyyy", $paciente->fecha_nacimiento);
$edadpaciente = date("Y") - $anio_nacimiento;
//array('name'=>'Edad', 'value'=>$edadpaciente, ''),
?>
<div class="row">
		<h4 class="text-center">Datos de Paciente</h4>
		<div class="span1"></div>
		<div class="span5">
			<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $paciente, 'attributes' => array('nombreCompleto', 'n_identificacion', array('name' => 'Edad', 'value' => $edadpaciente, ''))));
?>
		</div>
		<div class="span5">
			<?php