コード例 #1
0
 private function onFileUploaded($filePath, $userdata, $tipoFoto)
 {
     /*Yii::app()->user->setFlash('success',".".$filePath."  -  ".$userdata.".");	*/
     // will invoke method in a class defined when you setup the widget:
     // using: receptorClassName and methodName attributes.
     $this->_invokeMethod($filePath, $userdata, $tipoFoto);
     //Darle vuelta
     $elarchivo = substr($filePath, strpos($filePath, '/') + 1, strlen($filePath));
     $elarchivo = substr($elarchivo, strpos($elarchivo, '/'), strlen($elarchivo));
     $elarchivo = str_replace(' ', '', $elarchivo);
     if ($tipoFoto == "T") {
         $losTemporales = new TempImagenes();
         $losTemporales->archivo = $elarchivo;
         if ($losTemporales->save()) {
             # code...
         }
     }
     if ($tipoFoto == "B") {
         $losTemporales = new TempImagenes();
         $losTemporales->archivo = $elarchivo;
         if ($losTemporales->save()) {
             # code...
         }
     }
     if ($tipoFoto == "TP") {
         $losTemporales = new TempExamenes();
         $losTemporales->archivo = $elarchivo;
         if ($losTemporales->save()) {
             # code...
         }
     }
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['PacienteResultadosLab'])) {
         $model->attributes = $_POST['PacienteResultadosLab'];
         if ($model->save()) {
             $losarchivos = TempExamenes::model()->findAll();
             foreach ($losarchivos as $los_archivos) {
                 $losAdjuntos = new PacienteResultadosLabDetalle();
                 //Tabla que queda
                 $losAdjuntos->paciente_resultados_lab_id = $model->id;
                 $losAdjuntos->archivo = $los_archivos->archivo;
                 $losAdjuntos->save();
             }
             TempExamenes::model()->deleteAll();
         }
         $this->redirect(array('view', 'id' => $model->id));
     }
     $this->render('update', array('model' => $model));
 }