showHint() public static method

Returns HTML code for a tooltip
public static showHint ( string $message ) : string
$message string the message for the tooltip
return string
 /**
  * Sets the import plugin properties.
  * Called in the constructor.
  *
  * @return void
  */
 protected function setProperties()
 {
     $this->_setAnalyze(false);
     if ($GLOBALS['plugin_param'] !== 'table') {
         $this->_setAnalyze(true);
     }
     $generalOptions = parent::setProperties();
     $this->properties->setText('CSV');
     $this->properties->setExtension('csv');
     if ($GLOBALS['plugin_param'] !== 'table') {
         $leaf = new BoolPropertyItem();
         $leaf->setName("col_names");
         $leaf->setText(__('The first line of the file contains the table column names' . ' <i>(if this is unchecked, the first line will become part' . ' of the data)</i>'));
         $generalOptions->addProperty($leaf);
     } else {
         $hint = new PMA\libraries\Message(__('If the data in each row of the file is not' . ' in the same order as in the database, list the corresponding' . ' column names here. Column names must be separated by commas' . ' and not enclosed in quotations.'));
         $leaf = new TextPropertyItem();
         $leaf->setName("columns");
         $leaf->setText(__('Column names: ') . PMA\libraries\Util::showHint($hint));
         $generalOptions->addProperty($leaf);
     }
     $leaf = new BoolPropertyItem();
     $leaf->setName("ignore");
     $leaf->setText(__('Do not abort on INSERT error'));
     $generalOptions->addProperty($leaf);
 }
示例#2
0
 /**
  * Set the content that needs to be shown in message
  *
  * @param string  $sorted_column_message the message for sorted column
  * @param array   $analyzed_sql_results  the analyzed query
  * @param integer $total                 the total number of rows returned by
  *                                       the SQL query without any
  *                                       programmatically appended LIMIT clause
  * @param integer $pos_next              the offset for next page
  * @param string  $pre_count             the string renders before row count
  * @param string  $after_count           the string renders after row count
  *
  * @return Message $message an object of Message
  *
  * @access  private
  *
  * @see     getTable()
  */
 private function _setMessageInformation($sorted_column_message, $analyzed_sql_results, $total, $pos_next, $pre_count, $after_count)
 {
     $unlim_num_rows = $this->__get('unlim_num_rows');
     // To use in isset()
     if (!empty($analyzed_sql_results['statement']->limit)) {
         $first_shown_rec = $analyzed_sql_results['statement']->limit->offset;
         $row_count = $analyzed_sql_results['statement']->limit->rowCount;
         if ($row_count < $total) {
             $last_shown_rec = $first_shown_rec + $row_count - 1;
         } else {
             $last_shown_rec = $first_shown_rec + $total - 1;
         }
     } elseif ($_SESSION['tmpval']['max_rows'] == self::ALL_ROWS || $pos_next > $total) {
         $first_shown_rec = $_SESSION['tmpval']['pos'];
         $last_shown_rec = $total - 1;
     } else {
         $first_shown_rec = $_SESSION['tmpval']['pos'];
         $last_shown_rec = $pos_next - 1;
     }
     $table = new Table($this->__get('table'), $this->__get('db'));
     if ($table->isView() && $total == $GLOBALS['cfg']['MaxExactCountViews']) {
         $message = Message::notice(__('This view has at least this number of rows. ' . 'Please refer to %sdocumentation%s.'));
         $message->addParam('[doc@cfg_MaxExactCount]');
         $message->addParam('[/doc]');
         $message_view_warning = Util::showHint($message);
     } else {
         $message_view_warning = false;
     }
     $message = Message::success(__('Showing rows %1s - %2s'));
     $message->addParam($first_shown_rec);
     if ($message_view_warning !== false) {
         $message->addParam('... ' . $message_view_warning, false);
     } else {
         $message->addParam($last_shown_rec);
     }
     $message->addMessage('(');
     if ($message_view_warning === false) {
         if (isset($unlim_num_rows) && $unlim_num_rows != $total) {
             $message_total = Message::notice($pre_count . __('%1$d total, %2$d in query'));
             $message_total->addParam($total);
             $message_total->addParam($unlim_num_rows);
         } else {
             $message_total = Message::notice($pre_count . __('%d total'));
             $message_total->addParam($total);
         }
         if (!empty($after_count)) {
             $message_total->addMessage($after_count);
         }
         $message->addMessage($message_total, '');
         $message->addMessage(', ', '');
     }
     $message_qt = Message::notice(__('Query took %01.4f seconds.') . ')');
     $message_qt->addParam($this->__get('querytime'));
     $message->addMessage($message_qt, '');
     if (!is_null($sorted_column_message)) {
         $message->addMessage($sorted_column_message, '');
     }
     return $message;
 }
 /**
  * Returns whether the row count is approximated
  *
  * @param array   $current_table array containing details about the table
  * @param boolean $table_is_view whether the table is a view
  *
  * @return array
  */
 protected function isRowCountApproximated($current_table, $table_is_view)
 {
     $approx_rows = false;
     $show_superscript = '';
     // there is a null value in the ENGINE
     // - when the table needs to be repaired, or
     // - when it's a view
     //  so ensure that we'll display "in use" below for a table
     //  that needs to be repaired
     if (isset($current_table['TABLE_ROWS']) && ($current_table['ENGINE'] != null || $table_is_view)) {
         // InnoDB table: we did not get an accurate row count
         $approx_rows = !$table_is_view && $current_table['ENGINE'] == 'InnoDB' && !$current_table['COUNTED'];
         if ($table_is_view && $current_table['TABLE_ROWS'] >= $GLOBALS['cfg']['MaxExactCountViews']) {
             $approx_rows = true;
             $show_superscript = Util::showHint(PMA_sanitize(sprintf(__('This view has at least this number of ' . 'rows. Please refer to %sdocumentation%s.'), '[doc@cfg_MaxExactCountViews]', '[/doc]')));
         }
     }
     return array($approx_rows, $show_superscript);
 }
