<?php
ob_start();
// session_start();
 require_once("Sigma.php");
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("dispatcher.php");
// mb_http_output('UTF-8');
$tpl =& new HTML_Template_Sigma('.','./template/cache');

//$ARCHIVOS = array('wbc1.xml','wbc2.xml','wbc3.xml','wbc4.xml', 'wbc5.xml');

//redireccionamientos.
$tpl->loadTemplateFile('bc.htm');

$colores = "";
//$tpl->setVariable('fecha', date("d/m/Y"));
//$res = LoadConfiguration();
$archivo = $_GET['file'];//"bc.xml";
if (file_exists($archivo))
{
  //$tpl->setVariable('link','wbc.php?arch='.$archivo);
   //60;

  if(is_readable($archivo))
  {
    //$reloj = GetTimeRemaining($res,'WBC');
   if (!$myxml=simplexml_load_file($archivo))
        echo 'Error al Cargar Archivo XML';
       else
       {

        foreach($myxml as $node)
        {
			if ($colores == "grey")
			{
			  $tpl->setVariable('colores', '');
			  $colores = "";
			}
			else
			{
			  $tpl->setVariable('colores', ' class="grey"');
			  $colores = "grey";
			}

              $tpl->setVariable('nu'  ,BlankSpace($node->Orden));
         // $tpl->setVariable('dep',   'BC');
              $tpl->setVariable('dep',   $node->Liga);
                        //  $tpl->setVariable('JC-RL2',   'JC-RL');
                        //  $tpl->setVariable('JC-ML2',   'JC-ML');
                        //  $tpl->setVariable('H1-ML2',   'H1-ML');
                        //  $tpl->setVariable('H1-RL2',   'H1-RL');
                        //  $tpl->setVariable('Q1-ML2',   'Q1-ML');
                        //  $tpl->setVariable('Q1-RL2',   'Q1-RL');
               $timegame = explode(":", $node->TimeGame);
               $hora = $timegame[0].':'.$timegame[1];
              // $meridian = $timegame[2];
               if($timegame[2] == 'p.' || $timegame[2] == 'P.')
                 $meridian = 'PM';
               elseif($timegame[2] == 'a.' || $timegame[2] == 'A.')
                 $meridian = 'AM';
               else
                 $meridian = $timegame[2];

                  $tpl->setVariable('hora',$hora);
                  $tpl->setVariable('espa',$meridian);
                  $tpl->setVariable('vId',$node->VisTeam);

                  $tpl->setVariable('eq_visitante',   $node->EquipoVisitante);
                  $tpl->setVariable('lId', $node->LocTeam);

                  $tpl->setVariable('eq_local',   utf8_decode(BlankSpace($node->EquipoLocal)));
                  $tpl->setVariable('jc_mlv',     utf8_decode(BlankSpace($node->PriceMLJCVis)));

                  $tpl->setVariable('jc_mll',     utf8_decode(BlankSpace($node->PriceMLJCLoc)));
                  $tpl->setVariable('jc_rlv',     utf8_decode(BlankSpace($node->RLJCVis)));

                  $tpl->setVariable('jc_rll',     utf8_decode(BlankSpace($node->RLJCLoc)));

                  $tpl->setVariable('sjcv',       utf8_decode(BlankSpace($node->TotalSoloJCVis)));
                  $tpl->setVariable('sjcl',       utf8_decode(BlankSpace($node->TotalSoloJCLoc)));

                  $tpl->setVariable('h1_mlv',     utf8_decode(BlankSpace($node->PriceMLPMVis)));
                  $tpl->setVariable('h1_mll',     utf8_decode(BlankSpace($node->PriceMLPMLoc)));
                 // $tpl->setVariable('ml_lpm',     utf8_decode($node->PriceMLPMVis));

                  $tpl->setVariable('h1_rlv',     utf8_decode(BlankSpace($node->RLPMVis)));
                  $tpl->setVariable('h1_rll',     utf8_decode(BlankSpace($node->RLPMLoc)));

                  $tpl->setVariable('sh1v',       utf8_decode(BlankSpace($node->TotalSoloPMVis)));
                  $tpl->setVariable('sh1l',       utf8_decode(BlankSpace($node->TotalSoloPMLoc)));

                  $tpl->setVariable('h2_mlv',     utf8_decode(BlankSpace($node->PriceMLSMVis)));
                  $tpl->setVariable('h2_mll',     utf8_decode(BlankSpace($node->PriceMLSMLoc)));

                  $tpl->setVariable('h2_rlv',     utf8_decode(BlankSpace($node->RLSMVis)));
                  $tpl->setVariable('h2_rll',     utf8_decode(BlankSpace($node->RLSMVis)));

                  $tpl->setVariable('sh2v',       utf8_decode(BlankSpace($node->TotalSoloSMVis)));
                  $tpl->setVariable('sh2l',       utf8_decode(BlankSpace($node->TotalSoloSMLoc)));

                  $tpl->setVariable('tpm',       utf8_decode(BlankSpace($node->TotalPM)));
                  $tpl->setVariable('tjc',       utf8_decode(BlankSpace($node->TotalJC)));
				  
				  // Segunda Mitad
				  //if($node->PriceRLSMVis != 'NADA' || $node->PriceMLSMLoc != 'NADA' ||
				  //   $node->PriceRLSMLoc != 'NADA' || $node->PriceMLSMVis != 'NADA')
				  //{
				  $tpl->setVariable('smmlv',      utf8_decode(BlankSpace($node->PriceMLSMVis)));
				  $tpl->setVariable('smmll',      utf8_decode(BlankSpace($node->PriceMLSMLoc)));

				  $tpl->setVariable('rlsmv',      utf8_decode(BlankSpace($node->RLSMVis)).' '.utf8_decode(BlankSpace($node->PriceRLSMVis)));
				  $tpl->setVariable('rlsml',      utf8_decode(BlankSpace($node->RLSMLoc)).' '.utf8_decode(BlankSpace($node->PriceRLSMLoc)));

				  $tpl->setVariable('tv',         utf8_decode(BlankSpace($node->TotalSM)));

				  $tpl->setVariable('tsv',      utf8_decode(BlankSpace($node->TotalSoloSMVis)));
				  $tpl->setVariable('tsl',      utf8_decode(BlankSpace($node->TotalSoloSMLoc)));

				   //}

                  $registro++;

               $tpl->parse('bloque2');

        }//for.
       }//else
   }//is readable.
 }
$tpl->show();



?>