getCustomDirName();
//Inicializamos algunos valores
if($_REQUEST['db_fecha']!='')
$valorFecha = $_REQUEST['db_fecha'];
else
$valorFecha = date('d/m/y H:i:s');
//Comprobamos si ha pulsado alguno de los botones que indican tiempo
switch ($_REQUEST['Refrescar']){
case 'Ayer':
$valorFecha = date('d/m/y H:i:s',strtotime("-1 day"));
break;
case 'Hoy':
$valorFecha = date('d/m/y')." 00:00:00";
break;
case '-10m':
$valorFecha = date('d/m/y H:i:s',strtotime("-10 minutes"));
break;
case '-5m':
$valorFecha = date('d/m/y H:i:s',strtotime("-5 minutes"));
break;
case 'Ya!':
$valorFecha = date('d/m/y H:i:s');
}
if($_REQUEST['db_usuario']!='')
$valorUsuario = strtoupper($_REQUEST['db_usuario']);
else
$valorUsuario = '';
if($_REQUEST['db_aplicacion']!='')
$valorAplicacion = $_REQUEST['db_aplicacion'];
else{
$fichero = '../gvHidraConfig.inc.xml';
if (file_exists($fichero))
{
$sXML = simplexml_load_file($fichero);
$nombreApp = (string) $sXML->applicationName;
unset($sXML);//Liberamos el recurso
$valorAplicacion = $nombreApp;
}
}
if($_REQUEST["db_tipo"]!='')
$valorTipo = $_REQUEST["db_tipo"];
else
$valorTipo = 5;
//Comprobamos si tenemos que calcular la consulta
$error_bd = '';
$resultDatos = array();
if(($valorAplicacion!='') and ($valorFecha!='')){
//REVIEW: Toni Provisional hasta que este todo acabado.
if (ConfIgep::es_desarrollo()) {
$dsn_log = array(
'phptype' => 'pgsql',
'username' => 'igep_alog',
'password' => 'errlog',
'hostspec' => 'dolores',
'database' => 'marte',
);
}
else{
$dsn_log = array(
'phptype' => 'pgsql',
'username' => 'igep_alog',
'password' => 'errlog',
'hostspec' => 'adolfo',
'database' => 'marte',
);
}
require_once('MDB2.php');
$conexion =MDB2::factory($dsn_log);
$conexion->setFetchMode(MDB2_FETCHMODE_ASSOC);
//si hay usuario
if($_REQUEST['db_usuario']!='')
$whereUsuario = "and usuario='".$_REQUEST['db_usuario']."'";
$select = "SELECT iderror,aplicacion,modulo,version,usuario,fcmn_fechas(fecha,'FECHAHORA') as \"fecha\",tipo,mensaje FROM tcmn_errlog WHERE aplicacion='".$valorAplicacion."' and fecha>'".$valorFecha."' and tipo<=".$valorTipo." $whereUsuario ORDER BY iderror DESC";
$res = $conexion->query($select);
if(PEAR::isError($res))
$resultDatos = array();
else
$resultDatos = $res->fetchAll();
}
$htmlResult = '';
$htmlResult.= '
';
$htmlResult.= 'Debugger de Igep';
$htmlResult.= '';
$htmlResult.= '';
//REVIEW: creo que el visor del debugger debería estar en el custom
$htmlResult.= "";
$htmlResult.= '';
$htmlResult.= '';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= ' ';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '
DEBUGGER IGEP
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= ' ';
$htmlResult.= '
';
$htmlResult.= '
';
//Para meter los parámetros de la consulta
$htmlResult.= "';
$htmlResult.= ' ';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= 'Nº';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= 'FECHA';
$htmlResult.= '
';
if(empty($valorUsuario)){
$htmlResult.= '
';
$htmlResult.= 'USUARIO';
$htmlResult.= '
';
}
$htmlResult.= '
';
$htmlResult.= 'TIPO';
$htmlResult.= '
';
$htmlResult.= '
';
$htmlResult.= 'MENSAJE';
$htmlResult.= '
';
$htmlResult.= '
';
//Iteramos para mostrar los resultados
if(count($resultDatos)==0){
$htmlResult.= '
';
if(empty($valorUsuario))
$htmlResult.= '
';
else
$htmlResult.= '
';
$htmlResult.= 'NO HAY DATOS';
$htmlResult.= '
';
$htmlResult.= '
';
}
else{
foreach($resultDatos as $indice=>$tupla){
$htmlResult.= '