1
0
www.mikescher.com/www/fragments/panel_euler.php

80 lines
1.8 KiB
PHP
Raw Normal View History

2017-11-08 17:39:50 +01:00
<?php
2020-01-15 02:50:23 +01:00
require_once (__DIR__ . '/../internals/website.php');
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
/** @var URLRoute $ROUTE */ global $ROUTE;
/** @var Website $SITE */ global $SITE;
global $FRAGMENT_PARAM;
/** @var array $parameter */
$parameter = $FRAGMENT_PARAM;
?>
<?php
$EULER = $SITE->modules->Euler();
$data = $EULER->listAll();
2017-11-08 17:39:50 +01:00
$RATING_CLASSES = ['euler_pnl_celltime_perfect', 'euler_pnl_celltime_good', 'euler_pnl_celltime_ok', 'euler_pnl_celltime_bad', 'euler_pnl_celltime_fail'];
?>
<div class="index_pnl_base">
2017-11-08 17:39:50 +01:00
<div class="index_pnl_header">
2018-01-03 21:02:40 +01:00
<a href="/blog/1/Project_Euler_with_Befunge">Project Euler with Befunge-93</a>
2017-11-08 17:39:50 +01:00
</div>
<div class="index_pnl_content">
2017-11-08 17:39:50 +01:00
<?php
$arr = [];
$max = 0;
2020-01-15 02:50:23 +01:00
foreach ($data as $problem)
2017-11-08 17:39:50 +01:00
{
$max = max($max, $problem['number']);
$arr[$problem['number']] = $problem;
}
$max = ceil($max / 20 + 1) * 20;
echo "<div class='euler_pnl_row'>\n";
echo "<div class='euler_pnl_row2'>\n";
for ($i = 1; $i <= $max; $i++)
{
$cssclass = 'euler_pnl_cell_notexist';
$alttitle = '';
$href = '#';
if (key_exists($i, $arr))
{
$cssclass = $RATING_CLASSES[$arr[$i]['rating']];
$alttitle = $arr[$i]['title'];
$href = "/blog/1/Project_Euler_with_Befunge/problem-" . str_pad($i, 3, '0', STR_PAD_LEFT);
}
echo " <div class=\"euler_pnl_cell $cssclass\">";
echo "<a href=\"" . $href . "\" title=\"" . htmlspecialchars($alttitle) . "\" >";
echo "$i";
echo "</a>";
echo "</div>\n";
if (($i)%20 == 0)
{
echo "</div>\n";
echo "</div>\n";
echo "<div class='euler_pnl_row'>\n";
echo "<div class='euler_pnl_row2'>\n";
}
else if (($i)%10 == 0)
{
echo "</div>\n";
echo "<div class='euler_pnl_row2'>\n";
}
}
echo "</div>\n";
echo "</div>\n";
?>
</div>
</div>