<?php echo $this->doctype; ?>
<!--[if IE 9]><html class="lt-ie10" lang="en" > <![endif]-->
<html class="no-js" lang="en">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title><?php echo $this->title; ?></title>
        <?php
            $this->metas();
            $this->styles();
            $this->scripts();
        ?>
    </head>
    <body>
    <div class="header">
        <div class="row">
            <div class="small-7 column">
                <h1><i class="fa fa-clock-o"></i> Open Time Tracker</h1>
            </div>
            <div class="small-4 column text-right">
                <h4>
                    <?php
                    $auth = Staple_Auth::get();
                    $user = new userModel($auth->getAuthId());
                    echo ucfirst($user->getFirstName())." ".ucfirst($user->getLastName());
                    ?>
                </h4>
            </div>
        </div>
        <div class="contain-to-grid">
        <nav class="top-bar hide-for-print" data-topbar role="navigation">
            <ul class="title-area">
                <li class="name">

                </li>
                <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
                <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
            </ul>

            <section class="top-bar-section">
                <!-- Right Nav Section -->
                <ul class="left">
                    <li><a href="<?php echo $this->link(array('index')) ?>"><i class="fa fa-dashboard"></i> Your Dashboard</a></li>
                    <li><a href="<?php echo $this->link(array('timesheet')) ?>"><i class="fa fa-clock-o"></i> Your Time Sheet</a></li>
                </ul>

                <!-- Right Nav Section -->
                <ul class="right">
                    <?php
                        //Administrative Accounts
                        if($user->getAuthLevel() >= 900)
                        {
                            echo "
                            <li><a href=\"".$this->link(array('accounts')) ."\"><i class=\"fa fa-users\"></i> Accounts</a></li>
                            <li class=\"has-dropdown\">
                                <a href=\"#\"><i class='fa fa-file'></i> Reports</a>
                                <ul class=\"dropdown\">
                                    <li><a href=\"".$this->link(array('reports','payroll'))."\"><i class=\"fa fa-file\"></i> Month Totals</a></li>
                                    <li><a href=\"".$this->link(array('reports','payperiod'))."\"><i class=\"fa fa-file\"></i> Daily Totals</a></li>
                                    <li><a href=\"".$this->link(array('audit')) ."\" ><i class=\"fa fa-list-alt\" ></i > Audit Log</a ></li>
                                </ul>
                            </li>

                            <li class=\"has-dropdown\">
                                <a href=\"#\"><i class='fa fa-gear'></i> Tools</a>
                                <ul class=\"dropdown\">
                                    <li><a href=\"".$this->link(array('timesheet','admininsert'))."\" ><i class=\"fa fa-plus\" ></i > Time Insert </a ></li >
                                    <li><a href=\"".$this->link(array('reports','unlock'))."\"><i class=\"fa fa-unlock\"></i> Time Unlock</a></li>
                                </ul>
                            </li>

                            ";
                        }
                    ?>

                    <?php

                    //Supervisor Accounts
                    if($user->getAuthLevel() >= 500)
                    {
                        echo "
                            <li class=\"has-dropdown\">
                                <a href=\"#\"><i class='fa fa-file'></i> Time Sheets</a>
                                <ul class=\"dropdown\">
                                    <li><a href=\"".$this->link(array('reports')) ."\"><i class=\"fa fa-user\"></i> Active Accounts</a></li>
                                    <li><a href=\"".$this->link(array('reports','inactive'))."\" ><i class=\"fa fa-user\" ></i > Inactive Accounts</a ></li>
                                </ul>
                            </li>
                        ";
                    }

                    if($user->getAuthLevel() >= 900)
                    {
                        echo "<li><a href=\"".$this->link(array('messages','index'))."\" ><i class=\"fa fa-envelope\" ></i > Messaging </a ></li>";
                    }
                    elseif($user->getAuthLevel() >= 500)
                    {
                        echo "<li><a href=\"".$this->link(array('messages','account'))."\" ><i class=\"fa fa-envelope\" ></i > Messaging </a ></li>";
                    }

                    ?>

                    <li><a href="<?php echo $this->link(array('account','logout')) ?>"><i class="fa fa-close"></i> Logout</a></li>
                </ul>
            </section>
        </nav>
    </div>
    </div>
        <?php $this->content(); ?>
        <script>
            $(document).foundation();
            var delay = 600000; //10 Minutes
            $(document).ready(function() {
                setTimeout(function(){window.location = "<?php echo $this->link(array('account','logout')) ?>"; }, delay);
            });
        </script>
    </body>
</html>