diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index 33e09d5..b589560 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/edit_score/.htaccess b/admin/.htaccess similarity index 100% rename from edit_score/.htaccess rename to admin/.htaccess diff --git a/admin/ajax_load.php b/admin/ajax_load.php new file mode 100755 index 0000000..42287e6 --- /dev/null +++ b/admin/ajax_load.php @@ -0,0 +1,39 @@ +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); +} \ No newline at end of file diff --git a/admin/index.php b/admin/index.php new file mode 100644 index 0000000..1475890 --- /dev/null +++ b/admin/index.php @@ -0,0 +1,63 @@ + +

ADMIN

+

Editer Score

+ + + + +
+ +
+
+
Log
+
Points
+
+
+ +
+ +
+ Enregistrer +
+
+
+ + Retour sur le site + +
+ + + +"; + +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']; + ?> + + + + + + \ No newline at end of file diff --git a/assets/css/stats.css b/assets/css/stats.css index b6fcbb8..c394413 100755 --- a/assets/css/stats.css +++ b/assets/css/stats.css @@ -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; } diff --git a/assets/css/style.css b/assets/css/style.css index b82471a..fe17373 100755 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -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; diff --git a/assets/images/bg_up.jpg b/assets/images/bg_up.jpg index c4e6429..c74143d 100755 Binary files a/assets/images/bg_up.jpg and b/assets/images/bg_up.jpg differ diff --git a/assets/scripts/jquery.mousewheel.min.js b/assets/js/jquery.mousewheel.min.js similarity index 100% rename from assets/scripts/jquery.mousewheel.min.js rename to assets/js/jquery.mousewheel.min.js diff --git a/assets/scripts/map.js b/assets/js/map.js similarity index 100% rename from assets/scripts/map.js rename to assets/js/map.js diff --git a/assets/scripts/photos.js b/assets/js/photos.js similarity index 100% rename from assets/scripts/photos.js rename to assets/js/photos.js diff --git a/assets/scripts/planning.js b/assets/js/planning.js similarity index 100% rename from assets/scripts/planning.js rename to assets/js/planning.js diff --git a/assets/scripts/sidenav.js b/assets/js/sidenav.js similarity index 64% rename from assets/scripts/sidenav.js rename to assets/js/sidenav.js index 48c769b..0dd7c24 100755 --- a/assets/scripts/sidenav.js +++ b/assets/js/sidenav.js @@ -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"); diff --git a/assets/js/statsDisplay.js b/assets/js/statsDisplay.js new file mode 100644 index 0000000..096c13b --- /dev/null +++ b/assets/js/statsDisplay.js @@ -0,0 +1,42 @@ + +let entryTemplate = + '
' + + '' + + '' + + '
'; + +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.'); + }); + } + }); +} + + diff --git a/assets/js/statsManager.js b/assets/js/statsManager.js new file mode 100755 index 0000000..5f74ad6 --- /dev/null +++ b/assets/js/statsManager.js @@ -0,0 +1,96 @@ +let uniqueID = 0; +let ajaxurl = 'ajax_load.php'; + +let entryTemplate = + '' + + '' + + '' + + '' + + '' + + '' + + ''; + +$(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']); + } + } + ); +} \ No newline at end of file diff --git a/assets/scripts/timer.js b/assets/js/timer.js similarity index 100% rename from assets/scripts/timer.js rename to assets/js/timer.js diff --git a/blouse.php b/blouse.php index a8e820a..2ee8e66 100755 --- a/blouse.php +++ b/blouse.php @@ -68,5 +68,5 @@ ob_start(); // Start reading html \ No newline at end of file diff --git a/classes/dao.php b/classes/dao.php index 5355ed8..fd477f1 100755 --- a/classes/dao.php +++ b/classes/dao.php @@ -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]); } } diff --git a/coms.php b/coms.php index a8dd191..5e8aef1 100755 --- a/coms.php +++ b/coms.php @@ -20,5 +20,5 @@ include("includes/coms/com_template.php"); \ No newline at end of file diff --git a/downloads.php b/downloads.php index a8fbb13..134038f 100755 --- a/downloads.php +++ b/downloads.php @@ -26,5 +26,5 @@ ob_start(); // Start reading html \ No newline at end of file diff --git a/edit_score/edit_template.php b/edit_score/edit_template.php deleted file mode 100755 index 9728df2..0000000 --- a/edit_score/edit_template.php +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - Score <?= strtoupper($team) ?> | ADMIN | INSAT Accueil 2018 - - - - - -
- -
-
-

Administration

-
-
-
- - Retour sur le site - -
-
-
-
-

Editer Score

-

- -

-
- -
-
-
Log
-
Points
-
-
- - -
- -
- Enregistrer -
-
- -
-
-
- - - -get_score_team($team) as $row) { - $text = $row['text']; - $points = $row['points']; - ?> - - - - - - " + - "" + - "" + - "" + - "" + - "" + - "" + - ""); - }); - $(".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; -} \ No newline at end of file diff --git a/edit_score/urss/.htaccess b/edit_score/urss/.htaccess deleted file mode 100755 index 75f6483..0000000 --- a/edit_score/urss/.htaccess +++ /dev/null @@ -1,4 +0,0 @@ -#AuthName "Generals Only" -#AuthType Basic -#AuthUserFile /home_clubs/accueil_insa/public_html/includes/.htpassurss -#require valid-user diff --git a/edit_score/urss/edit.php b/edit_score/urss/edit.php deleted file mode 100755 index f323579..0000000 --- a/edit_score/urss/edit.php +++ /dev/null @@ -1,7 +0,0 @@ -save_scores($_POST['data'], 'urss'); - diff --git a/edit_score/usa/.htaccess b/edit_score/usa/.htaccess deleted file mode 100755 index 2088dbc..0000000 --- a/edit_score/usa/.htaccess +++ /dev/null @@ -1,4 +0,0 @@ -#AuthName "Generals Only" -#AuthType Basic -#AuthUserFile /home_clubs/accueil_insa/public_html/includes/.htpassusa -#require valid-user diff --git a/edit_score/usa/edit.php b/edit_score/usa/edit.php deleted file mode 100755 index 5c32364..0000000 --- a/edit_score/usa/edit.php +++ /dev/null @@ -1,7 +0,0 @@ -save_scores($_POST['data'], 'usa'); - diff --git a/includes/copyright.html b/includes/copyright.php similarity index 69% rename from includes/copyright.html rename to includes/copyright.php index d6d5679..fd2af59 100755 --- a/includes/copyright.html +++ b/includes/copyright.php @@ -7,13 +7,13 @@

