<?php
include '../config.php';
$anio = $_GET['y'];
$anio1 = $anio + 1;
//echo $anio;     
// Unix
setlocale(LC_TIME, 'es_ES.UTF-8');

$now = time();

$date = strtotime('Enero 01 '.$anio);
for($i = $anio;$i<$anio1;$i++){
    $weeks = max(date("W", strtotime($i ."-12-27")), date("W", strtotime($i ."-12-29")), date("W", strtotime($i ."-12-31"))). "\n";
}

if(intval($anio) == intval(date('Y', $now))){
    $weeks = date("W", $now);
}


$date = strtotime('01/01/'.$anio);
    
    $i = 1;
    echo '<select class="select-css" id="week" onchange="filterSemana();">';

    while ($i <= $weeks) {

        echo '<option value="'.date('Y-m-d', $date).'">('.$i.') Semana del ' . date('d/m/y', $date) . ' </option>';

        $date = strtotime( date('Y-m-d', $date) . ' + 7 Days');


        $i++;
    }

    echo '</select>';

?>