/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new PacienteBaul(); $paciente = Paciente::model()->findByPk($_GET['idPaciente']); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['PacienteBaul'])) { $model->attributes = $_POST['PacienteBaul']; $model->paciente_id = $_GET['idPaciente']; $model->personal_id = Yii::app()->user->usuarioId; $model->detalle = $_POST['PacienteBaul']['detalle']; $model->fecha = date("Y-m-d H:i:s"); if ($model->save()) { $losarchivos = TempImagenes::model()->findAll(); } foreach ($losarchivos as $los_archivos) { $losAdjuntos = new PacienteBaulDetalle(); //Tabla que queda $losAdjuntos->paciente_baul_id = $model->id; $losAdjuntos->archivo = $los_archivos->archivo; $losAdjuntos->save(); } TempImagenes::model()->deleteAll(); $this->redirect(array('view', 'id' => $model->id)); } $this->render('create', array('model' => $model, 'paciente' => $paciente)); }
if ($baul > 0) { ?> <div class="tab-pane" id="baul"> <h5>Baúl de Pacientes</h5> <table class="table table-condensed"> <tr> <th>Fecha</th> <th>Descripción</th> <th>Archivos</th> <th></th> </tr> <?php $losarchivos = PacienteBaul::model()->findAll("paciente_id = {$model->id}"); foreach ($losarchivos as $los_archivos) { $nArchivos = PacienteBaulDetalle::model()->count("paciente_baul_id = {$los_archivos->id}"); ?> <tr> <td><?php echo Yii::app()->dateformatter->format("dd-MM-yyyy", $los_archivos->fecha); ?> </td> <td><?php echo $los_archivos->detalle; ?> </td> <td><?php echo $nArchivos; ?> </td>
<div class="row"> <div class="span1"></div> <div class="span10"> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'fecha', 'value' => $laFecha, '')))); ?> <h3 class="text-center">Archivos</h3> <table class="table table-striped"> <tr> <th>Archivos</th> <th></th> </tr> <?php $losArchivos = PacienteBaulDetalle::model()->findAll("paciente_baul_id = {$model->id}"); ?> <?php foreach ($losArchivos as $los_archivos) { ?> <tr> <td> <center> <?php echo $los_archivos->archivo; ?> </center> </td> <td> <a href=<?php echo yii::app()->baseUrl . "/adjuntos/" . $los_archivos->archivo;