<?php
ob_start();

header("Expires: Mon, 20 Mar 1998 12:01:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

require_once("Sigma.php");
mb_http_output('UTF-8');

$tpl =& new HTML_Template_Sigma('.', './template/cache');
$tpl->loadTemplateFile('r_ras.htm');
$file = $_GET['file'];

$colores = "";

if (file_exists($file) && is_readable($file)) {
	
    if (!$myxml = simplexml_load_file($file))
        echo 'Error al Cargar Archivo XML';
    else {
        foreach ($myxml as $node) {
			
            $tpl->setVariable('nombre', $myxml->getName());
            
            $tpl->setVariable('cod_v', $node->FightNumberVis);
            $tpl->setVariable('traba_v', $node->TrabaVis);
            $tpl->setVariable('cod_l', $node->FightNumberLoc);
            $tpl->setVariable('traba_l', $node->TrabaLoc);
            
            $tpl->setVariable('blq', $node->BlockNumber);

            $resultado_v = utf8_decode($node->JCV);
            $resultado_l = utf8_decode($node->JCL);

            if(substr($resultado_v, 0, 3) == "Gan") {
                $tpl->setVariable('vis', 'won');
            }
            if(substr($resultado_l, 0, 3) == "Gan") {
                $tpl->setVariable('loc', 'won');
            }
            $tpl->setVariable('jcv', $resultado_v);
            $tpl->setVariable('jcl', utf8_decode($node->JCL));
            
            $tpl->setVariable('nota', BlankSpace(utf8_decode($node->NOTE)));
            
            $tpl->parse('bloque1');
            
        } //for.
    } //else
}

$tpl->show();

?>