public function getAll() { $result = array(); $html = file_get_html("http://www.eps.uam.es/esp/alumnos/lab_horario.php?horario_id=17&semestre=S2"); $e = $html->find('select'); $e = $e[0]; $curl = new CURL(); $opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true); foreach ($e->find('option') as $g) { $result[] = array("id" => $g->value, "name" => $g->innertext); $id = $g->value; $curl->addSession("http://www.eps.uam.es/esp/alumnos/lab_horario.php?local_id={$id}&horario_id=17&semestre=S2", $opts); } // Ejecuta todas las peticiones en paralelo $pages = $curl->exec(); $curl->clear(); for ($i = 0; $i < sizeof($pages); $i++) { $result[$i]["data"] = Laboratorio::get($result[$i]["id"], $page); } return $result; }
/** * 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 Laboratorio the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Laboratorio::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
?> <div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'paciente-fotografias-form', 'enableAjaxValidation' => false)); ?> <?php if (isset($_GET['idPaciente'])) { $elPaciente = $_GET['idPaciente']; } else { $elPaciente = "0"; } $paciente = Paciente::model()->find("id={$elPaciente}"); $laboratorios = Laboratorio::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' => $paciente, 'attributes' => array('nombreCompleto', 'n_identificacion', 'edad'))); ?> </div> <div class="span5"> <?php $this->widget('zii.widgets.CDetailView', array('data' => $paciente, 'attributes' => array('email', 'telefono1', 'celular'))); ?> </div> <div class="span1"></div>
<?php /** * FindYourLab @rokimoki, Alejandro López Santos */ include_once 'clases/Laboratorio.php'; include_once 'clases/CalendarioLaboratorio.php'; $err = ""; $laboratorios = new Laboratorio(); try { $laboratoriosList = $laboratorios->getAllLaboratorios(); } catch (Exception $e) { $err = $e->getMessage(); } ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="FindYourLab - Developed by Overflowschool"> <meta name="author" content="@rokimoki"> <script src="js/advertisement.js"></script> <link rel="shortcut icon" href="img/favicon.png"> <title>FindYourLab App</title> <!-- Bootstrap core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/theme.css" rel="stylesheet"> <link href="css/bootstrap-reset.css" rel="stylesheet"> <!--external css--> <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
/** * @name obtenerLaboratorios * * @description Retorna un listado con los Laboratorios que proveen * productos a Droguería. */ public function obtenerLaboratorios() { set_time_limit(10000); $autorizacion = json_decode($this->obtenerTokenUsuario()); $option = ['http' => ['method' => 'GET', 'header' => ['Authorization: GUID ' . $autorizacion->Guid, 'Content-Type: application/json']]]; $context = stream_context_create($option); $laboratorios = json_decode(file_get_contents("http://test.dronena.com:8083/REST/Cloud/Proveedor/Listado", false, $context)); if ($laboratorios) { foreach ($laboratorios->Proveedores->Proveedor as $p) { $labo = Laboratorio::where('Codigo', '=', $p->Codigo)->first(); if (!$labo) { $lab = new Laboratorio(); $lab->Codigo = $p->Codigo; $lab->Nombre = $p->Nombre; $lab->save(); } } } }
public function getAllAction() { $labs = Laboratorio::getAll(); return $labs; }