Umfragen
html.class.php
Go to the documentation of this file.
1 <?php
2 /*
3  * html.class.php
4  *
5  * Copyright 2012 Johannes <jojo@jojo-42>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301, USA.
21  *
22  *
23  */
24 
25 if( !isset($config_included) ){
26  die("config not loaded");
27 }
28 
29 
30 
31 class HTML{
32 
36  static function doctype(){
37  echo '<!DOCTYPE html>
38  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
39  ';
40  }
41 
47  static function head($extra="",$lvl=0){
48  $p = str_repeat("../",$lvl);
49  echo '
50  <head>
51  <title>Umfrage</title>
52  <meta http-equiv="content-type" content="text/html;charset=utf-8" />
53  <meta name="generator" content="Geany 0.21" />
54  <link rel="icon" type="image/png" href="'.APP_ROOT.'/icons/32/dialog-apply.png">
55  <link href="'.APP_ROOT.'/JS/jquery/css/smoothness/jquery-ui-1.10.0.custom" rel="stylesheet">
56  <script src="'.APP_ROOT.'/JS/jquery/jquery-1.9.0.js"></script>
57  <script src="'.APP_ROOT.'/JS/jquery/jquery-ui-1.10.0.custom.js"></script>
58  <script src="'.APP_ROOT.'/JS/poll.js"></script>
59  <link href="'.APP_ROOT.'/CSS/style.css" rel="stylesheet" type="text/css">
60  <link href="'.APP_ROOT.'/CSS/menu_nav.css" rel="stylesheet" type="text/css">
61  <link href="'.APP_ROOT.'/CSS/backend.css" rel="stylesheet" type="text/css">
62  <link href="'.APP_ROOT.'/CSS/messages.css" rel="stylesheet" type="text/css">';
63  if( (defined('ANALYTICS_HTML_INCLUDE_FILE')) AND (ANALYTICS_HTML_INCLUDE_FILE != "") ){
64  include_once(ANALYTICS_HTML_INCLUDE_FILE);
65  }
66  echo $extra;
67  echo'</head>
68  <body>
69  <div class="content">
70  <img src="'.APP_ROOT.'/hand.png" style="position:fixed;width:200px;margin-left:-220px;z-index:-1" alt=""/>
71  ';
72  }
73 
77  static function foot(){
78  echo '</div></body></html>';
79  }
80 
87  static function menu( $nav=array() ){
88  // Full name ... if not logged in => guest
89  if( isset($_SESSION["user"]->fullName) ){
90  $FN=$_SESSION["user"]->fullName;
91  }else{
92  $FN = "Gast";
93  }
94  // is admin?
95  $admins = explode(",",SUPER_ADMIN);
96  if( isset($_SESSION["user"]->ID) ){
97  $is_super_admin = in_array($_SESSION["user"]->ID,$admins);
98  }else{
99  $is_super_admin = false;
100  }
101 
102  echo "<div id='menu'>";
103  echo "<ul>";
104  // for logged in users
105  if( isset($_SESSION["user"]->ID) ){
106  echo "<li><a href='".APP_ROOT."/page.php'>Hauptseite</a></li>";
107  echo "<li><a href='".APP_ROOT."/backend'>Backend</a></li>";
108  echo "<li><a href='".APP_ROOT."/backend/profile.php'>Profil</a></li>";
109  }else{
110  //for Guests => public.php
111  echo "<li><a href='".APP_ROOT."/public.php'>Hauptseite</a></li>";
112  }
113  // for Admins
114  if($is_super_admin ===true){
115  echo "<li><a href='".APP_ROOT."/backend/admin.php'>Admin</a></li>";
116  }
117  // login / logout
118  if( isset($_SESSION["user"]->ID) ){
119  echo " <li id='logged_in_as'>Angemeldet als {$FN}";
120  echo " <form method=\"POST\" action=\"".APP_ROOT."/login.php\">
121  <input type=\"submit\" value=\"Logout\" name=\"logout\"/>
122  </form>";
123  echo " </li>";
124  }else{
125  echo " <li id='logged_in_as'>Angemeldet als {$FN}";
126  echo " <form method=\"POST\" action=\"".APP_ROOT."/login.php\">
127  <input type=\"submit\" value=\"Login\" name=\"logout\"/>
128  </form>";
129  echo " </li>";
130  }
131  echo "</ul>";
132  echo "</div>";
133 
134  // navigation bar
135  if( sizeof($nav) > 0 ){
136  echo "<ul class='nav'>";
137  for($i=0;$i<sizeof($nav);++$i){
138  $n = $i+1;
139  echo "<li><a href='{$nav[$i]["href"]}' class='navitem$n navitem' {$nav[$i]["onclick"]} >{$nav[$i]["name"]}</a></li>";
140  }
141  echo "</ul>";
142  }
143 
144  }
145 
146 }
147 
148 
149 // ! no ending newLine
150 ?>