public function getInstitucionprovincia() { $tipo = Input::get('tipo'); $provincia = Input::get('provincia'); $institucion = Institucion::where('id_provincia', $provincia); if (!empty($tipo)) { $institucion = Institucion::where('id_provincia', $provincia)->where('id_tipo_institucion', $tipo); } return $institucion->get(['id', 'denominacion']); }
/** * Authenticates a user. * The example implementation makes sure if the username and password * are both 'demo'. * In practical applications, this should be changed to authenticate * against some persistent user identity storage (e.g. database). * @return boolean whether authentication succeeds. */ public function authenticate() { $Institucion = Institucion::model()->findByAttributes(array('email' => $this->username)); if ($Institucion == null) { $this->errorCode = self::ERROR_USERNAME_INVALID; } elseif (md5($this->password) != $Institucion->password) { $this->errorCode = self::ERROR_PASSWORD_INVALID; } else { $this->_id = $Institucion->id_institucion; $this->setState("email", $Institucion->email); $this->errorCode = self::ERROR_NONE; } return !$this->errorCode; }
public function getCita($id) { //Declarar un arreglo para devolver los resultados. $parameter = array(); //Se instancian los objetos necesarios. $paciente = new Paciente(); $condiciones = new CondicionEnfermedad(); //Sentencia para crear un objeto para realizar los documentos PDF. $pdf = App::make('dompdf'); //Se almacena los datos pertenecientes a la cita. $parameter['cita'] = Cita::find($id); //Se almacena los datos pertenecientes al pacientes. $parameter['datos'] = $paciente->datos_pacientes($parameter['cita']->id_paciente); //Se busca la institucion respectiva del ID almacenado en la cita. $institucion = Institucion::find($parameter['cita']->id_institucion); if (empty($institucion)) { $parameter['institucion'] = new Institucion(); $parameter['institucion']->denominacion = 'No Definido'; } else { $parameter['institucion'] = Institucion::find($parameter['cita']->id_institucion); } //Se busca y se almacena al medico perteneciente al ID que se almaceno en la cita. $medico = Medico::find($parameter['cita']->id_medico); if (empty($medico)) { $parameter['medico'] = new Medico(); $parameter['medico']->primer_nombre = 'No'; $parameter['medico']->apellido_paterno = 'Definido'; } else { $parameter['medico'] = Medico::find($parameter['cita']->id_medico); } //Se busca y se almacenan los datos pertenecientes a los marcadores de la cita. $parameter['marcadores'] = MarcadorCita::where('id_cita', $id)->where('valor', '<>', '0')->get(); $parameter['cantidad'] = MarcadorCita::where('id_cita', $id)->where('valor', '<>', '0')->count(); //Se llama a la funcion obtenerEnfermedades que me devuelve un arreglo con las enfermedades que dieron positivo y negativo de la cita //correspondiente al ID que le envio. $parameter['resultados'] = $condiciones->obtenerEnfermedades($id); //Cargo la vista mandandole los respectivos datos correspondientes almacenados en el arreglo $parameter. $pdf = PDF::loadView('datos/citas/Print', $parameter); //Creo el archivo pdf y lo almaceno utilizando la cedula como el nombre del archivo. return $pdf->stream('' . $parameter['datos'][0]->cedula . '.pdf', array("Attachment" => false)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCrearActividad() { $usuarioins = Institucion::model()->findByPk(Yii::app()->user->id); $actividad = new Actividad(); $deporte = new Deporte(); $ficha_usuario = new FichaUsuario(); $actividad_horario = new ActividadHorario(); if (isset($_POST['Actividad'])) { $actividad->attributes = $_POST['Actividad']; $actividad->id_institucion = $usuarioins->id_institucion; $actividad->fhcreacion = new CDbExpression('NOW()'); $actividad->fhultmod = new CDbExpression('NOW()'); $actividad->cusuario = $usuarioins->email; $actividades = 0; if ($actividad->save()) { $cant = count($_POST['dia']); for ($i = 0; $i <= $cant - 1; $i++) { $actividad_horario = new ActividadHorario(); $actividad_horario->id_actividad = $actividad->id_actividad; $actividad_horario->id_dia = $_POST['dia'][$i]; $actividad_horario->hora = $_POST['hora'][$actividad_horario->id_dia - 1]; $actividad_horario->minutos = $_POST['minutos'][$actividad_horario->id_dia - 1]; $actividad_horario->fhcreacion = new CDbExpression('NOW()'); $actividad_horario->fhultmod = new CDbExpression('NOW()'); $actividad_horario->cusuario = $usuarioins->email; if ($actividad_horario->save()) { $actividades++; } } if ($actividades = $cant) { $this->redirect('CrearActividadOk'); } } } $this->render('CrearActividad', array('deporte' => $deporte, 'actividad' => $actividad, 'actividad_horario' => $actividad_horario, 'ficha_usuario' => $ficha_usuario)); }
<?php /*LLAMADA DE CLASES*/ session_start(); require_once '../../class/Conectar.class.php'; $objCon = new Conectar(); require_once '../../class/Paciente.class.php'; $objPac = new Paciente(); require_once '../../class/Util.class.php'; $objUtil = new Util(); require_once '../../class/Prevision.class.php'; $objPrev = new Prevision(); require_once '../../class/Nacionalidad.class.php'; $objNac = new Nacionalidad(); require_once '../../class/Institucion.class.php'; $objIns = new Institucion(); /*LLAMADA DE METODOS.*/ $objCon->db_connect(); $objPac->setPaciente($_POST['pac_id']); $datos = $objPac->getInformacionPaciente($objCon, "", "", ""); $nacionalidades = $objNac->obtenerNacionalidades($objCon); $previsiones = $objPrev->obtenerPrevisiones($objCon); $instituciones = $objIns->obtenerInstituciones($objCon); $objCon = null; $fecha = date("d") . "/" . date("m") . "/" . date("Y"); ?> <script type="text/javascript">calendario('txtFechaNac', '<?php echo $fecha; ?> ')</script> <script type="text/javascript" src="controller/client/js_editarPaciente.js"></script>
<?php /* @var $this UsuarioController */ /* @var $model Usuario */ /* @var $form CActiveForm */ if (!Yii::app()->user->isGuest) { //Es un usuario logueado. $usuarioins = Institucion::model()->findByPk(Yii::app()->user->id); } ?> <style type="text/css"> body { background: url(../img/25.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } </style> <header class="navbar navbar-static-top bs-docs-nav" id="top" role="banner"> <div class="container"> <div class="navbar-header"> <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#bs-navbar" aria-controls="bs-navbar" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
/** * 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 Institucion the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Institucion::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php require_once '../../class/Conectar.class.php'; $objCon = new Conectar(); require_once '../../class/Util.class.php'; $objUtil = new Util(); require_once '../../class/Institucion.class.php'; $objInst = new Institucion(); require_once '../../class/Unidad_Medida.class.php'; $objUnidadM = new Unidad_Medida(); require_once '../../class/Bono.class.php'; $objBono = new Bono(); switch ($op) { case 'cmbInstitucion': $objCon->db_connect(); $Institucion = $objInst->buscarInstitucion($objCon, $_POST['pre_id']); echo json_encode($Institucion); break; case 'cmbUnidadM': $objCon->db_connect(); $unidadMedida = $objUnidadM->buscarUnidadMedidaProducto($objCon, $_POST['tip_prod_id']); echo json_encode($unidadMedida); break; case 'cmbBonos': $objCon->db_connect(); $bonos = $objBono->buscarTiposBonos($objCon); echo json_encode($bonos); break; }
<?php require_once '../../class/Conectar.class.php'; $objCon = new Conectar(); require_once '../../class/Institucion.class.php'; $objIns = new Institucion(); require_once '../../class/Util.class.php'; $objUtil = new Util(); switch ($_POST['op']) { case "editar": $objIns->setInstitucion($_POST['txtIdCon'], $objUtil->eliminaEspacios($_POST['txtConvenio'])); $objCon->db_connect(); $institucion = $objIns->buscaInstitucion($objCon, 2); if ($institucion == "Existe con id") { $bandera = 0; } else { if ($institucion == "Existe sin id") { $bandera = 1; } else { $bandera = 0; } } if ($bandera == 0) { try { $objCon->beginTransaction(); $objIns->modificarConvenio($objCon); $objCon->commit(); } catch (PDOException $e) { $objCon->rollBack(); $e->getMessage(); }
/** * Declares an association between this object and a Institucion object. * * @param Institucion $v * @return PoliticoInstitucion The current object (for fluent API support) * @throws PropelException */ public function setInstitucion(Institucion $v = null) { if ($v === null) { $this->setInstitucionId(NULL); } else { $this->setInstitucionId($v->getId()); } $this->aInstitucion = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Institucion object, it will not be re-added. if ($v !== null) { $v->addPoliticoInstitucion($this); } return $this; }
<?php require_once '../../class/Conectar.class.php'; $objCon = new Conectar(); require_once '../../class/Institucion.class.php'; $objIns = new Institucion(); $objCon->db_connect(); $instituciones = $objIns->buscarInstitucionAsociacion($objCon, $_POST['pre_id']); $objCon = null; ?> <script type="text/javascript" src="controller/client/js_asociarInstitucion.js"></script> <center> <form id="frmEditarUsuario"> <?php if (count($instituciones) > 0) { ?> <input type="hidden" name="txtIdPre" id="txtIdPre" value="<?php echo $_POST['pre_id']; ?> "> <input type="hidden" name="txtNombrePre" id="txtNombrePre" value="<?php echo $_POST['pre_nombre']; ?> "> <fieldset style="width: 400px;"> <legend>Lista Instituciones</legend><br> <table border="0"> <tr> <td></td>
$fila = mysql_fetch_object($r); $numformulario = $fila->id; $EstadoFormulario = $fila->estado_envio; $fechCreacionForm = $fila->fecha_formulario; $comiteBipartido = $fila->comite_bipartito; $deteccionNecesidades = $fila->deteccionNecesidades; $codigoActividad = $fila->codigo_curso; include_once '../controller/class_curso.php'; $curso = new Curso(); $r = $curso->getCursoByCod($codigoActividad); $fila = mysql_fetch_object($r); $id_institucion = $fila->insotic_institucion_id; $nomCurso = $fila->nombre; $NumeroHoras = $fila->total_horas; include_once '../controller/class_institucion.php'; $institucion = new Institucion(); $r = $institucion->getInstitucionById($id_institucion); $fila = mysql_fetch_object($r); $NomRazonInstitucion = $fila->nombre; $NomRazonInstitucionContacto = $fila->insotic_nombre_contacto; $telInstitucion = $fila->telefono1; $idComuna = $fila->insotic_comuna_id; $direccionInstitucion = $fila->direccion; include_once '../controller/class_comuna.php'; $comunas = new comunas(); $r = $comunas->getComunaById($idComuna); $fila = mysql_fetch_object($r); $ComunaTipoInstitucion = $fila->nombre; $idCiudad = $fila->insotic_ciudad_id; include_once '../controller/class_ciudad.php'; $ciudades = new ciudades();
<?php require_once '../../class/Conectar.class.php'; require_once '../../class/Institucion.class.php'; $objCon = new Conectar(); $objIns = new Institucion(); $objIns->setInstitucion($_POST['ins_id'], $_POST['ins_nombre']); $objCon->db_connect(); $datos = $objIns->obtenerPrevisionesInstitucion($objCon); $objCon = null; ?> <script type="text/javascript" src="controller/client/js_busqudaInstitucionPrevision.js"></script> <center><h3>Listado de Previsiones asociadas</h3></center> <div id="btnAsociarPrevision" onclick="ventanaModal('./view/dialog/asociarPrevision','ins_id=<?php echo $_POST['ins_id']; ?> &ins_nombre=<?php echo $_POST['ins_nombre']; ?> ','auto','auto','Asociar a Previsión','modalAsociarPrevision')"><img src="./include/img/user.png" width="25" height="25"> Asociar Previsión</div> <br> <center> <div style="width]:500px;"> <table class="display" width="100%" id="tabInstitucionPrevision"> <thead> <td><th colspan="3">Previsión</th></td> <tr> <th width="10%">Id</th> <th width="10%">Nombre</th> <th width="10%">Opciones</th> </tr>
<?php require_once '../negocio/institucion.class.php'; $operacion = $_POST["a_operacion"]; $objInstitucion = new Institucion(); //LECTURA DE DATOS if ($operacion == "leer") { $codigoInstitucion = $_POST["p_codigo"]; $resultado = $objInstitucion->leerDatos($codigoInstitucion); echo json_encode($resultado); } //OPERACION DE AGREGAR Y EDITAR if ($operacion == "agregar" || $operacion == "editar") { parse_str($_POST["p_array_datos"], $datosFrm); if ($datosFrm["txttipooperacion"] == "editar") { $objInstitucion->setCodigo($datosFrm["txtcodigo"]); } $objInstitucion->setDescripcion($datosFrm["txtnombre"]); $objInstitucion->setTelefono($datosFrm["txttelefono"]); } //ELIMINAR UNO Y VARIOS REGISTROS if ($operacion == "eliminar") { $codigoInstitucion = $_POST["p_codigo"]; $resultado = $objInstitucion->setCodigo($codigoInstitucion); } //OBTENER EL CODIGO DE REGISTRO if ($operacion == "codigo") { $registros = $objInstitucion->ObtenerCodigo(); echo $registros; } try {
<?php require_once '../../class/Conectar.class.php'; require_once '../../class/Institucion.class.php'; $objCon = new Conectar(); $objIns = new Institucion(); $objCon->db_connect(); $datos = $objIns->obtenerInstitucionesActivas($objCon); $datos2 = $objIns->obtenerInstitucionesInactivas($objCon); $objCon = null; ?> <script type="text/javascript" src="controller/client/js_busqudaConvenio.js"></script> <center><h3>Listado de Convenios</h3></center> <div id="btnAgregarConvenio" onclick="ventanaModal('./view/dialog/agregarConvenio','','auto','auto','Registro de Convenio','modalAgregarConvenio')"><img src="./include/img/world.png" width="25" height="25"> Agregar Convenio</div> <br> <center> <div style="width]:500px;"> <table class="display" width="100%" id="tabUsuario"> <thead> <tr> <th width="10%">Id</th> <th width="10%">Nombre</th> <th width="10%">Opciones</th> </tr> </thead> <?php for ($i = 0; $i < count($datos); $i++) { ?> <tr> <td><?php echo $datos[$i]['ins_id'];
public function postTerminate($id_institucion) { $hasta = Fechas::getCarbonDate(Input::get('hasta')); Instituciones::setModel(Institucion::find($id_institucion)); Instituciones::cesaFunciones($hasta); if (!Instituciones::isValid()) { return Redirect::to('backend/instituciones/view/' . Instituciones::getModel()->id)->withInput()->withErrors(Instituciones::getMessages()); } return Redirect::to('backend/instituciones/view/' . Instituciones::getModel()->id)->with('message', 'La institución [' . Instituciones::getModel()->id . '] ha cesado sus actividades el ' . Fechas::getFormatedDate($hasta) . '.'); }
<?php require_once '../negocio/institucion.class.php'; require_once '../util/funciones/Funciones.class.php'; $objInstitucion = new Institucion(); try { $registros = $objInstitucion->listar(); // echo '<pre>'; // print_r($registros); // echo '</pre>'; } catch (Exception $exc) { Funciones::mensaje($exc->getMessage(), "e"); } ?> <table id="tabla-listado" class="table table-bordered table-striped"> <thead> <tr> <th> </th> <th>CODIGO</th> <th>NOMBRE INSTITUCIÓN</th> <th>TELEFONO</th> <th>OPCIÓN</th> </tr> </thead> <tbody> <?php for ($i = 0; $i < count($registros); $i++) { echo '<tr>';
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $paciente = new Paciente(); $cita = Cita::find($id); $institucion = Institucion::find($cita->id_institucion); //Decision para saber si se encontro la institucion perteneciente a la citas if (empty($institucion)) { $form['institucion'] = new Institucion(); } else { $form['institucion'] = $institucion; } $datos = $paciente->datos_pacientes(0); $dato_paciente = $paciente->datos_pacientes($cita->id_paciente); $form['datos'] = array('route' => array('datos.citas.update', $id), 'method' => 'PATCH'); $form['label'] = 'Editar'; $form['citas'] = $cita; $marcadorcita = new MarcadorCita(); //Ciclo que recorre todos los marcadores y los busca para devolver los datos correspondientes foreach (Marcador::all() as $marcador) { if ($marcador->trimestre_marcador == '3') { $form['1_marcador_' . $marcador->id . ''] = $marcadorcita->obtenerMarcador($marcador->id, $id); $marcador->trimestre_marcador = '2'; } $form['' . $marcador->trimestre_marcador . '_marcador_' . $marcador->id . ''] = $marcadorcita->obtenerMarcador($marcador->id, $id); } $form['marcador_cita'] = $marcadorcita; return View::make('datos/citas/list-edit-form')->with('pacientes', $datos)->with('datos', $dato_paciente)->with('form', $form); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Institucion $value A Institucion object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Institucion $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }