* @author Vero: * @author David: * * @package gvHIDRA */ use gvHidraDBAL\gvHidraDBAL; class gvHidraDebugger extends gvHidraForm { public $log = null; public $valorFechaIni = null; public $valorFechaFin = null; public $valorTipo = null; public $valorUsuario = null; public $valorAplicacion = null; public $valorAutoreload = null; public $errorDebugger = null; public $nombreTabla = 'tcmn_errlog'; public $strAccion=''; public function __construct() { $configuration = ConfigFramework::getConfig(); //Seguridad $seguridad = $configuration->getSecurityLog(); if (!empty($seguridad)) { $rol = IgepSession::dameRol(); $modulo = IgepSession::hayModulo($seguridad); if($rol!=$seguridad AND !$modulo) { die; } } $this->log = $configuration->getLogStatus(); $configuration->setLogStatus(LOG_ERRORS); parent::__construct(); //Inicializamos valores $this->valorFechaIni = new gvHidraTimestamp('now'); $this->valorFechaFin = new gvHidraTimestamp('+1 day'); $this->valorTipo = '5'; $this->valorUsuario = IgepSession::dameUsuario(); $this->valorAplicacion = ConfigFramework::getApplicationName(); $this->valorAutoreload = ''; $this->errorDebugger = ''; $this->nombreTabla = 'tcmn_errlog'; $this->resultDatos = array(); return 0; } //End construct public function regenerarInstancia() { //Recuperamos la instancia de la clase Error. Si no existe (caso en el que venimos de Views), lo creamos $conf = ConfigFramework::getConfig(); $conf->setLogStatus(LOG_ERRORS); global $g_error; //#NVI#VIEWS#: Cuando quietemos del views las llamadas a Negocio quitamos este if if(!isset($g_error)) $g_error = new IgepError(); $this->obj_errorNegocio = & $g_error; //Creamos la instancia de IgepComunicacion $this->comunica = new IgepComunicacion($this->v_descCamposPanel); } /** * metodo accionesParticulares * * @access public * @param string $strAccion * @param object $objDatos * * Incorpore aqui la logica de sus acciones particulares. * -En el parametro $str_accion aparece el id de la accion. * -En el parametro $objDatos esta la informacion de la peticion. Recuerde que debe fijar la operacion * con el metodo setOperacion. */ public function accionesParticulares($strAccion, $objDatos) { $configuration = ConfigFramework::getConfig(); $configuration->setLogStatus($this->log); //Inicializamos valores $this->errorDebugger = ''; //Tipo de DEBUG $this->valorTipo = 5; if (!empty($_REQUEST['db_tipo'])) { $this->valorTipo = $_REQUEST['db_tipo']; } //Usuario $usuario = ''; if (!empty($_REQUEST['db_usuario'])) { $usuario = $_REQUEST['db_usuario']; } else { $usuario = IgepSession::dameUsuario(); if (empty($usuario)) { $usuario = $_SERVER['REMOTE_ADDR']; if (empty($usuario)) { $usuario = 'UNKNOWN'; } } } $this->valorUsuario = $usuario; //Fecha de inicio $this->valorFechaIni = new gvHidraTimestamp(); if (!empty($_REQUEST['db_fecha'])) { $this->valorFechaIni = $_REQUEST['db_fecha']; //Transformamos a objeto IgepComunicacion::transform_User2FW($this->valorFechaIni, TIPO_FECHAHORA);//REVIEW: Cambiar } //Fecha de fin $this->valorFechaFin = new gvHidraTimestamp('+1 day'); if (!empty($_REQUEST['db_fechafin'])) { $ffinFormatoPHP = date_parse_from_format("j-n-Y H:i", $_REQUEST['db_fechafin']); $this->valorFechaFin = new gvHidraTimestamp($ffinFormatoPHP); } //Aplicación $this->valorAplicacion = ConfigFramework::getApplicationName(); //Autoreload $this->valorAutoreload = ''; if($_REQUEST['autoreload']) { $this->valorAutoreload = 'checked'; } $forward = $objDatos->getForward('gvHidraHeader'); $this->strAccion = $strAccion; switch ($strAccion) { case 'openDebugger': $usuario = IgepSession::dameUsuario(); $this->valorUsuario = $usuario; return $forward; break; case 'refreshDebugger': if (isset($_REQUEST['Refrescar'])) { switch ($_REQUEST['Refrescar']) { case 'Ayer': $this->valorFechaIni = new gvHidraTimestamp('-1 day'); $this->valorFechaFin = new gvHidraTimestamp('now'); break; case 'Hoy': $this->valorFechaIni = new gvHidraTimestamp('today'); $this->valorFechaFin = new gvHidraTimestamp('now'); break; case '-10m': $this->valorFechaIni = new gvHidraTimestamp('-10 minutes'); $this->valorFechaFin = new gvHidraTimestamp('now'); break; case '-5m': $this->valorFechaIni = new gvHidraTimestamp('-5 minutes'); $this->valorFechaFin = new gvHidraTimestamp('now'); break; case 'Ya!': $this->valorFechaIni = new gvHidraTimestamp('now'); $this->valorFechaFin = new gvHidraTimestamp('+5 minutes'); break; default: break; } } $this->query = <<vTypesSelect = array ( 'iderror' => gvHidraDBAL::T_INTEGER ,'aplicacion' => gvHidraDBAL::T_STRING ,'modulo' => gvHidraDBAL::T_STRING ,'version' => gvHidraDBAL::T_STRING ,'usuario' => gvHidraDBAL::T_STRING ,'fecha' => gvHidraDBAL::T_DATETIME ,'tipo' => gvHidraDBAL::T_INTEGER ,'mensaje' => gvHidraDBAL::T_CLOB ); $this->vTypesWhere = array ( 'aplicacion' => gvHidraDBAL::T_STRING ,'fechaIni' => gvHidraDBAL::T_DATETIME ,'fechaFin' => gvHidraDBAL::T_DATETIME ,'tipo' => gvHidraDBAL::T_INTEGER ,'usuario' => gvHidraDBAL::T_STRING ); $forward = $objDatos->getForward('gvHidraHeader'); return $forward; break; default: die; } die; } }//Fin clase gvHidraDebugger ?>