Rewrote score editing and started to add new teams

This commit is contained in:
Keplyx 2019-05-18 14:55:49 +02:00
parent 6a26644495
commit ebf4de0b7c
42 changed files with 406 additions and 615 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="PROJECT" libraries="{jquery-3.3.1}" />
<file url="PROJECT" libraries="{jquery-3.3.1, jquery-confirm}" />
</component>
</project>

39
admin/ajax_load.php Executable file
View file

@ -0,0 +1,39 @@
<?php
require_once '../classes/dao.php';
if (isset($_GET['function'])) {
if ($_GET['function'] == "save_scores") {
save_scores();
} elseif ($_GET['function'] == "get_scores") {
get_scores();
}
} else
show_error();
function save_scores() {
if (isset($_GET['lines']) && isset($_GET['team'])) {
$dao = new Dao('../');
$dao->save_scores($_GET['lines'], $_GET['team']);
echo "Réussite";
} else
show_error();
}
function get_scores() {
if (isset($_GET['team'])) {
header('Content-Type: application/json');
$dao = new Dao('../');
echo json_encode($dao->get_score_team($_GET['team']));
} else {
show_error();
}
}
function show_error() {
echo "Échec : ";
var_dump($_GET);
}

63
admin/index.php Normal file
View file

@ -0,0 +1,63 @@
<?php
ob_start(); // Start reading html
$relativePath = "../";
?>
<h1>ADMIN</h1>
<h2>Editer Score</h2>
<select id="teamSelect">
<option value="gli">Glissefondor</option>
<option value="pek">Peksentard</option>
<option value="boo">Boomsouffle</option>
<option value="ver">Verredaigle</option>
</select>
<div class="add-line">
<i class="fas fa-plus"></i>
</div>
<div class="edit-header">
<div class="stat-log">Log</div>
<div class="stat-points">Points</div>
<div class="stat-trash"><i class='fas fa-trash'></i></div>
</div>
<table class="stats-table edit-stats">
</table>
<div class="save-score">
<i class="fas fa-save"></i> Enregistrer
</div>
<br>
<div class="stats-button-container">
<a href="<?= $relativePath ?>stats.php" class="stats-button">
Retour sur le site
</a>
</div>
<link rel="stylesheet" type="text/css" media="screen" href="<?= $relativePath ?>assets/css/stats.css"/>
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "ADMIN";
$pageScripts = "<script type=\"text/javascript\" src=\"../assets/js/statsManager.js\"></script>";
include($relativePath . "includes/template.php"); // Display template with variable content
function get_stats($team, $path)
{
$dao = new Dao($path);
foreach ($dao->get_score_team($team) as $row) {
$text = $row['text'];
$points = $row['points'];
?>
<tr class="entry">
<td class="edit-text"><input type='text' value="<?= $text ?>"/></td>
<td class="edit-points"><input type='number' value="<?= $points ?>"/></td>
<td class='remove-line'><i class="fas fa-trash"></td>
</tr>
<?php
}
}
?>

View file

