source: branches/php/CustomOutput.php@ 112

Last change on this file since 112 was 112, checked in by chronos, 11 years ago
  • Odstraněno: Ukončovací PHP značka ze všech souborů.
File size: 6.2 KB
Line 
1<?php
2
3include_once(dirname(__FILE__).'/Base/Output.php');
4include_once(dirname(__FILE__).'/Base/HTML/XHTML.php');
5
6class CustomOutput extends Output
7{
8 var $Load = '';
9 var $Unload = '';
10 var $Document;
11 var $GlobalTitle;
12 var $Title;
13 var $ShowRuntimeInfo;
14 var $Charset;
15 var $FormatHTML;
16 var $Admin;
17 var $AdminEmail;
18 var $Style;
19 var $Keywords;
20
21 function __construct($System)
22 {
23 parent::__construct($System);
24 $this->Charset = 'utf-8';
25 $this->ShowRuntimeInfo = false;
26 $this->FormatHTML = false;
27 $this->Admin = 'admin';
28 $this->AdminEmail = 'admin@localhost';
29 $this->Style = 'Basic';
30 $this->Keywords = array();
31 }
32
33 function TopMenu()
34 {
35 $Output = '<div class="Navigation">';
36 // Visitor
37 $Output .= '<ul class="MenuItem">';
38 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('About'), $this->System->Navigation->MakeLink('Main', 'About')).'</li>';
39 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('Internet'), $this->System->Navigation->MakeLink('Main', 'Internet')).'</li>';
40 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('Hosting'), $this->System->Navigation->MakeLink('Main', 'Hosting')).'</li>';
41 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('VoIP'), $this->System->Navigation->MakeLink('Main', 'VoIP')).'</li>';
42 $Output .= '<li><a href="https://mail.zdechov.net/">Pošta</a></li>';
43 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('NetworkHistory'), $this->System->Navigation->MakeLink('Main', 'History')).'</li>';
44 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('Documents'), $this->System->Navigation->MakeLink('Main', 'Documents')).'</li>';
45 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('Links'), $this->System->Navigation->MakeLink('Main', 'Links')).'</li>';
46 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('Contact'), $this->System->Navigation->MakeLink('Main', 'Contact')).'</li>';
47 if($this->System->UserOnline->User == null)
48 {
49 $Output .= '</ul>';
50 $Output .= '<ul class="MenuItem2">';
51 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('UserLogin'), $this->System->Navigation->MakeLink('User', 'Login')).'</li>';
52 //$Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Translate('UserRegistration'), $this->System->MakeLink('UserList', 'Register')).'</li>';
53 } else
54 {
55 $Output .= '</ul>';
56 $Output .= '<ul class="MenuItem2">';
57 $Output .= '<li>'.$this->System->User->Data['FullName'].'</li>';
58 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('UserLogout'), $this->System->Navigation->MakeLink('User', 'Logout')).'</li>';
59 $Output .= '<li>'.$this->System->HTML->MakeLink($this->System->Localization->Translate('UserView'), $this->System->Navigation->MakeLink('User', 'View',
60 array('Id' => $this->System->User->Id))).'</li>';
61 }
62 $Output .= '</ul></div>';
63 return($Output);
64 }
65
66 function PageMenu()
67 {
68 $Output = '';
69 //if($Output != '') $Output = '<ul class="PageMenu">'.$Output.'</ul>';
70 return($Output);
71 }
72
73 function Footer()
74 {
75 $Time = round($this->System->GetMicrotime() - $this->System->TimeStart, 2);
76 $Tag = new XMLTag('ul');
77 $Tag->Attributes = array('class' => 'Footer');
78 $AdminTag = new XMLTag('li');
79 $AdminTag->SubElements = $this->Admin;
80 $EmailTag = new XMLTag('li');
81 $EmailTag->SubElements = $this->AdminEmail;
82 $Tag->SubElements = array($AdminTag, $EmailTag);
83 if($this->ShowRuntimeInfo)
84 {
85 $ExecutionTimeTag = new XMLTag('li');
86 $ExecutionTimeTag->SubElements = 'Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s';
87 $Tag->SubElements[] = $ExecutionTimeTag;
88 $UsedMemoryTag = new XMLTag('li');
89 $UsedMemoryTag->SubElements = 'Použitá paměť: '.$this->System->PrefixMultiplier->AddPrefixMultipliers(memory_get_peak_usage(FALSE), 'B').' / '.ini_get('memory_limit').'B';
90 $Tag->SubElements[] = $UsedMemoryTag;
91 }
92 return($Tag);
93 }
94
95 function Show($Content)
96 {
97 $this->Document = new XHTMLDocument();
98 $BodyParam = '';
99 if($this->Load != '') $BodyParam .= ' onload="'.$this->Load.'"';
100 if($this->Unload != '') $BodyParam .= ' onunload="'.$this->Unload.'"';
101 $this->Document->Encoding = $this->Charset;
102 $this->Document->Formated = $this->FormatHTML;
103
104 $Style = new XMLTag('link');
105 $Style->Attributes = array('rel' => 'stylesheet', 'href' => 'Style/'.$this->Style.'/Style.css',
106 'type' => 'text/css', 'media' => 'all');
107 $this->Document->HeadTag->SubElements[] = $Style;
108
109 $JavaScript = new XMLTag('script');
110 $JavaScript->Attributes = array('type' => 'text/javascript', 'src' => 'Style/'.$this->Style.'/Global.js');
111 $JavaScript->ShringEmpty = false;
112 $this->Document->HeadTag->SubElements[] = $JavaScript;
113
114 $JavaScript = new XMLTag('script');
115 $JavaScript->Attributes = array('type' => 'text/javascript', 'src' => 'Style/'.$this->Style.'/jquery.js');
116 $JavaScript->ShringEmpty = false;
117 $this->Document->HeadTag->SubElements[] = $JavaScript;
118
119 $Title = $this->GlobalTitle;
120 if($this->Title != '') $Title .= ' - '.$this->Title;
121 $this->Document->TitleTag->SubElements = $Title;
122 $Title = '<span class="GlobalTitle">'.$this->GlobalTitle.'</span>';
123 if($this->Title != '') $Title .= ' - '.$this->Title;
124
125 $Keywords = new XMLTag('meta');
126 $Keywords->Attributes = array('name' => 'keywords', 'content' => implode(',', $this->Keywords));
127 $Keywords->ShringEmpty = false;
128 $this->Document->HeadTag->SubElements[] = $Keywords;
129
130 $this->Document->BodyTag->SubElements = array('<div class="TitlePanel">'.$Title.'</div>',
131$this->TopMenu(), $this->PageMenu(), $Content, $this->Footer());
132 return($this->Document->GetOutput());
133 }
134
135 function SystemMessage($Text)
136 {
137 return('<table align="center"><tr><td><div class="SystemMessage"><h3>Systémová zpráva</h3><div>'.$Text.'</div></div</td></tr></table>');
138 }
139}
Note: See TracBrowser for help on using the repository browser.