1 | <?php
|
---|
2 |
|
---|
3 | $ScriptStartTime = GetMicrotime();
|
---|
4 |
|
---|
5 | class Page extends Module
|
---|
6 | {
|
---|
7 | var $TimeStart;
|
---|
8 | var $PathTree = array('Informační systém',
|
---|
9 | 'index.php' => '',
|
---|
10 | );
|
---|
11 |
|
---|
12 | function __construct()
|
---|
13 | {
|
---|
14 | $this->TimeStart = GetMicrotime(); // Get script start time
|
---|
15 | }
|
---|
16 |
|
---|
17 | function SystemMessage($Title, $Text)
|
---|
18 | {
|
---|
19 | return('<table align="center"><tr><td><div class="SystemMessage"><h3>'.$Title.'</h3><div>'.$Text.'</div></div></td></tr></table>');
|
---|
20 | //ShowFooter();
|
---|
21 | //die();
|
---|
22 | }
|
---|
23 |
|
---|
24 | function ShowHeader($Title, $Path, $BodyParam = '')
|
---|
25 | {
|
---|
26 | $ScriptName = $_SERVER['SCRIPT_NAME'];
|
---|
27 | while(strpos($ScriptName, '//') !== false)
|
---|
28 | $ScriptName = str_replace('//', '/', $ScriptName);
|
---|
29 | $PathTreePath = '/';
|
---|
30 | $PathTreeItem = $this->PathTree;
|
---|
31 | $Navigation = '<a href="'.$this->System->Config['Web']['RootFolder'].$PathTreePath.'">'.$PathTreeItem[0].'</a> > ';
|
---|
32 | $ScriptName = substr($ScriptName, strlen($this->System->Config['Web']['RootFolder']));
|
---|
33 | $ScriptNameParts = explode('/', $ScriptName);
|
---|
34 | array_shift($ScriptNameParts);
|
---|
35 | foreach($ScriptNameParts as $ScriptNamePart)
|
---|
36 | {
|
---|
37 | //echo($ScriptNamePart.'<br>');
|
---|
38 | if(array_key_exists($ScriptNamePart, $PathTreeItem))
|
---|
39 | {
|
---|
40 | if(is_array($PathTreeItem[$ScriptNamePart]))
|
---|
41 | {
|
---|
42 | $PathTreeItem = $PathTreeItem[$ScriptNamePart];
|
---|
43 | $PathTreePath .= $ScriptNamePart.'/';
|
---|
44 | if($PathTreeItem[0] != '')
|
---|
45 | $Navigation .= '<a href="'.$this->System->Config['Web']['RootFolder'].$PathTreePath.'">'.$PathTreeItem[0].'</a> > ';
|
---|
46 | } else
|
---|
47 | {
|
---|
48 | if($PathTreeItem[$ScriptNamePart] != '')
|
---|
49 | $Navigation .= '<a href="'.$this->System->Config['Web']['RootFolder'].$PathTreePath.$ScriptNamePart.'">'.$PathTreeItem[$ScriptNamePart].'</a> > ';
|
---|
50 | }
|
---|
51 | }
|
---|
52 | }
|
---|
53 | $Navigation = substr($Navigation, 0, -6);
|
---|
54 |
|
---|
55 | $Output = '<?xml version="1.0" encoding="'.$this->System->Config['Web']['Charset'].'"?>'."\n".
|
---|
56 | '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.
|
---|
57 | '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">'.
|
---|
58 | '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->System->Config['Web']['Charset'].'" />'.
|
---|
59 | '<head><link rel="stylesheet" href="'.$this->System->Config['Web']['RootFolder'].'/style.css" type="text/css" media="all" />'.
|
---|
60 | '<script type="text/javascript" src="'.$this->System->Config['Web']['RootFolder'].'/global.js"></script>'.
|
---|
61 | '<title>'.$this->System->Config['Web']['Title'].' - '.$Path.'</title>
|
---|
62 | </head><body'.$BodyParam.'>';
|
---|
63 | return($Output);
|
---|
64 | }
|
---|
65 |
|
---|
66 | function ShowFooter()
|
---|
67 | {
|
---|
68 | global $ScriptStartTime;
|
---|
69 |
|
---|
70 | $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2);
|
---|
71 | $Output = '<div class="Footer">| Správa webu: '.$this->System->Config['Web']['Admin'].' | E-mail: '.$this->System->Config['Web']['AdminEmail'].' |';
|
---|
72 | if($this->System->Config['Web']['ShowRuntimeInfo'] == true) $Output .= ' Doba generování: '.$ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |';
|
---|
73 | $Output .= '</div></body></html>';
|
---|
74 | return($Output);
|
---|
75 | }
|
---|
76 |
|
---|
77 | function GetOutput()
|
---|
78 | {
|
---|
79 | $Output = $this->Show();
|
---|
80 | $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output;
|
---|
81 | $Output .= $this->ShowFooter();
|
---|
82 | //$Output = $this->FormatOutput($Output);
|
---|
83 | echo($Output);
|
---|
84 | }
|
---|
85 |
|
---|
86 | // Funkce formatovani vystupu
|
---|
87 | function FormatOutput($s)
|
---|
88 | {
|
---|
89 | $out = '';
|
---|
90 | $nn = 0;
|
---|
91 | $n = 0;
|
---|
92 | while($s != '')
|
---|
93 | {
|
---|
94 | $start = strpos($s, '<');
|
---|
95 | $end = strpos($s, '>');
|
---|
96 | if($start != 0)
|
---|
97 | {
|
---|
98 | $end = $start - 1;
|
---|
99 | $start = 0;
|
---|
100 | }
|
---|
101 | $line = trim(substr($s, $start, $end + 1));
|
---|
102 | if(strlen($line) > 0)
|
---|
103 | if($line[0] == '<')
|
---|
104 | {
|
---|
105 | if($s[$start + 1] == '/')
|
---|
106 | {
|
---|
107 | $n = $n - 2;
|
---|
108 | $nn = $n;
|
---|
109 | } else
|
---|
110 | {
|
---|
111 | if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1);
|
---|
112 | else $cmd = substr($line, 1, strlen($line) - 2);
|
---|
113 | //echo('['.$cmd.']');
|
---|
114 | if(strpos($s, '</'.$cmd.'>')) $n = $n + 2;
|
---|
115 | }
|
---|
116 | }// else $line = '['.$line.']';
|
---|
117 | //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n"));
|
---|
118 | if($line != '') $out .= (str_repeat(' ', $nn).$line."\n");
|
---|
119 | $s = substr($s, $end + 1, strlen($s));
|
---|
120 | $nn = $n;
|
---|
121 | }
|
---|
122 | return($out);
|
---|
123 | }
|
---|
124 | }
|
---|
125 |
|
---|
126 | ?>
|
---|