| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once(dirname(__FILE__).'/../../Base/View.php');
|
|---|
| 4 | include_once(dirname(__FILE__).'/../../Module/News/View.php');
|
|---|
| 5 |
|
|---|
| 6 | class PageView extends View
|
|---|
| 7 | {
|
|---|
| 8 | var $TimeStart;
|
|---|
| 9 | var $ShortTitle;
|
|---|
| 10 | var $FullTitle;
|
|---|
| 11 | var $Load;
|
|---|
| 12 | var $Unload;
|
|---|
| 13 | var $Content;
|
|---|
| 14 |
|
|---|
| 15 | function ShowHeader($Title, $Path)
|
|---|
| 16 | {
|
|---|
| 17 | $BodyParam = '';
|
|---|
| 18 | if($this->Load != '') $BodyParam .= ' onload="'.$this->Load.'"';
|
|---|
| 19 | if($this->Unload != '') $BodyParam .= ' onunload="'.$this->Unload.'"';
|
|---|
| 20 | $Output = '<?xml version="1.0" encoding="'.$this->Config['Web']['Charset'].'"?>'."\n".
|
|---|
| 21 | '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
|
|---|
| 22 | '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">'.
|
|---|
| 23 | '<head><link rel="stylesheet" href="'.$this->Config['Web']['RootFolder'].'/Application/Style/Style.css" type="text/css" media="all" />'.
|
|---|
| 24 | '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->Config['Web']['Charset'].'" />'.
|
|---|
| 25 | '<script type="text/javascript" src="'.$this->Config['Web']['RootFolder'].'/Application/Style/Global.js"></script>'.
|
|---|
| 26 | '<title>'.$this->Config['Web']['Title'].' - '.$Path.'</title>
|
|---|
| 27 | </head><body'.$BodyParam.'>'.$this->ShowTopPanel();
|
|---|
| 28 | return($Output);
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | function ShowTopPanel()
|
|---|
| 32 | {
|
|---|
| 33 | $Output = '<div class="Navigation"><span class="MenuItem">'.
|
|---|
| 34 | '<a href="?Module=HomePage&Action=Info">Informace</a>'.
|
|---|
| 35 | ' <a href="?Module=HomePage&Action=State">Stav systému</a>'.
|
|---|
| 36 | ' <a href="?Module=Server&Action=ItemList">Seznam serverů</a>'.
|
|---|
| 37 | ' <a href="?Module=Client&Action=ItemList">Verze klienta</a>'.
|
|---|
| 38 | ' <a href="?Module=Emulator&Action=ItemList">Verze emulátoru</a>'.
|
|---|
| 39 | '</span><div class="MenuItem2">';
|
|---|
| 40 | if($this->System->Modules['User']->Data['Id'] == $this->Config['Web']['UserAnonymousId'])
|
|---|
| 41 | {
|
|---|
| 42 | $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Module=User&Action=Login">Přihlášení</a>';
|
|---|
| 43 | if($this->Config['Web']['UserRegistrationEnabled']) $Output .= ' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Module=User&Action=Register">Registrace</a>';
|
|---|
| 44 | } else $Output .= $this->System->Modules['User']->Data['Name'].' <a href="'.$this->Config['Web']['RootFolder'].'/?Module=User&Action=Logout">Odhlásit</a>'.
|
|---|
| 45 | ' <a href="'.$this->Config['Web']['RootFolder'].'/?Module=User&Action=Options">Nastavení</a>';
|
|---|
| 46 | $Output .= '</div></div>';
|
|---|
| 47 | return($Output);
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | function ShowFooter()
|
|---|
| 51 | {
|
|---|
| 52 | global $ScriptTimeStart;
|
|---|
| 53 |
|
|---|
| 54 | $Time = round($this->System->GetMicrotime() - $ScriptTimeStart, 2);
|
|---|
| 55 | $Output = '<div class="Footer">
|
|---|
| 56 | <ul><li>Založeno na projektu <a href="http://svn.zdechov.net/trac/wowhosting/">WoW hosting</a></li>'.
|
|---|
| 57 | '<li><a href="http://svn.zdechov.net/trac/wowhosting/browser">Zdrojové kódy</a></li>'.
|
|---|
| 58 | '<li><a href="http://svn.zdechov.net/trac/wowhosting/log?verbose=on">Novinky</a></li>'.
|
|---|
| 59 | '<li>Správce: '.$this->Config['Web']['Admin'].'</li>'.
|
|---|
| 60 | '<li>E-mail: '.$this->Config['Web']['AdminEmail'].'</li>';
|
|---|
| 61 | if($this->Config['Web']['ShowRuntimeInfo'] == true) $Output .= '<li>Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s</li><li>Použitá paměť: '.$this->System->AddPrefixMultipliers(memory_get_peak_usage(FALSE), 'B').' / '.ini_get('memory_limit').'B</li>';
|
|---|
| 62 | $Output .= '</ul></div></body></html>';
|
|---|
| 63 | return($Output);
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | function CenterPanel($Content)
|
|---|
| 67 | {
|
|---|
| 68 | $Output = '<table class="BasicTable"><tr>';
|
|---|
| 69 | if($this->System->Modules['User']->Data['Id'] != $this->Config['Web']['UserAnonymousId'])
|
|---|
| 70 | $Output .= '<td class="UserMenu">'.$this->UserMenu().'</td>';
|
|---|
| 71 | $Output .= '<td class="Content">'.$Content.'</td>';
|
|---|
| 72 | if(!array_key_exists('Action', $_GET))
|
|---|
| 73 | {
|
|---|
| 74 | $NewsView = new NewsView($this->System);
|
|---|
| 75 | $Output .= $NewsView->View();
|
|---|
| 76 | }
|
|---|
| 77 | $Output .= '</tr></table>';
|
|---|
| 78 | return($Output);
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | function UserMenu()
|
|---|
| 82 | {
|
|---|
| 83 | $Output = '<strong>Uživatelské menu</strong><br />';
|
|---|
| 84 | if($this->System->Modules['User']->Data['Id'] != $this->Config['Web']['UserAnonymousId'])
|
|---|
| 85 | {
|
|---|
| 86 | $Output .= '<div><a href="?Module=Cluster&Action=ItemList">Uzly skupiny</a></div>';
|
|---|
| 87 | $Output .= '<div><a href="?Module=Server&Action=ItemList&Filter=User">Moje servery</a></div>';
|
|---|
| 88 | //$Output .= '<div><a href="?Action=RealmList&Filter=User">Moje světy</a></div>';
|
|---|
| 89 | //$Output .= '<div><a href="?Action=DebugList&Id='.$Server['Id'].'">Ladící záznamy</a></div>';
|
|---|
| 90 | //$Output .= '<div><a href="?Action=BackupList&Id='.$Server['Id'].'">Zálohy</a></div>';
|
|---|
| 91 | $Output .= '<div><a href="?Module=Task&Action=ItemList">Fronta úloh</a></div>';
|
|---|
| 92 | //$Output .= '<div><a href="?Action=UpdateList&Id='.$Server['Id'].'">Dostupné aktualizace</a></div>';
|
|---|
| 93 |
|
|---|
| 94 | if($this->System->Modules['Permission']->Check('News', 'Add'))
|
|---|
| 95 | {
|
|---|
| 96 | $Output .= '<div><a href="?Module=News&Action=Add">Přidat aktualitu</a></div>';
|
|---|
| 97 | }
|
|---|
| 98 | }
|
|---|
| 99 | return($Output);
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | function GetOutput($Content)
|
|---|
| 103 | {
|
|---|
| 104 | $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).
|
|---|
| 105 | $this->CenterPanel($Content);
|
|---|
| 106 | $Output .= $this->ShowFooter();
|
|---|
| 107 | if($this->Config['Web']['FormatHTML'] == true) echo($this->FormatOutput($Output));
|
|---|
| 108 | else echo($Output);
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | function SystemMessage($Text)
|
|---|
| 112 | {
|
|---|
| 113 | return('<table align="center"><tr><td><div class="SystemMessage"><h3>Systémová zpráva</h3><div>'.$Text.'</div></div</td></tr></table>');
|
|---|
| 114 | //ShowFooter();
|
|---|
| 115 | //die();
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | function AccessDenied()
|
|---|
| 119 | {
|
|---|
| 120 | return($this->GetOutput($this->SystemMessage($this->System->Translate('AccessDenied'))));
|
|---|
| 121 | }
|
|---|
| 122 | }
|
|---|