[5] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | // Grafic user interface class
|
---|
[6] | 4 | // Date: 2012-06-13
|
---|
[5] | 5 |
|
---|
| 6 | class Gui
|
---|
| 7 | {
|
---|
[6] | 8 | private $Config;
|
---|
| 9 | private $Messages;
|
---|
| 10 | private $ActivePage = 'home';
|
---|
| 11 | private $Links = array();
|
---|
| 12 | private $Pages = array();
|
---|
[8] | 13 | private $Language;
|
---|
[18] | 14 | private $User;
|
---|
[5] | 15 |
|
---|
[11] | 16 | function __construct($User)
|
---|
[5] | 17 | {
|
---|
[6] | 18 | $this->Config = new Config();
|
---|
| 19 | $this->Messages = new Messages();
|
---|
[8] | 20 | $this->Language = new Language();
|
---|
[9] | 21 |
|
---|
[6] | 22 | $this->InitLinks();
|
---|
| 23 | $this->InitPages();
|
---|
[18] | 24 | $this->User = $User;
|
---|
[9] | 25 |
|
---|
| 26 | //have to be after inicialization of pages
|
---|
[11] | 27 | $this->Feedback($User);
|
---|
[5] | 28 | }
|
---|
[6] | 29 |
|
---|
| 30 | //init links
|
---|
| 31 | private function InitLinks() {
|
---|
| 32 | $this->Links['SourceCode'] = new Link('Zdrojové kódy','http://svn.zdechov.net/svn/phpvpsadmin/','');
|
---|
[18] | 33 | $this->Links['logout'] = new Link('Odhlásit', '?logout' , 'Odhlásit se z webového systému');
|
---|
[6] | 34 |
|
---|
| 35 | }
|
---|
[5] | 36 |
|
---|
[6] | 37 | //init Pages
|
---|
| 38 | private function InitPages() {
|
---|
[8] | 39 | $this->Pages['home'] = new PageHome($this->Language);
|
---|
[18] | 40 | $this->Pages['login'] = new PageLogin($this->Language);
|
---|
| 41 | $this->Pages['register'] = new PageRegister($this->Language);
|
---|
[6] | 42 |
|
---|
[5] | 43 | }
|
---|
| 44 |
|
---|
[9] | 45 | //gets feedback from post and get
|
---|
[11] | 46 | private function Feedback($User) {
|
---|
| 47 | $this->Messages->RegMess($User);
|
---|
[9] | 48 | $this->ActivePage = $this->Messages->WhichPage($this->Pages);
|
---|
| 49 | }
|
---|
| 50 |
|
---|
[6] | 51 | //shows page concent
|
---|
| 52 | public function ShowPage() {
|
---|
| 53 | $this->ShowHeader();
|
---|
| 54 |
|
---|
| 55 | //generate and shows active page
|
---|
[14] | 56 | if (isset($this->Pages[$this->ActivePage])) $this->Pages[$this->ActivePage]->Show();
|
---|
[6] | 57 |
|
---|
| 58 | $this->ShowFooter();
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | //shows header of web page
|
---|
| 63 | private function ShowHeader()
|
---|
| 64 | {
|
---|
[5] | 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'].'" />'.
|
---|
[11] | 71 | '<meta name="keywords" content="virtualizace, virtuálnÃ, server, hosting, webhosting, web, virtualization" />'.
|
---|
[5] | 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>');
|
---|
[18] | 78 | //left panel
|
---|
[5] | 79 |
|
---|
[18] | 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
|
---|
[6] | 95 | }
|
---|
[5] | 96 |
|
---|
[6] | 97 | //shows footer of webpage
|
---|
| 98 | private function ShowFooter()
|
---|
| 99 | {
|
---|
[5] | 100 | echo('</td>'.
|
---|
| 101 | '</tr><tr>'.
|
---|
[11] | 102 | '<td colspan="4" class="page-bottom">'.$this->Language->Texts['autors'].': '.$this->Config->Web['Authors'].' '.$this->Links['SourceCode']->Get().'');
|
---|
[5] | 103 |
|
---|
| 104 | echo('</td></tr>');
|
---|
| 105 | echo('</table>'.
|
---|
| 106 | '</body>'.
|
---|
| 107 | '</html>');
|
---|
[6] | 108 | }
|
---|
[5] | 109 |
|
---|
| 110 | }
|
---|
| 111 | ?>
|
---|