|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* PHPPgAdmin v6.0.0-beta.44 |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace PHPPgAdmin\XHtml; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class to render tables. Formerly part of Misc.php. |
|
11
|
|
|
*/ |
|
12
|
|
|
class HTMLFooterController extends HTMLController |
|
13
|
|
|
{ |
|
14
|
|
|
public $controller_name = 'HTMLFooterController'; |
|
15
|
|
|
private $_reload_drop_database = false; |
|
16
|
|
|
private $_no_bottom_link = false; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Sets the value of $_reload_drop_database which in turn will trigger a reload in the browser frame. |
|
20
|
|
|
* |
|
21
|
|
|
* @param bool $flag sets internal $_reload_drop_database var which will be passed to the footer methods |
|
22
|
|
|
* |
|
23
|
|
|
* @return HTMLFooterController $this the instance of this class |
|
24
|
|
|
*/ |
|
25
|
|
|
public function setReloadDropDatabase($flag) |
|
26
|
|
|
{ |
|
27
|
|
|
$this->_reload_drop_database = (bool) $flag; |
|
28
|
|
|
|
|
29
|
|
|
return $this; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Sets $_no_bottom_link boolean value. |
|
34
|
|
|
* |
|
35
|
|
|
* @param bool $flag [description] |
|
36
|
|
|
* |
|
37
|
|
|
* @return HTMLFooterController $this the instance of this class |
|
38
|
|
|
*/ |
|
39
|
|
|
public function setNoBottomLink($flag) |
|
40
|
|
|
{ |
|
41
|
|
|
$this->_no_bottom_link = (bool) $flag; |
|
42
|
|
|
|
|
43
|
|
|
return $this; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Prints the page footer. |
|
48
|
|
|
* |
|
49
|
|
|
* @param bool $doBody True to output body tag, false to return the html |
|
50
|
|
|
* @param mixed $template |
|
51
|
|
|
*/ |
|
52
|
|
|
public function printFooter($doBody = true, $template = 'footer.twig') |
|
53
|
|
|
{ |
|
54
|
|
|
$lang = $this->lang; |
|
|
|
|
|
|
55
|
|
|
|
|
56
|
|
|
$reload_param = 'none'; |
|
57
|
|
|
if ($this->misc->getReloadBrowser()) { |
|
58
|
|
|
$reload_param = 'other'; |
|
59
|
|
|
} elseif ($this->_reload_drop_database) { |
|
60
|
|
|
$reload_param = 'database'; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
$this->view->offsetSet('script_footer', ''); |
|
64
|
|
|
$this->view->offsetSet('reload', $reload_param); |
|
65
|
|
|
$this->view->offsetSet('footer_template', $template); |
|
66
|
|
|
$this->view->offsetSet('print_bottom_link', !$this->_no_bottom_link); |
|
67
|
|
|
|
|
68
|
|
|
$footer_html = $this->view->fetch($template); |
|
69
|
|
|
|
|
70
|
|
|
if ($doBody) { |
|
71
|
|
|
echo $footer_html; |
|
72
|
|
|
} else { |
|
73
|
|
|
return $footer_html; |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Outputs JavaScript to set default focus. |
|
79
|
|
|
* |
|
80
|
|
|
* @param string $object eg. forms[0].username |
|
81
|
|
|
*/ |
|
82
|
|
|
public function setFocus($object) |
|
83
|
|
|
{ |
|
84
|
|
|
echo "<script type=\"text/javascript\">\n"; |
|
85
|
|
|
echo " document.{$object}.focus();\n"; |
|
86
|
|
|
echo "</script>\n"; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Outputs JavaScript to set the name of the browser window. |
|
91
|
|
|
* |
|
92
|
|
|
* @param string $name the window name |
|
93
|
|
|
* @param bool $addServer if true (default) then the server id is |
|
94
|
|
|
* attached to the name |
|
95
|
|
|
*/ |
|
96
|
|
|
public function setWindowName($name, $addServer = true) |
|
97
|
|
|
{ |
|
98
|
|
|
echo "<script type=\"text/javascript\">\n"; |
|
99
|
|
|
echo "//<![CDATA[\n"; |
|
100
|
|
|
echo " window.name = '{$name}", ($addServer ? ':' . htmlspecialchars($this->misc->getServerId()) : ''), "';\n"; |
|
101
|
|
|
echo "//]]>\n"; |
|
102
|
|
|
echo "</script>\n"; |
|
103
|
|
|
} |
|
104
|
|
|
} |
|
105
|
|
|
|