コード例 #1
0
if (isset($_GET['idPaciente'])) {
    $elPaciente = $_GET['idPaciente'];
} else {
    $elPaciente = "0";
}
if (isset($_GET['idCita'])) {
    $laCita = $_GET['idCita'];
} else {
    $laCita = "0";
}
$model = Paciente::model()->find("id={$elPaciente}");
//Calculo de Edad
$anio_nacimiento = Yii::app()->dateformatter->format("yyyy", $model->fecha_nacimiento);
$edadpaciente = date("Y") - $anio_nacimiento;
//array('name'=>'Edad', 'value'=>$edadpaciente, ''),
$formulaciones = Formulacion::model()->findAll(array("condition" => "id > 0", 'order' => 'nombre asc'));
?>
<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' => $model, 'attributes' => array('nombreCompleto', 'n_identificacion', array('name' => 'Edad', 'value' => $edadpaciente, ''))));
?>
		</div>
		<div class="span5">
			<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('email', 'telefono1', 'celular')));
?>
		</div>
		<div class="span1"></div>
コード例 #2
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 Formulacion the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Formulacion::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }