本文整理汇总了PHP中PMA\libraries\Template类的典型用法代码示例。如果您正苦于以下问题:PHP Template类的具体用法?PHP Template怎么用?PHP Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Template类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getHtmlForServerEngine
/**
* Return HTML for a given Storage Engine
*
* @param StorageEngine $engine storage engine
*
* @return string
*/
private function _getHtmlForServerEngine($engine)
{
$pageOutput = !empty($_REQUEST['page']) ? $engine->getPage($_REQUEST['page']) : '';
/**
* Displays details about a given Storage Engine
*/
return Template::get('server/engines/engine')->render(array('title' => $engine->getTitle(), 'helpPage' => $engine->getMysqlHelpPage(), 'comment' => $engine->getComment(), 'infoPages' => $engine->getInfoPages(), 'support' => $engine->getSupportInformationMessage(), 'variables' => $engine->getHtmlVariables(), 'pageOutput' => $pageOutput));
}
示例2: _getPluginsHtml
/**
* Returns the html for plugin Tab.
*
* @return string
*/
private function _getPluginsHtml()
{
$html = '<div id="plugins_plugins">';
$html .= Template::get('server/plugins/section_links')->render(array('plugins' => $this->plugins));
foreach ($this->plugins as $plugin_type => $plugin_list) {
$html .= Template::get('server/plugins/section')->render(array('plugin_type' => $plugin_type, 'plugin_list' => $plugin_list));
}
$html .= '</div>';
return $html;
}
示例3: getTrackingIcon
/**
* Returns the tracking icon if the table is tracked
*
* @param string $table table name
*
* @return string HTML for tracking icon
*/
protected function getTrackingIcon($table)
{
$tracking_icon = '';
if (Tracker::isActive()) {
$is_tracked = Tracker::isTracked($GLOBALS["db"], $table);
if ($is_tracked || Tracker::getVersion($GLOBALS["db"], $table) > 0) {
$tracking_icon = Template::get('database/structure/tracking_icon')->render(array('url_query' => $this->_url_query, 'truename' => $table, 'is_tracked' => $is_tracked));
}
}
return $tracking_icon;
}
示例4: getSelectorDisplay
/**
* Returns HTML code for the language selector
*
* @param boolean $use_fieldset whether to use fieldset for selection
* @param boolean $show_doc whether to show documentation links
*
* @return string
*
* @access public
*/
public function getSelectorDisplay($use_fieldset = false, $show_doc = true)
{
$_form_params = array('db' => $GLOBALS['db'], 'table' => $GLOBALS['table']);
// For non-English, display "Language" with emphasis because it's
// not a proper word in the current language; we show it to help
// people recognize the dialog
$language_title = __('Language') . (__('Language') != 'Language' ? ' - <em>Language</em>' : '');
if ($show_doc) {
$language_title .= Util::showDocu('faq', 'faq7-2');
}
$available_languages = $this->sortedLanguages();
return Template::get('select_lang')->render(array('language_title' => $language_title, 'use_fieldset' => $use_fieldset, 'available_languages' => $available_languages, '_form_params' => $_form_params));
}
示例5: PMA_getHtmlForAllTableSpecificRights
//.........这里部分代码省略.........
$privileges = array();
foreach ($db_rights as $row) {
$onePrivilege = array();
$paramTableName = '';
$paramRoutineName = '';
if ($type == 'database') {
$name = $row['Db'];
$onePrivilege['grant'] = $row['Grant_priv'] == 'Y';
$onePrivilege['tablePrivs'] = !empty($row['Table_priv']) || !empty($row['Column_priv']);
$onePrivilege['privileges'] = join(',', PMA_extractPrivInfo($row, true));
$paramDbName = $row['Db'];
} elseif ($type == 'table') {
$name = $row['Table_name'];
$onePrivilege['grant'] = in_array('Grant', explode(',', $row['Table_priv']));
$onePrivilege['columnPrivs'] = !empty($row['Column_priv']);
$onePrivilege['privileges'] = join(',', PMA_extractPrivInfo($row, true));
$paramDbName = $dbname;
$paramTableName = $row['Table_name'];
} else {
// routine
$name = $row['Routine_name'];
$onePrivilege['grant'] = in_array('Grant', explode(',', $row['Proc_priv']));
$privs = array('Alter_routine_priv' => 'N', 'Execute_priv' => 'N', 'Grant_priv' => 'N');
foreach (explode(',', $row['Proc_priv']) as $priv) {
if ($priv == 'Alter Routine') {
$privs['Alter_routine_priv'] = 'Y';
} else {
$privs[$priv . '_priv'] = 'Y';
}
}
$onePrivilege['privileges'] = join(',', PMA_extractPrivInfo($privs, true));
$paramDbName = $dbname;
$paramRoutineName = $row['Routine_name'];
}
$foundRows[] = $name;
$onePrivilege['name'] = $name;
$onePrivilege['editLink'] = '';
if ($GLOBALS['is_grantuser']) {
$onePrivilege['editLink'] = PMA_getUserLink('edit', $username, $hostname, $paramDbName, $paramTableName, $paramRoutineName);
}
$onePrivilege['revokeLink'] = '';
if ($type != 'database' || !empty($row['can_delete'])) {
$onePrivilege['revokeLink'] = PMA_getUserLink('revoke', $username, $hostname, $paramDbName, $paramTableName, $paramRoutineName);
}
$privileges[] = $onePrivilege;
}
$data = $uiData[$type];
$data['privileges'] = $privileges;
$data['userName'] = $username;
$data['hostName'] = $hostname;
$data['database'] = $dbname;
$data['type'] = $type;
if ($type == 'database') {
// we already have the list of databases from libraries/common.inc.php
// via $pma = new PMA;
$pred_db_array = $GLOBALS['pma']->databases;
$databases_to_skip = array('information_schema', 'performance_schema');
$databases = array();
if (!empty($pred_db_array)) {
foreach ($pred_db_array as $current_db) {
if (in_array($current_db, $databases_to_skip)) {
continue;
}
$current_db_escaped = Util::escapeMysqlWildcards($current_db);
// cannot use array_diff() once, outside of the loop,
// because the list of databases has special characters
// already escaped in $foundRows,
// contrary to the output of SHOW DATABASES
if (!in_array($current_db_escaped, $foundRows)) {
$databases[] = $current_db;
}
}
}
$data['databases'] = $databases;
} elseif ($type == 'table') {
$result = @$GLOBALS['dbi']->tryQuery("SHOW TABLES FROM " . Util::backquote($dbname), null, DatabaseInterface::QUERY_STORE);
$tables = array();
if ($result) {
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
if (!in_array($row[0], $foundRows)) {
$tables[] = $row[0];
}
}
$GLOBALS['dbi']->freeResult($result);
}
$data['tables'] = $tables;
} else {
// routine
$routineData = $GLOBALS['dbi']->getRoutines($dbname);
$routines = array();
foreach ($routineData as $routine) {
if (!in_array($routine['name'], $foundRows)) {
$routines[] = $routine['name'];
}
}
$data['routines'] = $routines;
}
$html_output = Template::get('privileges/privileges_summary')->render($data);
return $html_output;
}
示例6: _getHtmlForServerVariablesItems
/**
* Prints Html for Server Variables Items
*
* @param array $serverVars global variables
* @param array $serverVarsSession session variables
*
* @return string
*/
private function _getHtmlForServerVariablesItems($serverVars, $serverVarsSession)
{
// list of static (i.e. non-editable) system variables
$static_variables = $this->_getStaticSystemVariables();
$output = '';
foreach ($serverVars as $name => $value) {
$has_session_value = isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value;
$row_class = $has_session_value ? ' diffSession' : '';
$docLink = isset($this->variable_doc_links[$name]) ? $this->variable_doc_links[$name] : null;
list($formattedValue, $isHtmlFormatted) = $this->_formatVariable($name, $value);
$output .= Template::get('server/variables/variable_row')->render(array('rowClass' => $row_class, 'editable' => !in_array(strtolower($name), $static_variables), 'docLink' => $docLink, 'name' => $name, 'value' => $formattedValue, 'isSuperuser' => $this->dbi->isSuperuser(), 'isHtmlFormatted' => $isHtmlFormatted));
if ($has_session_value) {
list($formattedValue, $isHtmlFormatted) = $this->_formatVariable($name, $serverVarsSession[$name]);
$output .= Template::get('server/variables/session_variable_row')->render(array('rowClass' => $row_class, 'value' => $formattedValue, 'isHtmlFormatted' => $isHtmlFormatted));
}
}
return $output;
}
示例7: PMA_RTE_getList
//.........这里部分代码省略.........
default:
break;
}
$retval .= '">';
$retval .= URL::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
$retval .= "<fieldset>\n";
$retval .= " <legend>\n";
$retval .= " " . PMA_RTE_getWord('title') . "\n";
$retval .= " " . PMA\libraries\Util::showMySQLDocu(PMA_RTE_getWord('docu')) . "\n";
$retval .= " </legend>\n";
$retval .= " <div class='{$class1}' id='nothing2display'>\n";
$retval .= " " . PMA_RTE_getWord('nothing') . "\n";
$retval .= " </div>\n";
$retval .= " <table class='data{$class2}'>\n";
$retval .= " <!-- TABLE HEADERS -->\n";
$retval .= " <tr>\n";
// th cells with a colspan need corresponding td cells, according to W3C
switch ($type) {
case 'routine':
$retval .= " <th></th>\n";
$retval .= " <th>" . __('Name') . "</th>\n";
$retval .= " <th colspan='4'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Type') . "</th>\n";
$retval .= " <th>" . __('Returns') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n";
// see comment above
for ($i = 0; $i < 7; $i++) {
$retval .= " <td></td>\n";
}
break;
case 'trigger':
$retval .= " <th></th>\n";
$retval .= " <th>" . __('Name') . "</th>\n";
if (empty($table)) {
$retval .= " <th>" . __('Table') . "</th>\n";
}
$retval .= " <th colspan='3'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Time') . "</th>\n";
$retval .= " <th>" . __('Event') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n";
// see comment above
for ($i = 0; $i < (empty($table) ? 7 : 6); $i++) {
$retval .= " <td></td>\n";
}
break;
case 'event':
$retval .= " <th></th>\n";
$retval .= " <th>" . __('Name') . "</th>\n";
$retval .= " <th>" . __('Status') . "</th>\n";
$retval .= " <th colspan='3'>" . __('Action') . "</th>\n";
$retval .= " <th>" . __('Type') . "</th>\n";
$retval .= " </tr>\n";
$retval .= " <tr style='display: none'>\n";
// see comment above
for ($i = 0; $i < 6; $i++) {
$retval .= " <td></td>\n";
}
break;
default:
break;
}
$retval .= " </tr>\n";
$retval .= " <!-- TABLE DATA -->\n";
$count = 0;
foreach ($items as $item) {
$rowclass = $count % 2 == 0 ? 'odd' : 'even';
if ($GLOBALS['is_ajax_request'] && empty($_REQUEST['ajax_page_request'])) {
$rowclass .= ' ajaxInsert hide';
}
// Get each row from the correct function
switch ($type) {
case 'routine':
$retval .= PMA_RTN_getRowForList($item, $rowclass);
break;
case 'trigger':
$retval .= PMA_TRI_getRowForList($item, $rowclass);
break;
case 'event':
$retval .= PMA_EVN_getRowForList($item, $rowclass);
break;
default:
break;
}
$count++;
}
$retval .= " </table>\n";
if (count($items)) {
$retval .= '<div class="withSelected">';
$retval .= Template::get('select_all')->render(array('pmaThemeImage' => $GLOBALS['pmaThemeImage'], 'text_dir' => $GLOBALS['text_dir'], 'formName' => 'rteListForm'));
$retval .= PMA\libraries\Util::getButtonOrImage('submit_mult', 'mult_submit', __('Export'), 'b_export.png', 'export');
$retval .= PMA\libraries\Util::getButtonOrImage('submit_mult', 'mult_submit', __('Drop'), 'b_drop.png', 'drop');
$retval .= '</div>';
}
$retval .= "</fieldset>\n";
$retval .= "</form>\n";
$retval .= "<!-- LIST OF " . PMA_RTE_getWord('docu') . " END -->\n";
return $retval;
}
示例8: indexAction
/**
* Execute the query and return the result
*
* @return void
*/
public function indexAction()
{
if (isset($_REQUEST['ajax_request']) && isset($_REQUEST['pos']) && isset($_REQUEST['session_max_rows'])) {
$this->ajaxAction();
return;
}
// Throw error if no sql query is set
if (!isset($this->sql_query) || $this->sql_query == '') {
$this->response->setRequestStatus(false);
$this->response->addHTML(Message::error(__('No SQL query was set to fetch data.')));
return;
}
$this->response->getHeader()->getScripts()->addFiles(array('chart.js', 'tbl_chart.js', 'jqplot/jquery.jqplot.js', 'jqplot/plugins/jqplot.barRenderer.js', 'jqplot/plugins/jqplot.canvasAxisLabelRenderer.js', 'jqplot/plugins/jqplot.canvasTextRenderer.js', 'jqplot/plugins/jqplot.categoryAxisRenderer.js', 'jqplot/plugins/jqplot.dateAxisRenderer.js', 'jqplot/plugins/jqplot.pointLabels.js', 'jqplot/plugins/jqplot.pieRenderer.js', 'jqplot/plugins/jqplot.highlighter.js'));
/**
* Extract values for common work
* @todo Extract common files
*/
$db =& $this->db;
$table =& $this->table;
/**
* Runs common work
*/
if (mb_strlen($this->table)) {
$url_params['goto'] = Util::getScriptNameForOption($this->cfg['DefaultTabTable'], 'table');
$url_params['back'] = 'tbl_sql.php';
include 'libraries/tbl_common.inc.php';
include 'libraries/tbl_info.inc.php';
} elseif (mb_strlen($this->db)) {
$url_params['goto'] = Util::getScriptNameForOption($this->cfg['DefaultTabDatabase'], 'database');
$url_params['back'] = 'sql.php';
include 'libraries/db_common.inc.php';
} else {
$url_params['goto'] = Util::getScriptNameForOption($this->cfg['DefaultTabServer'], 'server');
$url_params['back'] = 'sql.php';
include 'libraries/server_common.inc.php';
}
$data = array();
$result = $this->dbi->tryQuery($this->sql_query);
$fields_meta = $this->dbi->getFieldsMeta($result);
while ($row = $this->dbi->fetchAssoc($result)) {
$data[] = $row;
}
$keys = array_keys($data[0]);
$numeric_types = array('int', 'real');
$numeric_column_count = 0;
foreach ($keys as $idx => $key) {
if (in_array($fields_meta[$idx]->type, $numeric_types)) {
$numeric_column_count++;
}
}
if ($numeric_column_count == 0) {
$this->response->setRequestStatus(false);
$this->response->addJSON('message', __('No numeric columns present in the table to plot.'));
return;
}
$url_params['db'] = $this->db;
$url_params['reload'] = 1;
/**
* Displays the page
*/
$this->response->addHTML(Template::get('table/chart/tbl_chart')->render(array('url_query' => $this->url_query, 'url_params' => $url_params, 'keys' => $keys, 'fields_meta' => $fields_meta, 'numeric_types' => $numeric_types, 'numeric_column_count' => $numeric_column_count, 'sql_query' => $this->sql_query)));
}
示例9:
/**
* Returns the html for server Character Sets and Collations.
*
* @param array $mysqlCharsets Mysql Charsets list
* @param array $mysqlCollations Mysql Collations list
* @param array $mysqlCharsetsDesc Charsets descriptions
* @param array $mysqlDftCollations Default Collations list
*
* @return string
*/
function _getHtmlForCharsets($mysqlCharsets, $mysqlCollations, $mysqlCharsetsDesc, $mysqlDftCollations)
{
return Template::get('server/collations/charsets')->render(array('mysqlCharsets' => $mysqlCharsets, 'mysqlCollations' => $mysqlCollations, 'mysqlCharsetsDesc' => $mysqlCharsetsDesc, 'mysqlDftCollations' => $mysqlDftCollations));
}
示例10: _getOptionsBlock
/**
* Prepare option fields block
*
* @return string $options_html html content
*
* @access private
*
* @see _getTableHeaders()
*/
private function _getOptionsBlock()
{
$options_html = '';
$options_html .= '<form method="post" action="sql.php" ' . 'name="displayOptionsForm"';
$options_html .= ' class="ajax print_ignore" ';
$options_html .= '>';
$url_params = array('db' => $this->__get('db'), 'table' => $this->__get('table'), 'sql_query' => $this->__get('sql_query'), 'goto' => $this->__get('goto'), 'display_options_form' => 1);
$options_html .= URL::getHiddenInputs($url_params) . '<br />' . Util::getDivForSliderEffect('', __('Options')) . '<fieldset>';
$options_html .= '<div class="formelement">';
$choices = array('P' => __('Partial texts'), 'F' => __('Full texts'));
// pftext means "partial or full texts" (done to reduce line lengths)
$options_html .= Util::getRadioFields('pftext', $choices, $_SESSION['tmpval']['pftext'], true, true, '', 'pftext_' . $this->__get('unique_id')) . '</div>';
if ($GLOBALS['cfgRelation']['relwork'] && $GLOBALS['cfgRelation']['displaywork']) {
$options_html .= '<div class="formelement">';
$choices = array('K' => __('Relational key'), 'D' => __('Display column for relations'));
$options_html .= Util::getRadioFields('relational_display', $choices, $_SESSION['tmpval']['relational_display'], true, true, '', 'relational_display_' . $this->__get('unique_id')) . '</div>';
}
$options_html .= '<div class="formelement">' . Template::get('checkbox')->render(array('html_field_name' => 'display_binary', 'label' => __('Show binary contents'), 'checked' => !empty($_SESSION['tmpval']['display_binary']), 'onclick' => false, 'html_field_id' => 'display_binary_' . $this->__get('unique_id'))) . '<br />' . Template::get('checkbox')->render(array('html_field_name' => 'display_blob', 'label' => __('Show BLOB contents'), 'checked' => !empty($_SESSION['tmpval']['display_blob']), 'onclick' => false, 'html_field_id' => 'display_blob_' . $this->__get('unique_id'))) . '</div>';
// I would have preferred to name this "display_transformation".
// This is the only way I found to be able to keep this setting sticky
// per SQL query, and at the same time have a default that displays
// the transformations.
$options_html .= '<div class="formelement">' . Template::get('checkbox')->render(array('html_field_name' => 'hide_transformation', 'label' => __('Hide browser transformation'), 'checked' => !empty($_SESSION['tmpval']['hide_transformation']), 'onclick' => false, 'html_field_id' => 'hide_transformation_' . $this->__get('unique_id'))) . '</div>';
$options_html .= '<div class="formelement">';
$choices = array('GEOM' => __('Geometry'), 'WKT' => __('Well Known Text'), 'WKB' => __('Well Known Binary'));
$options_html .= Util::getRadioFields('geoOption', $choices, $_SESSION['tmpval']['geoOption'], true, true, '', 'geoOption_' . $this->__get('unique_id'));
$options_html .= '</div>';
$options_html .= '<div class="clearfloat"></div>' . '</fieldset>';
$options_html .= '<fieldset class="tblFooters">' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</div>' . '</form>';
return $options_html;
}
示例11: array
$partition['node_group'] = '';
}
if ($subpartition_count > 1 && $partitionDetails['can_have_subpartitions'] == true) {
// Has subpartitions
$partition['subpartition_count'] = $subpartition_count;
if (!isset($partition['subpartitions'])) {
$partition['subpartitions'] = array();
}
$subpartitions =& $partition['subpartitions'];
// Remove details of the additional subpartitions
// when number of subpartitions have been reduced
array_splice($subpartitions, $subpartition_count);
for ($j = 0; $j < $subpartition_count; $j++) {
if (!isset($subpartitions[$j])) {
// Newly added subpartition
$subpartitions[$j] = array('name' => $partition['name'] . '_s' . $j, 'engine' => '', 'comment' => '', 'data_directory' => '', 'index_directory' => '', 'max_rows' => '', 'min_rows' => '', 'tablespace' => '', 'node_group' => '');
}
$subpartition =& $subpartitions[$j];
$subpartition['prefix'] = 'partitions[' . $i . ']' . '[subpartitions][' . $j . ']';
}
} else {
// No subpartitions
unset($partition['subpartitions']);
unset($partition['subpartition_count']);
}
}
$partitionDetails['partitions'] = $partitions;
}
}
echo Template::get('columns_definitions/partitions')->render(array('partitionDetails' => $partitionDetails));
示例12: _getAllLogItemInfo
/**
* Returns the html for all binary log items.
*
* @param resource $result MySQL Query result
* @param bool $dontlimitchars Whether limit chars
*
* @return string
*/
private function _getAllLogItemInfo($result, $dontlimitchars)
{
$html = "";
$odd_row = true;
while ($value = $this->dbi->fetchAssoc($result)) {
$html .= Template::get('server/binlog/log_row')->render(array('odd_row' => $odd_row, 'value' => $value, 'dontlimitchars' => $dontlimitchars));
$odd_row = !$odd_row;
}
return $html;
}
示例13: PMA_getUsersOverview
/**
* Get HTML for display the users overview
* (if less than 50 users, display them immediately)
*
* @param array $result ran sql query
* @param array $db_rights user's database rights array
* @param string $pmaThemeImage a image source link
* @param string $text_dir text directory
*
* @return string HTML snippet
*/
function PMA_getUsersOverview($result, $db_rights, $pmaThemeImage, $text_dir)
{
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
$row['privs'] = PMA_extractPrivInfo($row, true);
$db_rights[$row['User']][$row['Host']] = $row;
}
@$GLOBALS['dbi']->freeResult($result);
$user_group_count = 0;
if ($GLOBALS['cfgRelation']['menuswork']) {
$user_group_count = PMA_getUserGroupCount();
}
$html_output = '<form name="usersForm" id="usersForm" action="server_privileges.php" ' . 'method="post">' . "\n" . URL::getHiddenInputs('', '') . '<table id="tableuserrights" class="data">' . "\n" . '<thead>' . "\n" . '<tr><th></th>' . "\n" . '<th>' . __('User name') . '</th>' . "\n" . '<th>' . __('Host name') . '</th>' . "\n" . '<th>' . __('Password') . '</th>' . "\n" . '<th>' . __('Global privileges') . ' ' . Util::showHint(__('Note: MySQL privilege names are expressed in English.')) . '</th>' . "\n";
if ($GLOBALS['cfgRelation']['menuswork']) {
$html_output .= '<th>' . __('User group') . '</th>' . "\n";
}
$html_output .= '<th>' . __('Grant') . '</th>' . "\n" . '<th colspan="' . ($user_group_count > 0 ? '3' : '2') . '">' . __('Action') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n";
$html_output .= '<tbody>' . "\n";
$html_output .= PMA_getHtmlTableBodyForUserRights($db_rights);
$html_output .= '</tbody>' . '</table>' . "\n";
$html_output .= '<div class="floatleft">' . Template::get('select_all')->render(array('pmaThemeImage' => $pmaThemeImage, 'text_dir' => $text_dir, 'formName' => 'usersForm')) . "\n";
$html_output .= Util::getButtonOrImage('submit_mult', 'mult_submit', __('Export'), 'b_tblexport.png', 'export');
$html_output .= '<input type="hidden" name="initial" ' . 'value="' . (isset($_GET['initial']) ? htmlspecialchars($_GET['initial']) : '') . '" />';
$html_output .= '</div>' . '<div class="clear_both" style="clear:both"></div>';
// add/delete user fieldset
$html_output .= PMA_getFieldsetForAddDeleteUser();
$html_output .= '</form>' . "\n";
return $html_output;
}
示例14: getTableStats
/**
* Get HTML snippet for display table statistics
*
* @return string $html_output
*/
protected function getTableStats()
{
if (empty($this->_showtable)) {
$this->_showtable = $this->dbi->getTable($this->db, $this->table)->getStatusInfo(null, true);
}
if (empty($this->_showtable['Data_length'])) {
$this->_showtable['Data_length'] = 0;
}
if (empty($this->_showtable['Index_length'])) {
$this->_showtable['Index_length'] = 0;
}
$is_innodb = isset($this->_showtable['Type']) && $this->_showtable['Type'] == 'InnoDB';
$mergetable = $this->table_obj->isMerge();
// this is to display for example 261.2 MiB instead of 268k KiB
$max_digits = 3;
$decimals = 1;
list($data_size, $data_unit) = Util::formatByteDown($this->_showtable['Data_length'], $max_digits, $decimals);
if ($mergetable == false) {
list($index_size, $index_unit) = Util::formatByteDown($this->_showtable['Index_length'], $max_digits, $decimals);
}
// InnoDB returns a huge value in Data_free, do not use it
if (!$is_innodb && isset($this->_showtable['Data_free']) && $this->_showtable['Data_free'] > 0) {
list($free_size, $free_unit) = Util::formatByteDown($this->_showtable['Data_free'], $max_digits, $decimals);
list($effect_size, $effect_unit) = Util::formatByteDown($this->_showtable['Data_length'] + $this->_showtable['Index_length'] - $this->_showtable['Data_free'], $max_digits, $decimals);
} else {
list($effect_size, $effect_unit) = Util::formatByteDown($this->_showtable['Data_length'] + $this->_showtable['Index_length'], $max_digits, $decimals);
}
list($tot_size, $tot_unit) = Util::formatByteDown($this->_showtable['Data_length'] + $this->_showtable['Index_length'], $max_digits, $decimals);
if ($this->_table_info_num_rows > 0) {
list($avg_size, $avg_unit) = Util::formatByteDown(($this->_showtable['Data_length'] + $this->_showtable['Index_length']) / $this->_showtable['Rows'], 6, 1);
} else {
$avg_size = $avg_unit = '';
}
return Template::get('table/structure/display_table_stats')->render(array('showtable' => $this->_showtable, 'table_info_num_rows' => $this->_table_info_num_rows, 'tbl_is_view' => $this->_tbl_is_view, 'db_is_system_schema' => $this->_db_is_system_schema, 'tbl_storage_engine' => $this->_tbl_storage_engine, 'url_query' => $this->_url_query, 'tbl_collation' => $this->_tbl_collation, 'is_innodb' => $is_innodb, 'mergetable' => $mergetable, 'avg_size' => isset($avg_size) ? $avg_size : null, 'avg_unit' => isset($avg_unit) ? $avg_unit : null, 'data_size' => $data_size, 'data_unit' => $data_unit, 'index_size' => isset($index_size) ? $index_size : null, 'index_unit' => isset($index_unit) ? $index_unit : null, 'free_size' => isset($free_size) ? $free_size : null, 'free_unit' => isset($free_unit) ? $free_unit : null, 'effect_size' => $effect_size, 'effect_unit' => $effect_unit, 'tot_size' => $tot_size, 'tot_unit' => $tot_unit));
}
示例15: indexAction
/**
* Index
*
* @return void
*/
public function indexAction()
{
// Send table of column names to populate corresponding dropdowns depending
// on the current selection
if (isset($_REQUEST['getDropdownValues']) && $_REQUEST['getDropdownValues'] === 'true') {
// if both db and table are selected
if (isset($_REQUEST['foreignTable'])) {
$this->getDropdownValueForTableAction();
} else {
// if only the db is selected
$this->getDropdownValueForDbAction();
}
return;
}
$this->response->getHeader()->getScripts()->addFiles(array('tbl_relation.js', 'indexes.js'));
// Gets tables information
include_once 'libraries/tbl_info.inc.php';
// updates for Internal relations
if (isset($_POST['destination_db']) && $this->cfgRelation['relwork']) {
$this->updateForInternalRelationAction();
}
// updates for foreign keys
if (isset($_POST['destination_foreign_db'])) {
$this->updateForForeignKeysAction();
}
// Updates for display field
if ($this->cfgRelation['displaywork'] && isset($_POST['display_field'])) {
$this->updateForDisplayField();
}
// If we did an update, refresh our data
if (isset($_POST['destination_db']) && $this->cfgRelation['relwork']) {
$this->existrel = PMA_getForeigners($this->db, $this->table, '', 'internal');
}
if (isset($_POST['destination_foreign_db']) && Util::isForeignKeySupported($this->tbl_storage_engine)) {
$this->existrel_foreign = PMA_getForeigners($this->db, $this->table, '', 'foreign');
}
if ($this->cfgRelation['displaywork']) {
$this->disp = PMA_getDisplayField($this->db, $this->table);
}
// display secondary level tabs if necessary
$engine = $this->dbi->getTable($this->db, $this->table)->getStatusInfo('ENGINE');
$this->response->addHTML(Template::get('table/secondary_tabs')->render(array('url_params' => array('db' => $GLOBALS['db'], 'table' => $GLOBALS['table']), 'engine' => $engine)));
$this->response->addHTML('<div id="structure_content">');
/**
* Dialog
*/
// Now find out the columns of our $table
// need to use DatabaseInterface::QUERY_STORE with $this->dbi->numRows()
// in mysqli
$columns = $this->dbi->getColumns($this->db, $this->table);
// common form
$this->response->addHTML(Template::get('table/relation/common_form')->render(array('db' => $this->db, 'table' => $this->table, 'columns' => $columns, 'cfgRelation' => $this->cfgRelation, 'tbl_storage_engine' => $this->tbl_storage_engine, 'existrel' => isset($this->existrel) ? $this->existrel : array(), 'existrel_foreign' => isset($this->existrel_foreign) ? $this->existrel_foreign['foreign_keys_data'] : array(), 'options_array' => $this->options_array)));
if (Util::isForeignKeySupported($this->tbl_storage_engine)) {
$this->response->addHTML(PMA_getHtmlForDisplayIndexes());
}
$this->response->addHTML('</div>');
}