<?php
require_once "includes/Mobile_Detect.php";
$detect = new Mobile_Detect;

include_once ('includes/lms_functions.php');

if (!isset($RootPath)){
    $RootPath = dirname(htmlspecialchars($_SERVER['PHP_SELF']));
    if ($RootPath == '/' OR $RootPath == "\\") {
        $RootPath = '';
    }
}

echo '<!DOCTYPE html>';

echo '<head>
        <meta http-equiv="Content-Type" content="application/html; charset=utf-8; cache-control: no-cache, no-store, must-revalidate; Pragma: no-cache" />
        <title>', $Title, '</title>
        <link rel="icon" href="', $RootPath, '/favicon.ico" />
        <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
        <script src="bootstrap/js/bootstrap.min.js"></script>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script defer="defer" src="', $RootPath, '/javascripts/MiscFunctions.js"></script>
        <script>
            localStorage.setItem("DateFormat", "', $_SESSION['DefaultDateFormat'], '");
            localStorage.setItem("Theme", "', $_SESSION['Theme'], '");
        </script>';

echo '</head>
    <body>
        <nav class="navbar navbar-default navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <a class="navbar-brand" href="'.$RootPath.'">Perfect Connection</a>
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>                        
                </button>
            </div>
            
            <div class="collapse navbar-collapse" id="navbar">
                <ul class="nav navbar-nav">
                    <li><a href="'.$RootPath.'/lms_Dashboard.php"><span class="glyphicon glyphicon-home"></span> Dashboard</a></li>
                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-list-alt"></span> Menu
                        <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="'.$RootPath.'/lms_Leads.php">New Entry</a></li>
                            <li><a href="'.$RootPath.'/lms_LeadsReport.php'.($detect->isMobile() ? '?MinView=1' : '').'">Contacts List</a></li>
                        </ul>
                    </li>
                </ul>
                <ul class="nav navbar-nav navbar-right">

                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span> Profile
                        <span class="caret"></span></a>
                        <ul class="dropdown-menu">

                            <li class="dropdown-header">Settings</li>
                            <li><a href="lms_LinkSettings.php">My Links</a></li>
                            <li class="divider"></li>
                            <li class="dropdown-header">Contact Info</li>
                            <li><a href="lms_UserSettings.php">Update Info</a></li>
                            <li><a href="'.getNameCardLink($_SESSION['UserID']).'" target="_blank">My Contact Card</a></li>
                        </ul>
                    </li>
                    <li><a href="'.$RootPath.'/Logout.php" onclick="return confirm(\''._('Are you sure you wish to logout?').'\');"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
                </ul>
            </div>
        </div>
        </nav>
        
        <br>
        
        <div class="container" style="margin-top:50px">
        <div id="MessageContainerHead" style="position:sticky; top:60px; position:-webkit-sticky; z-index:100"></div>';

?>