当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::formatNumber方法代码示例

本文整理汇总了PHP中PMA\libraries\Util::formatNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::formatNumber方法的具体用法?PHP Util::formatNumber怎么用?PHP Util::formatNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMA\libraries\Util的用法示例。


在下文中一共展示了Util::formatNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPageBufferpool

 /**
  * returns html tables with stats over inno db buffer pool
  *
  * @return string  html table with stats
  */
 public function getPageBufferpool()
 {
     // The following query is only possible because we know
     // that we are on MySQL 5 here (checked above)!
     // side note: I love MySQL 5 for this. :-)
     $sql = '
          SHOW STATUS
         WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'
            OR Variable_name = \'Innodb_page_size\';';
     $status = $GLOBALS['dbi']->fetchResult($sql, 0, 1);
     $output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n" . '    <caption class="tblHeaders">' . "\n" . '        ' . __('Buffer Pool Usage') . "\n" . '    </caption>' . "\n" . '    <tfoot>' . "\n" . '        <tr>' . "\n" . '            <th colspan="2">' . "\n" . '                ' . __('Total') . "\n" . '                : ' . Util::formatNumber($status['Innodb_buffer_pool_pages_total'], 0) . '&nbsp;' . __('pages') . ' / ' . join('&nbsp;', Util::formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n" . '            </th>' . "\n" . '        </tr>' . "\n" . '    </tfoot>' . "\n" . '    <tbody>' . "\n" . '        <tr class="odd">' . "\n" . '            <th>' . __('Free pages') . '</th>' . "\n" . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_pages_free'], 0) . '</td>' . "\n" . '        </tr>' . "\n" . '        <tr class="even">' . "\n" . '            <th>' . __('Dirty pages') . '</th>' . "\n" . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0) . '</td>' . "\n" . '        </tr>' . "\n" . '        <tr class="odd">' . "\n" . '            <th>' . __('Pages containing data') . '</th>' . "\n" . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n" . '</td>' . "\n" . '        </tr>' . "\n" . '        <tr class="even">' . "\n" . '            <th>' . __('Pages to be flushed') . '</th>' . "\n" . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n" . '</td>' . "\n" . '        </tr>' . "\n" . '        <tr class="odd">' . "\n" . '            <th>' . __('Busy pages') . '</th>' . "\n" . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n" . '</td>' . "\n" . '        </tr>';
     // not present at least since MySQL 5.1.40
     if (isset($status['Innodb_buffer_pool_pages_latched'])) {
         $output .= '        <tr class="even">' . '            <th>' . __('Latched pages') . '</th>' . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_pages_latched'], 0) . '</td>' . '        </tr>';
     }
     $output .= '    </tbody>' . "\n" . '</table>' . "\n\n" . '<table class="data" id="table_innodb_bufferpool_activity">' . "\n" . '    <caption class="tblHeaders">' . "\n" . '        ' . __('Buffer Pool Activity') . "\n" . '    </caption>' . "\n" . '    <tbody>' . "\n" . '        <tr class="odd">' . "\n" . '            <th>' . __('Read requests') . '</th>' . "\n" . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n" . '</td>' . "\n" . '        </tr>' . "\n" . '        <tr class="even">' . "\n" . '            <th>' . __('Write requests') . '</th>' . "\n" . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n" . '</td>' . "\n" . '        </tr>' . "\n" . '        <tr class="odd">' . "\n" . '            <th>' . __('Read misses') . '</th>' . "\n" . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n" . '</td>' . "\n" . '        </tr>' . "\n" . '        <tr class="even">' . "\n" . '            <th>' . __('Write waits') . '</th>' . "\n" . '            <td class="value">' . Util::formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n" . '</td>' . "\n" . '        </tr>' . "\n" . '        <tr class="odd">' . "\n" . '            <th>' . __('Read misses in %') . '</th>' . "\n" . '            <td class="value">' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars(Util::formatNumber($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 3, 2)) . ' %') . "\n" . '</td>' . "\n" . '        </tr>' . "\n" . '        <tr class="even">' . "\n" . '            <th>' . __('Write waits in %') . '</th>' . "\n" . '            <td class="value">' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars(Util::formatNumber($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 3, 2)) . ' %') . "\n" . '</td>' . "\n" . '        </tr>' . "\n" . '    </tbody>' . "\n" . '</table>' . "\n";
     return $output;
 }
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:23,代码来源:Innodb.php

