2019-11-03 15:33:23 +01:00
< ? php
2020-01-17 00:36:37 +01:00
require_once ( __DIR__ . '/../internals/website.php' );
2019-11-03 15:33:23 +01:00
2020-01-17 00:36:37 +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-17 00:36:37 +01:00
global $FRAGMENT_PARAM ;
/** @var array $parameter */
$parameter = $FRAGMENT_PARAM ;
?>
2019-11-03 15:33:23 +01:00
2020-01-17 00:36:37 +01:00
< ? php
$post = $parameter [ 'blogpost' ];
$subview = $parameter [ 'subview' ];
$year = $post [ 'extras' ][ 'aoc:year' ];
2019-11-03 15:33:23 +01:00
2020-01-17 00:36:37 +01:00
$day = $SITE -> modules -> AdventOfCode () -> getDayFromStrIdent ( $year , $subview );
if ( $day === NULL ) { $FRAME_OPTIONS -> forceResult ( 404 , 'AdventOfCode entry not found' ); return ; }
2020-01-20 21:13:26 +01:00
$FRAME_OPTIONS -> alternative_url = $day [ 'url-alternative' ];
2019-11-03 15:33:23 +01:00
?>
< div class = " boxedcontent base_markdown " >
< div style = " position: relative; " >
2020-01-17 00:36:37 +01:00
< a href = " <?php echo $SITE->modules ->AdventOfCode()->getGithubLink( $year ); ?> " style = " position: absolute; top: 0; right: 0; border: 0; " >
2019-11-03 15:33:23 +01:00
< img src = " /data/images/blog/github_band.png " alt = " Fork me on GitHub " data - canonical - src = " https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png " >
</ a >
</ div >
< div class = " bc_header " >
< ? php echo $day [ 'date' ]; ?>
</ div >
< div class = " bc_data " >
< div class = " bce_header " >< h1 >< a href = " <?php echo $day['url_aoc'] ; ?> " > Day < ? php echo $day [ 'day-padded' ]; ?> </a>: <?php echo htmlspecialchars($day['title']); ?></h1></div>
< b > Description :</ b >
2019-11-08 16:09:42 +01:00
< div class = " bc_aoc_description_parent " >< div class = " bc_aoc_description " >< ? php echo nl2br ( htmlspecialchars ( file_get_contents ( $day [ 'file_challenge' ]))); ?> </div></div>
2019-11-03 15:33:23 +01:00
< br />
< b > Input :</ b >
< div class = " bc_aoc_input " >< ? php echo nl2br ( htmlspecialchars ( file_get_contents ( $day [ 'file_input' ]))); ?> </div>
< br />
2020-12-02 08:32:04 +01:00
< ? php if ( $day [ 'single_solution_file' ]) : ?>
2019-11-03 15:33:23 +01:00
< div class = " bc_aoc_solution_parent " >
< div class = " bc_aoc_solution_code " >
2020-12-02 08:32:04 +01:00
< pre >< code class = " <?php echo $SITE->modules ->AdventOfCode()->getLanguageCSS( $day ) ?> " >< ? php echo htmlspecialchars ( $SITE -> modules -> AdventOfCode () -> getSolutionCode ( $day , 0 )); ?> </code></pre>
2019-11-03 15:33:23 +01:00
</ div >
2020-12-02 08:32:04 +01:00
< ? php for ( $i = 1 ; $i <= $day [ 'parts' ]; $i ++ ) : ?>
< div class = " bc_aoc_solution_value multi " >< b > Result Part < ? = $i ?> :</b> <?php echo $day['solutions'][$i-1]; ?></div>
< ? php endfor ; ?>
2019-11-03 15:33:23 +01:00
</ div >
< br />
2020-12-02 08:32:04 +01:00
< ? php else : ?>
< ? php for ( $i = 1 ; $i <= $day [ 'parts' ]; $i ++ ) : ?>
< b > Part < ? php echo $i ; ?> :</b>
< div class = " bc_aoc_solution_parent " >
< div class = " bc_aoc_solution_code " >
< pre >< code class = " <?php echo $SITE->modules ->AdventOfCode()->getLanguageCSS( $day ) ?> " >< ? php echo htmlspecialchars ( $SITE -> modules -> AdventOfCode () -> getSolutionCode ( $day , $i - 1 )); ?> </code></pre>
</ div >
< div class = " bc_aoc_solution_value " >< b > Result :</ b > < ? php echo $day [ 'solutions' ][ $i - 1 ]; ?> </div>
</ div >
< br />
< ? php endfor ; ?>
< ? php endif ; ?>
2019-11-03 15:33:23 +01:00
2020-01-17 00:36:37 +01:00
< ? php $FRAME_OPTIONS -> addScript ( " /data/javascript/prism.js " , true ); ?>
< ? php $FRAME_OPTIONS -> addStylesheet ( " /data/rawcss/prism.css " ); ?>
2019-11-03 15:33:23 +01:00
2019-11-08 16:09:42 +01:00
< div class = " pagination " >
< ? php
2020-01-17 00:36:37 +01:00
$assocdays = $SITE -> modules -> AdventOfCode () -> listSingleYearAssociative ( $year );
2019-11-03 15:33:23 +01:00
2019-11-08 16:09:42 +01:00
echo " <div class='pagAny'> " ;
for ( $i = 0 ; $i < 25 ; $i ++ )
{
if ( $i > 0 && $i % 5 == 0 ) echo " </div><div class='pagAny'> " ;
if ( $assocdays [ $i ] === null ) echo " <div class='pagbtn pagbtn_disabled'> " . ( $i + 1 ) . " </div> \n " ;
else if ( $i + 1 === $day [ 'day' ]) echo " <a class='pagbtn pagbtn_active' href=' " . $assocdays [ $i ][ 'url' ] . " '> " . ( $i + 1 ) . " </a> \n " ;
else echo " <a class='pagbtn' href=' " . $assocdays [ $i ][ 'url' ] . " '> " . ( $i + 1 ) . " </a> \n " ;
}
echo " </div> " ;
?>
</ div >
2019-11-03 15:33:23 +01:00
</ div >
</ div >