本文整理汇总了PHP中BuildPagination函数的典型用法代码示例。如果您正苦于以下问题:PHP BuildPagination函数的具体用法?PHP BuildPagination怎么用?PHP BuildPagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BuildPagination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ManageGiftCertificatesGrid
private function ManageGiftCertificatesGrid(&$numGiftCertificates)
{
// Show a list of products in a table
$page = 0;
$start = 0;
$numPages = 0;
$GLOBALS['CompanyGiftCertificatesGrid'] = "";
$GLOBALS['Nav'] = "";
$catList = "";
$max = 0;
if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") {
$sortOrder = "asc";
} else {
$sortOrder = "desc";
}
$validSortFields = array('cgcid', 'cgcname', 'cgccode', 'cgcto', 'cgcfrom', 'cgccustid', 'cgcamount', 'cgcbalance', 'cgcstatus', 'cgcpurchasedate', 'cgcexpiry', 'customername');
if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) {
$sortField = $_REQUEST['sortField'];
SaveDefaultSortField("ManageCompanyGiftCertificates", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageCompanyGiftCertificates", "cgcid", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
// Build the pagination and sort URL
$searchURL = '';
foreach ($_GET as $k => $v) {
if ($k == "sortField" || $k == "sortOrder" || $k == "page" || $k == "new" || $k == "ToDo" || $k == "SubmitButton1" || !$v) {
continue;
}
$searchURL .= sprintf("&%s=%s", $k, urlencode($v));
}
$sortURL = sprintf("%s&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of gift certificates returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE - (ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$certificateResult = $this->_GetCompanyGiftCertificatesList($start, $sortField, $sortOrder, $numGiftCertificates);
$numPages = ceil($numGiftCertificates / ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE);
// Add the "(Page x of n)" label
if ($numGiftCertificates > ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numGiftCertificates, ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE, $page, sprintf("index.php?ToDo=viewCompanyGiftCertificates%s", $sortURL));
} else {
$GLOBALS['Nav'] = "";
$GLOBALS['CurrentPageLink'] = "index.php?ToDo=viewCompanyGiftCertificates";
}
if (isset($_GET['searchQuery'])) {
$query = $_GET['searchQuery'];
} else {
$query = "";
}
$GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |');
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
$sortLinks = array("Id" => "cgcid", "CertificateAmount" => "cgcamount", "CertificateBalance" => "cgcbalance", "CertificateName" => "cgcname", "PurchaseDate" => "cgcpurchasedate", "Status" => "cgcstatus", "Code" => "cgccode", "Cust" => "customername");
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewCompanyGiftCertificates&page=" . $page, $sortField, $sortOrder);
$GLOBALS['GiftCertificateStatusList'] = $this->GetCompanyGiftCertificateStatusOptions();
// Display the gift certificates
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($certificateResult)) {
$GLOBALS['cgcId'] = (int) $row['cgcid'];
$GLOBALS['cgcCode'] = isc_html_escape($row['cgccode']);
$GLOBALS['cgcTo'] = isc_html_escape($row['cgcto']);
$GLOBALS['cgcToEmail'] = isc_html_escape($row['cgctoemail']);
$GLOBALS['cgcAmount'] = FormatPrice($row['cgcamount']) . ' / ' . FormatPrice($row['cgcbalance']);
$GLOBALS['cgcBalance'] = FormatPrice($row['cgcbalance']);
$GLOBALS['cgcName'] = isc_html_escape($row['cgcname']);
if (count(explode('$', $row['cgcto'])) > 1) {
$GLOBALS['cgcTos'] = isc_html_escape(str_replace('$', ', ', $row['cgcto']));
} else {
$GLOBALS['cgcTos'] = isc_html_escape($row['cgcto']);
}
$GLOBALS['cgcPurchaseDate'] = isc_date(GetConfig('DisplayDateFormat'), $row['cgcpurchasedate']);
if ($row['cgcexpirydate'] != 0) {
$GLOBALS['cgcPurchaseDate'] .= ' / ' . isc_date(GetConfig('DisplayDateFormat'), $row['cgcexpirydate']);
} else {
$GLOBALS['cgcPurchaseDate'] .= ' / ' . GetLang('GiftCertificateExpireNA');
}
// Something of this gift certificate has been sent so we need to show the expand icon
if ($row['cgcbalance'] != $row['cgcamount']) {
$GLOBALS['ExpandIcon'] = '+';
} else {
$GLOBALS['ExpandIcon'] = '';
}
$GLOBALS['cgcStatusOptions'] = $this->GetCompanyGiftCertificateStatusOptions($row['cgcstatus']);
if (($row['cgcstatus'] == 3 || $row['cgcstatus'] == 4) && !$row['cgcsended']) {
// $GLOBALS['cgcAction'] = "<a href='index.php?ToDo=editCompanyGiftCertificate&cgcid=".$row['cgcid']."' >Edit</a>";
} else {
$GLOBALS['cgcAction'] = " ";
}
$GLOBALS['cgcsendedval'] = $row['cgcsended'];
//.........这里部分代码省略.........
示例2: ManageQValueAssociationsGrid
public function ManageQValueAssociationsGrid(&$numQValueAssociations)
{
// Show a list of news in a table
$page = 0;
$start = 0;
$numQValueAssociations = 0;
$numPages = 0;
$GLOBALS['QValueAssociationGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
$searchURL = '';
if (isset($_GET['searchQuery'])) {
$query = $_GET['searchQuery'];
$GLOBALS['Query'] = $query;
$searchURL . 'searchQuery=' . urlencode($query);
} else {
$query = "";
$GLOBALS['Query'] = "";
}
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'desc';
} else {
$sortOrder = "asc";
}
$sortLinks = array("QValueName" => "qva.qvalue", "AssociationDisplayName" => "qva.displayname", "Comments" => "qa.comments");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageQValueAssociations", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("QValueAssociationGrid", "qva.qvalueassocid", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$resultFilter = '';
if (isset($_GET['precategoryid']) && isset($_GET['prequalifierid'])) {
$resultFilter = sprintf("&precategoryid=%d&prequalifierid=%d", $_GET['precategoryid'], $_GET['prequalifierid']);
}
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of qualifierassociations returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ISC_BRANDS_PER_PAGE - (ISC_BRANDS_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$qValueAssociationResult = $this->_GetQValueAssociationList($query, $start, $sortField, $sortOrder, $numQValueAssociations);
$numPages = ceil($numQValueAssociations / ISC_BRANDS_PER_PAGE);
// Workout the paging navigation
if ($numQValueAssociations > ISC_BRANDS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numQValueAssociations, ISC_BRANDS_PER_PAGE, $page, sprintf("index.php?ToDo=viewQValueAssociations%s%s", $sortURL, $resultFilter));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
//$GLOBALS['resultFilter'] = $resultFilter;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewQValueAssociations&" . $searchURL . "&page=" . $page . "&page=" . $page . $resultFilter, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_BRANDS_PER_PAGE;
if ($max > count($qValueAssociationResult)) {
$max = count($qValueAssociationResult);
}
if ($numQValueAssociations > 0) {
$tempcategoryid = 0;
$tempqualifierid = 0;
// Display the news
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($qValueAssociationResult)) {
$GLOBALS['QValueAssociationId'] = (int) $row['qvalueassocid'];
$GLOBALS['QualifierAssociationId'] = (int) $row['associd'];
$GLOBALS['QualifierDisplayName'] = isc_html_escape($row['column_name']);
$GLOBALS['QValueName'] = isc_html_escape($row['qvalue']);
$GLOBALS['AssociationDisplayName'] = $row['displayname'];
// Workout the edit link -- do they have permission to do so?
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_QValue_Associations)) {
$GLOBALS['EditQValueAssociationLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editQValueAssociations&QValueAssociationId=%d'>%s</a>", GetLang('QValueAssociationEdit'), $row['qvalueassocid'], GetLang('Edit'));
} else {
$GLOBALS['EditNewsLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
}
/*
if($tempcategoryid != $row['categoryid']) {
$GLOBALS['QValueAssociationGrid'] .= '<tr bgcolor="#eeeeee">
<td align="left" style="height:27px;" colspan="5">
<b>'.$row['catname'].'</b>
</td>
</tr>';
$tempcategoryid = $row['categoryid'];
$tempqualifierid = 0; //Need to start new qualifiers for the category
}
if($tempqualifierid != $row['qualifierid']) {
$GLOBALS['QValueAssociationGrid'] .= '<tr bgcolor="#eeeeee">
<td align="left" style="height:27px;" colspan="5">
<b>'.$row['column_name'].'</b>
//.........这里部分代码省略.........
示例3: getRedirectsTable
public function getRedirectsTable()
{
GetLib('class.redirects');
GetLib('class.urls');
$perPage = 20;
$page = max((int)@$_GET['page'], 1);
$start = ($page * $perPage) - $perPage;
$NumResults = 0;
$GLOBALS['RedirectsGrid'] = "";
$GLOBALS['RedirectPaging'] = "";
$sortOrder = 'desc';
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'asc') {
$sortOrder = 'asc';
}
$sortLinks = array(
"OldUrl" => "r.redirectpath",
"NewUrl" => "r.redirectassoctype",
"RedirectId" => "r.redirectid",
);
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
}
else {
$sortField = "r.redirectid";
}
$sortURL = '&sortField=' . $sortField . '&sortOrder=' . $sortOrder;
$GLOBALS['SortURL'] = $sortURL;
// Get the results for the query
$redirectResult = $this->getRedirectRows($start, $sortField, $sortOrder, $perPage, $NumResults);
$numPages = ceil($NumResults / $perPage);
if(($start+1) > $NumResults && $start > 1) {
$_GET['page'] = 1;
return $this->getRedirectsTable();
}
// Add the "(Page x of n)" label
if($NumResults > $perPage) {
$GLOBALS['RedirectPaging'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['RedirectPaging'] .= BuildPagination($NumResults, $perPage, $page, 'remote.php?remoteSection=redirects&w=getRedirectsTable' . $sortURL);
}
$GLOBALS['RedirectPaging'] = rtrim($GLOBALS['RedirectPaging'], ' |');
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "remote.php?remoteSection=redirects&w=getRedirectsTable&page=".$page, $sortField, $sortOrder);
if($NumResults > 0) {
// Display the redirects
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($redirectResult))
{
$GLOBALS['RedirectId'] = $row['redirectid'];
$GLOBALS['OldURL'] = $row['redirectpath'];
$redirectManual = $row['redirectmanual'];
if ($redirectManual == '') {
$redirectManual = GetLang('ClickHereToEnterAURL');
}
$GLOBALS['NewURL'] = $redirectManual;
$GLOBALS['RedirectTypeAutoSelected'] = "selected='selected'";
$GLOBALS['RedirectTypeManualSelected'] = '';
$GLOBALS['RedirectTypeManualDisplay'] = "display: none;";
$GLOBALS['RedirectTypeAutoDisplay'] = "";
$GLOBALS['NewURLTitle'] = '';
$GLOBALS['LinkerTitle'] = GetLang('ChangeLink');
$GLOBALS['RedirectTestLink'] = GetConfig('ShopPath') . $row['redirectpath'];
$row['redirectassoctype'] = (int)$row['redirectassoctype'];
switch($row['redirectassoctype']) {
case ISC_REDIRECTS::REDIRECT_TYPE_NOREDIRECT:
case ISC_REDIRECTS::REDIRECT_TYPE_MANUAL:
$GLOBALS['RedirectTypeManualSelected'] = "selected='selected'";
$GLOBALS['RedirectTypeAutoSelected'] = "";
$GLOBALS['RedirectTypeManualDisplay'] = "";
$GLOBALS['RedirectTypeAutoDisplay'] = "display: none;";
$GLOBALS['LinkerTitle'] = GetLang('BrowseForLink');
break;
case ISC_REDIRECTS::REDIRECT_TYPE_PRODUCT:
$urlInfo = ISC_URLS::getProductUrl($row['redirectassocid'], true);
if(is_array($urlInfo) && !empty($urlInfo['title'])) {
$GLOBALS['NewURL'] = $urlInfo['url'];
$GLOBALS['NewURLTitle'] = GetLang('Product') . ': ' . $urlInfo['title'];
}
break;
case ISC_REDIRECTS::REDIRECT_TYPE_CATEGORY:
$urlInfo = ISC_URLS::getCategoryUrl($row['redirectassocid'], true);
if(is_array($urlInfo) && !empty($urlInfo['title'])) {
$GLOBALS['NewURL'] = $urlInfo['url'];
$GLOBALS['NewURLTitle'] = GetLang('Category') . ': ' . $urlInfo['title'];
}
break;
case ISC_REDIRECTS::REDIRECT_TYPE_BRAND:
//.........这里部分代码省略.........
示例4: the_permalink
<a class="button" href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
">Detalii</a>
</div>
</div>
</li>
<?php
}
?>
</ul>
<?php
BuildPagination();
?>
<?php
} else {
?>
<h2>Nu exista nici o oferta.</h2>
<?php
}
?>
</div>
</div>
</div>
<div class="sidebar">
<?php
get_sidebar('croaziera');
示例5: GetNav
/**
* Builds the pagination and navigation links
*
* @param int $page The current page we're on
* @param int $total_items The total number of items to be paginated
*/
private function GetNav($page, $total_items)
{
$searchURL = $this->GetSearchURL();
$numPages = ceil($total_items / ITEMS_PER_PAGE);
// Add the "(Page x of n)" label
if ($total_items > ITEMS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($total_items, ITEMS_PER_PAGE, $page, "index.php?ToDo=startExport" . $searchURL);
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |');
}
示例6: ManageUsersGrid
private function ManageUsersGrid(&$numUsers)
{
// Show a list of news in a table
$page = 0;
$start = 0;
$numUsers = 0;
$numPages = 0;
$GLOBALS['UserGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'desc';
} else {
$sortOrder = "asc";
}
$sortLinks = array("User" => "username", "Name" => "name", "Email" => "useremail", "Status" => "userstatus", "Vendor" => "vendorname");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageUsers", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageUsers", "username", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of questions returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ISC_USERS_PER_PAGE - (ISC_USERS_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$userResult = $this->_GetUserList($start, $sortField, $sortOrder, $numUsers);
$numPages = ceil($numUsers / ISC_USERS_PER_PAGE);
// Add the "(Page x of n)" label
if ($numUsers > ISC_USERS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numUsers, ISC_USERS_PER_PAGE, $page, sprintf("index.php?ToDo=viewUsers%s", $sortURL));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |');
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
$GLOBALS['HideVendorColumn'] = 'display: none';
if (gzte11(ISC_HUGEPRINT) && !$GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
$GLOBALS['HideVendorColumn'] = '';
}
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewUsers&page=" . $page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_USERS_PER_PAGE;
if ($max > count($userResult)) {
$max = count($userResult);
}
if ($numUsers > 0) {
// Display the news
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($userResult)) {
$GLOBALS['UserId'] = (int) $row['pk_userid'];
if ($row['vendorname']) {
$GLOBALS['Vendor'] = "<a href='index.php?ToDo=editVendor&vendorId=" . $row['uservendorid'] . "'>" . isc_html_escape($row['vendorname']) . "</a>";
} else {
$GLOBALS['Vendor'] = GetLang('NA');
}
if ($row['pk_userid'] == 1 || $row['username'] == "admin") {
$GLOBALS['CheckDisabled'] = "DISABLED";
} else {
$GLOBALS['CheckDisabled'] = "";
}
if ($row['name'] == " ") {
$GLOBALS['Name'] = GetLang('NA');
} else {
$GLOBALS['Name'] = isc_html_escape($row['name']);
}
$GLOBALS['Username'] = isc_html_escape($row['username']);
if (!$row['useremail']) {
$GLOBALS['Email'] = GetLang('NA');
} else {
$GLOBALS['Email'] = sprintf("<a href='mailto:%s'>%s</a>", urlencode($row['useremail']), isc_html_escape($row['useremail']));
}
switch ($row['userstatus']) {
case 0:
if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Users)) {
$GLOBALS['Status'] = sprintf("<a title='%s' href='index.php?ToDo=updateUserStatus&userId=%d&status=1'><img border='0' src='images/cross.gif'></a>", GetLang('UserActiveTip'), $row['pk_userid']);
} else {
$GLOBALS['Status'] = "<img border='0' src='images/cross.gif'>";
}
break;
case 1:
if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Users) && !($row['pk_userid'] == 1)) {
$GLOBALS['Status'] = sprintf("<a title='%s' href='index.php?ToDo=updateUserStatus&userId=%d&status=0'><img border='0' src='images/tick.gif'></a>", GetLang('UserInactiveTip'), $row['pk_userid']);
} else {
$GLOBALS['Status'] = "<img border='0' src='images/tick.gif'></a>";
}
break;
}
//.........这里部分代码省略.........
示例7: ManageOrdersGrid
private function ManageOrdersGrid(&$numOrders)
{
// Show a list of products in a table
$page = 0;
$start = 0;
$numPages = 0;
$GLOBALS['OrderGrid'] = "";
$GLOBALS['Nav'] = "";
$GLOBALS['SmallNav'] = "";
$catList = "";
$max = 0;
// Is this a custom search?
if (isset($_GET['searchId'])) {
$this->_customSearch = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->LoadSearch($_GET['searchId']);
$_REQUEST = array_merge($_REQUEST, (array) $this->_customSearch['searchvars']);
// Override custom search sort fields if we have a requested field
if (isset($_GET['sortField'])) {
$_REQUEST['sortField'] = $_GET['sortField'];
}
if (isset($_GET['sortOrder'])) {
$_REQUEST['sortOrder'] = $_GET['sortOrder'];
}
} else {
if (isset($_GET['searchQuery'])) {
$GLOBALS['Query'] = $_GET['searchQuery'];
}
}
if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") {
$sortOrder = "asc";
} else {
$sortOrder = "desc";
}
$validSortFields = array('orderid', 'custname', 'orddate', 'ordstatus', 'newmessages', 'ordtotalamount', 'ordoverview');
if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) {
$sortField = $_REQUEST['sortField'];
SaveDefaultSortField("ManageOrders", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageOrders", "orderid", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
// Build the pagination and sort URL
$searchURL = '';
foreach ($_GET as $k => $v) {
if ($k == "sortField" || $k == "sortOrder" || $k == "page" || $k == "new" || $k == "ToDo" || $k == "SubmitButton1" || !$v) {
continue;
}
$searchURL .= sprintf("&%s=%s", $k, urlencode($v));
}
$sortURL = sprintf("%s&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of orders returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ISC_ORDERS_PER_PAGE - (ISC_ORDERS_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$orderResult = $this->_GetOrderList($start, $sortField, $sortOrder, $numOrders);
$numPages = ceil($numOrders / ISC_ORDERS_PER_PAGE);
// Add the "(Page x of n)" label
if ($numOrders > ISC_ORDERS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
//alandy_2012-3-28 add.
if (isset($_REQUEST['orderOwner']) && $_REQUEST['orderOwner'] != '') {
$GLOBALS['Nav'] .= BuildPagination($numOrders, ISC_ORDERS_PER_PAGE, $page, sprintf("index.php?ToDo=viewOrders%s&orderOwner=%s", $sortURL, $_REQUEST['orderOwner']));
} else {
$GLOBALS['Nav'] .= BuildPagination($numOrders, ISC_ORDERS_PER_PAGE, $page, sprintf("index.php?ToDo=viewOrders%s", $sortURL));
}
} else {
$GLOBALS['Nav'] = "";
}
if (isset($_GET['searchQuery'])) {
$query = $_GET['searchQuery'];
} else {
$query = "";
}
$GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |');
$GLOBALS['SmallNav'] = rtrim($GLOBALS['SmallNav'], ' |');
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
$sortLinks = array("Id" => "orderid", "Cust" => "custname", "Date" => "orddate", "Status" => "ordstatus", "Message" => "newmessages", "Total" => "ordtotalamount", "Review" => "ordoverview");
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewOrders&" . $searchURL . "&page=" . $page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_ORDERS_PER_PAGE;
if ($max > count($orderResult)) {
$max = count($orderResult);
}
if (!gzte11(ISC_LARGEPRINT)) {
$GLOBALS['HideOrderMessages'] = "none";
$GLOBALS['CustomerNameSpan'] = 2;
}
// Display the orders
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($orderResult)) {
$GLOBALS['OrderId'] = $row['orderid'];
//.........这里部分代码省略.........
示例8: LoadChooseTemplateTab
public function LoadChooseTemplateTab()
{
$templatePath = ISC_BASE_PATH . "/templates";
GetLib('class.file');
$templateCount = 0;
$templates = scandir($templatePath);
natcasesort($templates);
foreach ($templates as $k => $template) {
if ($template == "." || $template == ".." || $template == "CVS" || $template == ".svn" || $template == 'blank.dat' || $template[0] == '_') {
continue;
}
$previewPath = $templatePath . '/' . $template . '/Previews';
if (!is_dir($previewPath)) {
continue;
}
$previews = new FileClass();
$previews->SetLoadDir($previewPath);
$doneColors = array();
while (($preview = $previews->NextFile()) !== false) {
if (substr($preview, -4) != ".jpg" && substr($preview, -5) != ".jpeg" && substr($preview, -4) != ".gif") {
continue;
}
$templateColor = ucfirst(str_replace(array(".jpg", ".jpeg", "gif", "fixed_", "stretched_"), "", strtolower($preview)));
if (in_array($templateColor, $doneColors)) {
continue;
}
$doneColors[] = $templateColor;
$templateList[] = array('template' => $template, 'templateName' => ucfirst($template), 'templateColor' => $templateColor, 'preview' => $preview, 'id' => uniqid(5));
++$templateCount;
if (GetConfig('template') == $template && strtolower($templateColor) == GetConfig('SiteColor')) {
$GLOBALS['CurrentTemplateImage'] = $preview;
}
}
}
if (isset($_REQUEST['page'])) {
$pageNumber = (int) $_REQUEST['page'];
} else {
$pageNumber = 1;
}
$perPage = 20;
if (isset($_REQUEST['perpage'])) {
$perPage = (int) $_REQUEST['perpage'];
}
$startNumber = $pageNumber * $perPage - $perPage;
$pageCount = ceil(count($templateList) / $perPage);
$GLOBALS['PageNumber'] = $pageNumber;
switch ($perPage) {
case 10:
$GLOBALS['PerPage10Selected'] = 'selected="selected"';
break;
case 50:
$GLOBALS['PerPage50Selected'] = 'selected="selected"';
break;
case 100:
$GLOBALS['PerPage100Selected'] = 'selected="selected"';
break;
default:
$GLOBALS['PerPage20Selected'] = 'selected="selected"';
break;
}
$GLOBALS['Nav'] = '';
if ($pageCount > 1) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $pageNumber, $pageCount);
$GLOBALS['Nav'] .= BuildPagination(count($templateList), $perPage, $pageNumber, "index.php?ToDo=viewTemplates");
}
$GLOBALS['TemplateListMap'] = '';
for ($i = $startNumber; $i < $startNumber + $perPage; ++$i) {
if (!isset($templateList[$i])) {
continue;
}
$template = $templateList[$i];
$GLOBALS['Template'] = $template['template'];
$GLOBALS['TemplateName'] = $template['templateName'];
$GLOBALS['TemplateColor'] = $template['templateColor'];
$GLOBALS['TemplatePreview'] = $template['preview'];
$GLOBALS['TemplateID'] = $template['id'];
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('layout.choosetemplate.row');
$templateCode = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
if (strtolower($template['templateColor']) == strtolower(GetConfig('SiteColor')) && $template['template'] == GetConfig('template')) {
$GLOBALS['TemplateListMap'] .= '<div class="TemplateBoxOn" id="' . $GLOBALS['TemplateID'] . '">' . $templateCode . '</div>';
} else {
$GLOBALS['TemplateListMap'] .= '<div class="TemplateBox" id="' . $GLOBALS['TemplateID'] . '" onmouseover="this.className=\'TemplateBoxOver\'" onmouseout="this.className=\'TemplateBox\'">' . $templateCode . '</div>';
}
}
}
示例9: ManageReviewsGrid
public function ManageReviewsGrid(&$numReviews)
{
// Show a list of reviews in a table
$page = 0;
$start = 0;
$numReviews = 0;
$numPages = 0;
$GLOBALS['ReviewGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
$searchURL = '';
$filterURL = '';
//Added by Simha
if (isset($_GET['brandid'])) {
$filterURL .= "&brandid=" . trim($_GET['brandid']) . "";
}
if (isset($_GET['seriesid'])) {
$filterURL .= "&seriesid=" . trim($_GET['seriesid']) . "";
}
//Added by Simha Ends
if (isset($_GET['searchQuery'])) {
$query = $_GET['searchQuery'];
$GLOBALS['Query'] = $query;
$searchURL = sprintf("&searchQuery=%s", urlencode($query));
} else {
$query = "";
$GLOBALS['Query'] = "";
}
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'asc';
} else {
$sortOrder = "desc";
}
$sortLinks = array("Review" => "r.revtitle", "Name" => "p.prodname", "By" => "r.revfromname", "Rating" => "r.revrating", "Date" => "r.revdate", "Status" => "r.revstatus");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageReviews", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageReviews", "r.reviewid", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
$GLOBALS['Page'] = $page;
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of questions returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ISC_REVIEWS_PER_PAGE - (ISC_REVIEWS_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$reviewResult = $this->_GetReviewList($query, $start, $sortField, $sortOrder, $numReviews);
$numPages = ceil($numReviews / ISC_REVIEWS_PER_PAGE);
// Add the "(Page x of n)" label
if ($numReviews > ISC_REVIEWS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numReviews, ISC_REVIEWS_PER_PAGE, $page, sprintf("index.php?ToDo=viewReviews%s%s%s", $sortURL, $filterURL, $searchURL));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |');
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewReviews&" . $searchURL . "&page=" . $page . $filterURL, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_REVIEWS_PER_PAGE;
if ($max > $numReviews) {
$max = $numReviews;
}
if ($numReviews > 0) {
// Display the reviews
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($reviewResult)) {
$GLOBALS['ReviewId'] = $row['reviewid'];
$GLOBALS['ProdName'] = isc_html_escape($row['prodname']);
$GLOBALS['ProdLink'] = ProdLink($row['prodname']);
if (isc_strlen($row['revtext']) > 100) {
$GLOBALS['ReviewTitle'] = isc_html_escape(sprintf("%s...", isc_substr($row['revtitle'], 0, 100)));
} else {
$GLOBALS['ReviewTitle'] = isc_html_escape($row['revtitle']);
}
$GLOBALS['Rating'] = "";
$ratingText = sprintf(GetLang('ReviewRated'), $row['revrating']);
for ($r = 0; $r < $row['revrating']; $r++) {
$GLOBALS['Rating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_on.gif'>", $ratingText);
}
for ($r = $row['revrating']; $r < 5; $r++) {
$GLOBALS['Rating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_off.gif'>", $ratingText);
}
if ($row['revfromname'] != "") {
$GLOBALS['PostedBy'] = isc_html_escape($row['revfromname']);
} else {
$GLOBALS['PostedBy'] = GetLang('NA');
}
$GLOBALS['Date'] = CDate($row['revdate']);
//.........这里部分代码省略.........
示例10: ManageShipmentsGrid
/**
* Generate the grid that shows the shipment results in it.
*
* @return string The generated grid of shipments for the current page.
*/
private function ManageShipmentsGrid()
{
$page = 0;
$start = 0;
$numPages = 0;
$shipmentGrid = '';
$GLOBALS['Nav'] = '';
// Is this a custom view?
if (isset($_GET['searchId'])) {
$this->customSearch = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->LoadSearch($_GET['searchId']);
$_REQUEST = array_merge($_REQUEST, (array) $this->customSearch['searchvars']);
// Override the sort fields of the view
if (isset($_GET['sortField'])) {
$_REQUEST['sortField'] = $_GET['sortField'];
}
if (isset($_GET['sortOrder'])) {
$_REQUEST['sortOrder'] = $_GET['sortOrder'];
}
} else {
if (isset($_REQUEST['searchQuery'])) {
$GLOBALS['Query'] = isc_html_escape($_GET['searchQuery']);
}
}
// Validate the sort order
if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == 'asc') {
$sortOrder = 'asc';
} else {
$sortOrder = 'desc';
}
// Which fields can we sort by?
$validSortFields = array('shipmentid', 'shipdate', 'shiporderid', 'shiporderdate', 'shipfullname');
if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) {
$sortField = $_REQUEST['sortField'];
SaveDefaultSortField('ManageShipments', $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField('ManageShipments', 'shipmentid', $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
// Build the pagination and sort URL
$searchURL = '';
foreach ($_GET as $k => $v) {
if ($k == "sortField" || $k == "sortOrder" || $k == "page" || $k == "new" || $k == "ToDo" || !$v) {
continue;
}
$searchURL .= '&' . $k . '=' . urlencode($v);
}
$sortURL = $searchURL . '&sortField=' . $sortField . '&sortOrder=' . $sortOrder;
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of shipments returned
if ($page == 1) {
$start = 0;
} else {
$start = ($page - 1) * ISC_SHIPMENTS_PER_PAGE;
}
// Grab the queries we'll be executing
$shipmentQueries = $this->BuildShipmentSearchQuery($start, $sortField, $sortOrder);
// How many results do we have?
$numShipments = $GLOBALS['ISC_CLASS_DB']->FetchOne($shipmentQueries['countQuery']);
$numPages = ceil($numShipments / ISC_SHIPMENTS_PER_PAGE);
// Add the "(Page x of y)" label
if ($numShipments > ISC_SHIPMENTS_PER_PAGE) {
$GLOBALS['Nav'] = '(' . GetLang('Page') . ' ' . $page . ' ' . GetLang('Of') . ' ' . $numPages . ') ';
$GLOBALS['Nav'] .= BuildPagination($numShipments, ISC_SHIPMENTS_PER_PAGE, $page, 'index.php?ToDo=viewShipments' . $sortURL);
} else {
$GLOBALS['Nav'] = '';
}
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
$sortLinks = array('Id' => 'shipmentid', 'Date' => 'shipdate', 'OrderId' => 'shiporderid', 'OrderDate' => 'shiporderdate', 'Name' => 'shipfullname');
BuildAdminSortingLinks($sortLinks, 'index.php?ToDo=viewShipments&' . $searchURL . '&page=' . $page, $sortField, $sortOrder);
$result = $GLOBALS['ISC_CLASS_DB']->Query($shipmentQueries['query']);
// Display the shipments
while ($shipment = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$GLOBALS['ShipmentId'] = $shipment['shipmentid'];
$GLOBALS['OrderId'] = $shipment['shiporderid'];
$GLOBALS['Date'] = isc_date(GetConfig('DisplayDateFormat'), $shipment['shipdate']);
$GLOBALS['OrderDate'] = isc_date(GetConfig('DisplayDateFormat'), $shipment['shiporderdate']);
// If the customer still exists, link to the customer page
$GLOBALS['ShippedTo'] = isc_html_escape($shipment['shipshipfirstname'] . ' ' . $shipment['shipshiplastname']);
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('shipments.manage.row');
$shipmentGrid .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
if (!$shipmentGrid) {
return '';
}
$GLOBALS['ShipmentGrid'] = $shipmentGrid;
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('shipments.manage.grid');
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
示例11: ManageBrandsGrid
public function ManageBrandsGrid(&$numBrands)
{
// Show a list of news in a table
$page = 0;
$start = 0;
$numBrands = 0;
$numPages = 0;
$GLOBALS['BrandGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
$searchURL = '';
if (isset($_GET['searchQuery'])) {
$query = $_GET['searchQuery'];
$GLOBALS['Query'] = $query;
$searchURL . 'searchQuery=' . urlencode($query);
} else {
$query = "";
$GLOBALS['Query'] = "";
}
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'desc';
} else {
$sortOrder = "asc";
}
$sortLinks = array("Brand" => "b.brandname", "Products" => "products");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageBrands", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageBrands", "b.brandname", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of brands returned
if ($page == 1) {
} else {
$start = $page * ISC_BRANDS_PER_PAGE - (ISC_BRANDS_PER_PAGE - 1);
}
$start = 1;
$start = $start - 1;
// Get the results for the query
$brandResult = $this->_GetBrandList($query, $start, $sortField, $sortOrder, $numBrands);
$numPages = ceil($numBrands / ISC_BRANDS_PER_PAGE);
// Workout the paging navigation
if ($numBrands > ISC_BRANDS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numBrands, ISC_BRANDS_PER_PAGE, $page, sprintf("index.php?ToDo=viewBrands%s", $sortURL));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['Nav'] = "";
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewBrands&" . $searchURL . "&page=" . $page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_BRANDS_PER_PAGE;
if ($max > count($brandResult)) {
$max = count($brandResult);
}
if ($numBrands > 0) {
// Display the news
$i = 1;
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($brandResult)) {
$GLOBALS['BrandId'] = (int) $row['brandid'];
$GLOBALS['BrandName'] = isc_html_escape($row['brandname']);
$GLOBALS['Products'] = (int) $row['products'];
// Workout the edit link -- do they have permission to do so?
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Brands)) {
$GLOBALS['EditBrandLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editBrand&brandId=%d'>%s</a>", GetLang('BrandEdit'), $row['brandid'], GetLang('Edit'));
} else {
$GLOBALS['EditNewsLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
}
if ($row['prodavgrating'] > 0) {
$GLOBALS['Rating'] = "";
$ratingText = sprintf(GetLang('ReviewRated'), $row['prodavgrating']);
for ($r = 0; $r < $row['prodavgrating']; $r++) {
$GLOBALS['Rating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_on.gif'>", $ratingText);
}
for ($r = $row['prodavgrating']; $r < 5; $r++) {
$GLOBALS['Rating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_off.gif'>", $ratingText);
}
} else {
$GLOBALS['Rating'] = "Not Rated";
}
$GLOBALS['ViewFeedbackLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=viewReviews&brandid=%d'>%s</a>", GetLang('ViewFeedback'), $row['brandid'], GetLang('ViewFeedback'));
/* To display series under the brands -- Baskaran */
$cntquery = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT COUNT( productid ) as prodcnt FROM [|PREFIX|]products WHERE brandseriesid =" . $row['brandid']);
$cntrow = $GLOBALS["ISC_CLASS_DB"]->Fetch($cntquery);
$squery = "\n SELECT b.*, FLOOR(SUM(p.prodratingtotal)/SUM(p.prodnumratings)) AS seriesprodavgrating, \n (SELECT count(productid) FROM [|PREFIX|]products where brandseriesid = b.seriesid) as prodcnt \n FROM [|PREFIX|]brand_series b\n LEFT JOIN [|PREFIX|]products p ON p.brandseriesid=b.seriesid\n where b.brandid = " . $row['brandid'] . " GROUP BY b.seriesid order by seriessort asc ";
$sresult = $GLOBALS["ISC_CLASS_DB"]->Query($squery);
$GLOBALS['Brandidhide'] = 'b' . $row['brandid'];
// $GLOBALS['SeriesGrid'] = '';
$GLOBALS['SeriesGrid'] = '<ul class="SortableList" id="SeriesList_' . $i . '">';
//Append Series Row
//.........这里部分代码省略.........
示例12: ManageSeriesGrid
public function ManageSeriesGrid(&$numSeries)
{
// Show a list of news in a table
$page = 0;
$start = 0;
$numSeries = 0;
$numPages = 0;
$GLOBALS['SeriesGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
$searchURL = '';
/* if (isset($_GET['searchQuery'])) {
$query = $_GET['searchQuery'];
$GLOBALS['Query'] = $query;
$searchURL .'searchQuery='.urlencode($query);
} else {
$query = "";
$GLOBALS['Query'] = "";
} */
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'desc';
} else {
$sortOrder = "asc";
}
$sortLinks = array("Series" => "b.seriesname");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageSeries", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageSeries", "b.seriesname", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of series returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ISC_SERIES_PER_PAGE - (ISC_SERIES_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$seriesResult = $this->_GetSeriesList($start, $sortField, $sortOrder, $numSeries);
$numPages = ceil($numSeries / ISC_SERIES_PER_PAGE);
// Workout the paging navigation
if ($numSeries > ISC_SERIES_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numSeries, ISC_SERIES_PER_PAGE, $page, sprintf("index.php?ToDo=viewSeries%s", $sortURL));
} else {
$GLOBALS['Nav'] = "";
}
// $GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewSeries&" . $searchURL . "&page=" . $page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_SERIES_PER_PAGE;
if ($max > count($seriesResult)) {
$max = count($seriesResult);
}
if ($numSeries > 0) {
// Display the news
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($seriesResult)) {
$GLOBALS['SeriesId'] = (int) $row['seriesid'];
$GLOBALS['SeriesName'] = wordwrap(isc_html_escape($row['seriesname']), 90, '<br>', true);
$GLOBALS['Brandname'] = $this->BrandNameId($row['brandid']);
$GLOBALS['FileName'] = isc_html_escape($row['seriesphoto']);
// Workout the edit link -- do they have permission to do so?
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Brands)) {
$GLOBALS['EditSeriesLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editSeries&seriesId=%d'>%s</a>", GetLang('SeriesEdit'), $row['seriesid'], GetLang('Edit'));
} else {
$GLOBALS['EditNewsLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("series.manage.row");
$GLOBALS['SeriesGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("series.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
}
示例13: _LoadVariationCombinationsTable
//.........这里部分代码省略.........
//$sortURL = sprintf("%s&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder);
//$GLOBALS['SortURL'] = $sortURL;
$sortURL = '';
// Limit the number of questions returned
if($page == 1) {
$start = 1;
}
else {
$start = ($page * ISC_PRODUCTS_PER_PAGE) - (ISC_PRODUCTS_PER_PAGE-1);
}
$start = $start-1;
foreach ($newOptions as $option) {
$numOptions *= count($option);
}
$numPages = ceil($numOptions / ISC_PRODUCTS_PER_PAGE);
$filterQuery = '';
if (!empty($filterOptions)) {
$GLOBALS['FilterOptionsQuery'] = http_build_query($filterOptions);
$queryOptions = array('filterOption' => $filterOptions);
$filterQuery = "&" . http_build_query($queryOptions);
}
// Add the "(Page x of n)" label
if($numOptions > ISC_PRODUCTS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numOptions, ISC_PRODUCTS_PER_PAGE, $page, "remote.php?w=getVariationCombinations&productId=" . $ProductId . "&productHash=" . $ProductHash . "&v=" . $VariationId . "&inv=" . (int)$ShowInventoryFields . $sortURL . $filterQuery);
}
else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['Nav'] = preg_replace('# \|$#',"", $GLOBALS['Nav']);
//$GLOBALS['SortField'] = $sortField;
//$GLOBALS['SortOrder'] = $sortOrder;
// Get the variation combinations as text, such as #red#small#modern
$GLOBALS["variation_data"] = array();
$GLOBALS['VariationRows'] = "";
$this->GetCombinationText('', $newOptions, 0, ISC_PRODUCTS_PER_PAGE, $start);
$GLOBALS["variation_combinations"] = $GLOBALS["variation_data"];
// Get the variation combinations ID's, such as #145#185#195
$GLOBALS["variation_data"] = array();
$this->GetCombinationText('', $newOptionIds, 0, ISC_PRODUCTS_PER_PAGE, $start);
$GLOBALS["variation_combination_ids"] = $GLOBALS["variation_data"];
// Setup a counter
$count = 0;
// Loop through the variation combination ID's and output them as hidden fields
foreach($GLOBALS["variation_combination_ids"] as $k => $combo) {
$GLOBALS['VariationRows'] .= sprintf(" <input name='options[$count][variationcombination]' type='hidden' value='%s' /></td>", $combo);
++$count;
}
// Reset the counter
$count = 0;
示例14: ManageVendorPaymentsGrid
/**
* Generate a grid containing vendor payments for the current result set.
*
* @return string The generated payment grid.
*/
private function ManageVendorPaymentsGrid()
{
$page = 0;
$start = 0;
$numPages = 0;
$paymentGrid = '';
$GLOBALS['Nav'] = '';
// Validate the sort order
if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == 'asc') {
$sortOrder = 'asc';
} else {
$sortOrder = 'desc';
}
// Which fields can we sort by?
$validSortFields = array('paymentid', 'paymentfrom', 'vendorname', 'paymentamount', 'paymentmethod', 'paymentdate');
if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) {
$sortField = $_REQUEST['sortField'];
SaveDefaultSortField('ManageVendorPayments', $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField('ManageVendorPayments', 'paymentid', $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
// Build the pagination and sort URL
$searchURL = '';
foreach ($_GET as $k => $v) {
if ($k == "sortField" || $k == "sortOrder" || $k == "page" || $k == "new" || $k == "ToDo" || !$v) {
continue;
}
$searchURL .= '&' . $k . '=' . urlencode($v);
}
$sortURL = $searchURL . '&sortField=' . $sortField . '&sortOrder=' . $sortOrder;
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of payments returned
if ($page == 1) {
$start = 0;
} else {
$start = ($page - 1) * ISC_VENDOR_PAYMENTS_PER_PAGE;
}
// Grab the queries we'll be executing
$paymentQueries = $this->BuildVendorPaymentSearchQuery($start, $sortField, $sortOrder);
// How many results do we have?
$numPayments = $GLOBALS['ISC_CLASS_DB']->FetchOne($paymentQueries['countQuery']);
$numPages = ceil($numPayments / ISC_VENDOR_PAYMENTS_PER_PAGE);
// Add the "(Page x of y)" label
if ($numPayments > ISC_VENDOR_PAYMENTS_PER_PAGE) {
$GLOBALS['Nav'] = '(' . GetLang('Page') . ' ' . $page . ' ' . GetLang('Of') . ' ' . $numPages . ') ';
$GLOBALS['Nav'] .= BuildPagination($numPayments, ISC_VENDOR_PAYMENTS_PER_PAGE, $page, 'index.php?ToDo=viewVendorPayments' . $sortURL);
} else {
$GLOBALS['Nav'] = '';
}
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
$sortLinks = array('Id' => 'paymentid', 'Date' => 'paymentfrom', 'Vendor' => 'vendorname', 'Amount' => 'paymentamount', 'Method' => 'paymentmethod', 'PaymentDate' => 'paymentdate');
BuildAdminSortingLinks($sortLinks, 'index.php?ToDo=viewVendorPayments&' . $searchURL . '&page=' . $page, $sortField, $sortOrder);
// Display the payments
$result = $GLOBALS['ISC_CLASS_DB']->Query($paymentQueries['query']);
while ($payment = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$GLOBALS['PaymentId'] = $payment['paymentid'];
$GLOBALS['PaymentAmount'] = FormatPrice($payment['paymentamount']);
$GLOBALS['PaymentMethod'] = isc_html_escape($payment['paymentmethod']);
$GLOBALS['PaymentDate'] = CDate($payment['paymentdate']);
$GLOBALS['PaymentFrom'] = CDate($payment['paymentfrom']);
$GLOBALS['PaymentTo'] = CDate($payment['paymentto']);
$GLOBALS['PaymentComments'] = nl2br(isc_html_escape($payment['paymentcomments']));
$GLOBALS['Vendor'] = isc_html_escape($payment['vendorname']);
if (!$GLOBALS['PaymentComments']) {
$GLOBALS['HideExpandLink'] = 'display: none';
} else {
$GLOBALS['HideExpandLink'] = '';
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('vendorpayments.manage.row');
$paymentGrid .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
if (!$paymentGrid) {
return '';
}
$GLOBALS['PaymentGrid'] = $paymentGrid;
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('vendorpayments.manage.grid');
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
示例15: ManageWishListGrid
public function ManageWishListGrid(&$numMake)
{
// Show a list of news in a table
$page = 0;
$start = 0;
$numMake = 0;
$numPages = 0;
$GLOBALS['WishListGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
$searchURL = '';
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'desc';
} else {
$sortOrder = "asc";
}
$sortLinks = array("CustomerName" => "c.custconfirstname", "ProductName" => "p.prodname", "Amount" => "p.prodprice");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("manageWishList", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("manageWishList", "c.custconfirstname", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of WishList returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ISC_WISHLIST_PER_PAGE - (ISC_WISHLIST_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$wishlistResult = $this->_GetWishList($start, $sortField, $sortOrder, $numMake);
$numPages = ceil($numMake / ISC_WISHLIST_PER_PAGE);
// Workout the paging navigation
if ($numMake > ISC_WISHLIST_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numMake, ISC_WISHLIST_PER_PAGE, $page, sprintf("index.php?ToDo=wishlist%s", $sortURL));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=wishlist&" . $searchURL . "&page=" . $page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_WISHLIST_PER_PAGE;
if ($max > count($wishlistResult)) {
$max = count($wishlistResult);
}
if ($numMake > 0) {
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($wishlistResult)) {
$GLOBALS['CustomerName'] = isc_html_escape($row['customername']);
$GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
$GLOBALS['Amount'] = number_format($row['prodprice'], 2);
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("wishlist.manage.row");
$GLOBALS['WishListGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("wishlist.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
}