示例2: handleRealRowCountRequestAction

 /**
  * Handles request for real row count on database level view page.
  *
  * @return boolean true
  */
 public function handleRealRowCountRequestAction()
 {
     $ajax_response = $this->response;
     // If there is a request to update all table's row count.
     if (!isset($_REQUEST['real_row_count_all'])) {
         // Get the real row count for the table.
         $real_row_count = $this->dbi->getTable($this->db, $_REQUEST['table'])->getRealRowCountTable();
         // Format the number.
         $real_row_count = Util::formatNumber($real_row_count, 0);
         $ajax_response->addJSON('real_row_count', $real_row_count);
         return;
     }
     // Array to store the results.
     $real_row_count_all = array();
     // Iterate over each table and fetch real row count.
     foreach ($GLOBALS['tables'] as $table) {
         $row_count = $this->dbi->getTable($this->db, $table['TABLE_NAME'])->getRealRowCountTable();
         $real_row_count_all[] = array('table' => $table['TABLE_NAME'], 'row_count' => $row_count);
     }
     $ajax_response->addJSON('real_row_count_all', json_encode($real_row_count_all));
 }
开发者ID:netroby,项目名称:phpmyadmin,代码行数:26,代码来源:DatabaseStructureController.php

示例3: _formatVariable

 /**
  * Format Variable
  *
  * @param string  $name  variable name
  * @param integer $value variable value
  *
  * @return array formatted string and bool if string is HTML formatted
  */
 private function _formatVariable($name, $value)
 {
     $isHtmlFormatted = false;
     $formattedValue = $value;
     if (is_numeric($value)) {
         if (isset($this->variable_doc_links[$name][3]) && $this->variable_doc_links[$name][3] == 'byte') {
             $isHtmlFormatted = true;
             $formattedValue = '<abbr title="' . htmlspecialchars(Util::formatNumber($value, 0)) . '">' . htmlspecialchars(implode(' ', Util::formatByteDown($value, 3, 3))) . '</abbr>';
         } else {
             $formattedValue = Util::formatNumber($value, 0);
         }
     }
     return array($formattedValue, $isHtmlFormatted);
 }
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:22,代码来源:ServerVariablesController.php

示例4: _formatVariable

 /**
  * Format Variable
  *
  * @param string $name  variable name
  * @param number $value variable value
  *
  * @return string formatted string
  */
 private function _formatVariable($name, $value)
 {
     if (is_numeric($value)) {
         if (isset($this->variable_doc_links[$name][3]) && $this->variable_doc_links[$name][3] == 'byte') {
             return '<abbr title="' . Util::formatNumber($value, 0) . '">' . implode(' ', Util::formatByteDown($value, 3, 3)) . '</abbr>';
         } else {
             return Util::formatNumber($value, 0);
         }
     }
     return $value;
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:19,代码来源:ServerVariablesController.php

示例5: getHtmlVariables

 /**
  * Returns as HTML table of the engine's server variables
  *
  * @return string The table that was generated based on the retrieved
  *                information
  */
 public function getHtmlVariables()
 {
     $odd_row = false;
     $ret = '';
     foreach ($this->getVariablesStatus() as $details) {
         $ret .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" . '    <td>' . "\n";
         if (!empty($details['desc'])) {
             $ret .= '        ' . Util::showHint($details['desc']) . "\n";
         }
         $ret .= '    </td>' . "\n" . '    <th>' . htmlspecialchars($details['title']) . '</th>' . "\n" . '    <td class="value">';
         switch ($details['type']) {
             case PMA_ENGINE_DETAILS_TYPE_SIZE:
                 $parsed_size = $this->resolveTypeSize($details['value']);
                 $ret .= $parsed_size[0] . '&nbsp;' . $parsed_size[1];
                 unset($parsed_size);
                 break;
             case PMA_ENGINE_DETAILS_TYPE_NUMERIC:
                 $ret .= Util::formatNumber($details['value']) . ' ';
                 break;
             default:
                 $ret .= htmlspecialchars($details['value']) . '   ';
         }
         $ret .= '</td>' . "\n" . '</tr>' . "\n";
         $odd_row = !$odd_row;
     }
     if (!$ret) {
         $ret = '<p>' . "\n" . '    ' . __('There is no detailed status information available for this ' . 'storage engine.') . "\n" . '</p>' . "\n";
     } else {
         $ret = '<table class="data">' . "\n" . $ret . '</table>' . "\n";
     }
     return $ret;
 }
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:38,代码来源:StorageEngine.php


注:本文中的PMA\libraries\Util::formatNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。