本文整理汇总了PHP中PMA_RecentFavoriteTable类的典型用法代码示例。如果您正苦于以下问题:PHP PMA_RecentFavoriteTable类的具体用法?PHP PMA_RecentFavoriteTable怎么用?PHP PMA_RecentFavoriteTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_RecentFavoriteTable类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_fixPMATables
/**
* Creates PMA tables in the given db, updates if already exists.
*
* @param string $db database
* @param boolean $create whether to create tables if they don't exist.
*
* @return void
*/
function PMA_fixPMATables($db, $create = true)
{
$tablesToFeatures = array('pma__bookmark' => 'bookmarktable', 'pma__relation' => 'relation', 'pma__table_info' => 'table_info', 'pma__table_coords' => 'table_coords', 'pma__pdf_pages' => 'pdf_pages', 'pma__column_info' => 'column_info', 'pma__history' => 'history', 'pma__recent' => 'recent', 'pma__favorite' => 'favorite', 'pma__table_uiprefs' => 'table_uiprefs', 'pma__tracking' => 'tracking', 'pma__userconfig' => 'userconfig', 'pma__users' => 'users', 'pma__usergroups' => 'usergroups', 'pma__navigationhiding' => 'navigationhiding', 'pma__savedsearches' => 'savedsearches', 'pma__central_columns' => 'central_columns');
$existingTables = $GLOBALS['dbi']->getTables($db, $GLOBALS['controllink']);
$createQueries = null;
$foundOne = false;
foreach ($tablesToFeatures as $table => $feature) {
if (!in_array($table, $existingTables)) {
if ($create) {
if ($createQueries == null) {
// first create
$createQueries = PMA_getDefaultPMATableNames();
$GLOBALS['dbi']->selectDb($db);
}
$GLOBALS['dbi']->tryQuery($createQueries[$table]);
if ($error = $GLOBALS['dbi']->getError()) {
$GLOBALS['message'] = $error;
return;
}
$GLOBALS['cfg']['Server'][$feature] = $table;
}
} else {
$foundOne = true;
$GLOBALS['cfg']['Server'][$feature] = $table;
}
}
if (!$foundOne) {
return;
}
$GLOBALS['cfg']['Server']['pmadb'] = $db;
$_SESSION['relation'][$GLOBALS['server']] = PMA_checkRelationsParam();
$cfgRelation = PMA_getRelationsParam();
if ($cfgRelation['recentwork'] || $cfgRelation['favoritework']) {
// Since configuration storage is updated, we need to
// re-initialize the favorite and recent tables stored in the
// session from the current configuration storage.
include_once 'libraries/RecentFavoriteTable.class.php';
if ($cfgRelation['favoritework']) {
$fav_tables = PMA_RecentFavoriteTable::getInstance('favorite');
$_SESSION['tmpval']['favorite_tables'][$GLOBALS['server']] = $fav_tables->getFromDb();
}
if ($cfgRelation['recentwork']) {
$recent_tables = PMA_RecentFavoriteTable::getInstance('recent');
$_SESSION['tmpval']['recent_tables'][$GLOBALS['server']] = $recent_tables->getFromDb();
}
// Reload navi panel to update the recent/favorite lists.
$GLOBALS['reload'] = true;
}
}
示例2: _addRecentTable
/**
* Add recently used table and reload the navigation.
*
* @param string $db Database name where the table is located.
* @param string $table The table name
*
* @return string
*/
private function _addRecentTable($db, $table)
{
$retval = '';
if ($this->_menuEnabled && mb_strlen($table) && $GLOBALS['cfg']['NumRecentTables'] > 0) {
$tmp_result = PMA_RecentFavoriteTable::getInstance('recent')->add($db, $table);
if ($tmp_result === true) {
$retval = PMA_RecentFavoriteTable::getHtmlUpdateRecentTables();
} else {
$error = $tmp_result;
$retval = $error->getDisplay();
}
}
return $retval;
}
示例3: PMA_synchronizeFavoriteTables
/**
* Synchronize favorite tables
*
* @param PMA_RecentFavoriteTable $fav_instance Instance of this class
* @param string $user The user hash
* @param array $favorite_tables Existing favorites
*
* @return void
*/
function PMA_synchronizeFavoriteTables($fav_instance, $user, $favorite_tables)
{
$fav_instance_tables = $fav_instance->getTables();
if (empty($fav_instance_tables) && isset($favorite_tables[$user])) {
foreach ($favorite_tables[$user] as $key => $value) {
$fav_instance->add($value['db'], $value['table']);
}
}
$favorite_tables[$user] = $fav_instance->getTables();
$ajax_response = PMA_Response::getInstance();
$ajax_response->addJSON('favorite_tables', json_encode($favorite_tables));
$ajax_response->addJSON('list', $fav_instance->getHtmlList());
$server_id = $GLOBALS['server'];
// Set flag when localStorage and pmadb(if present) are in sync.
$_SESSION['tmpval']['favorites_synced'][$server_id] = true;
}
示例4: USER
$server_info .= ' (';
}
}
if ($GLOBALS['cfg']['ShowServerInfo'] || empty($cfg['Server']['verbose'])) {
$server_info .= $GLOBALS['dbi']->getHostInfo();
}
if (!empty($cfg['Server']['verbose']) && $GLOBALS['cfg']['ShowServerInfo']) {
$server_info .= ')';
}
$mysql_cur_user_and_host = $GLOBALS['dbi']->fetchValue('SELECT USER();');
// should we add the port info here?
$short_server_info = !empty($GLOBALS['cfg']['Server']['verbose']) ? $GLOBALS['cfg']['Server']['verbose'] : $GLOBALS['cfg']['Server']['host'];
}
echo '<div id="maincontainer">' . "\n";
// Anchor for favorite tables synchronization.
echo PMA_RecentFavoriteTable::getInstance('favorite')->getHtmlSyncFavoriteTables();
echo '<div id="main_pane_left">';
if ($server > 0 || count($cfg['Servers']) > 1) {
if ($cfg['DBG']['demo']) {
echo '<div class="group">';
echo '<h2>' . __('phpMyAdmin Demo Server') . '</h2>';
echo '<p style="margin: 0.5em 1em 0.5em 1em">';
printf(__('You are using the demo server. You can do anything here, but ' . 'please do not change root, debian-sys-maint and pma users. ' . 'More information is available at %s.'), '<a href="http://demo.phpmyadmin.net/">demo.phpmyadmin.net</a>');
echo '</p>';
echo '</div>';
}
echo '<div class="group">';
echo '<h2>' . __('General Settings') . '</h2>';
echo '<ul>';
/**
* Displays the MySQL servers choice form
示例5: _quickWarp
/**
* Display quick warp links, contain Recents and Favorites
*
* @return string HTML code
*/
private function _quickWarp()
{
$retval = '<div class="pma_quick_warp">';
if ($GLOBALS['cfg']['NumRecentTables'] > 0) {
$retval .= PMA_RecentFavoriteTable::getInstance('recent')->getHtml();
}
if ($GLOBALS['cfg']['NumFavoriteTables'] > 0) {
$retval .= PMA_RecentFavoriteTable::getInstance('favorite')->getHtml();
}
$retval .= '<div class="clearfloat"></div>';
$retval .= '</div>';
return $retval;
}
示例6: PMA_checkAndFixPMATablesInCurrentDb
/**
* Checks and fixes configuration storage in current DB.
*
* @return void
*/
function PMA_checkAndFixPMATablesInCurrentDb()
{
if (isset($GLOBALS['db']) && !empty($GLOBALS['db'])) {
if (isset($GLOBALS['cfg']['Server']['pmadb']) && empty($GLOBALS['cfg']['Server']['pmadb'])) {
$default_tables = PMA_getDefaultPMATableNames();
if (PMA_searchPMATablesInDb($GLOBALS['db'], array_keys($default_tables))) {
PMA_fixPMATables($GLOBALS['db']);
// Since configuration storage is updated, we need to
// re-initialize the favorite and recent tables stored in the
// session from the current configuration storage.
include_once 'libraries/RecentFavoriteTable.class.php';
$fav_tables = PMA_RecentFavoriteTable::getInstance('favorite');
$recent_tables = PMA_RecentFavoriteTable::getInstance('recent');
$_SESSION['tmpval']['favorite_tables'][$GLOBALS['server']] = $fav_tables->getFromDb();
$_SESSION['tmpval']['recent_tables'][$GLOBALS['server']] = $recent_tables->getFromDb();
// Reload navi panel to update the recent/favorite lists.
$GLOBALS['reload'] = true;
}
}
}
}
示例7:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Browse recent and favourite tables chosen from navigation
*
* @package PhpMyAdmin
*/
require_once 'libraries/common.inc.php';
require_once 'libraries/RecentFavoriteTable.class.php';
PMA_RecentFavoriteTable::getInstance('recent')->removeIfInvalid($_REQUEST['db'], $_REQUEST['table']);
PMA_RecentFavoriteTable::getInstance('favorite')->removeIfInvalid($_REQUEST['db'], $_REQUEST['table']);
require 'sql.php';
示例8: ceil
$response->addHTML(PMA_URL_getHiddenInputs($db));
$response->addHTML(PMA_tableHeader($db_is_system_schema, $server_slave_status));
$i = $sum_entries = 0;
$overhead_check = '';
$create_time_all = '';
$update_time_all = '';
$check_time_all = '';
$num_columns = $cfg['PropertiesNumColumns'] > 1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 : 0;
$row_count = 0;
$sum_size = (double) 0;
$overhead_size = (double) 0;
$hidden_fields = array();
$odd_row = true;
$sum_row_count_pre = '';
// Instance of PMA_RecentFavoriteTable class.
$fav_instance = PMA_RecentFavoriteTable::getInstance('favorite');
foreach ($tables as $keyname => $current_table) {
// Get valid statistics whatever is the table type
$drop_query = '';
$drop_message = '';
$already_favorite = false;
$overhead = '';
$table_is_view = false;
$table_encoded = urlencode($current_table['TABLE_NAME']);
// Sets parameters for links
$tbl_url_query = $url_query . '&table=' . $table_encoded;
// do not list the previous table's size info for a view
list($current_table, $formatted_size, $unit, $formatted_overhead, $overhead_unit, $overhead_size, $table_is_view, $sum_size) = PMA_getStuffForEngineTypeTable($current_table, $db_is_system_schema, $is_show_stats, $table_is_view, $sum_size, $overhead_size);
if (!PMA_Table::isMerge($db, $current_table['TABLE_NAME'])) {
$sum_entries += $current_table['TABLE_ROWS'];
}
示例9: _addRecentTable
/**
* Add recently used table and reload the navigation.
*
* @param string $db Database name where the table is located.
* @param string $table The table name
*
* @return string
*/
private function _addRecentTable($db, $table)
{
$retval = '';
if ($this->_menuEnabled && strlen($table) && $GLOBALS['cfg']['NumRecentTables'] > 0) {
$tmp_result = PMA_RecentFavoriteTable::getInstance('recent')->add($db, $table);
if ($tmp_result === true) {
$params = array('ajax_request' => true, 'recent_table' => true);
$url = 'index.php' . PMA_URL_getCommon($params);
$retval = '<a class="hide" id="update_recent_tables"';
$retval .= ' href="' . $url . '"></a>';
} else {
$error = $tmp_result;
$retval = $error->getDisplay();
}
}
return $retval;
}