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


PHP PMA_RecentFavoriteTable::getInstance方法代码示例

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


在下文中一共展示了PMA_RecentFavoriteTable::getInstance方法的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;
    }
}
开发者ID:mercysmart,项目名称:naikelas,代码行数:57,代码来源:relation.lib.php

示例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;
 }
开发者ID:sruthikudaravalli,项目名称:QuickCabs,代码行数:22,代码来源:Header.class.php

示例3: PMA_addRemoveFavoriteTables

/**
 * Add or remove favorite tables
 *
 * @param string $db current database
 *
 * @return void
 */
function PMA_addRemoveFavoriteTables($db)
{
    $fav_instance = PMA_RecentFavoriteTable::getInstance('favorite');
    if (isset($_REQUEST['favorite_tables'])) {
        $favorite_tables = json_decode($_REQUEST['favorite_tables'], true);
    } else {
        $favorite_tables = array();
    }
    // Required to keep each user's preferences separate.
    $user = sha1($GLOBALS['cfg']['Server']['user']);
    // Request for Synchronization of favorite tables.
    if (isset($_REQUEST['sync_favorite_tables'])) {
        PMA_synchronizeFavoriteTables($fav_instance, $user, $favorite_tables);
        exit;
    }
    $changes = true;
    $msg = '';
    $titles = PMA_Util::buildActionTitles();
    $favorite_table = $_REQUEST['favorite_table'];
    $already_favorite = PMA_checkFavoriteTable($db, $favorite_table);
    if (isset($_REQUEST['remove_favorite'])) {
        if ($already_favorite) {
            // If already in favorite list, remove it.
            $fav_instance->remove($db, $favorite_table);
        }
    } elseif (isset($_REQUEST['add_favorite'])) {
        if (!$already_favorite) {
            if (count($fav_instance->getTables()) == $GLOBALS['cfg']['NumFavoriteTables']) {
                $changes = false;
                $msg = '<div class="error"><img src="themes/dot.gif" ' . 'title="" alt="" class="icon ic_s_error" />' . __("Favorite List is full!") . '</div>';
            } else {
                // Otherwise add to favorite list.
                $fav_instance->add($db, $favorite_table);
            }
        }
    }
    $favorite_tables[$user] = $fav_instance->getTables();
    $ajax_response = PMA_Response::getInstance();
    $ajax_response->addJSON('changes', $changes);
    if ($changes) {
        $ajax_response->addJSON('user', $user);
        $ajax_response->addJSON('favorite_tables', json_encode($favorite_tables));
        $ajax_response->addJSON('list', $fav_instance->getHtmlList());
        $ajax_response->addJSON('anchor', PMA_getHtmlForFavoriteAnchor($db, array('TABLE_NAME' => $favorite_table), $titles));
    } else {
        $ajax_response->addJSON('message', $msg);
    }
}
开发者ID:tecshuttle,项目名称:51qsk,代码行数:55,代码来源:structure.lib.php

示例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
开发者ID:RyoBamboo,项目名称:RoughSetSystem,代码行数:31,代码来源:index.php

示例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;
 }
开发者ID:mercysmart,项目名称:naikelas,代码行数:18,代码来源:NavigationTree.class.php

示例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;
            }
        }
    }
}
开发者ID:harryboulderdash,项目名称:PlayGFC,代码行数:26,代码来源:core.lib.php

示例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';
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:13,代码来源:tbl_recent_favorite.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 . '&amp;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'];
    }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:31,代码来源:db_structure.php

示例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;
 }
开发者ID:skduncan,项目名称:pizza-order,代码行数:25,代码来源:Header.class.php


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