Skip to content

Commit

Permalink
Refactoring db print view
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Delisle <marc@infomarc.info>
  • Loading branch information
lem9 committed Aug 24, 2014
1 parent 7ee56a7 commit 12ceeed
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
31 changes: 13 additions & 18 deletions db_printview.php
Expand Up @@ -10,6 +10,7 @@
*
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/db_printview.lib.php';

$response = PMA_Response::getInstance();
$header = $response->getHeader();
Expand Down Expand Up @@ -115,30 +116,24 @@
echo '<table width="100%">';

if (! empty($sts_data['Create_time'])) {
echo '<tr>';
echo '<td class="right">' . __('Creation:') . '</td>';
echo '<td class="right">';
echo PMA_Util::localisedDate(strtotime($sts_data['Create_time']));
echo '</td>';
echo '</tr>';
echo PMA_getHtmlForOneDate(
__('Creation:'),
$sts_data['Create_time']
);
}

if (! empty($sts_data['Update_time'])) {
echo '<tr>';
echo '<td class="right">' . __('Last update:') . '</td>';
echo '<td class="right">';
echo PMA_Util::localisedDate(strtotime($sts_data['Update_time']));
echo '</td>';
echo '</tr>';
echo PMA_getHtmlForOneDate(
__('Last update:'),
$sts_data['Update_time']
);
}

if (! empty($sts_data['Check_time'])) {
echo '<tr>';
echo '<td class="right">' . __('Last check:') . '</td>';
echo '<td class="right">';
echo PMA_Util::localisedDate(strtotime($sts_data['Check_time']));
echo '</td>';
echo '</tr>';
echo PMA_getHtmlForOneDate(
__('Last check:'),
$sts_data['Check_time']
);
}
echo '</table>';
}
Expand Down
30 changes: 30 additions & 0 deletions libraries/db_printview.lib.php
@@ -0,0 +1,30 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Set of functions related to db printview
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}

/**
* Function to get html for one of the db dates
*
* @param string $title the title
* @param string $date which date to display
*
* @return string html content
*/
function PMA_getHtmlForOneDate($title, $date)
{
$html = '<tr>'
. '<td class="right">' . $title . '</td>'
. '<td class="right">'
. PMA_Util::localisedDate(strtotime($date))
. '</td>'
. '</tr>';
return $html;
}
?>

0 comments on commit 12ceeed

Please sign in to comment.