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


PHP PMA_checkFavoriteTable函数代码示例

本文整理汇总了PHP中PMA_checkFavoriteTable函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_checkFavoriteTable函数的具体用法?PHP PMA_checkFavoriteTable怎么用?PHP PMA_checkFavoriteTable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: 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

示例2: PMA_getHtmlForFavoriteAnchor

/**
 * Get HTML for favorite anchor.
 *
 * @param string $db            current database
 * @param string $current_table current table
 * @param array  $titles        titles
 *
 * @return $html_output
 */
function PMA_getHtmlForFavoriteAnchor($db, $current_table, $titles)
{
    $html_output = '<a ';
    $html_output .= 'id="' . md5($current_table) . '_favorite_anchor" ';
    $html_output .= 'class="ajax favorite_table_anchor';
    // Check if current table is already in favorite list.
    $already_favorite = PMA_checkFavoriteTable($db, $current_table);
    $fav_params = array('db' => $db, 'ajax_request' => true, 'favorite_table' => $current_table, ($already_favorite ? 'remove' : 'add') . '_favorite' => true);
    $fav_url = 'db_structure.php' . PMA_URL_getCommon($fav_params);
    $html_output .= '" ';
    $html_output .= 'href="' . $fav_url . '" title="' . ($already_favorite ? __("Remove from Favorites") : __("Add to Favorites")) . '" data-favtargets="' . md5($db . "." . $current_table) . '" >' . (!$already_favorite ? $titles['NoFavorite'] : $titles['Favorite']) . '</a>';
    return $html_output;
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:22,代码来源:structure.lib.php

示例3: list

  * I could have used the PHP ternary conditional operator but I find
  * the code easier to read without this operator.
  */
 list($browse_table, $search_table, $browse_table_label, $empty_table, $tracking_icon) = PMA_getHtmlForActionLinks($current_table, $table_is_view, $tbl_url_query, $titles, $truename, $db_is_system_schema, $url_query);
 if (!$db_is_system_schema) {
     list($drop_query, $drop_message) = PMA_getTableDropQueryAndMessage($table_is_view, $current_table);
 }
 if ($num_columns > 0 && $num_tables > $num_columns && $row_count % $num_columns == 0) {
     $row_count = 1;
     $odd_row = true;
     $response->addHTML('</tr></tbody></table>');
     $response->addHTML(PMA_tableHeader(false, $server_slave_status));
 }
 list($do, $ignored) = PMA_getServerSlaveStatus($server_slave_status, $truename);
 // Handle favorite table list. ----START----
 $already_favorite = PMA_checkFavoriteTable($db, $current_table['TABLE_NAME']);
 if (isset($_REQUEST['remove_favorite'])) {
     if ($already_favorite) {
         // If already in favorite list, remove it.
         $favorite_table = $_REQUEST['favorite_table'];
         $fav_instance->remove($db, $favorite_table);
     }
 }
 if (isset($_REQUEST['add_favorite'])) {
     if (!$already_favorite) {
         // Otherwise add to favorite list.
         $favorite_table = $_REQUEST['favorite_table'];
         $fav_instance->add($db, $favorite_table);
     }
 }
 // Handle favorite table list. ----ENDS----
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:31,代码来源:db_structure.php


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