site-accueil-insa/structure/menu.php
2023-01-26 15:53:45 +01:00

138 lines
No EOL
4.6 KiB
PHP

<?php
if(!isset($relativepath)) {
header('Location: ../index.php');
}
include "assets/scripts/globals.php"
?>
<!-- The actual menu * desktop -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
class="menu" id="parent"
viewBox="0 0 512 34.85">
<!-- Might put them somewhere else later -->
<style type="text/css">
.st0{fill:#AA572E;}
.st1{fill:#C06538;}
.st2{fill:#2B0A00;}
.st3{fill:#914522;}
.st4{fill:#9B4D25;}
.st5{fill:#A04E26;}
.st6{fill:#491A05;}
.st7{fill:#3F1403;}
.st8{fill:#BA6135;}
.st16{fill:#392313;}
.st17{fill:#492715;}
</style>
<style type="text/css">
.menu-link text {
fill: white;
text-anchor: middle;
alignment-baseline: central;
dominant-baseline: central;
font-size: 8px;
}
</style>
<!-- This svg create an image of a brick and cache it for further <use>s-->
<symbol id="Brick" viewBox="0 0 47 17">
<rect x="1" y="1" class="st0" width="45" height="15"/>
<rect x="1.5" y="0" class="st1" width="44" height="1.5"/> <!-- Top side -->
<rect x="1.5" y="15.5" class="st2" width="44" height="1.5"/> <!-- Bottom side -->
<rect x="45.5" y="1.5" class="st3" width="1.5" height="14"/> <!-- Right side -->
<rect x="0" y="1.5" class="st4" width="1.5" height="14"/> <!-- Left side -->
<polygon class="st5" points="47,1.5 45.5,1.5 45.5,0"/> <!-- TR corner -->
<polygon class="st6" points="45.5,17 47,15.5 45.5,15.5"/> <!-- BR corner -->
<polygon class="st7" points="0,15.5 1.5,15.5 1.5,17"/> <!-- BL corner -->
<polygon class="st8" points="0,1.5 1.5,1.5 1.5,0"/> <!-- TL corner -->
</symbol>
<!-- Fond -->
<rect x="0" y="2.85" class="st16" width="512" height="32"/>
<!-- Fond : Surface -->
<rect x="0" y="2.85" class="st17" width="512" height="1.5"/>
<!-- Top layer (LtR) -->
<?php
$co_y_0 = [0, 48.85, 97.7, 146.55, 195.4, 244.25, 293.1, 341.95, 390.8, 439.65, 488.5];
$texte_y_0 = ["Accueil", "Planning", "Plan", "Lydia/Izly", "Blouse", $TEAM1, $TEAM2, "Les stats", "INSARIO", "Prévention", ""];
$lien_y_0 = ["index.php", "planning.php", "map.php", "lydia.php", "blouse.php", "team.php?team=".$TEAM1, "team.php?team=".$TEAM2, "stats.php", "game.php", "prevs.php", ""];
for($i = 0; $i <= 10; $i++) {
echo
'<a href="'.$lien_y_0[$i].'" class="menu-link">
<use xlink:href="#Brick" width="47" height="17" x="'.$co_y_0[$i].'" y="0"/>
<svg id="btn10" width="47" height="17" x="'.$co_y_0[$i].'" y="0">
<text x="50%" y="50%">
'.$texte_y_0[$i].'
</text>
</svg>
</a>';
}
$co_y_1 = [-23.5, 25.35,74.2, 123.05, 171.9, 220.75, 269.6, 318.45, 367.3, 416.15, 465];
$texte_y_1 = ["", "Photos","Les clubs", "Com's", "", "Homework", "Chansons", "", "Download", "Contact", "Infos"];
$lien_y_1 = ["", "photos.php","clubs.php", "com_page.php", "", "vacances.php", "chansons.php", "", "downloads.php", "coms.php", "info.php"];
for($i = 0; $i <= 10; $i++) {
echo
'<a href="'.$lien_y_1[$i].'" class="menu-link menu-bottom-line">
<use xlink:href="#Brick" width="47" height="17" x="'.$co_y_1[$i].'" y="17.85"/>
<svg id="btn10" width="47" height="17" x="'.$co_y_1[$i].'" y="17.85">
<text x="50%" y="50%">
'.$texte_y_1[$i].'
</text>
</svg>
</a>';
}
?>
</svg>
<!-- Sur téléphone -->
<nav class="mobile-menu" id="mobile-menu">
<div class="containerF3g">
<div class="mobile-grid">
<?php
for($i = 0; $i <= 21; $i++) {
if($i%2 == 0) {
// pair
$link = $lien_y_0[$i/2];
$text = $texte_y_0[$i/2];
} else {
//impair
$link = $lien_y_1[($i-1)/2];
$text = $texte_y_1[($i-1)/2];
}
echo
'<a href="'.$link.'" class="mobile-menu-link">
<svg class="mobile-brick menu-link" viewBox="-2 -2 51 21">
<use xlink:href="#Brick" width="47" height="17" x="0" y="0"/>
<text x="23.8" y="8.5">
'.$text.'
</text>
</svg>
</a>';
}
?>
</div>
</div>
<span id="close-mobile-menu" class="close-mobile-menu">
x
</span>
</nav>