@ -1,145 +1,22 @@
#stats-container {
display: block;
.score-entry {
width: 100%;
}
.stats-table {
width: 100%;
border: none;
.score-entry-text {
margin-right: 20px;
}
.stats-table tr:nth-child(even) {
background-color: #2d2d2d;
.score-entry-points {
margin-left: 20px;
}
.stats-table.stats-usa tr:hover {
background-color: #f0d289;
}
.stats-table.stats-urss tr:hover {
background-color: #3b5941;
}
.stats-table.stats-boomsouffle tr:hover {
background-color: #f0d289;
}
.stats-table.stats-verredaigle tr:hover {
background-color: #f0d289;
}
.stats-toggle, .edit-stats th {
border-radius: 10px 10px 0 0;
font-size: 20px;
font-family: 'Russo One', sans-serif;
color: #fff;
cursor: pointer;
}
.stats-toggle#toggle-usa {
background-color: #F0BA00;
border-color: #F0BA00;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-ms-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
.stats-toggle#toggle-usa:hover {
background-color: #f0c424;
border-color: #F0C424;
box-shadow: 0 0 10px #F0C424;
}
.stats-toggle#toggle-urss {
background-color: #275933;
border-color: #275933;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-ms-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
.stats-toggle#toggle-urss:hover {
background-color: #205929;
border-color: #205929;
box-shadow: 0 0 10px #205929;
}
.stats-toggle#toggle-boomsouffle {
background-color: #F0BA00;
border-color: #F0BA00;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-ms-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
.stats-toggle#toggle-boomsouffle:hover {
background-color: #f0c424;
border-color: #F0C424;
box-shadow: 0 0 10px #F0C424;
}
.stats-toggle#toggle-verredaigle {
background-color: #F0BA00;
border-color: #F0BA00;
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-ms-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
}
.stats-toggle#toggle-verredaigle:hover {
background-color: #f0c424;
border-color: #F0C424;
box-shadow: 0 0 10px #F0C424;
}
.stats-table .stat-log, .stats-table .stat-points {
color: #1c1c1c;
border-radius: 0;
.positive {
font-weight: bold;
color: white;
}
.stats-usa .stat-log, .stats-usa .stat-points {
background-color: #F0DB82;
border-color: #F0DB82;
}
.stats-usa td {
border-bottom: 1px solid #F0BA00;
}
.stats-urss .stat-log, .stats-urss .stat-points {
background-color: #395a4a;
border-color: #395A4A;
}
.stats-urss td {
border-bottom: 1px solid #275933;
}
.stats-boomsouffle .stat-log, .stats-boomsouffle .stat-points {
background-color: #F0DB82;
border-color: #F0DB82;
}
.stats-boomsouffle td {
border-bottom: 1px solid #F0BA00;
}
.stats-verredaigle .stat-log, .stats-verredaigle .stat-points {
background-color: #F0DB82;
border-color: #F0DB82;
}
.stats-verredaigle td {
border-bottom: 1px solid #F0BA00;
.negative {
color: #1a1a1a;
}
@ -159,15 +36,6 @@
width: 20%;
}
#positive{
color: #ffffff;
font-weight: bold;
}
#negative{
color: #adadad;
}
.edit-button-container {
border: none;
margin: 10px;
@ -176,8 +44,8 @@
.edit-header {
display: flex;
text-align: center;
background-color: #adaca8;
color: #1c1c1c;
background-color: #61605e;
color: #fefefe;
font-weight: bold;
}
@ -193,33 +61,6 @@
width: 20%;
}
.edit-button {
width: auto;
color: #fafafa;
border-radius: 5px;
padding: 5px;
box-shadow: 0 0 5px #000000;
}
.edit-button#button-urss {
background: #275933;
}
.edit-button#button-usa {
background: #F0BA00;
}
.edit-button#button-boomsouffle {
background: #F0BA00;
}
.edit-button#button-verredaigle {
background: #F0BA00;
}
.edit-button:hover, .edit-button#button-urss:hover, .edit-button#button-usa:hover {
color: #000;
background: #fafafa;
}
.stats-button-container {
display: inline-flex;
@ -278,22 +119,37 @@ input {
margin: 30px 0 20px 0;
}
#add-line-usa {
#addLine_gli {
background: #f02800;
}
#addLine_pek {
background: #21f022;
}
#addLine_boo {
background: #F0BA00;
}
.add-line#add-line-usa:hover {
background: #f0c424;
box-shadow: 0 0 5px #f0c424;
#addLine_ver {
background: #5aa4f0;
}
#add-line-urss {
background: #275933;
#editHeader_gli {
background: #9c1a00;
}
.add-line#add-line-urss:hover {
background: #205929;
box-shadow: 0 0 5px #205929;
#editHeader_pek {
background: #138a14;
}
#editHeader_boo {
background: #6b5300;
}
#editHeader_ver {
background: #264565;
}

View file

@ -280,6 +280,10 @@ Full-Width Styles
z-index: -10;
}
.index-background {
background: url("../images/bg_index.jpg") no-repeat center fixed;
}
#bg_ussr {
background: url("../images/urss.png") no-repeat center fixed;
background-size: cover;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 KiB

After

Width:  |  Height:  |  Size: 279 KiB

View file

