PageRenderTime 51ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/classes/UnitCheckHeader.php

#
PHP | 167 lines | 96 code | 21 blank | 50 comment | 2 complexity | a57e787627b0220395c299d035cb0527 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. /**
  3. * This file is part of UnitCheck.
  4. * This file contains all the UnitCheckHeader attributes and methods.
  5. *
  6. * @author Tom Kaczocha <freedomdeveloper@yahoo.com>
  7. * @package UnitCheck
  8. * @copyright (C) 2010, 2011 Tom Kaczocha <freedomdeveloper@yahoo.com>
  9. *
  10. * UnitCheck is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * UnitCheck is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with UnitCheck. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. /**
  25. *
  26. * @package UnitCheck
  27. * @author Tom Kaczocha <freedomdeveloper@yahoo.com>
  28. * @copyright (C) 2010, 2011 Tom Kaczocha <freedomdeveloper@yahoo.com>
  29. * @version 1.0
  30. *
  31. */
  32. class UnitCheckHeader {
  33. /**
  34. * UnitCheckHeader Constructor
  35. *
  36. * @access public
  37. *
  38. */
  39. public function __construct() {
  40. }
  41. /**
  42. * UnitCheckHeader Destructor
  43. *
  44. * @access public
  45. *
  46. */
  47. public function __destruct() {
  48. }
  49. /**
  50. * Function prints UnitCheck header
  51. *
  52. * @access public
  53. *
  54. */
  55. public static function printHeader() {
  56. global $user;
  57. //echo "Login Status: " . $user->isUserLoggedIn();
  58. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  59. <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="es-ar" xml:lang="es-ar">
  60. <head>
  61. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  62. <meta http-equiv="Content-Style-Type" content="text/css" />
  63. <meta http-equiv="Content-Language" content="es-ar" />
  64. <meta name="description" content="Generador de links con destino modificable" />
  65. <link href="../includes/styles/styles.css" rel="stylesheet" type="text/css" />
  66. <link href="../includes/styles/page.css" rel="stylesheet" type="text/css" />
  67. <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
  68. <title>' . $_SESSION['title'] . ' - UnitCheck</title>
  69. <link href="" rel="Top" />
  70. </head>
  71. <body>
  72. <div id="header">
  73. <div id="banner">
  74. </div> <!-- END banner -->
  75. <table id="titles" cellspacing="0" cellpadding="0" border="0">
  76. <tr>
  77. <td id="title">
  78. <p style="color:#FFFFFF;">UnitCheck &ndash; ' . $_SESSION['title'] . '</p>
  79. </td>
  80. <td id="information">
  81. <p style="color:#FFFFFF;">version ' . VERSION . '</p>
  82. </td>
  83. </tr>
  84. </table>
  85. <ul class="links">
  86. <li>
  87. <a href="../public/index.php">Home</a>
  88. </li>
  89. <li>
  90. <span class="separator">| </span>
  91. <a href="../public/new.php">Add New</a>
  92. </li>
  93. <li>
  94. <span class="separator">| </span>
  95. <a href="../public/edit.php">Edit</a>
  96. </li>
  97. <li>
  98. <span class="separator">| </span>
  99. <a href="../public/configure.php">Configure</a>
  100. </li>
  101. <li>
  102. <span class="separator">| </span>
  103. <a href="../public/reports.php">Reports</a>
  104. </li>';
  105. if ($user->isUserLoggedIn()) {
  106. echo self::loggedIn();
  107. }
  108. else {
  109. echo self::loggedOut();
  110. }
  111. echo ' </ul>
  112. </div> <!-- END header -->
  113. <div id="unitcheck-body">';
  114. }
  115. private static function loggedIn() {
  116. global $user;
  117. //$email = $user->getUserEmail();
  118. $email = $_SESSION['email'];
  119. $logout = '<li>
  120. <span class="separator">| </span>
  121. <a href="../public/logout.php">Logout</a> ';
  122. $logout .= $email;
  123. $logout .= '</li>';
  124. return $logout;
  125. }
  126. private static function loggedOut() {
  127. return '<li id="new_account_container_top">
  128. <span class="separator">| </span>
  129. <a href="createaccount.php">New &nbsp; Account</a>
  130. </li>
  131. <li id="mini_login_container_top">
  132. <span class="separator">| </span>
  133. <form id="mini_login_top" class="mini_login" method="post" action="login.php">
  134. <input id="UnitCheck_login_top" class="uc_login type="text" value="email" onblur="email" onfocus="" onClick="clear" name="UnitCheck_login" />
  135. <input id="UnitCheck_password_top" class="uc_login" type="password" value="password" onblur="" onfocus="" name="UnitCheck_password" />
  136. <input id="login_top" type="submit" value="Log in" name="GoAheadAndLogIn" />
  137. </form>
  138. </li>
  139. <li id="forgot_container_top">
  140. <span class="separator">| </span>
  141. <a id="forgot_link_top" href="forgotpassword.php">Forgot Password</a>
  142. </li>';
  143. }
  144. }