PageRenderTime 56ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/views/Restaurant/header.php

https://gitlab.com/tusharbd/RestaurantManagementSystem
PHP | 265 lines | 183 code | 75 blank | 7 comment | 13 complexity | dd1d4c08048eb233f50b4667bace3d1f MD5 | raw file
  1. <?php
  2. include_once ('../../vendor/autoload.php');
  3. use App\User\Auth;
  4. use App\User\User;
  5. use App\GlobalClasses\Message;
  6. $auth = new Auth();
  7. $loggedIn = $auth->logged_in();
  8. if($loggedIn){
  9. $user = new User();
  10. $singleUser= $user->view();
  11. }
  12. if(!isset($_SESSION)){
  13. session_start();
  14. }
  15. // To make active current nav bar link
  16. function getActiveCurrent($data = ""){
  17. $end = basename($_SERVER['SCRIPT_FILENAME']);
  18. if($end == $data ) {
  19. echo "current";
  20. }
  21. }
  22. // To make active current nav bar link
  23. //Get total items in cart start
  24. $total = 0;
  25. if(isset($_SESSION["cart_list"]) && !empty($_SESSION['cart_list'])){
  26. foreach($_SESSION["cart_list"] as $k => $v) {
  27. $total = $total+ $_SESSION["cart_list"][$k]["quantity"];
  28. }
  29. }
  30. //Get total items end
  31. // Current page title
  32. $end = basename($_SERVER['SCRIPT_FILENAME']);
  33. $title = substr($end, 0, -4);
  34. $title = strtoupper($title)."-RESTAURANT";
  35. //
  36. ?>
  37. <!DOCTYPE html>
  38. <html lang="en" xmlns="http://www.w3.org/1999/html">
  39. <head>
  40. <title><?php echo $title?></title>
  41. <meta charset="utf-8">
  42. <meta name = "format-detection" content = "telephone=no" />
  43. <link rel="icon" href="../../resource/images/favicon.ico">
  44. <link rel="shortcut icon" href="../../resource/images/favicon.ico" />
  45. <link rel="stylesheet" href="../../resource/css/form.css">
  46. <link rel="stylesheet" href="../../resource/css/stuck.css">
  47. <link rel="stylesheet" href="../../resource/css/style.css">
  48. <link rel="stylesheet" href="../../resource/formResource/css/booking.css">
  49. <script src="../../resource/jquery/1.12.0/jquery.min.js"></script>
  50. <script src="../../resource/js/jquery.js"></script>
  51. <script src="../../resource/js/jquery-migrate-1.1.1.js"></script>
  52. <script src="../../resource/js/script.js"></script>
  53. <script src="../../resource/js/superfish.js"></script>
  54. <script src="../../resource/js/jquery.equalheights.js"></script>
  55. <script src="../../resource/js/jquery.mobilemenu.js"></script>
  56. <script src="../../resource/js/jquery.easing.1.3.js"></script>
  57. <script src="../../resource/js/tmStickUp.js"></script>
  58. <script src="../../resource/js/jquery.ui.totop.js"></script>
  59. <script src="../../resource/js/TMForm.js"></script>
  60. <script src="../../resource/js/modal.js"></script>
  61. <script src="../../resource/js/touchTouch.jquery.js"></script>
  62. <link rel="stylesheet" href="../../resource/Custom/style.css">
  63. <script src="../../resource/formResource/js/jquery-ui-1.10.3.custom.min.js"></script>
  64. <script src="../../resource/formResource/js/booking.js"></script>
  65. <script>
  66. $(document).ready(function(){
  67. $().UItoTop({ easingType: 'easeOutQuart' });
  68. $('#stuck_container').tmStickUp({});
  69. });
  70. </script>
  71. <!--[if lt IE 9]>
  72. <div style=' clear: both; text-align:center; position: relative;'>
  73. <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
  74. <img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." />
  75. </a>
  76. </div>
  77. <script src="../../resource/js/html5shiv.js"></script>
  78. <link rel="stylesheet" media="screen" href="../../resource/css/ie.css">
  79. <![endif]-->
  80. </head>
  81. <body>
  82. <!--==============================
  83. header
  84. =================================-->
  85. <header>
  86. <!--==============================
  87. Stuck menu
  88. =================================-->
  89. <section id="stuck_container">
  90. <div class="container">
  91. <div class="row">
  92. <div class="grid_12">
  93. <h1>
  94. <a href="index.php">
  95. <img src="../../resource/images/logo.png" alt="Logo alt" >
  96. </a>
  97. </h1>
  98. <table>
  99. <tr>
  100. <td width='500' height="5">
  101. <?php if(isset($_SESSION['message']) ) if($_SESSION['message']!=""){ ?>
  102. <div class="alert success">
  103. <span class="closebtn">&times;</span>
  104. <center>
  105. <?php if((array_key_exists('message',$_SESSION)&& (!empty($_SESSION['message'])))) {
  106. echo "&nbsp;".Message::message();
  107. }
  108. Message::message(NULL);
  109. ?></center>
  110. </div>
  111. <?php } ?>
  112. </td>
  113. <td>
  114. <!-- Searching START -->
  115. <form action="searchItem.php">
  116. <label></label>
  117. <input type="text" name="search" value="" placeholder="Search Food Item" id="itemname">
  118. <button type="submit">Search</button>
  119. </form><br>
  120. </td>
  121. <?php
  122. if($loggedIn) {
  123. //grettings and logout option
  124. ?>
  125. <td height="">Welcome <?php echo $singleUser->first_name." ". $singleUser->last_name?>!</td><td width='50'><a href='User/Authentication/logout.php'><input type='button' value='Logout'></a></td><td width='50'><a href='User/Profile/edit.php'><input type='button' value='Edit Profile'></a></td></tr></table>
  126. <td width="50"> </td>
  127. <?php
  128. }
  129. else {
  130. ?>
  131. <!-- LOGIN FORM START -->
  132. <form action="User/Authentication/login.php" method="post">
  133. <table cellspacing="0" role="presentation"> <tbody> <tr>
  134. <td width="100"></td> <td width="100"></td><td width="100"></td><td width="100"></td>
  135. <td width="100">
  136. <label for="email">Email</label>
  137. </td>
  138. <td >
  139. <label for="pass">Password</label>
  140. </td>
  141. </tr>
  142. <tr>
  143. <td width="100"></td><td width="100"></td><td width="100"></td><td width="100"></td>
  144. <td width="">
  145. <input type="email" class="inputtext" name="email" id="email" value="" tabindex="1">
  146. </td>
  147. <td>
  148. <input type="password" class="inputtext" name="password" id="password" tabindex="2"></td>
  149. <td>
  150. <input value="Log In" tabindex="4" type="submit" id="u_0_m">
  151. </td>
  152. <td width="50"> </td>
  153. <td >
  154. <a href='User/Profile/signup.php'><input type='button' value='Signup'></a>
  155. </td>
  156. </tr>
  157. <tr>
  158. <td width="100"></td><td width="100"></td><td width="100"></td><td width="100"></td>
  159. <td class="login_form_label_field">
  160. <a href="forgotten.php">Forgotten account?</a>
  161. </td>
  162. </tr>
  163. </tbody>
  164. </table>
  165. </form>
  166. <!-- Login Form End -->
  167. <?php } ?>
  168. <div class="navigation ">
  169. <nav>
  170. <ul class="sf-menu">
  171. <li class= "<?php getActiveCurrent("index.php") ?>"><a href="index.php">home</a></li>
  172. <li class="<?php getActiveCurrent("menu.php") ?>"><a href="menu.php">menu</a></li>
  173. <!-- <li class="<?php // getActiveCurrent("reservation.php") ?>"><a href="reservation.php">reservation</a></li> -->
  174. <!-- <li class="--><?php //getActiveCurrent("blog.php") ?><!--"><a href="blog.php">blog</a></li>-->
  175. <li class="<?php getActiveCurrent("contact.php") ?>"><a href="contact.php">contacts</a></li>
  176. <li id="refreshCart" class="<?php getActiveCurrent("cart.php") ?>"><a href="cart.php" type="button" class="badge1" data-badge=" <?php echo $total?>">Cart</a></li>
  177. <?php if($loggedIn) {?>
  178. <li class="<?php getActiveCurrent("profile.php") ?>"><a href="profile.php">Profile</a></li>
  179. <?php } else { ?>
  180. <li class="<?php getActiveCurrent("Profile/signup.php") ?>"><a href="User/Profile/signup.php">Login/Signup</a></li>
  181. <?php } ?>
  182. </ul>
  183. </nav>
  184. <div class="clear"></div>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </section>
  190. </header>