<?php
    // ini_set('display_errors',1);
    // ini_set('display_startup_erros',1);
    // error_reporting(E_ALL);
    require '../../../inc/conexao.php';
    require '../../../inc/functions.php';
?>
<div class="page">
  <div class="navbar">
    <div class="navbar-inner sliding">
      <div class="left">
        <a href="#" class="link back">
          <i class="icon icon-back"></i>
          <span class="ios-only">Voltar</span>
        </a>
      </div>
      <div class="title">Campeonatos</div>
      <div class="right">
        <a href="javascript: location.reload();" class="link topIcon icon-only icon-spin"><i class="material-icons icon_btn">refresh</i></a>
      </div>
    </div>
  </div>
  <div class="page-content">
    <form action="" method="GET" id="filterMatches">
      <div class="list listMarginZero">
        <a class="item-link smart-select smart-select-init">
          <select name="esporte" id="sportFilterMatch">
            <option <?php if($_GET['esporte'] == 'futebol'){ echo 'selected'; } ?> value="futebol">Futebol</option>
            <option <?php if($_GET['esporte'] == 'basquete'){ echo 'selected'; } ?> value="basquete">Basquete</option>
            <option <?php if($_GET['esporte'] == 'mma'){ echo 'selected'; } ?> value="mma">MMA</option>
            <option <?php if($_GET['esporte'] == 'tenis'){ echo 'selected'; } ?> value="tenis">Tênis</option>
            <option <?php if($_GET['esporte'] == 'volei'){ echo 'selected'; } ?> value="volei">Vôlei</option>
            <option <?php if($_GET['esporte'] == 'futebol-americano'){ echo 'selected'; } ?> value="futebol-americano">Futebol Americano</option>
          </select>
          <div class="item-content">
            <div class="item-inner">
              <div class="item-title">Esporte</div>
            </div>
          </div>
        </a>
        <a class="item-link smart-select smart-select-init" data-url="select/">
          <select name="data" id="dataFilterMatch">
            <option value="<?php echo date('Y-m-d'); ?>" data-display-as="Hoje">Hoje</option>
            <option value="<?php echo date('Y-m-d', strtotime('+1 day', strtotime(date('Y-m-d')))); ?>" data-display-as="Amanhã">Amanhã</option>
            <?php $d = 2; while($d <= 5){ ?>
            <option value="<?php echo date('Y-m-d', strtotime('+'.$d.' days', strtotime(date('Y-m-d')))); ?>">
              <?php
                $n = date('N', strtotime('+'.$d.' days', strtotime(date('Y-m-d'))));
                echo date('d/m/Y', strtotime('+'.$d.' days', strtotime(date('Y-m-d'))));
                switch ($n) {
                  case '1':
                    echo ' - Segunda-feira';
                    break;

                  case '2':
                    echo ' - Terça-feira';
                    break;

                  case '3':
                    echo ' - Quarta-feira';
                    break;

                  case '4':
                    echo ' - Quinta-feira';
                    break;

                  case '5':
                    echo ' - Sexta-feira';
                    break;

                  case '6':
                    echo ' - Sábado';
                    break;

                  case '7':
                    echo ' - Domingo';
                    break;

                  default:
                    # code...
                    break;
                }
              ?>
            </option>
            <?php $d++; } ?>
          </select>
          <div class="item-content">
            <div class="item-inner">
              <div class="item-title">Data</div>
            </div>
          </div>
        </a>
      </div>
      <a class="col button button-fill color-orange" onClick="filterMatches();">Filtrar</a>
    </form>
    <div class="block-title">Jogos do dia</div>
    <div class="list">
      <ul>
        <li>
          <a href="/partidas/?esporte=<?php echo $_GET['esporte']; ?>&data=<?php echo date('Y-m-d'); ?>" class="item-link item-content">
            <div class="item-media"><i class="material-icons icon_btn">today</i></div>
            <div class="item-inner">
              <div class="item-title">Jogos de hoje</div>
            </div>
          </a>
        </li>
        <li>
          <a href="/partidas/?esporte=<?php echo $_GET['esporte']; ?>&data=<?php echo date('Y-m-d', strtotime('+1 day', strtotime(date('Y-m-d')))); ?>" class="item-link item-content">
            <div class="item-media"><i class="material-icons icon_btn">today</i></div>
            <div class="item-inner">
              <div class="item-title">Jogos de amanhã</div>
            </div>
          </a>
        </li>
      </ul>
    </div>
    <div class="block-title">Selecione um país</div>
    <div class="list">
      <ul id="matchesListByFilter">
      </ul><br /><br />
    </div>
  </div>
<?php include $_SERVER["DOCUMENT_ROOT"].'/m/inc/float_menu.php'; ?>