Permalink
Browse files

Refactor server_engines templates

Signed-off-by: Leonardo Strozzi <laps15@inf.ufpr.br>
  • Loading branch information...
laps15 committed Jun 27, 2018
1 parent 28d890f commit 36ceaee55ae0d15cfea57e961bd5f55fb951e800
@@ -43,57 +43,37 @@ public function indexAction()
'type' => 'engines',
])
);
$html = '';
/**
* Did the user request information about a certain storage engine?
*/
if (empty($_REQUEST['engine'])
|| ! StorageEngine::isValid($_REQUEST['engine'])
) {
$this->response->addHTML($this->_getHtmlForAllServerEngines());
$html = $this->template->render('server/engines/list_engines', [
'engines' => StorageEngine::getStorageEngines(),
]);
} else {
$engine = StorageEngine::getEngine($_REQUEST['engine']);
$this->response->addHTML($this->_getHtmlForServerEngine($engine));
}
}
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
$pageOutput = ! empty($page) ? $engine->getPage($page) : '';
/**
* Return HTML with all Storage Engine information
*
* @return string
*/
private function _getHtmlForAllServerEngines()
{
return $this->template->render('server/engines/engines', [
'engines' => StorageEngine::getStorageEngines(),
]);
}
/**
* Return HTML for a given Storage Engine
*
* @param StorageEngine $engine storage engine
*
* @return string
*/
private function _getHtmlForServerEngine(StorageEngine $engine)
{
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
$pageOutput = ! empty($page) ? $engine->getPage($page) : '';
/**
* Displays details about a given Storage Engine
*/
return $this->template->render('server/engines/engine', [
'title' => $engine->getTitle(),
'help_page' => $engine->getMysqlHelpPage(),
'comment' => $engine->getComment(),
'info_pages' => $engine->getInfoPages(),
'support' => $engine->getSupportInformationMessage(),
'variables' => $engine->getHtmlVariables(),
'page_output' => $pageOutput,
'page' => $page,
'engine' => $_REQUEST['engine'],
]);
/**
* Displays details about a given Storage Engine
*/
$html = $this->template->render('server/engines/show_engine', [
'title' => $engine->getTitle(),
'help_page' => $engine->getMysqlHelpPage(),
'comment' => $engine->getComment(),
'info_pages' => $engine->getInfoPages(),
'support' => $engine->getSupportInformationMessage(),
'variables' => $engine->getHtmlVariables(),
'page_output' => $pageOutput,
'page' => $page,
'engine' => $_REQUEST['engine'],
]);
}
$this->response->addHTML($html);
}
}

0 comments on commit 36ceaee

Please sign in to comment.