本文整理汇总了PHP中PMA_Table::sGetToolTip方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Table::sGetToolTip方法的具体用法?PHP PMA_Table::sGetToolTip怎么用?PHP PMA_Table::sGetToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Table
的用法示例。
在下文中一共展示了PMA_Table::sGetToolTip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_showMessage
/**
* displays the message and the query
* usually the message is the result of the query executed
*
* @param string $message the message to display
* @param string $sql_query the query to display
* @param string $type the type (level) of the message
* @global array the configuration array
* @uses $cfg
* @access public
*/
function PMA_showMessage($message, $sql_query = null, $type = 'notice')
{
global $cfg;
if (null === $sql_query) {
if (!empty($GLOBALS['display_query'])) {
$sql_query = $GLOBALS['display_query'];
} elseif ($cfg['SQP']['fmtType'] == 'none' && !empty($GLOBALS['unparsed_sql'])) {
$sql_query = $GLOBALS['unparsed_sql'];
} elseif (!empty($GLOBALS['sql_query'])) {
$sql_query = $GLOBALS['sql_query'];
} else {
$sql_query = '';
}
}
// Corrects the tooltip text via JS if required
// @todo this is REALLY the wrong place to do this - very unexpected here
if (strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {
$tooltip = PMA_Table::sGetToolTip($GLOBALS['db'], $GLOBALS['table']);
$uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false);
echo "\n";
echo '<script type="text/javascript">' . "\n";
echo '//<![CDATA[' . "\n";
echo "if (window.parent.updateTableTitle) window.parent.updateTableTitle('" . $uni_tbl . "', '" . PMA_jsFormat($tooltip, false) . "');" . "\n";
echo '//]]>' . "\n";
echo '</script>' . "\n";
}
// end if ... elseif
// Checks if the table needs to be repaired after a TRUNCATE query.
// @todo what about $GLOBALS['display_query']???
// @todo this is REALLY the wrong place to do this - very unexpected here
if (strlen($GLOBALS['table']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
if (PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Index_length') > 1024) {
PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
}
}
unset($tbl_status);
echo '<div align="' . $GLOBALS['cell_align_left'] . '">' . "\n";
if ($message instanceof PMA_Message) {
if (isset($GLOBALS['special_message'])) {
$message->addMessage($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
$message->display();
$type = $message->getLevel();
} else {
echo '<div class="' . $type . '">';
echo PMA_sanitize($message);
if (isset($GLOBALS['special_message'])) {
echo PMA_sanitize($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
echo '</div>';
}
if ($cfg['ShowSQL'] == true && !empty($sql_query)) {
// Html format the query to be displayed
// If we want to show some sql code it is easiest to create it here
/* SQL-Parser-Analyzer */
if (!empty($GLOBALS['show_as_php'])) {
$new_line = '\\n"<br />' . "\n" . ' . "';
$query_base = htmlspecialchars(addslashes($sql_query));
$query_base = preg_replace('/((\\015\\012)|(\\015)|(\\012))/', $new_line, $query_base);
} else {
$query_base = $sql_query;
}
$query_too_big = false;
if (strlen($query_base) > $cfg['MaxCharactersInDisplayedSQL']) {
// when the query is large (for example an INSERT of binary
// data), the parser chokes; so avoid parsing the query
$query_too_big = true;
$shortened_query_base = nl2br(htmlspecialchars(substr($sql_query, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]'));
} elseif (!empty($GLOBALS['parsed_sql']) && $query_base == $GLOBALS['parsed_sql']['raw']) {
// (here, use "! empty" because when deleting a bookmark,
// $GLOBALS['parsed_sql'] is set but empty
$parsed_sql = $GLOBALS['parsed_sql'];
} else {
// Parse SQL if needed
$parsed_sql = PMA_SQP_parse($query_base);
}
// Analyze it
if (isset($parsed_sql)) {
$analyzed_display_query = PMA_SQP_analyze($parsed_sql);
// Here we append the LIMIT added for navigation, to
// enable its display. Adding it higher in the code
// to $sql_query would create a problem when
// using the Refresh or Edit links.
// Only append it on SELECTs.
/**
* @todo what would be the best to do when someone hits Refresh:
* use the current LIMITs ?
//.........这里部分代码省略.........
示例2: PMA_showMessage
/**
* displays the message and the query
* usually the message is the result of the query executed
*
* @param string $message the message to display
* @param string $sql_query the query to display
* @param string $type the type (level) of the message
* @param boolean $is_view is this a message after a VIEW operation?
*
* @return string
*
* @access public
*/
function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view = false)
{
/*
* PMA_ajaxResponse uses this function to collect the string of HTML generated
* for showing the message. Use output buffering to collect it and return it
* in a string. In some special cases on sql.php, buffering has to be disabled
* and hence we check with $GLOBALS['buffer_message']
*/
if ($GLOBALS['is_ajax_request'] == true && !isset($GLOBALS['buffer_message'])) {
ob_start();
}
global $cfg;
if (null === $sql_query) {
if (!empty($GLOBALS['display_query'])) {
$sql_query = $GLOBALS['display_query'];
} elseif ($cfg['SQP']['fmtType'] == 'none' && !empty($GLOBALS['unparsed_sql'])) {
$sql_query = $GLOBALS['unparsed_sql'];
} elseif (!empty($GLOBALS['sql_query'])) {
$sql_query = $GLOBALS['sql_query'];
} else {
$sql_query = '';
}
}
if (isset($GLOBALS['using_bookmark_message'])) {
$GLOBALS['using_bookmark_message']->display();
unset($GLOBALS['using_bookmark_message']);
}
// Corrects the tooltip text via JS if required
// @todo this is REALLY the wrong place to do this - very unexpected here
if (!$is_view && strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {
$tooltip = PMA_Table::sGetToolTip($GLOBALS['db'], $GLOBALS['table']);
$uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false);
echo "\n";
echo '<script type="text/javascript">' . "\n";
echo '//<![CDATA[' . "\n";
echo "if (window.parent.updateTableTitle) window.parent.updateTableTitle('" . $uni_tbl . "', '" . PMA_jsFormat($tooltip, false) . "');" . "\n";
echo '//]]>' . "\n";
echo '</script>' . "\n";
}
// end if ... elseif
// Checks if the table needs to be repaired after a TRUNCATE query.
// @todo what about $GLOBALS['display_query']???
// @todo this is REALLY the wrong place to do this - very unexpected here
if (strlen($GLOBALS['table']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
if (PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Index_length') > 1024 && !PMA_DRIZZLE) {
PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
}
}
unset($tbl_status);
// In an Ajax request, $GLOBALS['cell_align_left'] may not be defined. Hence,
// check for it's presence before using it
echo '<div id="result_query" align="' . (isset($GLOBALS['cell_align_left']) ? $GLOBALS['cell_align_left'] : '') . '">' . "\n";
if ($message instanceof PMA_Message) {
if (isset($GLOBALS['special_message'])) {
$message->addMessage($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
$message->display();
$type = $message->getLevel();
} else {
echo '<div class="' . $type . '">';
echo PMA_sanitize($message);
if (isset($GLOBALS['special_message'])) {
echo PMA_sanitize($GLOBALS['special_message']);
unset($GLOBALS['special_message']);
}
echo '</div>';
}
if ($cfg['ShowSQL'] == true && !empty($sql_query)) {
// Html format the query to be displayed
// If we want to show some sql code it is easiest to create it here
/* SQL-Parser-Analyzer */
if (!empty($GLOBALS['show_as_php'])) {
$new_line = '\\n"<br />' . "\n" . ' . "';
$query_base = htmlspecialchars(addslashes($sql_query));
$query_base = preg_replace('/((\\015\\012)|(\\015)|(\\012))/', $new_line, $query_base);
} else {
$query_base = $sql_query;
}
$query_too_big = false;
if (strlen($query_base) > $cfg['MaxCharactersInDisplayedSQL']) {
// when the query is large (for example an INSERT of binary
// data), the parser chokes; so avoid parsing the query
$query_too_big = true;
$shortened_query_base = nl2br(htmlspecialchars(substr($sql_query, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]'));
} elseif (!empty($GLOBALS['parsed_sql']) && $query_base == $GLOBALS['parsed_sql']['raw']) {
// (here, use "! empty" because when deleting a bookmark,
//.........这里部分代码省略.........
示例3: testSGetToolTip
/**
* Test for sGetToolTip
*
* @return void
*/
public function testSGetToolTip()
{
$table = 'PMA_BookMark';
$db = 'PMA';
PMA_Table::$cache[$db][$table] = array('Comment' => "Comment222");
PMA_Table::$cache[$db][$table]['ExactRows'] = 10;
$result = PMA_Table::sGetToolTip($db, $table);
$this->assertEquals('Comment222 (10 Rows)', $result);
}