/**
 * 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" . PMA_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">' . Util::getWithSelected($pmaThemeImage, $text_dir, "usersForm") . "\n";
    $html_output .= Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', __('Export'), 'b_tblexport.png', 'export');
    $html_output .= '<input type="hidden" name="initial" ' . 'value="' . (isset($_GET['initial']) ? $_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;
}
/**
 * Returns html with Settings dialog
 *
 * @return string
 */
function PMA_getHtmlForSettingsDialog()
{
    $retval = '<div class="popupContent settingsPopup">';
    $retval .= '<a href="#addNewChart">';
    $retval .= PMA\libraries\Util::getImage('b_chart.png') . __('Add chart');
    $retval .= '</a>';
    $retval .= '<a href="#rearrangeCharts">';
    $retval .= PMA\libraries\Util::getImage('b_tblops.png') . __('Enable charts dragging');
    $retval .= '</a>';
    $retval .= '<div class="clearfloat paddingtop"></div>';
    $retval .= '<div class="floatleft">';
    $retval .= __('Refresh rate') . '<br />';
    $retval .= ServerStatusData::getHtmlForRefreshList('gridChartRefresh', 5, array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200));
    $retval .= '<br />';
    $retval .= '</div>';
    $retval .= '<div class="floatleft">';
    $retval .= __('Chart columns');
    $retval .= '<br />';
    $retval .= '<select name="chartColumns">';
    $retval .= '<option>1</option>';
    $retval .= '<option>2</option>';
    $retval .= '<option>3</option>';
    $retval .= '<option>4</option>';
    $retval .= '<option>5</option>';
    $retval .= '<option>6</option>';
    $retval .= '</select>';
    $retval .= '</div>';
    $retval .= '<div class="clearfloat paddingtop">';
    $retval .= '<b>' . __('Chart arrangement') . '</b> ';
    $retval .= PMA\libraries\Util::showHint(__('The arrangement of the charts is stored to the browsers local storage. ' . 'You may want to export it if you have a complicated set up.'));
    $retval .= '<br/>';
    $retval .= '<a class="ajax" href="#importMonitorConfig">';
    $retval .= __('Import');
    $retval .= '</a>';
    $retval .= '&nbsp;&nbsp;';
    $retval .= '<a class="disableAjax" href="#exportMonitorConfig">';
    $retval .= __('Export');
    $retval .= '</a>';
    $retval .= '&nbsp;&nbsp;';
    $retval .= '<a href="#clearMonitorConfig">';
    $retval .= __('Reset to default');
    $retval .= '</a>';
    $retval .= '</div>';
    $retval .= '</div>';
    return $retval;
}
示例#6
0
 /**
  * Provides the main search form's html
  *
  * @return string HTML for selection form
  */
 public function getSelectionForm()
 {
     $html_output = '<a id="db_search"></a>';
     $html_output .= '<form id="db_search_form"' . ' class="ajax lock-page"' . ' method="post" action="db_search.php" name="db_search">';
     $html_output .= URL::getHiddenInputs($GLOBALS['db']);
     $html_output .= '<fieldset>';
     // set legend caption
     $html_output .= '<legend>' . __('Search in database') . '</legend>';
     $html_output .= '<table class="formlayout">';
     // inputbox for search phrase
     $html_output .= '<tr>';
     $html_output .= '<td>' . __('Words or values to search for (wildcard: "%"):') . '</td>';
     $html_output .= '<td><input type="text"' . ' name="criteriaSearchString" size="60"' . ' value="' . htmlspecialchars($this->_criteriaSearchString) . '" />';
     $html_output .= '</td>';
     $html_output .= '</tr>';
     // choices for types of search
     $html_output .= '<tr>';
     $html_output .= '<td class="right vtop">' . __('Find:') . '</td>';
     $html_output .= '<td>';
     $choices = array('1' => __('at least one of the words') . Util::showHint(__('Words are separated by a space character (" ").')), '2' => __('all words') . Util::showHint(__('Words are separated by a space character (" ").')), '3' => __('the exact phrase'), '4' => __('as regular expression') . ' ' . Util::showMySQLDocu('Regexp'));
     // 4th parameter set to true to add line breaks
     // 5th parameter set to false to avoid htmlspecialchars() escaping
     // in the label since we have some HTML in some labels
     $html_output .= Util::getRadioFields('criteriaSearchType', $choices, $this->_criteriaSearchType, true, false);
     $html_output .= '</td></tr>';
     // displays table names as select options
     $html_output .= '<tr>';
     $html_output .= '<td class="right vtop">' . __('Inside tables:') . '</td>';
     $html_output .= '<td rowspan="2">';
     $html_output .= '<select name="criteriaTables[]" size="6"' . ' multiple="multiple">';
     foreach ($this->_tables_names_only as $each_table) {
         if (in_array($each_table, $this->_criteriaTables)) {
             $is_selected = ' selected="selected"';
         } else {
             $is_selected = '';
         }
         $html_output .= '<option value="' . htmlspecialchars($each_table) . '"' . $is_selected . '>' . str_replace(' ', '&nbsp;', htmlspecialchars($each_table)) . '</option>';
     }
     // end for
     $html_output .= '</select>';
     $html_output .= '</td></tr>';
     // Displays 'select all' and 'unselect all' links
     $alter_select = '<a href="#" ' . 'onclick="setSelectOptions(\'db_search\',' . ' \'criteriaTables[]\', true); return false;">' . __('Select all') . '</a> &nbsp;/&nbsp;';
     $alter_select .= '<a href="#" ' . 'onclick="setSelectOptions(\'db_search\',' . ' \'criteriaTables[]\', false); return false;">' . __('Unselect all') . '</a>';
     $html_output .= '<tr><td class="right vbottom">' . $alter_select . '</td></tr>';
     // Inputbox for column name entry
     $html_output .= '<tr>';
     $html_output .= '<td class="right">' . __('Inside column:') . '</td>';
     $html_output .= '<td><input type="text" name="criteriaColumnName" size="60"' . 'value="' . (!empty($this->_criteriaColumnName) ? htmlspecialchars($this->_criteriaColumnName) : '') . '" /></td>';
     $html_output .= '</tr>';
     $html_output .= '</table>';
     $html_output .= '</fieldset>';
     $html_output .= '<fieldset class="tblFooters">';
     $html_output .= '<input type="submit" name="submit_search" value="' . __('Go') . '" id="buttonGo" />';
     $html_output .= '</fieldset>';
     $html_output .= '</form>';
     $html_output .= '<div id="togglesearchformdiv">' . '<a id="togglesearchformlink"></a></div>';
     return $html_output;
 }
 /**
  * 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;
 }