<!-- Historial de Plan de Tratamiento -->
<?php 
if ($Gplan > 0) {
    ?>
<div id="Gplan" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Historial de Plan de Tratamiento</h3>
  </div>
  <div class="modal-body">
 	<!-- Evaluar politicas de cancelación -->
 	<?php 
    $Gplantratamiento = HistorialPlanTratamiento::model()->findAll("paciente_id = {$model->paciente_id}");
    foreach ($Gplantratamiento as $Gplan_tratamiento) {
        //$latabla = HistorialTablaMedidas::model()->find("cita_id = $model->id");
        ?>
 
 		<?php 
        $this->widget('zii.widgets.CDetailView', array('data' => $Gplan_tratamiento, 'attributes' => array(array('name' => 'fecha', 'value' => Yii::app()->dateformatter->format("dd-MM-yyyy", $Gplan_tratamiento->fecha), ''), 'observaciones')));
        ?>
 		<table class="table table-striped">
			<tr>
				<th>Linea</th>
				<th>Observaciones</th>
			</tr>
		
		<?php 
        $Gplanlineas = HistorialPlanTratamientoDetalle::model()->findAll("historial_plan_tratamiento_id = {$Gplan_tratamiento->id}");
?>

					<?php 
if ($plan > 0) {
    ?>
		                <div class="tab-pane" id="plan">
		                	<h5>Historial de Plan de Tratamiento</h5>
		                	<table class="table table-condensed">
		                		<tr>
		                			<th>Fecha</th>
		                			<th>Responsable</th>
		                			<th></th>
		                		</tr>
		                
		                	<?php 
    $losPlanes = HistorialPlanTratamiento::model()->findAll("paciente_id = {$model->id}");
    foreach ($losPlanes as $los_planes) {
        ?>
						 			<tr>
						 				<td><?php 
        echo Yii::app()->dateformatter->format("dd-MM-yyyy", $los_planes->fecha);
        ?>
</td>
						 				<td><?php 
        echo $los_planes->personal->nombreCompleto;
        ?>
</td>
						 				<td><a href="index.php?r=historialPlanTratamiento/view&id=<?php 
        echo $los_planes->id;
        ?>
" class="btn btn-mini btn-info"><i class="icon-search icon-white"></i></a></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 $id the ID of the model to be loaded
  * @return HistorialPlanTratamiento the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = HistorialPlanTratamiento::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }