diff options
author | Amenadiel <amenadiel@gmail.com> | 2017-08-22 22:56:45 +0300 |
---|---|---|
committer | Amenadiel <amenadiel@gmail.com> | 2017-08-22 22:56:45 +0300 |
commit | ac0e4216805cb23fabf6bcf30ba773b076886dfc (patch) | |
tree | 5882dbf7d6a0372a302b80627cae3da03f220398 /src/controllers/IntroController.php | |
parent | 776f2afd4eca3986bbc2729e7653848707cc9302 (diff) |
simplifies routes and templates
Diffstat (limited to 'src/controllers/IntroController.php')
-rw-r--r-- | src/controllers/IntroController.php | 72 |
1 files changed, 28 insertions, 44 deletions
diff --git a/src/controllers/IntroController.php b/src/controllers/IntroController.php index 0f1d55a0..c45c18c0 100644 --- a/src/controllers/IntroController.php +++ b/src/controllers/IntroController.php @@ -12,23 +12,14 @@ class IntroController extends BaseController public function render() { - $conf = $this->conf; - $misc = $this->misc; - $lang = $this->lang; - $action = $this->action; - - $misc->setNoDBConnection(true); - $this->printHeader($lang['strintro']); - $this->printBody(); - - switch ($action) { - - default: - $this->doDefault(); - break; + if ($this->container->requestobj->getAttribute('route') === null) { + echo $this->doDefault(); + } else { + $body = $this->container->responseobj->getBody(); + $body->write($this->doDefault()); + return $this->container->responseobj; } - $this->printFooter(); } /** @@ -39,34 +30,25 @@ class IntroController extends BaseController public function doDefault() { - $conf = $this->conf; - $misc = $this->misc; - $lang = $this->lang; + $intro_html = $this->printHeader('Intro', $this->scripts, false); + $intro_html .= $this->printBody(false); - $appLangFiles = $this->appLangFiles; - $misc = $this->misc; - $appThemes = $this->appThemes; - $appName = $this->appName; - $appVersion = $this->appVersion; - - $misc->setNoDBConnection(true); - - $intro_html = $this->printTrail('root', false); + $intro_html .= $this->printTrail('root', false); $intro_html .= $this->printTabs('root', 'intro', false); - $intro_html .= "<h1> $appName $appVersion (PHP " . PHP_VERSION . ')</h1>'; + $intro_html .= '<h1>' . $this->appName . ' ' . $this->appVersion . ' (PHP ' . PHP_VERSION . ')</h1>'; $intro_html .= '<form method="get" action="intro.php">'; $intro_html .= '<table>'; $intro_html .= '<tr class="data1">'; - $intro_html .= '<th class="data">' . $lang['strlanguage'] . '</th>'; + $intro_html .= '<th class="data">' . $this->lang['strlanguage'] . '</th>'; $intro_html .= '<td>'; $intro_html .= '<select name="language" onchange="this.form.submit()">'; - $language = isset($_SESSION['webdbLanguage']) ? $_SESSION['webdbLanguage'] : 'english'; - foreach ($appLangFiles as $k => $v) { - $selected = ($k == $language) ? ' selected="selected"' : ''; + $this->language = isset($_SESSION['webdbLanguage']) ? $_SESSION['webdbLanguage'] : 'english'; + foreach ($this->appLangFiles as $k => $v) { + $selected = ($k == $this->language) ? ' selected="selected"' : ''; $intro_html .= "\t<option value=\"{$k}\"" . $selected . ">{$v}</option>\n"; } @@ -74,12 +56,12 @@ class IntroController extends BaseController $intro_html .= '</td>'; $intro_html .= '</tr>'; $intro_html .= '<tr class="data2">'; - $intro_html .= '<th class="data">' . $lang['strtheme'] . '</th>'; + $intro_html .= '<th class="data">' . $this->lang['strtheme'] . '</th>'; $intro_html .= '<td>'; $intro_html .= '<select name="theme" onchange="this.form.submit()">'; - foreach ($appThemes as $k => $v) { - $selected = ($k == $conf['theme']) ? ' selected="selected"' : ''; + foreach ($this->appThemes as $k => $v) { + $selected = ($k == $this->conf['theme']) ? ' selected="selected"' : ''; $intro_html .= "\t<option value=\"{$k}\"" . $selected . ">{$v}</option>\n"; } @@ -87,23 +69,25 @@ class IntroController extends BaseController $intro_html .= '</td>'; $intro_html .= '</tr>'; $intro_html .= '</table>'; - $intro_html .= '<noscript><p><input type="submit" value="' . $lang['stralter'] . '" /></p></noscript>'; + $intro_html .= '<noscript><p><input type="submit" value="' . $this->lang['stralter'] . '" /></p></noscript>'; $intro_html .= '</form>'; - $intro_html .= '<p>' . $lang['strintro'] . '</p>'; + $intro_html .= '<p>' . $this->lang['strintro'] . '</p>'; $intro_html .= '<ul class="intro">'; - $intro_html .= ' <li><a href="https://github.com/HuasoFoundries/phpPgAdmin6">' . $lang['strppahome'] . '</a></li>'; - $intro_html .= '<li><a href="' . $lang['strpgsqlhome_url'] . '">' . $lang['strpgsqlhome'] . '</a></li>'; - $intro_html .= '<li><a href="https://github.com/HuasoFoundries/phpPgAdmin6/issues">' . $lang['strreportbug'] . '</a></li>'; - //$intro_html .= '<li><a href="' . $lang['strviewfaq_url'] . '">' . $lang['strviewfaq'] . '</a></li>'; + $intro_html .= ' <li><a href="https://github.com/HuasoFoundries/phpPgAdmin6">' . $this->lang['strppahome'] . '</a></li>'; + $intro_html .= '<li><a href="' . $this->lang['strpgsqlhome_url'] . '">' . $this->lang['strpgsqlhome'] . '</a></li>'; + $intro_html .= '<li><a href="https://github.com/HuasoFoundries/phpPgAdmin6/issues">' . $this->lang['strreportbug'] . '</a></li>'; + //$intro_html .= '<li><a href="' . $this->lang['strviewfaq_url'] . '">' . $this->lang['strviewfaq'] . '</a></li>'; $intro_html .= '</ul>'; - if (isset($_GET['language'])) { - $misc->setReloadBrowser(true); + if ($this->container->requestobj->getQueryParam('language')) { + $this->misc->setReloadBrowser(true); } - echo $intro_html; + $intro_html .= $this->printFooter(false); + + return $intro_html; } } |