<?php

class Design {

    private function __construct() {
        
    }

    /**
     *
     * $setup = array(title, headline, description, keywords);
     * $level indicated what userlevel is required to view the page. 0 means public/nologin
     *
     */
    public static function header($setup = array(), $level) { // Primary design function. This function is called on all pages, this is our header.
        if ($level > 0) {
            if (!User::checkLevel($level)) {
                header('Location: ' . Config::$sys_url . '?page=error&r=level');
                die("You are not authorized to view this page.");
            }
        }
        echo '<!DOCTYPE html>
<!--
 Made by DFiNE (Kenneth Hedahl)
 Copyright DIS (www.dfine.net)
-->
<html lang="da">
    <head>
        <title>' . $setup['title'] . ' | Odense Track</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="headline" content="' . $setup['headline'] . '">
        <meta name="description" content="' . $setup['description'] . '">
        <meta name="keywords" content="' . $setup['keywords'] . '">
        <meta name="author" content="Odense Track">
        <link href="css/style.css" rel="stylesheet" />
        <link rel="stylesheet" type="text/css" href="css/slick.css" />
        <link rel="stylesheet" type="text/css" href="css/slick-theme.css" />
        <link rel="stylesheet" type="text/css" href="css/jquery.datetimepicker.min.css" />
        <link href="//stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
        <!-- WYSIWYG -->
        
    </head>
    <body>

        <div class="contentwrapper"> <!-- Contentwrapper start -->
            <header> <!-- Header start -->
                <div class="topnav">
                    <p>Support:</p> <a href="?page=order"><button>Bestil nu</button></a>
                </div>

                <div class="header">
                    <a href="' . Config::$sys_url . '"><div class="header_logo">&nbsp;</div></a>
                    <div class="header_right">
                        <a href="' . Config::$sys_url . '?page=aboutus">Om Odense Track</a> | <a href="' . Config::$sys_url . '?page=contact">Kontakt Os</a>
                    </div>
                </div>

                <div class="clear"></div>


                <nav class="mainnav"> <!-- Main navigation start -->
                    <ul>
                        <li><a href="' . Config::$sys_url . '?page=home">Formel 1</a></li>
                        <li><a href="' . Config::$sys_url . '?page=events">Events</a></li>
                        <li><a href="' . Config::$sys_url . '?page=news">Nyheder</a></li>
                            
                        ' . (User::userLevel() > 74 ? "<li><a href=\"?page=newsadmin\">Nyhedsadmin</a></li>" : "") . '
                        ' . (User::userLevel() > 74 ? "<li><a href=\"?page=eventadmin\">Eventadmin</a></li>" : "") . '
                        ' . (User::userLevel() > 0 ? "<li><a href=\"_login.php?logout\">Log ud</a></li>" : "<li><a href=\"?page=login\">Login</a></li>") . '
                            
                    </ul>
                </nav> <!-- Main navigation end -->

            </header> <!-- Header end -->

            <div class="content"> <!-- Content start -->';
    }

    public static function footer($scripts) { // Shown at the bottom of every page we display. - if $scripts true, use javascripts on page
        echo '</div> <!-- Content end -->


        </div> <!-- Contentwrapper End -->

        <footer> <!-- Footer start -->
            <div class="footer_wrap">
                <a href="' . Config::$sys_url . '"><div class="footer_logo"></div></a>

                <div class="footer_followus">
                    <h1>Følg os her</h1>
                    <p>Tilmeld dig vores sociale netværk</p>
                    <div class="socialicons">
                        <a href="#"><img src="' . Config::$sys_url . 'img/icons/facebook.png" alt="facebook" title="Følg os på facebook" /></a>
                        <a href="#"><img src="' . Config::$sys_url . 'img/icons/twitter.png" alt="twitter" title="Følg os på twitter" /></a>
                        <a href="#"><img src="' . Config::$sys_url . 'img/icons/youtube.png" alt="YouTube" title="Følg os på YouTube" /></a>
                        <a href="#"><img src="' . Config::$sys_url . 'img/icons/instagram.png" alt="Instagram" title="Følg os på Instagram" /></a>
                    </div>
                </div>

                <div class="footer_newsletter">
                    <h1>Tilmeld dig vores nyhedsbrev</h1>
                    <p>Tilmeld dig vores sociale netværk</p>

                </div>

                <div class="clear"></div>
                <div class="footer_links">
                    <div class="pull_left">
                        <ul>
                            <li><a href="' . Config::$sys_url . '?page=contact">Kontakt os</a></li>
                            <li><a href="' . Config::$sys_url . '?page=aboutus">Om Odense Track</a></li>
                            <li><a href="' . Config::$sys_url . '?page=sitemap">Sitemap</a></li>
                        </ul>
                    </div>

                    <div class="pull_right">
                        &copy; <a href="' . Config::$sys_url . '">Odense Track</a>
                    </div>

                </div>
            </div>

        </footer> <!-- Footer end -->';


        if ($scripts == true) {

            echo '
        <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
        <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
        <script src="js/jquery.datetimepicker.full.min.js"></script>
        <script src="' . Config::$sys_url . 'js/slick.min.js"></script>
        <script>
            $(document).ready(function(){
              $(\'.eventslider\').slick({
                "slidesToShow": 5, "slidesToScroll": 1, "autoplay": true, "autoplayspeed": 4000
              });
            });
            
            $(".activityprev").click(function(){
              $(".activityfeed").slick("slickPrev");
            })

            $(".activitynext").click(function(){
              $(".activityfeed").slick("slickNext");
            })
            
            $(\'.activityfeed\').slick({
                 dots: false,
                 infinite: false,
                 speed: 300,
                 slidesToShow: 3,
                 vertical: true,
                 adaptiveHeight: false,
                 arrows: false,
                 verticalSwiping:true
                 
            });
            jQuery(\'.datetime\').datetimepicker();
        </script>
        

        <!-- WYSIWYG -->
        <script src="' . Config::$sys_url . 'js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
        <script>
  tinymce.init({
    selector: \'.editor\',
    menubar: false,
    height: \'400px\'
  });
  </script>
        ';
        }


        echo '
        </body>
</html>';

        if (Config::$debug == true) {
            
            echo '<div style="position:fixed; top:5px; left:5px; background-color:#000; color:#20C20E; border:1px solid #20C20E; width:300px; height:auto;">';
            echo '<center>Debug Panel</center><hr>';
            echo '<br/>-GET' . var_dump($_GET) . '<hr>';
            echo '<br/>-POST' . var_dump($_POST) . '<hr>';
            echo '<br/>-SESS' . var_dump($_SESSION) . '<hr>';
            echo '<center>Disable this in CONFIG!</center></div>';
        }
    }

}
