Passed
Push — develop ( 5ae676...d12c25 )
by Felipe
04:37
created

HTMLFooterController::printReload()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 21
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.3142
c 0
b 0
f 0
cc 3
eloc 17
nc 4
nop 2
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
     * [setReloadBrowser description].
20
     *
21
     * @param bool $flag sets internal $_reload_drop_database var which will be passed to the footer methods
22
     *
23
     * @return $this
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.
1 ignored issue
show
Coding Style introduced by
Doc comment short description must start with a capital letter
Loading history...
34
     *
35
     * @param bool $flag [description]
36
     *
37
     * @return $this
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 $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
        $footer_html  = '';
57
        $reload_param = 'none';
58
        if ($this->misc->getReloadBrowser()) {
59
            $reload_param = 'other';
60
        } elseif ($this->_reload_drop_database) {
61
            $reload_param = 'database';
62
        }
63
        if (!$this->_no_bottom_link) {
64
            $footer_html .= '<a data-footertemplate="' . $template . '" href="#" class="bottom_link">' . $lang['strgotoppage'] . '</a>';
65
        }
66
67
        $this->view->offsetSet('reload', $reload_param);
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 $object eg. forms[0].username
0 ignored issues
show
Documentation Bug introduced by
The doc comment eg. at position 0 could not be parsed: Unknown type name 'eg.' at position 0 in eg..
Loading history...
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.
0 ignored issues
show
Bug introduced by
The type PHPPgAdmin\XHtml\the was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
91
     *
92
     * @param $name the window name
93
     * @param $addServer if true (default) then the server id is
0 ignored issues
show
Bug introduced by
The type PHPPgAdmin\XHtml\if was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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