Skip to content
Snippets Groups Projects
Commit b3cda25d authored by jaimarq's avatar jaimarq
Browse files

Subida código

parent 0779e58e
No related branches found
No related tags found
No related merge requests found
# Auto detect text files and perform LF normalization
* text=auto
{
"CurrentProjectSetting": null
}
\ No newline at end of file
{
"ExpandedNodes": [
"",
"\\templates"
],
"PreviewInSolutionExplorer": false
}
\ No newline at end of file
File added
File added
<?php
/**
* Smarty Autoloader
*
* @package Smarty
*/
/**
* Smarty Autoloader
*
* @package Smarty
* @author Uwe Tews
* Usage:
* require_once '...path/Autoloader.php';
* Smarty_Autoloader::register();
* or
* include '...path/bootstrap.php';
*
* $smarty = new Smarty();
*/
class Smarty_Autoloader
{
/**
* Filepath to Smarty root
*
* @var string
*/
public static $SMARTY_DIR = null;
/**
* Filepath to Smarty internal plugins
*
* @var string
*/
public static $SMARTY_SYSPLUGINS_DIR = null;
/**
* Array with Smarty core classes and their filename
*
* @var array
*/
public static $rootClasses = array('smarty' => 'Smarty.class.php', 'smartybc' => 'SmartyBC.class.php',);
/**
* Registers Smarty_Autoloader backward compatible to older installations.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function registerBC($prepend = false)
{
/**
* register the class autoloader
*/
if (!defined('SMARTY_SPL_AUTOLOAD')) {
define('SMARTY_SPL_AUTOLOAD', 0);
}
if (SMARTY_SPL_AUTOLOAD
&& set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
) {
$registeredAutoLoadFunctions = spl_autoload_functions();
if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
spl_autoload_register();
}
} else {
self::register($prepend);
}
}
/**
* Registers Smarty_Autoloader as an SPL autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function register($prepend = false)
{
self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR;
self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR :
self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR;
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
} else {
spl_autoload_register(array(__CLASS__, 'autoload'));
}
}
/**
* Handles auto loading of classes.
*
* @param string $class A class name.
*/
public static function autoload($class)
{
if ($class[ 0 ] !== 'S' || strpos($class, 'Smarty') !== 0) {
return;
}
$_class = strtolower($class);
if (isset(self::$rootClasses[ $_class ])) {
$file = self::$SMARTY_DIR . self::$rootClasses[ $_class ];
if (is_file($file)) {
include $file;
}
} else {
$file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
if (is_file($file)) {
include $file;
}
}
return;
}
}
# velostat
web de velostat
This diff is collapsed.
<?php
/**
* Project: Smarty: the PHP compiling template engine
* File: SmartyBC.class.php
* SVN: $Id: $
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* smarty-discussion-subscribe@googlegroups.com
*
* @link http://www.smarty.net/
* @copyright 2008 New Digital Group, Inc.
* @author Monte Ohrt <monte at ohrt dot com>
* @author Uwe Tews
* @author Rodney Rehm
* @package Smarty
*/
/**
* @ignore
*/
require_once dirname(__FILE__) . '/Smarty.class.php';
/**
* Smarty Backward Compatibility Wrapper Class
*
* @package Smarty
*/
class SmartyBC extends Smarty
{
/**
* Smarty 2 BC
*
* @var string
*/
public $_version = self::SMARTY_VERSION;
/**
* This is an array of directories where trusted php scripts reside.
*
* @var array
*/
public $trusted_dir = array();
/**
* Initialize new SmartyBC object
*/
public function __construct()
{
parent::__construct();
}
/**
* wrapper for assign_by_ref
*
* @param string $tpl_var the template variable name
* @param mixed &$value the referenced value to assign
*/
public function assign_by_ref($tpl_var, &$value)
{
$this->assignByRef($tpl_var, $value);
}
/**
* wrapper for append_by_ref
*
* @param string $tpl_var the template variable name
* @param mixed &$value the referenced value to append
* @param boolean $merge flag if array elements shall be merged
*/
public function append_by_ref($tpl_var, &$value, $merge = false)
{
$this->appendByRef($tpl_var, $value, $merge);
}
/**
* clear the given assigned template variable.
*
* @param string $tpl_var the template variable to clear
*/
public function clear_assign($tpl_var)
{
$this->clearAssign($tpl_var);
}
/**
* Registers custom function to be used in templates
*
* @param string $function the name of the template function
* @param string $function_impl the name of the PHP function to register
* @param bool $cacheable
* @param mixed $cache_attrs
*
* @throws \SmartyException
*/
public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
{
$this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
}
/**
* Unregister custom function
*
* @param string $function name of template function
*/
public function unregister_function($function)
{
$this->unregisterPlugin('function', $function);
}
/**
* Registers object to be used in templates
*
* @param string $object name of template object
* @param object $object_impl the referenced PHP object to register
* @param array $allowed list of allowed methods (empty = all)
* @param boolean $smarty_args smarty argument format, else traditional
* @param array $block_methods list of methods that are block format
*
* @throws SmartyException
* @internal param array $block_functs list of methods that are block format
*/
public function register_object(
$object,
$object_impl,
$allowed = array(),
$smarty_args = true,
$block_methods = array()
) {
settype($allowed, 'array');
settype($smarty_args, 'boolean');
$this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
}
/**
* Unregister object
*
* @param string $object name of template object
*/
public function unregister_object($object)
{
$this->unregisterObject($object);
}
/**
* Registers block function to be used in templates
*
* @param string $block name of template block
* @param string $block_impl PHP function to register
* @param bool $cacheable
* @param mixed $cache_attrs
*
* @throws \SmartyException
*/
public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null)
{
$this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
}
/**
* Unregister block function
*
* @param string $block name of template function
*/
public function unregister_block($block)
{
$this->unregisterPlugin('block', $block);
}
/**
* Registers compiler function
*
* @param string $function name of template function
* @param string $function_impl name of PHP function to register
* @param bool $cacheable
*
* @throws \SmartyException
*/
public function register_compiler_function($function, $function_impl, $cacheable = true)
{
$this->registerPlugin('compiler', $function, $function_impl, $cacheable);
}
/**
* Unregister compiler function
*
* @param string $function name of template function
*/
public function unregister_compiler_function($function)
{
$this->unregisterPlugin('compiler', $function);
}
/**
* Registers modifier to be used in templates
*
* @param string $modifier name of template modifier
* @param string $modifier_impl name of PHP function to register
*
* @throws \SmartyException
*/
public function register_modifier($modifier, $modifier_impl)
{
$this->registerPlugin('modifier', $modifier, $modifier_impl);
}
/**
* Unregister modifier
*
* @param string $modifier name of template modifier
*/
public function unregister_modifier($modifier)
{
$this->unregisterPlugin('modifier', $modifier);
}
/**
* Registers a resource to fetch a template
*
* @param string $type name of resource
* @param array $functions array of functions to handle resource
*/
public function register_resource($type, $functions)
{
$this->registerResource($type, $functions);
}
/**
* Unregister a resource
*
* @param string $type name of resource
*/
public function unregister_resource($type)
{
$this->unregisterResource($type);
}
/**
* Registers a prefilter function to apply
* to a template before compiling
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_prefilter($function)
{
$this->registerFilter('pre', $function);
}
/**
* Unregister a prefilter function
*
* @param callable $function
*/
public function unregister_prefilter($function)
{
$this->unregisterFilter('pre', $function);
}
/**
* Registers a postfilter function to apply
* to a compiled template after compilation
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_postfilter($function)
{
$this->registerFilter('post', $function);
}
/**
* Unregister a postfilter function
*
* @param callable $function
*/
public function unregister_postfilter($function)
{
$this->unregisterFilter('post', $function);
}
/**
* Registers an output filter function to apply
* to a template output
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_outputfilter($function)
{
$this->registerFilter('output', $function);
}
/**
* Unregister an outputfilter function
*
* @param callable $function
*/
public function unregister_outputfilter($function)
{
$this->unregisterFilter('output', $function);
}
/**
* load a filter of specified type and name
*
* @param string $type filter type
* @param string $name filter name
*
* @throws \SmartyException
*/
public function load_filter($type, $name)
{
$this->loadFilter($type, $name);
}
/**
* clear cached content for the given template and cache id
*
* @param string $tpl_file name of template file
* @param string $cache_id name of cache_id
* @param string $compile_id name of compile_id
* @param string $exp_time expiration time
*
* @return boolean
*/
public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
{
return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);
}
/**
* clear the entire contents of cache (all templates)
*
* @param string $exp_time expire time
*
* @return boolean
*/
public function clear_all_cache($exp_time = null)
{
return $this->clearCache(null, null, null, $exp_time);
}
/**
* test to see if valid cache exists for this template
*
* @param string $tpl_file name of template file
* @param string $cache_id
* @param string $compile_id
*
* @return bool
* @throws \Exception
* @throws \SmartyException
*/
public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
{
return $this->isCached($tpl_file, $cache_id, $compile_id);
}
/**
* clear all the assigned template variables.
*/
public function clear_all_assign()
{
$this->clearAllAssign();
}
/**
* clears compiled version of specified template resource,
* or all compiled template files if one is not specified.
* This function is for advanced use only, not normally needed.
*
* @param string $tpl_file
* @param string $compile_id
* @param string $exp_time
*
* @return boolean results of {@link smarty_core_rm_auto()}
*/
public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
{
return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
}
/**
* Checks whether requested template exists.
*
* @param string $tpl_file
*
* @return bool
* @throws \SmartyException
*/
public function template_exists($tpl_file)
{
return $this->templateExists($tpl_file);
}
/**
* Returns an array containing template variables
*
* @param string $name
*
* @return array
*/
public function get_template_vars($name = null)
{
return $this->getTemplateVars($name);
}
/**
* Returns an array containing config variables
*
* @param string $name
*
* @return array
*/
public function get_config_vars($name = null)
{
return $this->getConfigVars($name);
}
/**
* load configuration values
*
* @param string $file
* @param string $section
* @param string $scope
*/
public function config_load($file, $section = null, $scope = 'global')
{
$this->ConfigLoad($file, $section, $scope);
}
/**
* return a reference to a registered object
*
* @param string $name
*
* @return object
*/
public function get_registered_object($name)
{
return $this->getRegisteredObject($name);
}
/**
* clear configuration values
*
* @param string $var
*/
public function clear_config($var = null)
{
$this->clearConfig($var);
}
/**
* trigger Smarty error
*
* @param string $error_msg
* @param integer $error_type
*/
public function trigger_error($error_msg, $error_type = E_USER_WARNING)
{
trigger_error("Smarty error: $error_msg", $error_type);
}
}
<?php session_start();
require_once("funciones.php");
require('include.php');
/*
* Archivo de control. Añadir paciente, etiología y patología asociada
* Caso de uso: REGISTRAR PACIENTE <<include>> AÑADIR ETIOLOGÍA
*/
if($_SESSION['user']==$_GET["variable"] && $_SESSION["user"]!=""){
$id_admin=$_GET["variable"];
$html=new Smarty;
// Barra
barra();
// Fin de barra
//Recogemos los datos del formulario
$dni_paciente = ($_GET["id"]);
$accion = ($_GET["accion"]);
$n_etiologia = ($_POST["etiologia"]);
$fecha_lesion =($_POST["fecha_lesion"]);
$cuadrantes = ($_POST["cuadrantes"]);
$comentarios = ($_POST["comentarios"]);
$patologia = ($_POST["patologia"]);
$mensaje = "";
// Valores para el formulario:
// Tipo de ensayos
// Nombre
// Apellidos
// Edad
// Sexo
$html->assign("id_admin",$id_admin);
//Mostramos una tabla con todos los sujetos para marcar el que queremos
if($accion == 1){
$result = $conex->query("SELECT `id_patologia` FROM `PATOLOGIAS` WHERE `nombre`='$patologia'");
$row = $result->fetch_assoc();
$patologia = $row['id_patologia'];
$mensaje= "Actualizado resgistro de Pacientes para: '$nombre'";
//Añadimos la etiología vinculada al paciente
if($cuadrantes == "" && $comentarios == ""){
$sql="INSERT INTO `ETIOLOGIAS` (`etiologia`, `fecha_lesion`, `cuadrantes`, `comentarios`, `id_patologia`, `dni_paciente` )
VALUES ('$n_etiologia', '$fecha_lesion', NULL, NULL, '$patologia', '$dni_paciente')";
}elseif ($cuadrantes != "" && $comentarios == ""){
$sql="INSERT INTO `ETIOLOGIAS` (`etiologia`, `fecha_lesion`, `cuadrantes`, `comentarios`, `id_patologia`, `dni_paciente` )
VALUES ('$n_etiologia', '$fecha_lesion', '$cuadrantes', NULL, '$patologia', '$dni_paciente')";
}elseif($cuadrantes == "" && $comentarios != ""){
$sql="INSERT INTO `ETIOLOGIAS` (`etiologia`, `fecha_lesion`, `cuadrantes`, `comentarios`, `id_patologia`, `dni_paciente` )
VALUES ('$n_etiologia', '$fecha_lesion', NULL, '$comentarios', '$patologia', '$dni_paciente')";
}else{
$sql="INSERT INTO `ETIOLOGIAS` (`etiologia`, `fecha_lesion`, `cuadrantes`, `comentarios`, `id_patologia`, `dni_paciente` )
VALUES ('$n_etiologia', '$fecha_lesion', '$cuadrantes', '$comentarios', '$patologia', '$dni_paciente')";
}
if (!$conex->query($sql)){
$mensaje.= " Error actualizando base de datos Etiologias $dni_paciente $patologia";
}else{
//VOLVEMOS A MOSTRAR LA INFORMACIÓN DEL PACIENTE
$sql="SELECT tipo, fecha, simetria, PRUEBAS_PACIENTES.anotaciones, PRUEBAS_PACIENTES.id_prueba
FROM ENSAYOS, PRUEBAS_PACIENTES
WHERE `dni_paciente`='$dni_paciente' AND ENSAYOS.id_ensayo=PRUEBAS_PACIENTES.id_ensayo
ORDER BY fecha DESC
";
if($result=$conex->query($sql)){
// rellenamos array con tabla obtenida de las pruebas
//Cambiar formato de fecha: date("Y/m/d - H:i:s", strtotime($row['fecha'])),
$x = 0;
while ($row = $result->fetch_assoc()){
$entrada[$x]=[
$row['id_prueba'],
$row['tipo'],
$row['fecha'],
$row['simetria'],
$row['anotaciones']
];
$x++;
}
$html->assign("entrada",$entrada);
}else{
$mensaje.=" Error al obtener las pruebas.";
}
$sql="SELECT dni_paciente,id_etiologia, etiologia, fecha_lesion, cuadrantes, comentarios, PATOLOGIAS.nombre
FROM ETIOLOGIAS, PATOLOGIAS
WHERE `dni_paciente`='$dni_paciente' AND PATOLOGIAS.id_patologia=ETIOLOGIAS.id_patologia
ORDER BY fecha_lesion DESC
";
if($result=$conex->query($sql)){
// rellenamos array con tabla obtenida
$x = 0;
while ($row = $result->fetch_assoc()){
$etiologia[$x]=[
$row['id_etiologia'],
$row['etiologia'],
$row['fecha_lesion'],
$row['cuadrantes'],
$row['comentarios'],
$row['nombre']
];
$x++;
}
$html->assign("etiologia",$etiologia);
}else{
$mensaje.=" Error al obtener las etiologías.";
}
}
$sql="SELECT * FROM PACIENTES WHERE `dni_paciente`='$dni_paciente'";
$result=$conex->query($sql);
$row = $result->fetch_assoc();
$sujeto = [ $row['dni_paciente'],$row['nombre'],$row['apellidos'],$row['sexo'],$row['edad'],$row['anotaciones']];
$html->assign("id_admin",$id_admin);
$html->assign("sujeto",$sujeto);
//VOLVEMOS A MOSTRAR LA INFORMACIÓN DEL PACIENTE
$html->assign("mensaje",$mensaje);
$html->display("pac_reg.tpl");
}else{
$sujeto[0]=$dni_paciente;
$html->assign("sujeto",$sujeto);
//Necesitamos las patologias
$x=0;
$result = $conex->query("SELECT nombre, descripcion FROM `PATOLOGIAS`");
while ($row = $result->fetch_assoc()){
$patologias[$x]=$row['nombre'];
$x++;
}
$html->assign("patologias",$patologias);
$html->display("add_eti.tpl");
}
}
else @header('location:index.php');
?>
<?php session_start();
require_once("funciones.php");
require('include.php');
/*
* Archivo de control. Añadir nuevo trabajdor
* Caso de uso: REGISTRAR TRABAJADOR
*/
if($_SESSION['user']==$_GET["variable"] && $_SESSION["user"]!=""){
$id_admin=$_GET["variable"];
// Comprueba que sigue en la sesión
$html=new Smarty;
// Barra del menú
barra();
// Fin de barra
// Descargamos las variables de los formularios:
$dni_trabajador = ($_POST["dni_trabajador"]);
$nombre = ($_POST["nombre"]);
$apellidos = ($_POST["apellidos"]);
$nick = ($_POST["login"]);
$titulacion = ($_POST["titulacion"]);
$permisos = ($_POST["permisos"]);
$pass = sha1(mysqli_real_escape_string($conex, $_POST["pass"]));
$passrw= sha1(mysqli_real_escape_string($conex, $_POST["passrw"]));
if ($dni_trabajador){ //Si hemos pulsado validar al cambiar un registro
if ($permisos!=0 && $permisos!=1 && $permisos!=2 && $permisos!=3 && $permisos > $chmod )
$mensaje = 'El campo permisos debe ser "1" para permisos de lectura y escritura, y "0" para permisos de solo lectura.';
else if ($pass != $passrw)
$mensaje="Las contraseñas no coinciden";
else
{
// Comprobamos que no se repita login
$result = $conex->query("SELECT * FROM TRABAJADORES");
while ($row = $result->fetch_assoc()){
if ($row['login'] == $nick)
$mensaje = "El nick $nick, ya existe";
else if ($row['dni_trabajador'] == $dni_trabajador)
$mensaje = "El DNI: '$dni_trabajador', ya existe";
}
}
if (!$mensaje)
{
// Si todos los campos están bien entonces actualizamos el nuevo trabajador/usuario
if ($conex->query("INSERT INTO `TRABAJADORES` (`dni_trabajador`, `login`, `nombre`, `apellidos`, `contraseña`, `titulacion`, `permisos`) VALUES ('$dni_trabajador', '$nick', '$nombre', '$apellidos', '$pass', '$titulacion', '$permisos')"))
$mensaje= "Actualizado trabajador $nick";
else $mensaje= "Error actualizando base de datos";
mysqli_close($conex);
}
}
$html->assign("id_admin",$id_admin);
$html->assign("mensaje","$mensaje");
$html->display("add_gestor.tpl");
}
else @header('location:index.php');
?>
<?php session_start();
require_once("funciones.php");
require('include.php');
/*
* Archivo de control. Añadir paciente, etiología y patología asociada
* Caso de uso: REGISTRAR PACIENTE <<include>> AÑADIR ETIOLOGÍA
*/
if($_SESSION['user']==$_GET["variable"] && $_SESSION["user"]!=""){
$id_admin=$_GET["variable"];
$html=new Smarty;
// Barra
barra();
// Fin de barra
//Recogemos los datos del formulario
$dni_paciente = ($_POST["dni"]);
$nombre = ($_POST["nombre"]);
$apellidos = ($_POST["apellidos"]);
$edad = ($_POST["edad"]);
$sexo = ($_POST["sexo"]);
$anotaciones = ($_POST["anotaciones"]);
$etiologia = ($_POST["etiologia"]);
$fecha_lesion =($_POST["fecha_lesion"]);
$cuadrantes = ($_POST["cuadrantes"]);
$comentarios = ($_POST["comentarios"]);
$patologia = ($_POST["patologia"]);
$mensaje = "";
// Valores para el formulario:
// Tipo de ensayos
// Nombre
// Apellidos
// Edad
// Sexo
//Mostramos una tabla con todos los sujetos para marcar el que queremos
if($dni_paciente != ""){
if ($result = $conex->query("SELECT * FROM `PACIENTES` ORDER BY `nombre` ASC")){
while ($row = $result->fetch_assoc()) {
if($row['dni_paciente'] == $dni_paciente){
$mensaje="El DNI: '$dni_paciente', ya existe.";
$dni_paciente = "";
}
}
if (dni_paciente != "") {//Agregacion del paciente
if($anotaciones == ""){
$sql="INSERT INTO `PACIENTES` (`dni_paciente`, `nombre`, `apellidos`, `edad`, `sexo`, `anotaciones`, `dni_trabajador`)
VALUES ('$dni_paciente', '$nombre', '$apellidos', '$edad', '$sexo', NULL, '$id_admin')";
}else{
$sql="INSERT INTO `PACIENTES` (`dni_paciente`, `nombre`, `apellidos`, `edad`, `sexo`, `anotaciones`, `dni_trabajador`)
VALUES ('$dni_paciente', '$nombre', '$apellidos', '$edad', '$sexo', '$anotaciones', '$id_admin')";
}
$result = $conex->query("SELECT `id_patologia` FROM `PATOLOGIAS` WHERE `nombre`='$patologia'");
$row = $result->fetch_assoc();
$patologia = $row['id_patologia'];
if ($conex->query($sql)){
$mensaje= "Actualizado resgistro de Pacientes para: '$nombre'";
//Añadimos la etiología vinculada al paciente
if($cuadrantes == "" && $comentarios == ""){
$sql="INSERT INTO `ETIOLOGIAS` (`etiologia`, `fecha_lesion`, `cuadrantes`, `comentarios`, `id_patologia`, `dni_paciente` )
VALUES ('$etiologia', '$fecha_lesion', NULL, NULL, '$patologia', '$dni_paciente')";
}elseif ($cuadrantes != "" && $comentarios == ""){
$sql="INSERT INTO `ETIOLOGIAS` (`etiologia`, `fecha_lesion`, `cuadrantes`, `comentarios`, `id_patologia`, `dni_paciente` )
VALUES ('$etiologia', '$fecha_lesion', '$cuadrantes', NULL, '$patologia', '$dni_paciente')";
}elseif($cuadrantes == "" && $comentarios != ""){
$sql="INSERT INTO `ETIOLOGIAS` (`etiologia`, `fecha_lesion`, `cuadrantes`, `comentarios`, `id_patologia`, `dni_paciente` )
VALUES ('$etiologia', '$fecha_lesion', NULL, '$comentarios', '$patologia', '$dni_paciente')";
}else{
$sql="INSERT INTO `ETIOLOGIAS` (`etiologia`, `fecha_lesion`, `cuadrantes`, `comentarios`, `id_patologia`, `dni_paciente` )
VALUES ('$etiologia', '$fecha_lesion', '$cuadrantes', '$comentarios', '$patologia', '$dni_paciente')";
}
if (!$conex->query($sql)){
$mensaje= "Error actualizando base de datos Etiologias";
}
}else {
$mensaje= "Error actualizando base de datos";
$sujeto = array($dni_paciente,$nombre,$apellidos,$sexo,$edad,$anotaciones);
}
}
} else {
$mensaje= "Ha habido un error inesperado.";
}
}else{
$mensaje="Registro de un nuevo paciente";
$sujeto = array("",$nombre,$apellidos,$sexo,$edad,$anotaciones);
}
//Necesitamos las patologias
$x=0;
$result = $conex->query("SELECT nombre, descripcion FROM `PATOLOGIAS`");
while ($row = $result->fetch_assoc()){
$patologias[$x]=$row['nombre'];
$x++;
}
$html->assign("id_admin",$id_admin);
$html->assign("patologias",$patologias);
$html->assign("mensaje",$mensaje);
$html->assign("sujeto",$sujeto);
$html->display("add_pac.tpl");
}
else @header('location:index.php');
?>
<?php session_start();
require_once("funciones.php");
require('include.php');
/*
* Archivo de control. Realizar una prueba
* Inicio del caso de uso: REALIZAR UNA PRUEBA
*/
if($_SESSION['user']==$_GET["variable"] && $_SESSION["user"]!=""){
$id_admin=$_GET["variable"];
$dni = $_GET['id'];
$id_prueba = $_GET['id_prueba'];
$accion = $_GET['accion'];
$html=new Smarty;
// Barra
barra();
// Fin de barra
//Si hemos salido borramos la última prueba creada
if ($accion==1 && $id_prueba!=""){
$sql="DELETE FROM `PRUEBAS_PACIENTES` WHERE `id_prueba`='$id_prueba'";
if ($conex->query($sql)){
$mensaje ="Prueba anterior borrada correctamente";
}else{
$mensaje ="Error al borrar la prueba";
}
}
// Valores para el formulario:
// Tipo de ensayos
// Nombre
// Apellidos
// Edad
// Sexo
//Necesitamos tipos de ensayos
$x=0;
$result = $conex->query("SELECT tipo FROM `ENSAYOS`");
while ($row = $result->fetch_assoc()){
$entrada[$x]=$row['tipo'];
$x++;
}
// asignamos variable a template
$html->assign("ensayos",$entrada);
//Mostramos una tabla con todos los sujetos para marcar el que queremos
$x=0;
if ($result = $conex->query("SELECT * FROM `PACIENTES` ORDER BY `nombre` ASC")){
while ($row = $result->fetch_assoc()) {
$date = date_create(date("Y-m-d"))->diff(date_create($row['edad']));
if($date->y != 0){
$date = $date->y . " a&ntildeos";
}elseif($date->m != 0){
$date = $date->m . " meses";
}else{
$date = $date->d . " d&iacuteas";
}
$campos[$x] = array($row['dni_paciente'],$row['nombre'],$row['apellidos'],$row['sexo'],$date,$row['anotaciones'],$row['edad']);
if ($dni == $row['dni_paciente']) {$sujeto = array($row['dni_paciente'],$row['nombre'],$row['apellidos'],$row['sexo'],$row['edad'],$row['anotaciones']);}
$x++;
}
} else $mensaje= "Ha habido un error inesperado.";
$html->assign("id_admin",$id_admin);
$html->assign("mensaje",$mensaje);
$html->assign("sujeto",$sujeto);
$html->assign("campos",$campos);
$html->display("add_reg.tpl");
}
else @header('location:index.php');
?>
<?php session_start();
require_once("funciones.php");
require('include.php');
/*
* Archivo de control. Realizar una prueba a un paciente
* Caso de uso: REALIZAR UNA PRUEBA
*/
if($_SESSION['user']==$_GET["variable"] && $_SESSION["user"]!=""){
$html=new Smarty;
// Barra
barra();
// Fin de barra
$id_admin= $_GET["variable"];
$ensayo= $_POST['ensayo'];
$name= $_POST['nombre'];
$apellidos= $_POST['apellidos'];
$edad= $_POST['edad'];
$sexo= $_POST['sexo'];
$simetria= $_POST['simetria'];
$anotaciones=$_POST['anotaciones'];
$dni= $_POST['dni_paciente'];
if ($result = $conex->query("SELECT count(`dni_paciente`) as num, `dni_paciente` FROM `PACIENTES` WHERE `dni_paciente`= '$dni'")){
$row = $result->fetch_assoc();
if($row['num'] == 1 && $row['dni_paciente'] == $dni){
// recuperamos el id_ensayo con el ensayo
$result = $conex->query("SELECT id_ensayo, coloc_sensores, duracion, repeticiones FROM `ENSAYOS` WHERE `tipo` = '$ensayo'");
$row = $result->fetch_assoc();
$id_ensayo=$row['id_ensayo'];
$coloc_sensores=nl2br($row['coloc_sensores']);
$duracion=$row['duracion'];
$repeticiones=$row['repeticiones'];
if ($duracion == 10) $getESP = 'A';
if ($duracion == 30) $getESP = 'B';
if ($duracion == 45) $getESP = 'C';
if ($duracion == 60) $getESP = 'D';
if ($duracion == 75) $getESP = 'E';
if ($duracion == 90) $getESP = 'F';
//Hacemos el insert en la tabla de las pruebas de un paciente
if($simetria == "" && $anotaciones == ""){//Simetria y anotaciones vacias
$sql = "INSERT INTO `PRUEBAS_PACIENTES` (`id_ensayo`, `dni_paciente`, `dni_trabajador`, `fecha`, `simetria`, `anotaciones`)
VALUES ('$id_ensayo', '$dni' , '$id_admin', NOW(), NULL, NULL)";
}elseif ($simetria != "" && $anotaciones == ""){//Anotaciones vacias
$sql = "INSERT INTO `PRUEBAS_PACIENTES` (`id_ensayo`, `dni_paciente`, `dni_trabajador`, `fecha`, `simetria`, `anotaciones`)
VALUES ('$id_ensayo', '$dni' , '$id_admin', NOW(), '$simetria', NULL)";
}elseif ($simetria == "" && $anotaciones != ""){//Simetria vacía
$sql = "INSERT INTO `PRUEBAS_PACIENTES` (`id_ensayo`, `dni_paciente`, `dni_trabajador`, `fecha`, `simetria`, `anotaciones`)
VALUES ('$id_ensayo', '$dni' , '$id_admin', NOW(), NULL, '$anotaciones')";
}else{//Ningún campo vacío
$sql = "INSERT INTO `PRUEBAS_PACIENTES` (`id_ensayo`, `dni_paciente`, `dni_trabajador`, `fecha`, `simetria`, `anotaciones`)
VALUES ('$id_ensayo', '$dni' , '$id_admin', NOW(), '$simetria', '$anotaciones')";
}
if (!$conex->query($sql))
{
$mensaje.="Error: \n". $conex->error. "DNI: $dni";
}
else {
$mensaje.= "Actualizada prueba ";
$result = $conex->query("SELECT max(`id_prueba`) as num FROM `PRUEBAS_PACIENTES` WHERE `dni_paciente`= '$dni'");
$row = $result->fetch_assoc();
$id_prueba = $row["num"];
}
$imagen = imagen('media/images/ensayo/',$ensayo); // Aquí ejecutamos la función para obtener la imagen y en caso de no existir poner una alternativa (por definir)
$html->assign("imagen",$imagen);
$html->assign("segundos",$duracion);
$html->assign("coloc_sensores",$coloc_sensores);
$html->assign("get",$getESP);
$html->assign("repeticiones",$repeticiones);
$html->assign("ensayo",$ensayo);
$html->assign("id_admin",$id_admin);
$html->assign("mensaje",$mensaje);
$html->assign("id_prueba",$id_prueba);
$html->assign("dni_paciente",$dni);
$html->display("add_reg_val.tpl");
}else{
$mensaje = "Error con el paciente DNI: $dni";
$html->assign("id_admin",$id_admin);
$html->assign("mensaje",$mensaje);
$html->display("add_reg.tpl");
}
}
}
else @header('location:index.php');
?>
<?php
/**
* This file is part of the Smarty package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Load and register Smarty Autoloader
*/
if (!class_exists('Smarty_Autoloader')) {
include dirname(__FILE__) . '/Autoloader.php';
}
Smarty_Autoloader::register(true);
<?php session_start();
require_once("funciones.php");
require('include.php');
/*
* Archivo de control. Gestionar ensayos
* Caso de uso: CREAR ENSAYO
*/
if($_SESSION['user']==$_GET["variable"] && $_SESSION["user"]!=""){
$id_admin=$_GET["variable"];
$id_prueba =$_GET["id"];
$html=new Smarty;
// Barra
barra();
// Fin de barra
// Valores para el formulario:
// Id ensayo
// Tipo
// Colocación sensores
// Duración
// Repeticiones
// Comentarios
// Fecha creación
if($id_prueba!=""){//eliminar un ensayo
if ($result = $conex->query("SELECT `dni_paciente` FROM `PRUEBAS_PACIENTES` WHERE `id_prueba`='$id_prueba'")){
$row = $result->fetch_assoc();
$id_paciente = $row['dni_paciente'];
}
else {
$mensaje = "Error inesperado en captura del identificador del paciente";
}
$sql="DELETE FROM `PRUEBAS_PACIENTES` WHERE `id_prueba`='$id_prueba'";
$id_ensayo = "";
if ($conex->query($sql)){
$mensaje ="Prueba borrada con éxito";
}else{
$mensaje ="Error al borrar la prueba";
}
//Obtenemos las pruebas del paciente
$sql="SELECT tipo, fecha, simetria, PRUEBAS_PACIENTES.anotaciones, PRUEBAS_PACIENTES.id_prueba
FROM ENSAYOS, PRUEBAS_PACIENTES
WHERE `dni_paciente`='$id_paciente' AND ENSAYOS.id_ensayo=PRUEBAS_PACIENTES.id_ensayo
ORDER BY fecha DESC
";
if($result=$conex->query($sql)){
// rellenamos array con tabla obtenida de las pruebas
//Cambiar formato de fecha: date("Y/m/d - H:i:s", strtotime($row['fecha'])),
$x = 0;
while ($row = $result->fetch_assoc()){
$entrada[$x]=[
$row['id_prueba'],
$row['tipo'],
$row['fecha'],
$row['simetria'],
$row['anotaciones']
];
$x++;
}
$html->assign("entrada",$entrada);
}
//Obtenemos las etiologias del paciente
$sql="SELECT dni_paciente,id_etiologia, etiologia, fecha_lesion, cuadrantes, comentarios, PATOLOGIAS.nombre
FROM ETIOLOGIAS, PATOLOGIAS
WHERE `dni_paciente`='$id_paciente' AND PATOLOGIAS.id_patologia=ETIOLOGIAS.id_patologia
ORDER BY fecha_lesion DESC
";
if($result=$conex->query($sql)){
// rellenamos array con tabla obtenida
//Cambiar formato de fecha: date("Y/m/d - H:i:s", strtotime($row['fecha'])),
$x = 0;
while ($row = $result->fetch_assoc()){
$etiologia[$x]=[
$row['id_etiologia'],
$row['etiologia'],
$row['fecha_lesion'],
$row['cuadrantes'],
$row['comentarios'],
$row['nombre']
];
$x++;
}
$html->assign("etiologia",$etiologia);
}
//Obtenemos los datos del paciente
$sql="SELECT * FROM PACIENTES WHERE `dni_paciente`='$id_paciente'";
$result=$conex->query($sql);
$row = $result->fetch_assoc();
$sujeto = [ $row['dni_paciente'],$row['nombre'],$row['apellidos'],$row['sexo'],$row['edad'],$row['anotaciones']];
$html->assign("sujeto",$sujeto);
}else{
$mensaje = "Error inesperado en captura del identificador de la prueba";
}
$html->assign("id_admin",$id_admin);
$html->assign("mensaje",$mensaje);
$html->display("pac_reg.tpl");
}
else @header('location:index.php');
?>
<?php session_start();
require_once("funciones.php");
require('include.php');
/*
* Archivo de control. Gestionar ensayos
* Caso de uso: CREAR ENSAYO
*/
if($_SESSION['user']==$_GET["variable"] && $_SESSION["user"]!=""){
$id_admin=$_GET["variable"];
$id_prueba_sujeto =$_GET["id"];
$html=new Smarty;
// Barra
barra();
// Fin de barra
// Valores para el formulario:
// Id ensayo
// Tipo
// Colocación sensores
// Duración
// Repeticiones
// Comentarios
// Fecha creación
if($id_prueba_sujeto!=""){//eliminar una prueba
if ($result = $conex->query("SELECT `dni_paciente` FROM `PRUEBAS_PACIENTES` WHERE `id_prueba`='$id_prueba_sujeto'")){
$row = $result->fetch_assoc();
$id_paciente = $row['dni_paciente'];
}
else {
$mensaje = "Error inesperado en captura del identificador del paciente";
}
$sql="DELETE FROM `PRUEBAS_SUJETOS` WHERE `id_prueba_sujeto`='$id_prueba_sujeto'";
$id_ensayo = "";
if ($conex->query($sql)){
$mensaje ="Prueba borrada con éxito";
}else{
$mensaje ="Error al borrar la prueba";
}
$sql="SELECT SUJETOS.edad, SUJETOS.sexo, tipo, fecha, simetria, PRUEBAS_SUJETOS.anotaciones, PRUEBAS_SUJETOS.id_prueba_sujeto
FROM ENSAYOS, PRUEBAS_SUJETOS, SUJETOS
WHERE ENSAYOS.id_ensayo=PRUEBAS_SUJETOS.id_ensayo AND SUJETOS.id_sujeto = PRUEBAS_SUJETOS.id_sujeto
ORDER BY fecha DESC
";
if($result=$conex->query($sql)){
// rellenamos array con tabla obtenida de las pruebas
//Cambiar formato de fecha: date("Y/m/d - H:i:s", strtotime($row['fecha'])),
$x = 0;
while ($row = $result->fetch_assoc()){
$entrada[$x]=[
$row['id_prueba_sujeto'],
$row['tipo'],
$row['fecha'],
$row['sexo'],
$row['edad'],
$row['simetria'],
$row['anotaciones']
];
$x++;
}
$html->assign("entrada",$entrada);
}else{
$mensaje="Error al capturar las pruebas sobre los sujetos";
}
$html->assign("id_admin",$id_admin);
$html->display("ver_pruebas_sujetos.tpl");
}else{
$mensaje = "Error inesperado en captura del identificador de la prueba";
$html->assign("id_admin",$id_admin);
$html->assign("mensaje",$mensaje);
$html->display("pac_reg.tpl");
}
}
else @header('location:index.php');
?>
This diff is collapsed.
This diff is collapsed.
.board {
border: 10px solid #fafaf9;
background-color: #d4e7e3;
color: #141414;
padding: 15px;
font-size: 22px;
width: 50%;
/* height: 150px; */
margin-bottom: 15px;
}
#virtual-keyboard {
border: 5px #212F3D double;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 15px;
background-color: #525252;
}
.keyboard-row {
text-align: center;
margin-bottom: 10px;
color: white;
}
#virtual-keyboard a {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background: #000000;
padding: 3px 7px;
font-size: 30px;
color:#ffffff;
text-align: center;
margin-right: 15px;
}
#virtual-keyboard a:hover {
text-decoration: none;
opacity: 0.8;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment