2019-11-03 15:33:23 +01:00
|
|
|
<?php
|
2020-01-15 02:50:23 +01:00
|
|
|
require_once (__DIR__ . '/../internals/website.php');
|
2019-11-03 15:33:23 +01:00
|
|
|
|
2020-01-15 02:50:23 +01:00
|
|
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
|
|
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
|
|
|
/** @var Website $SITE */ global $SITE;
|
2019-11-03 15:33:23 +01:00
|
|
|
|
2020-01-15 02:50:23 +01:00
|
|
|
global $FRAGMENT_PARAM;
|
|
|
|
/** @var array $parameter */
|
|
|
|
$parameter = $FRAGMENT_PARAM;
|
|
|
|
?>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$year = $parameter['year'];
|
|
|
|
$shownav = $parameter['nav'];
|
|
|
|
$linkheader = $parameter['linkheader'];
|
|
|
|
$ajax = $parameter['ajax'];
|
|
|
|
$frame = $parameter['frame'];
|
|
|
|
$frameid = $parameter['frameid'];
|
|
|
|
|
2020-01-16 11:48:27 +01:00
|
|
|
$assocdays = $SITE->modules->AdventOfCode()->listSingleYearAssociative($year);
|
|
|
|
$prev_year = $shownav ? $SITE->modules->AdventOfCode()->getPrevYear($year) : null;
|
|
|
|
$next_year = $shownav ? $SITE->modules->AdventOfCode()->getNextYear($year) : null;
|
2019-11-03 15:33:23 +01:00
|
|
|
|
2020-01-15 02:50:23 +01:00
|
|
|
if ($ajax) $FRAME_OPTIONS->addScript("/data/javascript/aoc_panel_interactive.js", true);
|
2020-01-06 21:58:09 +01:00
|
|
|
|
2019-11-03 15:33:23 +01:00
|
|
|
?>
|
|
|
|
|
2020-01-06 21:58:09 +01:00
|
|
|
<?php if ($frame) echo '<div class="aoc_calendar_parent" id="' . $frameid . '">'; ?>
|
2019-11-03 15:33:23 +01:00
|
|
|
<div class="aoc_calendar">
|
|
|
|
<div class="aoc_calendar_header">
|
|
|
|
<?php
|
2020-01-06 21:58:09 +01:00
|
|
|
if ($prev_year !== null)
|
|
|
|
{
|
|
|
|
if ($ajax)
|
|
|
|
echo '<a href="javascript:void();" onclick="javascript:changeAOCPanel(' . $prev_year . ', ' . ($shownav?'true':'false') . ', ' . ($linkheader?'true':'false') . ', ' . ($ajax?'true':'false') . ', \'' . $frameid . '\')" class="aoc_calendar_header_link aoc_prev" ><</a>';
|
|
|
|
else
|
2020-01-16 11:48:27 +01:00
|
|
|
echo '<a href="' . $SITE->modules->AdventOfCode()->getURLForYear($prev_year) . '" class="aoc_calendar_header_link aoc_prev" ><</a>';
|
2020-01-06 21:58:09 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo '<a href="#" class="aoc_calendar_header_link aoc_prev aoc_link_hidden" ><</a>';
|
|
|
|
}
|
2019-11-03 15:33:23 +01:00
|
|
|
|
2020-01-16 11:48:27 +01:00
|
|
|
if ($linkheader) echo '<span class="aoc_calendar_header_title"><a href="' . $SITE->modules->AdventOfCode()->getURLForYear($year) . '">'.$year.'</a></span>';
|
2020-01-06 21:58:09 +01:00
|
|
|
else echo '<span class="aoc_calendar_header_title">'.$year.'</span>';
|
2019-11-03 15:33:23 +01:00
|
|
|
|
2020-01-06 21:58:09 +01:00
|
|
|
if ($next_year !== null)
|
|
|
|
{
|
|
|
|
if ($ajax)
|
|
|
|
echo '<a href="javascript:void();" onclick="javascript:changeAOCPanel(' . $next_year . ', ' . ($shownav?'true':'false') . ', ' . ($linkheader?'true':'false') . ', ' . ($ajax?'true':'false') . ', \'' . $frameid . '\')" class="aoc_calendar_header_link aoc_next" >></a>';
|
|
|
|
else
|
2020-01-16 11:48:27 +01:00
|
|
|
echo '<a href="' . $SITE->modules->AdventOfCode()->getURLForYear($next_year) . '" class="aoc_calendar_header_link aoc_next" >></a>';
|
2020-01-06 21:58:09 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo '<a href="" class="aoc_calendar_header_link aoc_next aoc_link_hidden" >></a>';
|
|
|
|
}
|
2019-11-03 15:33:23 +01:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
for ($i=0; $i<5; $i++)
|
|
|
|
{
|
|
|
|
echo '<div class="aoc_calendar_row">'."\n";
|
|
|
|
for ($j=0; $j<5; $j++)
|
|
|
|
{
|
|
|
|
$day = $assocdays[$i*5+$j];
|
|
|
|
if ($day === null) echo '<span class="aoc_calendar_field aoc_disabled">'.($i*5+$j+1).'</span>'."\n";
|
|
|
|
else echo '<a href="'.$day['url'].'" class="aoc_calendar_field aoc_enabled" >'.($i*5+$j+1).'</a>'."\n";
|
|
|
|
}
|
|
|
|
echo '</div>'."\n";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
2020-01-06 21:58:09 +01:00
|
|
|
<?php if ($frame) echo '</div>'; ?>
|