- + diff --git a/includes/score_counter.php b/includes/score_counter.php index 910e83c..7427015 100755 --- a/includes/score_counter.php +++ b/includes/score_counter.php @@ -1,7 +1,7 @@
- + diff --git a/includes/sidenav.php b/includes/sidenav.php new file mode 100755 index 0000000..aac8e1a --- /dev/null +++ b/includes/sidenav.php @@ -0,0 +1,42 @@ + diff --git a/template.php b/includes/template.php similarity index 56% rename from template.php rename to includes/template.php index 497fbda..3073971 100755 --- a/template.php +++ b/includes/template.php @@ -1,8 +1,18 @@ 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=''; ?> + + + + - - - - - - - + + + + + + + - - <?= $pageTitle ?> | INSAT Accueil 2018 + + <?= $pageTitle ?> | INSAT Accueil 2019 - + + + + + + + diff --git a/includes/top_bar.php b/includes/top_bar.php index 079d476..0689ba0 100755 --- a/includes/top_bar.php +++ b/includes/top_bar.php @@ -10,8 +10,8 @@
- - + + - + - - Semaine d'Accueil 2018 | INSA Toulouse @@ -50,7 +49,7 @@ $scoreURSS = get_total_points('urss'); -
+
@@ -140,9 +139,12 @@ $scoreURSS = get_total_points('urss'); + diff --git a/info.php b/info.php index ba5659c..ced0bb8 100644 --- a/info.php +++ b/info.php @@ -79,5 +79,5 @@ ob_start(); // Start reading html diff --git a/map.php b/map.php index 87a631e..10c527c 100755 --- a/map.php +++ b/map.php @@ -26,9 +26,10 @@ ob_start(); // Start reading html

Clique sur un bâtiment pour afficher ses informations

- + "; +include("includes/template.php"); // Display template with variable content ?> diff --git a/parrainage.php b/parrainage.php index b29df4e..79f1ad9 100755 --- a/parrainage.php +++ b/parrainage.php @@ -24,5 +24,5 @@ ob_start(); // Start reading html diff --git a/photos.php b/photos.php index 4c1711b..4105d30 100755 --- a/photos.php +++ b/photos.php @@ -10,7 +10,9 @@ define("photoRoot", "photos_folders/photos"); */ function getActivePath() { - $dir = $_GET[urlParam]; + $dir = ''; + if (isset($_GET[urlParam])) + $dir = $_GET[urlParam]; $folders = explode(DIRECTORY_SEPARATOR, $dir); $currentPath = ""; foreach ($folders as $value) { @@ -278,14 +280,14 @@ function generatePath($path) ?> - + - "; +include("includes/template.php"); // Display template with variable content ?> diff --git a/planning.php b/planning.php index 26e4c8f..6e2f549 100755 --- a/planning.php +++ b/planning.php @@ -98,11 +98,12 @@ ob_start(); // Start reading html

Clique sur un évenement pour afficher ses informations

- + "; +include("includes/template.php"); // Display template with variable content ?> diff --git a/prevs.php b/prevs.php index 7b95e57..51e44b6 100755 --- a/prevs.php +++ b/prevs.php @@ -21,5 +21,5 @@ ob_start(); // Start reading html \ No newline at end of file diff --git a/stats.php b/stats.php index 8c2fc74..89dfad0 100755 --- a/stats.php +++ b/stats.php @@ -34,138 +34,14 @@ function get_stats($team) Clique sur une équipe pour voir le détail de son score

-
+
Glissefondor
+
Peksentard
+
Boomsouffle
+
Verredaigle
-
- -
- Glissefondor -
- - - - - - - -
- -
- -
- Peksentard -
- - - - - - - -
- -
- -
- Boomsouffle -
- - - - - - - -
- -
- -
- Verredaigle -
- - - - - - - -
-
- "; +include("includes/template.php"); // Display template with variable content diff --git a/wini.php b/wini.php index b5d73fa..18b92d5 100755 --- a/wini.php +++ b/wini.php @@ -77,5 +77,5 @@ ob_start(); // Start reading html \ No newline at end of file