From 4085ccd275d85a957db91cece1985ebaba6dc1ff Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Mon, 1 Feb 2016 19:53:45 +1100 Subject: [PATCH] Use templating Signed-off-by: Madhura Jayaratne --- .../server/ServerBinlogController.php | 73 +++++-------------- templates/server/binlog/log_selector.phtml | 28 +++++++ 2 files changed, 47 insertions(+), 54 deletions(-) create mode 100644 templates/server/binlog/log_selector.phtml diff --git a/libraries/controllers/server/ServerBinlogController.php b/libraries/controllers/server/ServerBinlogController.php index 3054ad29e8..893846e17c 100644 --- a/libraries/controllers/server/ServerBinlogController.php +++ b/libraries/controllers/server/ServerBinlogController.php @@ -13,6 +13,7 @@ use PMA\libraries\controllers\Controller; use PMA\libraries\DatabaseInterface; use PMA\libraries\Message; use PMA\libraries\Util; +use PMA\libraries\Template; /** * Handles viewing binary logs @@ -21,25 +22,25 @@ use PMA\libraries\Util; */ class ServerBinlogController extends Controller { - /** - * array binary log files - */ - protected $binary_logs; + /** + * array binary log files + */ + protected $binary_logs; - /** - * Constructs ServerBinlogController - */ - public function __construct() - { - parent::__construct(); - $this->binary_logs = $this->dbi->fetchResult( + /** + * Constructs ServerBinlogController + */ + public function __construct() + { + parent::__construct(); + $this->binary_logs = $this->dbi->fetchResult( 'SHOW MASTER LOGS', 'Log_name', null, null, DatabaseInterface::QUERY_STORE ); - } + } /** * Index action @@ -80,48 +81,12 @@ class ServerBinlogController extends Controller */ private function _getLogSelector($url_params) { - $html = ""; - if (count($this->binary_logs) > 1) { - $html .= '
'; - $html .= PMA_URL_getHiddenInputs($url_params); - $html .= '
'; - $html .= __('Select binary log to view'); - $html .= ''; - $html .= '
'; - $html .= '
'; - } - - return $html; + return Template::get('server/binlog/log_selector')->render( + array( + 'url_params' => $url_params, + 'binary_logs' => $this->binary_logs, + ) + ); } /** diff --git a/templates/server/binlog/log_selector.phtml b/templates/server/binlog/log_selector.phtml new file mode 100644 index 0000000000..c3ab733272 --- /dev/null +++ b/templates/server/binlog/log_selector.phtml @@ -0,0 +1,28 @@ +
+ +
+ + + + + + + 0): ?> + + +
+
+ +
+
\ No newline at end of file