source: trunk/class/Gui.php

Last change on this file was 18, checked in by maron, 13 years ago

kostra webu

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1<?php
2
3// Grafic user interface class
4// Date: 2012-06-13
5
6class Gui
7{
8 private $Config;
9 private $Messages;
10 private $ActivePage = 'home';
11 private $Links = array();
12 private $Pages = array();
13 private $Language;
14 private $User;
15
16 function __construct($User)
17 {
18 $this->Config = new Config();
19 $this->Messages = new Messages();
20 $this->Language = new Language();
21
22 $this->InitLinks();
23 $this->InitPages();
24 $this->User = $User;
25
26 //have to be after inicialization of pages
27 $this->Feedback($User);
28 }
29
30//init links
31 private function InitLinks() {
32 $this->Links['SourceCode'] = new Link('Zdrojové kódy','http://svn.zdechov.net/svn/phpvpsadmin/','');
33 $this->Links['logout'] = new Link('Odhlásit', '?logout' , 'Odhlásit se z webového systému');
34
35 }
36
37//init Pages
38 private function InitPages() {
39 $this->Pages['home'] = new PageHome($this->Language);
40 $this->Pages['login'] = new PageLogin($this->Language);
41 $this->Pages['register'] = new PageRegister($this->Language);
42
43 }
44
45//gets feedback from post and get
46 private function Feedback($User) {
47 $this->Messages->RegMess($User);
48 $this->ActivePage = $this->Messages->WhichPage($this->Pages);
49 }
50
51//shows page concent
52 public function ShowPage() {
53 $this->ShowHeader();
54
55 //generate and shows active page
56 if (isset($this->Pages[$this->ActivePage])) $this->Pages[$this->ActivePage]->Show();
57
58 $this->ShowFooter();
59 }
60
61
62//shows header of web page
63 private function ShowHeader()
64 {
65
66 echo('<?xml version="1.0" encoding="'.$this->Config->Web['Charset'].'"?>
67 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
68<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cz">'.
69'<head>'.
70'<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->Config->Web['Charset'].'" />'.
71'<meta name="keywords" content="virtualizace, virtuální, server, hosting, webhosting, web, virtualization" />'.
72'<meta name="description" content="'.$this->Config->Web['Title'].'" />'.
73'<meta name="robots" content="all" />'.
74'<link rel="stylesheet" href="'.$this->Config->Web['Style'].'" type="text/css" media="all" />'.
75'<script type="text/javascript" src="'.$this->Config->Web['Script'].'"></script>'.
76'<link rel="shortcut icon" href="'.$this->Config->Web['Icon'].'" />');
77 echo('<title>'.$this->Config->Web['Title'].'</title></head><body><table><tr><td>');
78 //left panel
79
80 foreach($this->Pages as $Key => $Page )
81 {
82 echo $Page->Link->Get();
83 echo '<br />';
84 }
85
86 if ($this->User->Licence(0)) {
87 echo 'Přihlášen ';
88 echo $this->Links['logout']->Get();
89 }
90 // else echo 'notlog';
91
92
93 echo ('</td><td>');
94 //right panel
95 }
96
97//shows footer of webpage
98 private function ShowFooter()
99 {
100 echo('</td>'.
101 '</tr><tr>'.
102 '<td colspan="4" class="page-bottom">'.$this->Language->Texts['autors'].': '.$this->Config->Web['Authors'].' &nbsp; '.$this->Links['SourceCode']->Get().'');
103
104 echo('</td></tr>');
105 echo('</table>'.
106 '</body>'.
107 '</html>');
108 }
109
110}
111?>
Note: See TracBrowser for help on using the repository browser.