Add page selection control at the bottom of pages, without the items per-page selector. Fix

objectMananger::handleMultiPageControls() to not display the items per-page selector if
the $bItemsPerPageSelector input parameter is false.
This commit is contained in:
Chris Morgan
2007-08-24 02:10:23 +00:00
committed by WineHQ
parent 2dcfdc24f6
commit 6b5305d1bf

View File

@@ -95,8 +95,8 @@ class ObjectManager
$oObject = new $this->sClass(); $oObject = new $this->sClass();
/* Display selectors for items per page and current page, if applicable. The function // Display top of the page selectors for items per page and
returns FALSE or an array of arguments to be passed to objectGetEntries() */ // current page, if applicable.
$this->handleMultiPageControls($aClean, TRUE); $this->handleMultiPageControls($aClean, TRUE);
/* query the class for its entries */ /* query the class for its entries */
@@ -192,6 +192,11 @@ class ObjectManager
echo "<br /><br /><a href=\"".$this->makeUrl("add", false, echo "<br /><br /><a href=\"".$this->makeUrl("add", false,
"Add $this->sClass")."\">Add entry</a>\n"; "Add $this->sClass")."\">Add entry</a>\n";
} }
// Display bottom of page selectors current page, if applicable
// NOTE: second parameter is false because we don't want the
// items per page selector appearing for the second set of page controls
$this->handleMultiPageControls($aClean, FALSE);
} }
/* display the entry for editing */ /* display the entry for editing */
@@ -704,24 +709,32 @@ class ObjectManager
$iItemsPerPage = $iDefaultPerPage; $iItemsPerPage = $iDefaultPerPage;
if ( isset($aClean['iItemsPerPage']) && in_array($aClean['iItemsPerPage'], $aItemsPerPage) ) if ( isset($aClean['iItemsPerPage']) &&
$iItemsPerPage = $aClean['iItemsPerPage']; in_array($aClean['iItemsPerPage'], $aItemsPerPage) )
$sControls = "<form action=\"".$this->makeUrl()."\" method=\"get\">";
/* Fill in form data for the objectManager URL */
$sControls .= $this->makeUrlFormData();
$sControls .= "<p><b>&nbsp;Items per page</b>";
$sControls .= "<select name=\"iItemsPerPage\" />";
foreach($aItemsPerPage as $iNum)
{ {
$sSelected = ($iNum == $iItemsPerPage) ? ' selected="selected"' : ""; $iItemsPerPage = $aClean['iItemsPerPage'];
$sControls .= "<option$sSelected>$iNum</option>"; }
// if $bItemsPerPageSelector is true, display the items
// per-page dropdown and update button
if($bItemsPerPageSelector)
{
$sControls = "<form action=\"".$this->makeUrl()."\" method=\"get\">";
/* Fill in form data for the objectManager URL */
$sControls .= $this->makeUrlFormData();
$sControls .= "<p><b>&nbsp;Items per page</b>";
$sControls .= "<select name=\"iItemsPerPage\" />";
foreach($aItemsPerPage as $iNum)
{
$sSelected = ($iNum == $iItemsPerPage) ? ' selected="selected"' : "";
$sControls .= "<option$sSelected>$iNum</option>";
}
$sControls .= "</select>";
$sControls .= " &nbsp; <input type=\"submit\" value=\"Update\" />";
$sControls .= "</form></p>";
} }
$sControls .= "</select>";
$sControls .= " &nbsp; <input type=\"submit\" value=\"Update\" />";
$sControls .= "</form></p>";
$iTotalEntries = $oObject->objectGetEntriesCount($this->bIsQueue, $this->bIsRejected); $iTotalEntries = $oObject->objectGetEntriesCount($this->bIsQueue, $this->bIsRejected);
$iNumPages = ceil($iTotalEntries / $iItemsPerPage); $iNumPages = ceil($iTotalEntries / $iItemsPerPage);