<?php
require_once 'classes/dao.php';
function get_total_points($team)
{
    $dao = new Dao('');
    $points = 0;
    foreach ($dao->get_score_team($team) as $row) {
        $points += $row['points'];
    }
    return $points;
}

$scoreUSA = get_total_points('usa');
$scoreURSS = get_total_points('urss');
?>

<!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/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>
    <!-- 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="home-content-wrap" class="outer">
    <section id="home-content" class="inner">
        <img id="home-title" src="assets/images/titre-site-accueil.svg">
        <?php
        $platformID = 'main-score';
        include("includes/score_counter.php");
        ?>
        <h4>Semaine d'Accueil INSA Toulouse 2019</h4>
        <div id="main-link-container">
            <?php
            $is_image = false;
            $link = "planning.php";
            $icon = "fas fa-calendar-alt";
            $text = "Le planning de ta semaine, sois au courant de tous les événements";
            include("includes/main_button_template.php");

            $link = "wini.php";
            $icon = "fas fa-star";
            $text = "Le WINI, le bouquet final de la semaine";
            include("includes/main_button_template.php");

            $link = "map.php";
            $icon = "fas fa-map";
            $text = "Le plan du campus, il est interactif et tout, comme ça tu peux pas te perdre";
            include("includes/main_button_template.php");

            $link = "parrainage.php";
            $icon = "fas fa-user-plus";
            $text = "Toutes les informations concernant le parrainage";
            include("includes/main_button_template.php");

            $link = "blouse.php";
            $icon = "fas fa-tshirt";
            $text = "La fameuse Blouse, habit officiel de l'Insa";
            include("includes/main_button_template.php");

            $link = "photos.php";
            $icon = "fas fa-camera";
            $text = "Les photos de la semaine (la tienne et la notre)";
            include("includes/main_button_template.php");

            $is_image = true;
            $link = "usa.php";
            $icon = "assets/images/usa_logo.png";
            $text = "Les potes d'Harry";
            include("includes/main_button_template.php");

            $is_image = false;
            $link = "stats.php";
            $icon = "fas fa-list-ol";
            $text = "Les stats de chaque équipe";
            include("includes/main_button_template.php");

            $is_image = true;
            $link = "urss.php";
            $icon = "assets/images/urss_logo.png";
            $text = "La clique de Drago";
            include("includes/main_button_template.php");

            $is_image = false;
            $link = "coms.php";
            $icon = "fas fa-users";
            $text = "Les différentes COM présentes pour assurer la pérénité de la semaine";
            include("includes/main_button_template.php");

            $link = "prevs.php";
            $icon = "fas fa-medkit";
            $text = "La prévention, pour éviter tout incident";
            include("includes/main_button_template.php");

            $link = "downloads.php";
            $icon = "fas fa-download";
            $text = "Les téléchargements, si t'as paumé une feuille";
            include("includes/main_button_template.php");

            $link = "info.php";
            $icon = "fas fa-info";
            $text = "Les informations supplémentaires, si tu veux tout savoir";
            include("includes/main_button_template.php");
            ?>
        </div>
        <iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Faccueil2018INSAT%2F&tabs=timeline&width=340&height=500&small_header=true&adapt_container_width=true&hide_cover=false&show_facepile=false&appId"
                width="340" height="500" style="border:none;overflow:hidden;margin-top: " scrolling="no" frameborder="0"
                allowTransparency="true" allow="encrypted-media"></iframe>
    </section>
</div>
<div id="footer-wrap" class="outer">
    <footer class="inner">
        <?php
        include("includes/copyright.html");
        ?>
    </footer>
</div>
</body>
</html>