forked from rebillar/site-accueil-insa
div en dessous du menu
This commit is contained in:
parent
3416d25529
commit
e1adf5bf21
6 changed files with 324 additions and 9 deletions
|
@ -0,0 +1,6 @@
|
||||||
|
#menu_space_bottom {
|
||||||
|
background-color: transparent;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 13%;
|
||||||
|
}
|
|
@ -3,4 +3,5 @@
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
z-index: 2;
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ $selector = ['gymnase', 'bib', 'ru', 'csh', 'tp', 'stpi', 'gc', 'gpe', 'gp', 'ge
|
||||||
|
|
||||||
//attention, les éléments sont dans l'ordre
|
//attention, les éléments sont dans l'ordre
|
||||||
$title = [
|
$title = [
|
||||||
'Le gymnase et le synthe',
|
'Le gymnase',
|
||||||
'bib\'insa et cafet',
|
'bib\'insa et cafet',
|
||||||
'le ru',
|
'le ru',
|
||||||
'Le CSH',
|
'Le CSH',
|
||||||
|
@ -47,13 +47,13 @@ $desc = [
|
||||||
'L\'Accueil et la loge du gardien.',
|
'L\'Accueil et la loge du gardien.',
|
||||||
'Et à côté la salle de danse et le lieu de réunion de la Junior INSA Services.',
|
'Et à côté la salle de danse et le lieu de réunion de la Junior INSA Services.',
|
||||||
'Le GMM (Génie Mathématique et Modélisation), que tu ne devrais pas voir souvent cette année.\r\n<br><br>\r\nEt le CSN (Centre des Services Numériques) à côté, où tu iras peut-être pour réviser l\'Algo...\r\n<br><br>\r\nEt enfin, l\'Amphi Fourier, c\'est pour les réceptions, les pièces du CATIN, les concerts des Enfoiros et les spectacles de danse de tes camarades au second semestre !',
|
'Le GMM (Génie Mathématique et Modélisation), que tu ne devrais pas voir souvent cette année.\r\n<br><br>\r\nEt le CSN (Centre des Services Numériques) à côté, où tu iras peut-être pour réviser l\'Algo...\r\n<br><br>\r\nEt enfin, l\'Amphi Fourier, c\'est pour les réceptions, les pièces du CATIN, les concerts des Enfoiros et les spectacles de danse de tes camarades au second semestre !',
|
||||||
'', //R3
|
'R3', //R3
|
||||||
'', //R4
|
'R4', //R4
|
||||||
'Ici on aime bien le calme',
|
'Ici on aime bien le calme',
|
||||||
'Ici on aime bien le calme',
|
'Ici on aime bien le calme',
|
||||||
'', //R7
|
'R7', //R7
|
||||||
'', //R1
|
'R1', //R1
|
||||||
'', //R2
|
'R2', //R2
|
||||||
'L\'Amicale', 'C\'est l\'Association des élèves, à côté de quelques clubs. Si tu as besoin de quelque chose ce sera toujours là-bas.',
|
'L\'Amicale', 'C\'est l\'Association des élèves, à côté de quelques clubs. Si tu as besoin de quelque chose ce sera toujours là-bas.',
|
||||||
'Le Ptit Kawa, mais PK c\'est mieux (Peks pour les intimes). Le bar de l\'INSA, idéal pour se reposer entre les cours en jouant à la coinche ou au mus, ou pour se détendre les mercredi soir grâce aux soirée PK !',
|
'Le Ptit Kawa, mais PK c\'est mieux (Peks pour les intimes). Le bar de l\'INSA, idéal pour se reposer entre les cours en jouant à la coinche ou au mus, ou pour se détendre les mercredi soir grâce aux soirée PK !',
|
||||||
'de ton...'
|
'de ton...'
|
||||||
|
|
16
coms.php
16
coms.php
|
@ -1,6 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
ob_start(); // Start reading html
|
ob_start(); // Start reading html
|
||||||
?>
|
?>
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
color: white;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
section {
|
||||||
|
background-color: black;
|
||||||
|
margin: 10px solid white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
<h1>Les Com's</h1>
|
<h1>Les Com's</h1>
|
||||||
|
@ -117,9 +127,9 @@ ob_start(); // Start reading html
|
||||||
|
|
||||||
respo(
|
respo(
|
||||||
"Respo com graphisme",
|
"Respo com graphisme",
|
||||||
["Guilhem", "Akinlami-Gallagher", "Baptiste"],
|
["Guilhem", "Akinlami-Gallagher"],
|
||||||
["Rebejac (resp graphisme)", "Ciaran (resp graphisme)", "Rébillard (resp web)"],
|
["Rebejac", "Ciaran"],
|
||||||
["rebejac@insa-toulouse.fr", "clj.akinlami@gmail.com", "rebillar@insa-toulouse.fr"]);
|
["rebejac@insa-toulouse.fr", "clj.akinlami@gmail.com"]);
|
||||||
|
|
||||||
respo(
|
respo(
|
||||||
'Respo info (com graphisme)',
|
'Respo info (com graphisme)',
|
||||||
|
|
|
@ -49,6 +49,7 @@ $pagename = $infopage[4]; // nom de la page exact servant à appeler le css
|
||||||
?>
|
?>
|
||||||
<footer>
|
<footer>
|
||||||
<?php include $relativepath."structure/footer.php"; ?>
|
<?php include $relativepath."structure/footer.php"; ?>
|
||||||
|
<div id="menu_space_bottom"></div>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
297
test.php
Normal file
297
test.php
Normal file
|
@ -0,0 +1,297 @@
|
||||||
|
<?php
|
||||||
|
ob_start(); // Start reading html
|
||||||
|
|
||||||
|
define("urlParam", "path");
|
||||||
|
define("photoRoot", "photos_folders/photos");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get active path from url and prevent from seeing folders before 'photos/'
|
||||||
|
* @return string current path
|
||||||
|
*/
|
||||||
|
function getActivePath()
|
||||||
|
{
|
||||||
|
$dir = '';
|
||||||
|
if (isset($_GET[urlParam]))
|
||||||
|
$dir = $_GET[urlParam];
|
||||||
|
$folders = explode(DIRECTORY_SEPARATOR, $dir);
|
||||||
|
$currentPath = "";
|
||||||
|
foreach ($folders as $value) {
|
||||||
|
if ($value != ".." && $value != "." && $value != "") {
|
||||||
|
$currentPath .= DIRECTORY_SEPARATOR . $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $currentPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get active folder from the active path
|
||||||
|
* @param string $path path representing the active folder
|
||||||
|
* @return string active folder name
|
||||||
|
*/
|
||||||
|
function GetActiveFolder($path)
|
||||||
|
{
|
||||||
|
$dir = explode(DIRECTORY_SEPARATOR, $path);
|
||||||
|
return $dir[sizeof($dir) - 1]; // Last item after /
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the current album is available for download as a .zip file
|
||||||
|
* @param string $path path to search the album in
|
||||||
|
* @return bool True if an album is available, false otherwise
|
||||||
|
*/
|
||||||
|
function isAlbumAvailable($path)
|
||||||
|
{
|
||||||
|
$dir = photoRoot . $path;
|
||||||
|
$files = scandir($dir);
|
||||||
|
$valid = false;
|
||||||
|
foreach ($files as $key => $value) {
|
||||||
|
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
|
||||||
|
if (!is_dir($path)) {
|
||||||
|
$valid = pathinfo($path, PATHINFO_EXTENSION) == "zip";
|
||||||
|
if ($valid)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all directories in the specified path and creates them on the page
|
||||||
|
* @param string $path path to search directories in
|
||||||
|
*/
|
||||||
|
function createDirectories($path)
|
||||||
|
{
|
||||||
|
$path = photoRoot . $path;
|
||||||
|
$displayedItems = 0;
|
||||||
|
$folders = getDirectories($path);
|
||||||
|
foreach ($folders as $key => $value) {
|
||||||
|
$folderTitle = $value;
|
||||||
|
$photos = getTotalPhotoCount($path . DIRECTORY_SEPARATOR . $value);
|
||||||
|
$albums = getTotalAlbumCount($path . DIRECTORY_SEPARATOR . $value);
|
||||||
|
$folderLink = "?" . urlParam . "=" . getActivePath() . DIRECTORY_SEPARATOR . $value;
|
||||||
|
include("includes/photos/folder_template.php");
|
||||||
|
$displayedItems++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all photos in the specified path and creates them on the page
|
||||||
|
* @param string $path path to search photos in
|
||||||
|
*/
|
||||||
|
function createPhotos($path)
|
||||||
|
{
|
||||||
|
$path = photoRoot . "_thumb" . $path;
|
||||||
|
$files = scandir($path);
|
||||||
|
$displayedItems = 0;
|
||||||
|
foreach ($files as $key => $value) {
|
||||||
|
$realPath = realpath($path . DIRECTORY_SEPARATOR . $value);
|
||||||
|
if (isValidImage($realPath)) {
|
||||||
|
$imageSrc = $path . DIRECTORY_SEPARATOR . $value;
|
||||||
|
$imageId = "photo-" . $displayedItems;
|
||||||
|
include("includes/photos/photo_template.php");
|
||||||
|
$displayedItems++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get folders in the given path
|
||||||
|
* @param string $path path to search folders in
|
||||||
|
* @return array array of folders
|
||||||
|
*/
|
||||||
|
function getDirectories($path)
|
||||||
|
{
|
||||||
|
$files = scandir($path);
|
||||||
|
$folders = [];
|
||||||
|
foreach ($files as $key => $value) {
|
||||||
|
$realPath = realpath($path . DIRECTORY_SEPARATOR . $value);
|
||||||
|
if (isValidDirectory($realPath, $value)) {
|
||||||
|
array_push($folders, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $folders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counts directories in the specified folder
|
||||||
|
* @param string $path path to search directories in
|
||||||
|
* @return int directories count
|
||||||
|
*/
|
||||||
|
function getDirectoriesCount($path)
|
||||||
|
{
|
||||||
|
$files = scandir($path);
|
||||||
|
$dirCount = 0;
|
||||||
|
foreach ($files as $key => $value) {
|
||||||
|
$realPath = realpath($path . DIRECTORY_SEPARATOR . $value);
|
||||||
|
if (isValidDirectory($realPath, $value)) {
|
||||||
|
$dirCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $dirCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counts images in the specified folder
|
||||||
|
* @param string $path path to search photos in
|
||||||
|
* @return int photo count
|
||||||
|
*/
|
||||||
|
function getPhotoCount($path)
|
||||||
|
{
|
||||||
|
$files = scandir($path);
|
||||||
|
$fileCount = 0;
|
||||||
|
foreach ($files as $key => $value) {
|
||||||
|
$realPath = realpath($path . DIRECTORY_SEPARATOR . $value);
|
||||||
|
if (isValidImage($realPath)) {
|
||||||
|
$fileCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $fileCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the count of all directories, recursively from the path specified
|
||||||
|
* @param string $path root for search
|
||||||
|
* @return int total number of directories
|
||||||
|
*/
|
||||||
|
function getTotalAlbumCount($path)
|
||||||
|
{
|
||||||
|
$folders = getDirectories($path);
|
||||||
|
$total = sizeof($folders);
|
||||||
|
foreach ($folders as $key => $value) {
|
||||||
|
$total += getTotalAlbumCount($path . DIRECTORY_SEPARATOR . $value);
|
||||||
|
}
|
||||||
|
return $total;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTotalPhotoCount($path)
|
||||||
|
{
|
||||||
|
$folders = getDirectories($path);
|
||||||
|
$total = getPhotoCount($path);
|
||||||
|
foreach ($folders as $key => $value) {
|
||||||
|
$total += getTotalPhotoCount($path . DIRECTORY_SEPARATOR . $value);
|
||||||
|
}
|
||||||
|
return $total;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given image is valid
|
||||||
|
* @param string $imagePath absolute path of the image
|
||||||
|
* @return bool True if the file is a jpg, jpeg or png, false otherwise
|
||||||
|
*/
|
||||||
|
function isValidImage($imagePath)
|
||||||
|
{
|
||||||
|
$ext = pathinfo($imagePath, PATHINFO_EXTENSION);
|
||||||
|
return !is_dir($imagePath) && ($ext == "jpg" || $ext == "JPG" || $ext == "jpeg" || $ext == "JPEG" || $ext == "png" || $ext == "PNG");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given folder is valid (is not '.' or '..')
|
||||||
|
* @param string $directoryPath directory path
|
||||||
|
* @param string $directory directory name
|
||||||
|
* @return bool True if the directory is valid, false otherwise
|
||||||
|
*/
|
||||||
|
function isValidDirectory($directoryPath, $directory)
|
||||||
|
{
|
||||||
|
return is_dir($directoryPath) && $directory != "." && $directory != ".." && substr($directory, 0, 1) !== ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates buttons representing the actual path for easier navigation
|
||||||
|
* @param string $path Actual Path
|
||||||
|
*/
|
||||||
|
function generatePath($path)
|
||||||
|
{
|
||||||
|
$folders = explode(DIRECTORY_SEPARATOR, $path);
|
||||||
|
$currentPath = "";
|
||||||
|
$pathTitle = "Menu";
|
||||||
|
$pathLink = "?" . urlParam . "=";
|
||||||
|
include("includes/photos/path_template.php");
|
||||||
|
foreach ($folders as $value) {
|
||||||
|
if ($value != "") {
|
||||||
|
$pathTitle = $value;
|
||||||
|
$currentPath .= DIRECTORY_SEPARATOR . $value;
|
||||||
|
$pathLink = "?" . urlParam . "=" . $currentPath;
|
||||||
|
include("includes/photos/path_template.php");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="inner">
|
||||||
|
<div id="photoOverlay" style="display:none">
|
||||||
|
|
||||||
|
<img src="" id="imgBig">
|
||||||
|
|
||||||
|
<div id="closeBack" onclick="closeBig()"></div>
|
||||||
|
<div id="loadingIconContainer" onclick="closeBig()">
|
||||||
|
<i class="fas fa-spinner fa-spin"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="photoButtonsContainer">
|
||||||
|
<div id="rightButton" onclick="displayNext(1)">
|
||||||
|
<i class="fas fa-arrow-right"></i>
|
||||||
|
</div>
|
||||||
|
<div id="leftButton" onclick="displayNext(-1)">
|
||||||
|
<i class="fas fa-arrow-left"></i>
|
||||||
|
</div>
|
||||||
|
<a id="downloadButton" download="" href="">
|
||||||
|
<i class="fas fa-download"></i>
|
||||||
|
</a>
|
||||||
|
<div id="closeButton">
|
||||||
|
<i class="fas fa-times" onclick="closeBig()"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1 id="photosTitle">Photos</h1>
|
||||||
|
<p>Clique sur le dossier de ton choix pour afficher les photos. Il faut que tu sois inscrit à l'INSA pour pouvoir
|
||||||
|
les regarder (et oui, pas de spoiler).
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Si tu ne peux pas voir les photos (la fenêtre pour entrer le mot de passe ne s'affiche pas), ouvre cette page
|
||||||
|
avec
|
||||||
|
un autre navigateur.
|
||||||
|
</p>
|
||||||
|
<ul class="photos-path">
|
||||||
|
<li><p>Chemin : </p></li>
|
||||||
|
<?php
|
||||||
|
generatePath(getActivePath());
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="photoContainer">
|
||||||
|
<?php if (getDirectoriesCount(photoRoot . getActivePath()) > 0): ?>
|
||||||
|
<div class="photos-folder-container">
|
||||||
|
<?php
|
||||||
|
createDirectories(getActivePath());
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (isAlbumAvailable(getActivePath())): ?>
|
||||||
|
<a download=""
|
||||||
|
href="photos_folders/photos<?php echo getActivePath() . DIRECTORY_SEPARATOR . GetActiveFolder(getActivePath()) ?>.zip"
|
||||||
|
id="downloadAlbum">
|
||||||
|
<span id="downloadText"><i class="fas fa-download"></i>Télécharger</span>
|
||||||
|
<span id="albumPhotoCount"><?php echo getPhotoCount(photoRoot . getActivePath()) ?> photos</span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (getPhotoCount(photoRoot . getActivePath()) > 0): ?>
|
||||||
|
<div class="photos">
|
||||||
|
<?php
|
||||||
|
createPhotos(getActivePath());
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/photos.css">
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$pageContent = ob_get_clean(); // Store html content in variable
|
||||||
|
$pageTitle = "Photos";
|
||||||
|
$pageScripts = "<script src=\"assets/js/photos.js\"></script><script type=\"text/javascript\" src=\"assets/js/jquery.mousewheel.min.js\"></script>";
|
||||||
|
include("includes/template.php"); // Display template with variable content
|
||||||
|
?>
|
Loading…
Reference in a new issue