* * @package gvHIDRA */ class gvHidraDebugger extends gvHidraForm { 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->valorAutoreload = ''; $this->valorFecha = new gvHidraTimestamp(); $this->valorTipo = '5'; $this->valorUsuario = IgepSession::dameUsuario(); $this->valorAplicacion = ConfigFramework::getApplicationName(); $this->valorAutoreload = ''; $this->errorDebugger = ''; 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 $configuration = ConfigFramework::getConfig(); $configuration->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) { $this->errorDebugger = ''; switch ($strAccion) { case 'openDebugger': $configuration = ConfigFramework::getConfig(); $configuration->setLogStatus($this->log); //Inicializamos valores $this->resultDatos = array(); $this->valorFecha = new gvHidraTimestamp(); $this->valorTipo = '5'; $this->valorUsuario = IgepSession::dameUsuario(); $this->valorAplicacion = ConfigFramework::getApplicationName(); $this->valorAutoreload = ''; $forward = $objDatos->getForward('ok'); return $forward; break; case 'refreshDebugger': //La respuesta es unica $forward = $objDatos->getForward('ok'); //Calculo de la fecha if($_REQUEST['db_fecha']!='') { $this->valorFecha = $_REQUEST['db_fecha']; //Transformamos a objeto IgepComunicacion::transform_User2FW($this->valorFecha,TIPO_FECHAHORA); } else { $this->valorFecha = new gvHidraTimestamp(); } if (isset($_REQUEST['Refrescar'])) { switch ($_REQUEST['Refrescar']) { case 'Ayer': $this->valorFecha = new gvHidraTimestamp('-1 day'); break; case 'Hoy': $this->valorFecha = new gvHidraTimestamp('today'); break; case '-10m': $this->valorFecha = new gvHidraTimestamp('-10 minutes'); break; case '-5m': $this->valorFecha = new gvHidraTimestamp('-5 minutes'); break; case 'Ya!': $this->valorFecha = new gvHidraTimestamp('now'); break; default: break; } } $this->valorTipo = $_REQUEST['db_tipo']; $this->valorUsuario = $_REQUEST['db_usuario']; $this->valorAplicacion = ConfigFramework::getApplicationName(); if($_REQUEST['autoreload']) { $this->valorAutoreload = 'checked'; } //Calculamos la consulta $configuration = ConfigFramework::getConfig(); $resultDatos = array(); $dsn_log = $configuration->getDSNLog(); $resultDatos = array(); if (empty($dsn_log)) { $this->errorDebugger = 'ERROR DE DEBUG: no hay dsn para el log'; return $forward; } else { $conexion = new IgepConexion($dsn_log); $db_pear = $conexion->getConnection(); if (PEAR::isError($db_pear)) { $this->errorDebugger = 'Error de conexión al debug: '.$db_pear->userinfo; return $forward; } else { $fechabd = clone $this->valorFecha; $conexion->prepararOperacion($fechabd, TIPO_FECHAHORA); //si hay usuario $whereUsuario=''; if($this->valorUsuario!='') $whereUsuario = "and usuario='$this->valorUsuario'"; $select = "SELECT iderror,aplicacion,modulo,version,usuario as \"usuario\",fecha as \"fecha\",tipo as \"tipo\",mensaje as \"mensaje\" FROM tcmn_errlog WHERE aplicacion='".$this->valorAplicacion."' and fecha>'$fechabd' and tipo<=".$this->valorTipo." $whereUsuario ORDER BY iderror DESC"; // quitamos el log del consultar para que no interfiera en la salida $configuration->setLogStatus(LOG_ERRORS); $resultDatos = $conexion->consultar($select, array('DATATYPES'=>array('fecha'=>TIPO_FECHAHORA))); $configuration->setLogStatus($this->log); if ($resultDatos==-1) { $resultDatos = array(); $err = $conexion->obj_errorConexion->getDescErrorDB(); $this->errorDebugger = 'Error en consulta: '.$err[0]; return $forward; } $this->resultDatos = $resultDatos; } } return $forward; break; default: die; } die; } }//Fin clase gvHidraDebugger ?>