@ -47,27 +47,6 @@ function enableHamburger() {
hamburger.addClass("change-clic");
}
/*
* Open navigation menu when swiping right (if not swiping on an image)
*/
var img = document.querySelector('.sidenav');
// Create a manager to manager the element
var manager = new Hammer.Manager(img, {touchAction: "auto"}); // enable the touch action to allow scrolling on the sidenav
// Create a recognizer
var Swipe = new Hammer.Swipe();
// Add the recognizer to the manager
manager.add(Swipe);
// Subscribe to the swipe event
manager.on('swipe', function(e) {
var direction = e.offsetDirection;
if (direction === 4) { // right
openNav();
} else if (direction === 2) { // left
closeNav();
}
});
// Animate hamburger on hover
hamburger.hover(function(){
hamburger.addClass("change-hover");

42
assets/js/statsDisplay.js Normal file
View file

@ -0,0 +1,42 @@
let entryTemplate =
'<div class="score-entry">' +
'<span class="score-entry-text"></span>' +
'<span class="score-entry-points"></span>' +
'</div>';
function showScores(team) {
console.log(team);
$.alert({
title: 'wesh',
theme: 'supervan',
content: function () {
let self = this;
let object = {
"function": 'get_scores',
'team': team,
};
return $.ajax({
url: 'admin/ajax_load.php',
data: object,
method: 'get'
}).done(function (data) {
for (let i = 0; i < data.length; i++) {
let $entry = $(entryTemplate);
$entry.attr('id', 'entry_' + i);
$entry.find('.score-entry-text').text(data[i]['text']);
$entry.find('.score-entry-points').text(data[i]['points']);
if (parseInt(data[i]['points']) > 0)
$entry.addClass('positive');
else
$entry.addClass('negative');
self.setContentAppend($entry);
}
}).fail(function(){
self.setContent('Something went wrong.');
});
}
});
}

96
assets/js/statsManager.js Executable file
View file

@ -0,0 +1,96 @@
let uniqueID = 0;
let ajaxurl = 'ajax_load.php';
let entryTemplate =
'<tr class="entry">' +
'<td class="edit-text"><input class="edit-text-input" type="text" placeholder="Entrez le texte ici"></td>' +
'<td class="edit-points"><input class="edit-value-input" type="number" value="0"></td>' +
'<td class="remove-line">' +
'<i class="fas fa-trash"></i>' +
'</td>' +
'</tr>';
$(document).ready(function () {
getScores(getSelectedTeam());
setTeamColors(getSelectedTeam());
$(".add-line").click(function () {
addLine();
});
$(".save-score").click(function () {
let lines = getLine();
let object = {
"function": 'save_scores',
"team": getSelectedTeam(),
"lines": lines,
};
$.get(
ajaxurl,
object,
function (data) {
alert(data);
});
});
$('#teamSelect').on('change', function () {
getScores(getSelectedTeam());
setTeamColors(getSelectedTeam());
});
});
function setTeamColors(team) {
$('.add-line').attr('id', 'addLine_' + team);
$('.edit-header').attr('id', 'editHeader_' + team);
}
function getSelectedTeam() {
return $('#teamSelect').val();
}
function addLine(text, value) {
uniqueID += 1;
let $entry = $(entryTemplate);
$entry.attr('id', 'entry_' + uniqueID);
$entry.find('.remove-line').attr('id', 'removeEntry_'+uniqueID);
$(".stats-table").prepend(
$entry
);
$entry.find('.edit-text-input').val(text);
$entry.find('.edit-value-input').val(value);
$("#removeEntry_" + uniqueID).on("click", function () {
console.log($($entry));
$entry.remove();
});
}
function getLine() {
let elements = $(".entry").map(function () {
return this;
}).get();
let array = [];
for (let i = 0; i < elements.length; i++) {
let values = {
"text": $(elements[i]).find('.edit-text-input').val(),
"points": parseInt($(elements[i]).find('.edit-value-input').val())
};
array.push(values);
}
console.log(array);
return array;
}
function getScores(team) {
$('.stats-table').html('');
let object = {
"function": 'get_scores',
'team': team,
};
$.get(
ajaxurl,
object,
function (data) {
for (let i = 0; i < data.length; i++) {
addLine(data[i]['text'], data[i]['points']);
}
}
);
}

View file

@ -68,5 +68,5 @@ ob_start(); // Start reading html
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Blouse";
include("template.php"); // Display template with variable content
include("includes/template.php"); // Display template with variable content
?>

View file

@ -11,7 +11,7 @@ class Dao
{
if ($this->debug) {
$username = 'root';
/* $password = $this->read_password($path_to_password);*/
// $password = $this->read_password($path_to_password);
$password ='';
$dsn = 'mysql:dbname=phpmyadmin;host=127.0.0.1';
} else {
@ -51,12 +51,10 @@ class Dao
$sql = 'DELETE FROM scores WHERE team = ?';
$cursor = $this->conn->prepare($sql);
$cursor->execute([$team]);
$array = json_decode($scores_json)->array;
foreach ($array as $value) {
foreach ($scores_json as $value) {
$sql = 'INSERT INTO scores (text, points, team) VALUES (?, ?, ?)';
$cursor = $this->conn->prepare($sql);
$cursor->execute([$value->text, $value->points, $team]);
$cursor->execute([$value['text'], $value['points'], $team]);
}
}

View file

@ -20,5 +20,5 @@ include("includes/coms/com_template.php");
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Coms";
include("template.php"); // Display template with variable content
include("includes/template.php"); // Display template with variable content
?>

View file

@ -26,5 +26,5 @@ ob_start(); // Start reading html
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Téléchargements";
include("template.php"); // Display template with variable content
include("includes/template.php"); // Display template with variable content
?>

View file

@ -1,109 +0,0 @@
<?php
require_once '../../classes/dao.php';
if (!isset($team))
$team = 'usa';
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width,maximum-scale=2">
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/all.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="../../assets/css/style.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../assets/css/sidenav.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../assets/css/score.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../assets/css/hamburger.css">
<link rel="stylesheet" type="text/css" media="screen" href="../../assets/css/stats.css"/>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.js"></script>
<script src="../statsManager.js"></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat|Raleway|Russo+One" rel="stylesheet">
<link rel="shortcut icon" href="../favicon.ico">
<title>Score <?= strtoupper($team) ?> | ADMIN | INSAT Accueil 2018</title>
<!-- Matomo -->
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function () {
var u = "//etud.insa-toulouse.fr/~accueil_insa/analytics/";
_paq.push(['setTrackerUrl', u + 'piwik.php']);
_paq.push(['setSiteId', '1']);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.async = true;
g.defer = true;
g.src = u + 'piwik.js';
s.parentNode.insertBefore(g, s);
})();
</script>
<!-- End Matomo Code -->
</head>
<body id="main">
<div class="background"></div>
<div id="header-wrap" class="outer">
<header class="inner">
<h1 id="title">Administration</h1>
</header>
</div>
<div class="stats-button-container">
<a href="../../stats.php" class="stats-button">
Retour sur le site
</a>
</div>
<div id="main-fading-top-edge"></div>
<div id="main-content-wrap" class="outer">
<section id="main-content" class="inner">
<h1>Editer Score <?= strtoupper($team) ?></h1>
<p>
<?= $description ?>
</p>
<div class="add-line" id="add-line-<?= $team ?>">
<i class="fas fa-plus"></i>
</div>
<div class="edit-header">
<div class="stat-log">Log</div>
<div class="stat-points">Points</div>
<div class="stat-trash"><i class='fas fa-trash'></i></div>
</div>
<table class="stats-table edit-stats stats-<?= $team ?>">
<?php get_stats($team) ?>
</table>
<div class="save-score">
<i class="fas fa-save"></i> Enregistrer
</div>
<br>
<div class="stats-button-container">
<a href="../../stats.php" class="stats-button">
Retour sur le site
</a>
</div>
</section>
</div>
<div id="main-fading-bottom-edge"></div>
</body>
</html>
<?php
function get_stats($team)
{
$dao = new Dao('../../');
foreach ($dao->get_score_team($team) as $row) {
$text = $row['text'];
$points = $row['points'];
?>
<tr class="entry">
<td class="edit-text"><input type='text' value="<?= $text ?>"/></td>
<td class="edit-points"><input type='number' value="<?= $points ?>"/></td>
<td class='remove-line'><i class="fas fa-trash"></td>
</tr>
<?php
}
}

View file

@ -1,45 +0,0 @@
$(document).ready(function () {
$(".add-line").click(function () {
$(".stats-table")
.prepend("<tr class='entry'>" +
"<td class=\"edit-text\">" +
"<input type='text' value='text''></td>" +
"<td class=\"edit-points\"><input type='number' value='0'></td>" +
"<td class='remove-line'>" +
"<i class='fas fa-trash'></i>" +
"</td>" +
"</tr>");
});
$(".stats-table").on("click", ".remove-line", function (elem) {
$(elem.target).parent().remove();
console.log("clicked")
});
$(".save-score").click(function () {
let lines = get_lines();
let object = {"array": lines};
let ajaxurl = 'post_scores.php';
let data = {'data': JSON.stringify(object)};
$.post(ajaxurl, data, function (data, status) {
alert("\nStatus: " + status);
});
});
});
function get_lines() {
let elements = $(".entry").map(function () {
return this;
}).get();
let array = [];
for (let i = 0; i < elements.length; i++) {
let fields = $(elements[i]).find('input');
let values = {"text": "", "points": 0};
for (let j = 0; j < fields.length; j++) {
if ($(fields[j]).attr("type") === "text")
values.text = $(fields[j]).prop("value");
if ($(fields[j]).attr("type") === "number")
values.points = parseInt($(fields[j]).prop("value"));
}
array.push(values);
}
return array;
}

View file

@ -1,4 +0,0 @@
#AuthName "Generals Only"
#AuthType Basic
#AuthUserFile /home_clubs/accueil_insa/public_html/includes/.htpassurss
#require valid-user

View file

@ -1,7 +0,0 @@
<?php
$description = 'Whoa t\'es admin ! Ici tu peux éditer le score pour les rouges, mais essaie de pas abuser sur les points stp.';
$team = 'urss';
include '../edit_template.php'; // Display template with variable content

View file

@ -1,6 +0,0 @@
<?php
require_once '../../classes/dao.php';
$dao = new Dao('../../');
$dao->save_scores($_POST['data'], 'urss');

View file

@ -1,4 +0,0 @@
#AuthName "Generals Only"
#AuthType Basic
#AuthUserFile /home_clubs/accueil_insa/public_html/includes/.htpassusa
#require valid-user

View file

@ -1,7 +0,0 @@
<?php
$description = 'Whoa t\'es admin ! Ici tu peux éditer le score pour les riquains, mais essaie de pas abuser sur les points stp.';
$team = 'usa';
include '../edit_template.php'; // Display template with variable content

View file

@ -1,6 +0,0 @@
<?php
require_once '../../classes/dao.php';
$dao = new Dao('../../');
$dao->save_scores($_POST['data'], 'usa');

View file

@ -7,13 +7,13 @@
</p>
<p class="copyright">
Ce site utilise <a href="https://matomo.org/">Matomo</a> pour analyser la fréquentation de manière anonyme. Rendez
vous sur la page <a href="info.php">info</a> pour plus de détails.
vous sur la page <a href="<?= $relativePath ?>info.php">info</a> pour plus de détails.
</p>
<p class="copyright">Contacter <a href='info.php#beranger'>Béranger, le responsable de la semaine</a>, pour plus d'informations</p>
<p class="copyright">Contacter <a href='<?= $relativePath ?>info.php#beranger'>Béranger, le responsable de la semaine</a>, pour plus d'informations</p>
<p class="copyright"> Site maintenu par Arthur Boivert</p>
<p class="copyright">
<script type="text/javascript">
var d = new Date();
document.write("Copyright © " + d.getFullYear() + " <a href='info.php#arnaud'>Arnaud VERGNET</a>")
document.write("Copyright © " + d.getFullYear() + " <a href='<?= $relativePath ?>info.php#arnaud'>Arnaud VERGNET</a>")
</script>
</p>

View file

@ -1,7 +1,7 @@
<div class="score-counter" id="<?= $platformID ?>">
<img class="title-image" src="assets/images/titre-site-accueil.svg">
<img class="title-image" src="<?= $relativePath ?>assets/images/titre-site-accueil.svg">
<div class="score-container">
<a href="stats.php">
<a href="<?= $relativePath ?>stats.php">
<?php
$usaClass = '';
$urssClass = '';

View file

@ -1,42 +0,0 @@
<div id="menuSidenav" class="sidenav">
<div id="sidenav-scroll">
<a href="index.php" id="index" class="page-link"><span class="sidenav-content"><i
class="fas fa-home sidenav-icon"></i> L'Accueil</span></a>
<a href="planning.php" id="planning" class="page-link"><span class="sidenav-content"><i
class="fas fa-calendar-alt sidenav-icon"></i> Le
Planning</span></a>
<a href="wini.php" id="wini" class="page-link"><span class="sidenav-content"><i
class="fas fa-star sidenav-icon"></i> Le
WINI</span></a>
<a href="map.php" id="map" class="page-link"><span class="sidenav-content"><i
class="fas fa-map sidenav-icon"></i> Le
Plan</span></a>
<a href="parrainage.php" id="parrainage" class="page-link"><span class="sidenav-content"><i
class="fas fa-user-plus sidenav-icon"></i> Le
Parrainage</span></a>
<a href="blouse.php" id="blouse" class="page-link"><span class="sidenav-content"><i
class="fas fa-tshirt sidenav-icon"></i> La Blouse</span></a>
<a href="photos.php" id="photos" class="page-link"><span class="sidenav-content"><i
class="fas fa-camera sidenav-icon"></i> Les Photos</span></a>
<div class="separator"></div>
<a href="glissefondor.php" id="usa" class="page-link"><span class="sidenav-content"><img
src="assets/images/usa_logo.png" class="sidenav-image"> Glissefondor </span></a>
<a href="peksentard.php" id="urss" class="page-link"><span class="sidenav-content"><img
src="assets/images/urss_logo.png" class="sidenav-image"> Peksentard </span></a>
<a href="boomsouffle.php" id="urss" class="page-link"><span class="sidenav-content"><img
src="assets/images/urss_logo.png" class="sidenav-image"> Boomsouffle </span></a>
<a href="verredaigle.php" id="urss" class="page-link"><span class="sidenav-content"><img
src="assets/images/urss_logo.png" class="sidenav-image"> Verredaigle </span></a>
<a href="stats.php" id="stats" class="page-link"><span class="sidenav-content"><i
class="fas fa-list-ol sidenav-icon"></i> Les Stats</span></a>
<div class="separator"></div>
<a href="coms.php" id="coms" class="page-link"><span class="sidenav-content"><i
class="fas fa-users sidenav-icon"></i> Les Coms</span></a>
<a href="prevs.php" id="prevs" class="page-link"><span class="sidenav-content"><i
class="fas fa-medkit sidenav-icon"></i> La Prévention</span></a>
<a href="downloads.php" id="downloads" class="page-link"><span class="sidenav-content"><i
class="fas fa-download sidenav-icon"></i> Les Téléchargements</span></a>
<a href="info.php" id="contact" class="page-link"><span class="sidenav-content"><i
class="fas fa-info sidenav-icon"></i> Les Infos</span></a>
</div>
</div>

42
includes/sidenav.php Executable file
View file

@ -0,0 +1,42 @@
<div id="menuSidenav" class="sidenav">
<div id="sidenav-scroll">
<a href="<?= $relativePath ?>index.php" id="index" class="page-link"><span class="sidenav-content"><i
class="fas fa-home sidenav-icon"></i> L'Accueil</span></a>
<a href="<?= $relativePath ?>planning.php" id="planning" class="page-link"><span class="sidenav-content"><i
class="fas fa-calendar-alt sidenav-icon"></i> Le
Planning</span></a>
<a href="<?= $relativePath ?>wini.php" id="wini" class="page-link"><span class="sidenav-content"><i
class="fas fa-star sidenav-icon"></i> Le
WINI</span></a>
<a href="<?= $relativePath ?>map.php" id="map" class="page-link"><span class="sidenav-content"><i
class="fas fa-map sidenav-icon"></i> Le
Plan</span></a>
<a href="<?= $relativePath ?>parrainage.php" id="parrainage" class="page-link"><span class="sidenav-content"><i
class="fas fa-user-plus sidenav-icon"></i> Le
Parrainage</span></a>
<a href="<?= $relativePath ?>blouse.php" id="blouse" class="page-link"><span class="sidenav-content"><i
class="fas fa-tshirt sidenav-icon"></i> La Blouse</span></a>
<a href="<?= $relativePath ?>photos.php" id="photos" class="page-link"><span class="sidenav-content"><i
class="fas fa-camera sidenav-icon"></i> Les Photos</span></a>
<div class="separator"></div>
<a href="<?= $relativePath ?>glissefondor.php" id="usa" class="page-link"><span class="sidenav-content"><img
src="<?= $relativePath ?>assets/images/usa_logo.png" class="sidenav-image"> Glissefondor </span></a>
<a href="<?= $relativePath ?>peksentard.php" id="urss" class="page-link"><span class="sidenav-content"><img
src="<?= $relativePath ?>assets/images/urss_logo.png" class="sidenav-image"> Peksentard </span></a>
<a href="<?= $relativePath ?>boomsouffle.php" id="urss" class="page-link"><span class="sidenav-content"><img
src="<?= $relativePath ?>assets/images/urss_logo.png" class="sidenav-image"> Boomsouffle </span></a>
<a href="<?= $relativePath ?>verredaigle.php" id="urss" class="page-link"><span class="sidenav-content"><img
src="<?= $relativePath ?>assets/images/urss_logo.png" class="sidenav-image"> Verredaigle </span></a>
<a href="<?= $relativePath ?>stats.php" id="stats" class="page-link"><span class="sidenav-content"><i
class="fas fa-list-ol sidenav-icon"></i> Les Stats</span></a>
<div class="separator"></div>
<a href="<?= $relativePath ?>coms.php" id="coms" class="page-link"><span class="sidenav-content"><i
class="fas fa-users sidenav-icon"></i> Les Coms</span></a>
<a href="<?= $relativePath ?>prevs.php" id="prevs" class="page-link"><span class="sidenav-content"><i
class="fas fa-medkit sidenav-icon"></i> La Prévention</span></a>
<a href="<?= $relativePath ?>downloads.php" id="downloads" class="page-link"><span class="sidenav-content"><i
class="fas fa-download sidenav-icon"></i> Les Téléchargements</span></a>
<a href="<?= $relativePath ?>info.php" id="contact" class="page-link"><span class="sidenav-content"><i
class="fas fa-info sidenav-icon"></i> Les Infos</span></a>
</div>
</div>

View file

@ -1,8 +1,18 @@
<?php
require_once 'classes/dao.php';
function get_total_points($team)
if (!isset($relativePath))
$relativePath='';
if (!isset($customBackgroundId))
$customBackgroundId='';
require_once $relativePath.'classes/dao.php';
function get_total_points($team, $path)
{
$dao = new Dao('');
$dao = new Dao($path);
$points = 0;
foreach ($dao->get_score_team($team) as $row) {
$points += $row['points'];
@ -10,29 +20,32 @@ function get_total_points($team)
return $points;
}
$scoreUSA = get_total_points('usa');
$scoreURSS = get_total_points('urss');
$scoreUSA = get_total_points('usa', $relativePath);
$scoreURSS = get_total_points('urss', $relativePath);
if (!isset($customBackgroundId))
$customBackgroundId='';
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width,maximum-scale=2">
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/all.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/style.css">
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/sidenav.css">
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/score.css">
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/hamburger.css">
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="<?= $relativePath ?>assets/css/style.css">
<link rel="stylesheet" type="text/css" media="screen" href="<?= $relativePath ?>assets/css/sidenav.css">
<link rel="stylesheet" type="text/css" media="screen" href="<?= $relativePath ?>assets/css/score.css">
<link rel="stylesheet" type="text/css" media="screen" href="<?= $relativePath ?>assets/css/hamburger.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat|Raleway|Russo+One" rel="stylesheet">
<link rel="shortcut icon" href="favicon.ico">
<title><?= $pageTitle ?> | INSAT Accueil 2018</title>
<link rel="shortcut icon" href="../favicon.ico">
<title><?= $pageTitle ?> | INSAT Accueil 2019</title>
<!-- Matomo -->
<script type="text/javascript">
var _paq = _paq || [];
@ -54,8 +67,8 @@ if (!isset($customBackgroundId))
<div class="background" id="<?= $customBackgroundId?>"></div>
<div id="back-button" onclick="closeNav()"></div>
<?php
include("includes/top_bar.php");
include("includes/sidenav.html");
include($relativePath."includes/top_bar.php");
include($relativePath . "includes/sidenav.php");
?>
<div id="header-wrap" class="outer">
<header class="inner">
@ -66,7 +79,7 @@ include("includes/sidenav.html");
<?php
$platformID = 'mobile-score';
include("includes/score_counter.php");
include($relativePath."includes/score_counter.php");
?>
<div id="main-fading-top-edge"></div>
@ -79,11 +92,18 @@ include("includes/score_counter.php");
<div id="footer-wrap" class="outer">
<footer class="inner">
<?php
include("includes/copyright.html");
include($relativePath . "includes/copyright.php");
?>
</footer>
</div>
</body>
<script src="assets/scripts/timer.js"></script>
<script src="assets/scripts/sidenav.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.js"></script>
<script type="text/javascript" src="<?= $relativePath ?>assets/js/timer.js"></script>
<script type="text/javascript" src="<?= $relativePath ?>assets/js/sidenav.js"></script>
<?php if (isset($pageScripts)): ?>
<?= $pageScripts ?>
<?php endif; ?>
</html>

View file

@ -10,8 +10,8 @@
<div id="bar8"></div>
<div id="bar9"></div>
</div>
<a id="menu-link" href="index.php">
<img src="assets/images/logo-site-accueil.svg" id="menu-icon">
<a id="menu-link" href="<?= $relativePath ?>index.php">
<img src="<?= $relativePath ?>assets/images/logo-site-accueil.svg" id="menu-icon">
<h4 id="menu-title">INSA Toulouse 2019</h4>
</a>
<?php

View file

@ -20,11 +20,10 @@ $scoreURSS = get_total_points('urss');
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width,maximum-scale=2">
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/all.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/style.css">
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/score.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.js"></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat|Raleway|Russo+One" rel="stylesheet">
<link rel="shortcut icon" href="favicon.ico">
<title>Semaine d'Accueil 2018 | INSA Toulouse</title>
@ -50,7 +49,7 @@ $scoreURSS = get_total_points('urss');
<!-- End Matomo Code -->
</head>
<body id="main">
<div class="background"></div>
<div class="background index-background"></div>
<div id="home-content-wrap" class="outer">
<section id="home-content" class="inner">
<img id="home-title" src="assets/images/titre-site-accueil.svg">
@ -140,9 +139,12 @@ $scoreURSS = get_total_points('urss');
<div id="footer-wrap" class="outer">
<footer class="inner">
<?php
include("includes/copyright.html");
include("includes/copyright.php");
?>
</footer>
</div>
</body>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
</html>

View file

@ -79,5 +79,5 @@ ob_start(); // Start reading html
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Info";
include("template.php"); // Display template with variable content
include("includes/template.php"); // Display template with variable content
?>

View file

@ -26,9 +26,10 @@ ob_start(); // Start reading html
<p>Clique sur un bâtiment pour afficher ses informations</p>
</div>
<script type="text/javascript" src="assets/scripts/map.js"></script>
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Plan";
include("template.php"); // Display template with variable content
$pageScripts = "<script type=\"text/javascript\" src=\"assets/js/map.js\"></script>";
include("includes/template.php"); // Display template with variable content
?>

View file

@ -24,5 +24,5 @@ ob_start(); // Start reading html
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Parrainage";
include("template.php"); // Display template with variable content
include("includes/template.php"); // Display template with variable content
?>

View file

@ -10,6 +10,8 @@ define("photoRoot", "photos_folders/photos");
*/
function getActivePath()
{
$dir = '';
if (isset($_GET[urlParam]))
$dir = $_GET[urlParam];
$folders = explode(DIRECTORY_SEPARATOR, $dir);
$currentPath = "";
@ -278,14 +280,14 @@ function generatePath($path)
?>
</div>
<?php endif; ?>
<script src="assets/scripts/photos.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/photos.css">
<script type="text/javascript" src="assets/scripts/jquery.mousewheel.min.js"></script>
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Photos";
include("template.php"); // Display template with variable content
$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
?>

View file

@ -98,11 +98,12 @@ ob_start(); // Start reading html
<div id="infoBox">
<p>Clique sur un évenement pour afficher ses informations</p>
</div>
<script src="assets/scripts/planning.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/planningEvents.css">
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Planning";
include("template.php"); // Display template with variable content
$pageScripts = "<script src=\"assets/js/planning.js\"></script>";
include("includes/template.php"); // Display template with variable content
?>

View file

@ -21,5 +21,5 @@ ob_start(); // Start reading html
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Prévention";
include("template.php"); // Display template with variable content
include("includes/template.php"); // Display template with variable content
?>

136
stats.php
View file

@ -34,138 +34,14 @@ function get_stats($team)
<strong>Clique sur une équipe pour voir le détail de son score</strong>
</p>
<div id="stats-container">
<div class="team-button" id="buttonGli" onclick="showScores('gli')">Glissefondor</div>
<div class="team-button" id="buttonPek" onclick="showScores('pek')">Peksentard</div>
<div class="team-button" id="buttonBoo" onclick="showScores('boo')">Boomsouffle</div>
<div class="team-button" id="buttonVer" onclick="showScores('ver')">Verredaigle</div>
<div id="oldest-score-usa"></div>
<div class="edit-button-container">
<a href="edit_score/usa/edit.php" class="edit-button" id="button-usa">
Éditer les scores
</a>
</div>
<div class="stats-toggle stats-usa" onclick="toggleTable(this)" id="toggle-usa">
<i class="fas fa-arrow-down"></i> Glissefondor <i class="fas fa-arrow-down"></i>
</div>
<table class="stats-table stats-usa" id="usa-table" style="display: none">
<tr>
<td class="stat-log">Log</td>
<td class="stat-points">Points</td>
</tr>
<?php get_stats('usa') ?>
</table>
<div id="latest-score-usa"></div>
<div id="oldest-score-urss"></div>
<div class="edit-button-container">
<a href="edit_score/urss/edit.php" class="edit-button" id="button-urss">
Éditer les scores
</a>
</div>
<div class="stats-toggle" onclick="toggleTable(this)" id="toggle-urss">
<i class="fas fa-arrow-down"></i> Peksentard <i class="fas fa-arrow-down"></i>
</div>
<table class="stats-table stats-urss" id="urss-table" style="display: none">
<tr>
<td class="stat-log">Log</td>
<td class="stat-points">Points</td>
</tr>
<?php get_stats('urss') ?>
</table>
<div id="latest-score-urss"></div>
<div id="oldest-score-usa"></div>
<div class="edit-button-container">
<a href="edit_score/usa/edit.php" class="edit-button" id="button-boomsouffle">
Éditer les scores
</a>
</div>
<div class="stats-toggle stats-boomsouffle" onclick="toggleTable(this)" id="toggle-boomsouffle">
<i class="fas fa-arrow-down"></i> Boomsouffle <i class="fas fa-arrow-down"></i>
</div>
<table class="stats-table stats-boomsouffle" id="boomsouffle-table" style="display: none">
<tr>
<td class="stat-log">Log</td>
<td class="stat-points">Points</td>
</tr>
<?php get_stats('usa') ?>
</table>
<div id="latest-score-usa"></div>
<div id="oldest-score-usa"></div>
<div class="edit-button-container">
<a href="edit_score/usa/edit.php" class="edit-button" id="button-verredaigle">
Éditer les scores
</a>
</div>
<div class="stats-toggle stats-verredaigle" onclick="toggleTable(this)" id="toggle-verredaigle">
<i class="fas fa-arrow-down"></i> Verredaigle <i class="fas fa-arrow-down"></i>
</div>
<table class="stats-table stats-verredaigle" id="verredaigle-table" style="display: none">
<tr>
<td class="stat-log">Log</td>
<td class="stat-points">Points</td>
</tr>
<?php get_stats('usa') ?>
</table>
<div id="latest-score-usa"></div>
</div>
<script>
function scrolltoOld(team) {
if (team === 'usa') {
$('html, body').animate({
scrollTop: $("#oldest-score-usa").offset().top
}, 300);
}
else {
$('html, body').animate({
scrollTop: $("#oldest-score-urss").offset().top
}, 300);
}
}
function scrolltoNew(team) {
if (team === 'usa') {
$('html, body').animate({
scrollTop: ($("#latest-score-usa").offset().top - window.innerHeight)
}, 300);
}
else {
$('html, body').animate({
scrollTop: ($("#latest-score-urss").offset().top - window.innerHeight)
}, 300);
}
}
function toggleTable(elem) {
if (elem.id === 'toggle-usa') {
if ($("#usa-table").css("display") === "none") {
$("#usa-table").show(300);
elem.innerHTML = "<i class=\"fas fa-arrow-up\"></i> Glissefondor <i class=\"fas fa-arrow-up\"></i>";
// scrolltoNew('usa');
}
else {
$("#usa-table").hide(300);
// scrolltoOld('usa');
elem.innerHTML = "<i class=\"fas fa-arrow-down\"></i> Glissefondor <i class=\"fas fa-arrow-down\"></i>";
}
}
else {
if ($("#urss-table").css("display") === "none") {
$("#urss-table").show(300);
elem.innerHTML = "<i class=\"fas fa-arrow-up\"></i> Peksentard <i class=\"fas fa-arrow-up\"></i>";
// scrolltoNew('urss');
}
else {
$("#urss-table").hide(300);
// scrolltoOld('urss');
elem.innerHTML = "<i class=\"fas fa-arrow-down\"></i> Peksentard <i class=\"fas fa-arrow-down\"></i>";
}
}
}
</script>
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/stats.css">
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "Stats";
include("template.php"); // Display template with variable content
$pageScripts = "<script type=\"text/javascript\" src=\"assets/js/statsDisplay.js\"></script>";
include("includes/template.php"); // Display template with variable content

View file

@ -77,5 +77,5 @@ ob_start(); // Start reading html
<?php
$pageContent = ob_get_clean(); // Store html content in variable
$pageTitle = "WINI";
include("template.php"); // Display template with variable content
include("includes/template.php"); // Display template with variable content
?>