getItems() becomes getLimitedItems($offset, $count)
This commit is contained in:
@@ -50,9 +50,6 @@ require_once './libraries/List.class.php';
|
|||||||
*/
|
*/
|
||||||
var $_show_databases_disabled = false;
|
var $_show_databases_disabled = false;
|
||||||
|
|
||||||
var $limit_offset = 0;
|
|
||||||
var $limit_count = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@@ -303,13 +300,15 @@ require_once './libraries/List.class.php';
|
|||||||
* @uses implode()
|
* @uses implode()
|
||||||
* @uses strstr()
|
* @uses strstr()
|
||||||
* @uses explode()
|
* @uses explode()
|
||||||
|
* @param integer $offset
|
||||||
|
* @param integer $count
|
||||||
* @return array db list
|
* @return array db list
|
||||||
*/
|
*/
|
||||||
function getGroupedDetails()
|
function getGroupedDetails($offset, $count)
|
||||||
{
|
{
|
||||||
$dbgroups = array();
|
$dbgroups = array();
|
||||||
$parts = array();
|
$parts = array();
|
||||||
foreach ($this->getItems() as $key => $db) {
|
foreach ($this->getLimitedItems($offset, $count) as $key => $db) {
|
||||||
// garvin: Get comments from PMA comments table
|
// garvin: Get comments from PMA comments table
|
||||||
$db_tooltip = '';
|
$db_tooltip = '';
|
||||||
if ($GLOBALS['cfg']['ShowTooltip']
|
if ($GLOBALS['cfg']['ShowTooltip']
|
||||||
@@ -358,14 +357,14 @@ require_once './libraries/List.class.php';
|
|||||||
* returns a part of the items
|
* returns a part of the items
|
||||||
*
|
*
|
||||||
* @uses PMA_List_Database::$items
|
* @uses PMA_List_Database::$items
|
||||||
* @uses PMA_List_Database::$limit_offset
|
|
||||||
* @uses PMA_List_Database::$limit_count
|
|
||||||
* @uses array_slice()
|
* @uses array_slice()
|
||||||
* @return array the items
|
* @param integer $offset
|
||||||
|
* @param integer $count
|
||||||
|
* @return array some items
|
||||||
*/
|
*/
|
||||||
function getItems()
|
function getLimitedItems($offset, $count)
|
||||||
{
|
{
|
||||||
return(array_slice($this->items, $this->limit_offset, $this->limit_count));
|
return(array_slice($this->items, $offset, $count));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -373,14 +372,14 @@ require_once './libraries/List.class.php';
|
|||||||
*
|
*
|
||||||
* @return string html code list
|
* @return string html code list
|
||||||
*/
|
*/
|
||||||
function getHtmlListGrouped($selected = '')
|
function getHtmlListGrouped($selected = '', $offset, $count)
|
||||||
{
|
{
|
||||||
if (true === $selected) {
|
if (true === $selected) {
|
||||||
$selected = $this->getDefault();
|
$selected = $this->getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = '<ul id="databaseList" xml:lang="en" dir="ltr">' . "\n";
|
$return = '<ul id="databaseList" xml:lang="en" dir="ltr">' . "\n";
|
||||||
foreach ($this->getGroupedDetails() as $group => $dbs) {
|
foreach ($this->getGroupedDetails($offset, $count) as $group => $dbs) {
|
||||||
if (count($dbs) > 1) {
|
if (count($dbs) > 1) {
|
||||||
$return .= '<li>' . $group . '<ul>' . "\n";
|
$return .= '<li>' . $group . '<ul>' . "\n";
|
||||||
// wether display db_name cuted by the group part
|
// wether display db_name cuted by the group part
|
||||||
@@ -417,7 +416,7 @@ require_once './libraries/List.class.php';
|
|||||||
*
|
*
|
||||||
* @return string html code select
|
* @return string html code select
|
||||||
*/
|
*/
|
||||||
function getHtmlSelectGrouped($selected = '')
|
function getHtmlSelectGrouped($selected = '', $offset, $count)
|
||||||
{
|
{
|
||||||
if (true === $selected) {
|
if (true === $selected) {
|
||||||
$selected = $this->getDefault();
|
$selected = $this->getDefault();
|
||||||
@@ -427,7 +426,7 @@ require_once './libraries/List.class.php';
|
|||||||
. ' onchange="if (this.value != \'\') window.parent.openDb(this.value);">' . "\n"
|
. ' onchange="if (this.value != \'\') window.parent.openDb(this.value);">' . "\n"
|
||||||
. '<option value="" dir="' . $GLOBALS['text_dir'] . '">'
|
. '<option value="" dir="' . $GLOBALS['text_dir'] . '">'
|
||||||
. '(' . $GLOBALS['strDatabases'] . ') ...</option>' . "\n";
|
. '(' . $GLOBALS['strDatabases'] . ') ...</option>' . "\n";
|
||||||
foreach ($this->getGroupedDetails() as $group => $dbs) {
|
foreach ($this->getGroupedDetails($offset, $count) as $group => $dbs) {
|
||||||
if (count($dbs) > 1) {
|
if (count($dbs) > 1) {
|
||||||
$return .= '<optgroup label="' . htmlspecialchars($group)
|
$return .= '<optgroup label="' . htmlspecialchars($group)
|
||||||
. '">' . "\n";
|
. '">' . "\n";
|
||||||
|
@@ -79,8 +79,7 @@ if (! isset($_SESSION['navi_limit_offset'])) {
|
|||||||
if (isset($_REQUEST['pos'])) {
|
if (isset($_REQUEST['pos'])) {
|
||||||
$_SESSION['navi_limit_offset'] = (int) $_REQUEST['pos'];
|
$_SESSION['navi_limit_offset'] = (int) $_REQUEST['pos'];
|
||||||
}
|
}
|
||||||
$pos = $GLOBALS['PMA_List_Database']->limit_offset = $_SESSION['navi_limit_offset'];
|
$pos = $_SESSION['navi_limit_offset'];
|
||||||
$GLOBALS['PMA_List_Database']->limit_count = $GLOBALS['cfg']['MaxDbList'];
|
|
||||||
|
|
||||||
// free the session file, for the other frames to be loaded
|
// free the session file, for the other frames to be loaded
|
||||||
session_write_close();
|
session_write_close();
|
||||||
@@ -119,8 +118,7 @@ if (! isset($_SESSION['navi_limit_offset'])) {
|
|||||||
if (isset($_REQUEST['pos'])) {
|
if (isset($_REQUEST['pos'])) {
|
||||||
$_SESSION['navi_limit_offset'] = (int) $_REQUEST['pos'];
|
$_SESSION['navi_limit_offset'] = (int) $_REQUEST['pos'];
|
||||||
}
|
}
|
||||||
$pos = $GLOBALS['PMA_List_Database']->limit_offset = $_SESSION['navi_limit_offset'];
|
$pos = $_SESSION['navi_limit_offset'];
|
||||||
$GLOBALS['PMA_List_Database']->limit_count = $GLOBALS['cfg']['MaxDbList'];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Displays the frame
|
* Displays the frame
|
||||||
@@ -202,14 +200,14 @@ if (! $GLOBALS['server']) {
|
|||||||
<label for="lightm_db"><?php echo $GLOBALS['strDatabase']; ?></label>
|
<label for="lightm_db"><?php echo $GLOBALS['strDatabase']; ?></label>
|
||||||
<?php
|
<?php
|
||||||
echo PMA_generate_common_hidden_inputs() . "\n";
|
echo PMA_generate_common_hidden_inputs() . "\n";
|
||||||
echo $GLOBALS['PMA_List_Database']->getHtmlSelectGrouped(true) . "\n";
|
echo $GLOBALS['PMA_List_Database']->getHtmlSelectGrouped(true, $_SESSION['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
|
||||||
echo '<noscript>' . "\n"
|
echo '<noscript>' . "\n"
|
||||||
.'<input type="submit" name="Go" value="' . $GLOBALS['strGo'] . '" />' . "\n"
|
.'<input type="submit" name="Go" value="' . $GLOBALS['strGo'] . '" />' . "\n"
|
||||||
.'</noscript>' . "\n"
|
.'</noscript>' . "\n"
|
||||||
.'</form>' . "\n"
|
.'</form>' . "\n"
|
||||||
.'</div>' . "\n";
|
.'</div>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
echo $GLOBALS['PMA_List_Database']->getHtmlListGrouped(true) . "\n";
|
echo $GLOBALS['PMA_List_Database']->getHtmlListGrouped(true, $_SESSION['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -282,7 +280,7 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
|
|||||||
echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
|
echo '<p>' . $GLOBALS['strSelectADb'] . '</p>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
$common_url_query = PMA_generate_common_url();
|
$common_url_query = PMA_generate_common_url();
|
||||||
PMA_displayDbList($GLOBALS['PMA_List_Database']->getGroupedDetails());
|
PMA_displayDbList($GLOBALS['PMA_List_Database']->getGroupedDetails($_SESSION['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']), $_SESSION['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -305,14 +303,16 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
|
|||||||
* @global $db_start
|
* @global $db_start
|
||||||
* @global $common_url_query
|
* @global $common_url_query
|
||||||
* @param array $ext_dblist extended db list
|
* @param array $ext_dblist extended db list
|
||||||
|
* @param integer $offset
|
||||||
|
* @param integer $count
|
||||||
*/
|
*/
|
||||||
function PMA_displayDbList($ext_dblist) {
|
function PMA_displayDbList($ext_dblist, $offset, $count) {
|
||||||
global $element_counter, $img_minus, $img_plus, $href_left,
|
global $element_counter, $img_minus, $img_plus, $href_left,
|
||||||
$db_start, $common_url_query;
|
$db_start, $common_url_query;
|
||||||
|
|
||||||
// get table list, for all databases
|
// get table list, for all databases
|
||||||
// doing this in one step takes advantage of a single query with information_schema!
|
// doing this in one step takes advantage of a single query with information_schema!
|
||||||
$tables_full = PMA_DBI_get_tables_full($GLOBALS['PMA_List_Database']->getItems());
|
$tables_full = PMA_DBI_get_tables_full($GLOBALS['PMA_List_Database']->getLimitedItems($offset, $count));
|
||||||
|
|
||||||
$url_dbgroup = '';
|
$url_dbgroup = '';
|
||||||
echo '<ul id="leftdatabaselist">';
|
echo '<ul id="leftdatabaselist">';
|
||||||
|
Reference in New Issue
Block a user