本文整理汇总了PHP中GetDefaultSortField函数的典型用法代码示例。如果您正苦于以下问题:PHP GetDefaultSortField函数的具体用法?PHP GetDefaultSortField怎么用?PHP GetDefaultSortField使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetDefaultSortField函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
//.........这里部分代码省略.........
示例2: GetGrid
/**
* Gets a grid of data for the current export
*
* @param string $where The WHERE statement to use to get the data
*/
private function GetGrid($where = "")
{
// get current page
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
// Limit the number of orders returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ITEMS_PER_PAGE - (ITEMS_PER_PAGE - 1);
}
$start = $start - 1;
// set sort order
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'asc') {
$sortOrder = 'asc';
} else {
$sortOrder = "desc";
}
$sortLinks = $this->filetype->GetListSortLinks();
// get the field to sort on
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("Export" . $this->type, $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("Export" . $this->type, current($sortLinks), $sortOrder);
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=startExport" . $this->GetSearchURL(true) . "&page=" . $page, $sortField, $sortOrder);
// get the icon to show for this type
//$details = $this->filetype->GetTypeDetails();
//$GLOBALS['TypeIcon'] = $details['icon'];
// get number of records total
$query = $this->filetype->GetListCountQuery($where, $this->vendorid);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
$total_items = $row['ListCount'];
$GLOBALS['DataSummary'] = sprintf(GetLang("ExportSummary"), number_format($total_items), isc_strtolower($this->type_title));
// generate navigation links
$this->GetNav($page, $total_items);
// get the query to list the data
$query = $this->filetype->GetListQuery($where, $this->vendorid, $sortField, $sortOrder);
$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, ITEMS_PER_PAGE);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if (!$GLOBALS['ISC_CLASS_DB']->CountResult($result)) {
throw new Exception(sprintf(GetLang("NoDataFound"), isc_strtolower($this->type_title)));
}
// get the columns to display in the grid
$columns = $this->filetype->GetListColumns();
$sortKeys = array_keys($sortLinks);
// modify columns to include a sort link
$new_columns = array();
foreach ($columns as $x => $value) {
$new_columns[] = $value . " %%GLOBAL_SortLinks" . $sortKeys[$x] . "%%";
}
//zcs=>modified
//$GLOBALS['ColSpan'] = count($columns) + 1;
$GLOBALS['ColSpan'] = count($columns);
//<zcs=
$gridData = "<tr class=\"Heading3\">\n" . $this->BuildTableRow($new_columns) . "\n</tr>";
$gridData = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseGL($gridData);
// Build the items for the grid
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
// get a formatted row
$output = $this->filetype->GetListRow($row);
$new_row = $output;
foreach ($output as $id => $value) {
if (!$value) {
$new_row[$id] = "N/A";
}
}
$GLOBALS['RowData'] = $this->BuildTableRow($new_row);
$GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("export.grid.row");
$gridData .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
return $gridData;
}
示例3: 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>
//.........这里部分代码省略.........
示例4: ManageGiftWrappingGrid
/**
* Generate a grid containing the different types of configured gift wrapping.
*
* @param int The number of gift wrapping types (passed by reference)
* @return string the HTML for the grid of gift wrapping types.
*/
private function ManageGiftWrappingGrid(&$numGiftWrap)
{
$page = 0;
$start = 0;
$numGiftWrap = 0;
$GLOBALS['GiftWrapGrid'] = '';
$GLOBALS['Nav'] = '';
if (isset($_REQUEST['page'])) {
$page = (int) $_REQUEST['page'];
} else {
$page = 1;
}
// Where are we starting at?
if ($page == 1) {
$start = 0;
} else {
$start = $page * ISC_GIFTWRAP_PER_PAGE - ISC_GIFTWRAP_PER_PAGE;
}
// Fetch the list of available gift wrapping
$query = "SELECT COUNT(wrapid) FROM [|PREFIX|]gift_wrapping";
$numGiftWrap = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
// If there aren't any wrapping papers set up, just return nothing here
if ($numGiftWrap == 0) {
return '';
}
$validSortFields = array('wrapname', 'wrapprice', 'wrapvisible');
if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") {
$sortOrder = "asc";
} else {
$sortOrder = "desc";
}
if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) {
$sortField = $_REQUEST['sortField'];
SaveDefaultSortField("ManageGiftWrapping", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageGiftWrapping", "wrapname", $sortOrder);
}
$numPages = ceil($numGiftWrap / ISC_GIFTWRAP_PER_PAGE);
// Add the "(Page x of n)" label
if ($numGiftWrap > ISC_GIFTWRAP_PER_PAGE) {
$GLOBALS['Nav'] = "(" . GetLang('Page') . " " . $page . " of " . $numPages . ") ";
$pagingUrl = "index.php?ToDo=viewGiftWrapping&sortOrder=" . $sortOrder . "&sortField=" . $sortField;
$GLOBALS['Nav'] .= BuildPagination($numGiftWrap, ISC_GIFTWRAP_PER_PAGE, $page, $pagingUrl);
} else {
$GLOBALS['Nav'] = "";
$GLOBALS['HidePaging'] = 'display: none';
}
$sortLinks = array("WrapName" => "wrapname", "WrapPrice" => "wrapprice", "WrapVisible" => "wrapvisible");
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewGiftWrapping&page=" . $page, $sortField, $sortOrder);
// Start fetching out the actual wrapping types
$query = "\n\t\t\tSELECT *\n\t\t\tFROM [|PREFIX|]gift_wrapping\n\t\t\tORDER BY " . $sortField . " " . $sortOrder . "\n\t\t";
$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, ISC_GIFTWRAP_PER_PAGE);
$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
while ($wrap = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$GLOBALS['WrapName'] = isc_html_escape($wrap['wrapname']);
$GLOBALS['WrapId'] = $wrap['wrapid'];
$GLOBALS['WrapPrice'] = FormatPrice($wrap['wrapprice']);
if ($wrap['wrapvisible'] == 1) {
$GLOBALS['WrapVisibleImage'] = 'tick.gif';
} else {
$GLOBALS['WrapVisibleImage'] = 'cross.gif';
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("giftwrapping.manage.row");
$GLOBALS['GiftWrapGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("giftwrapping.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
示例5: ManageCabsizeGrid
private function ManageCabsizeGrid(&$numCab)
{
// Show a list of news in a table
$page = 0;
$start = 0;
$numCab = 0;
$numPages = 0;
$GLOBALS['CabsizeGrid'] = '';
$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("Irregularvalue" => "c.irregular_value", "Generalizevalue" => "c.generalize_value");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageCabsize", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageCabsize", "c.irregular_value", $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) {
$start = 1;
} else {
$start = $page * ISC_CABSIZE_PER_PAGE - (ISC_CABSIZE_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$cabsizeResult = $this->_GetCabsizeList($start, $sortField, $sortOrder, $numCab);
$numPages = ceil($numCab / ISC_CABSIZE_PER_PAGE);
// Workout the paging navigation
if ($numCab > ISC_CABSIZE_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numCab, ISC_CABSIZE_PER_PAGE, $page, sprintf("index.php?ToDo=viewCabsizeSettings%s", $sortURL));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewCabsizeSettings&" . $searchURL . "&page=" . $page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_CABSIZE_PER_PAGE;
if ($max > count($cabsizeResult)) {
$max = count($cabsizeResult);
}
if ($numCab > 0) {
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($cabsizeResult)) {
$GLOBALS['Prodstartyear'] = isc_html_escape($row['prodstartyear']);
$GLOBALS['Prodendyear'] = isc_html_escape($row['prodendyear']);
$GLOBALS['Prodmake'] = isc_html_escape($row['prodmake']);
$GLOBALS['Prodmodel'] = isc_html_escape($row['prodmodel']);
$GLOBALS['Irregularvalue'] = isc_html_escape($row['irregular_value']);
$GLOBALS['Generalizevalue'] = isc_html_escape($row['generalize_value']);
$GLOBALS['EditCabsizeLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editCabsizesettings&cabId=%d'>%s</a>", GetLang('Edit'), $row['id'], GetLang('Edit'));
$GLOBALS['DeleteCabsizeLink'] = sprintf("<a title='%s' class='Action' href='#' onclick=deleteCabid(%d)>%s</a>", GetLang('Delete'), $row['id'], GetLang('Delete'));
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("cabsize.manage.row");
$GLOBALS['CabsizeGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("cabsize.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
}
示例6: ManageDiscountsGrid
private function ManageDiscountsGrid(&$numDiscounts)
{
// Show a list of discounts in a table
$page = 0;
$start = 0;
$numDiscounts = 0;
$numPages = 0;
$GLOBALS['DiscountGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'desc';
} else {
$sortOrder = "asc";
}
$sortLinks = array("DiscountName" => "c.discountname", "DiscountMaxUses" => "c.discountmaxuses", "DiscountCurrentUses" => "c.discountcurrentuses", "DiscountExpiryDate" => "c.discountexpiry", "DiscountStartDate" => "c.discountstart", "DiscountEnabled" => "c.discountenabled");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageDiscounts", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageDiscounts", "c.discountid", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Get the results for the query
$discountResult = $this->_GetDiscountList($start, $sortField, $sortOrder, $numDiscounts);
$GLOBALS['SortField'] = $sortField;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewDiscounts&page=" . $page, $sortField, $sortOrder);
if ($numDiscounts > 0) {
// Display the discounts
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($discountResult)) {
$GLOBALS['DiscountId'] = isc_html_escape($row['discountid']);
$GLOBALS['RowId'] = 'Sort_' . $row['discountid'];
$GLOBALS['Name'] = isc_html_escape($row['discountname']);
$GLOBALS['MaxUses'] = (int) $row['discountmaxuses'];
$tmp = unserialize($row['configdata']);
$GLOBALS['DiscountType'] = '';
if (isset($tmp['var_discountpolicy'])) {
$discountpolicy = $tmp['var_discountpolicy'];
if ($discountpolicy == 0) {
$GLOBALS['DiscountType'] = "Sale Price";
} elseif ($discountpolicy == 1) {
$GLOBALS['DiscountType'] = "Price in Cart";
}
}
if ($GLOBALS['MaxUses'] == 0) {
$GLOBALS['MaxUses'] = 'Unlimited';
}
$GLOBALS['CurrentUses'] = (int) $row['discountcurrentuses'];
if ($row['discountexpiry'] != 0) {
$GLOBALS['ExpiryDate'] = date("m/d/Y H:i", isc_html_escape($row['discountexpiry']));
} else {
$GLOBALS['ExpiryDate'] = 'N/A';
}
if ($row['discountstart'] != 0) {
$GLOBALS['StartDate'] = date("m/d/Y H:i", isc_html_escape($row['discountstart']));
} else {
$GLOBALS['StartDate'] = 'N/A';
}
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Discounts)) {
$GLOBALS['EditDiscountLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editDiscount&discountId=%d'>%s</a>", GetLang('DiscountEdit'), $row['discountid'], GetLang('Edit'));
if ($row['discountenabled'] == 1) {
$GLOBALS['Enabled'] = sprintf("<a title='%s' href='index.php?ToDo=editDiscountEnabled&discountId=%d&enabled=0'><img border='0' src='images/tick.gif'></a>", GetLang('ClickToDisableDiscount'), $row['discountid']);
} else {
$GLOBALS['Enabled'] = sprintf("<a title='%s' href='index.php?ToDo=editDiscountEnabled&discountId=%d&enabled=1'><img border='0' src='images/cross.gif'></a>", GetLang('ClickToEnableDiscount'), $row['discountid']);
}
if ($row['halts'] == 1) {
$GLOBALS['Halt'] = sprintf("<a title='%s' href='index.php?ToDo=editDiscountHalt&discountId=%d&halt=0'><img border='0' src='images/tick.gif'></a>", GetLang('ClickToDisableHaltDiscount'), $row['discountid']);
} else {
$GLOBALS['Halt'] = sprintf("<a title='%s' href='index.php?ToDo=editDiscountHalt&discountId=%d&halt=1'><img border='0' src='images/cross.gif'></a>", GetLang('ClickToEnableHaltDiscount'), $row['discountid']);
}
} else {
$GLOBALS['EditDiscountLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
if ($row['discountenabled'] == 1) {
$GLOBALS['Enabled'] = '<img border="0" src="images/tick.gif" alt="tick" />';
} else {
$GLOBALS['Enabled'] = '<img border="0" src="images/cross.gif" alt="cross" />';
}
if ($row['halts'] == 1) {
$GLOBALS['Halt'] = '<img border="0" src="images/tick.gif" alt="tick" />';
} else {
$GLOBALS['Halt'] = '<img border="0" src="images/cross.gif" alt="cross" />';
}
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("discounts.manage.row");
$GLOBALS['DiscountGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("discounts.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
}
示例7: ProductStatsByInventoryGrid
/**
* Show all products by inventory levels
*/
public function ProductStatsByInventoryGrid()
{
$GLOBALS['OrderGrid'] = "";
// How many records per page?
if (isset($_GET['Show'])) {
$per_page = (int) $_GET['Show'];
} else {
$per_page = 20;
}
$GLOBALS['ProductsPerPage'] = $per_page;
$GLOBALS["IsShowPerPage" . $per_page] = 'selected="selected"';
// Should we limit the records returned?
if (isset($_GET['Page'])) {
$page = (int) $_GET['Page'];
} else {
$page = 1;
}
$GLOBALS['ProductsByInventoryCurrentPage'] = $page;
// Workout the start and end records
$start = $per_page * $page - $per_page;
$end = $start + ($per_page - 1);
// Only fetch products this user can actually see
$vendorRestriction = $this->GetVendorRestriction();
$vendorSql = '';
if ($vendorRestriction !== false) {
$vendorSql = " WHERE prodvendorid = '" . $GLOBALS['ISC_CLASS_DB']->Quote($vendorRestriction) . "'";
}
// How many products are there in total?
$query = "\n\t\t\tSELECT\n\t\t\t\tCOUNT(*) AS num\n\t\t\tFROM\n\t\t\t\t[|PREFIX|]products\n\t\t\t" . $vendorRestriction;
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
$total_products = $row['num'];
if ($total_products > 0) {
// Workout the paging
$num_pages = ceil($total_products / $per_page);
$paging = sprintf(GetLang('PageXOfX'), $page, $num_pages);
$paging .= " ";
// Is there more than one page? If so show the « to jump back to page 1
if ($num_pages > 1) {
$paging .= "<a href='javascript:void(0)' onclick='ChangeProductsByInventoryPage(1)'>«</a> | ";
} else {
$paging .= "« | ";
}
// Are we on page 2 or above?
if ($page > 1) {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeProductsByInventoryPage(%d)'>%s</a> | ", $page - 1, GetLang('Prev'));
} else {
$paging .= sprintf("%s | ", GetLang('Prev'));
}
for ($i = 1; $i <= $num_pages; $i++) {
// Only output paging -5 and +5 pages from the page we're on
if ($i >= $page - 6 && $i <= $page + 5) {
if ($page == $i) {
$paging .= sprintf("<strong>%d</strong> | ", $i);
} else {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeProductsByInventoryPage(%d)'>%d</a> | ", $i, $i);
}
}
}
// Are we on page 2 or above?
if ($page < $num_pages) {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeProductsByInventoryPage(%d)'>%s</a> | ", $page + 1, GetLang('Next'));
} else {
$paging .= sprintf("%s | ", GetLang('Next'));
}
// Is there more than one page? If so show the » to go to the last page
if ($num_pages > 1) {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeProductsByInventoryPage(%d)'>»</a> | ", $num_pages);
} else {
$paging .= "» | ";
}
$paging = rtrim($paging, ' |');
$GLOBALS['Paging'] = $paging;
if (isset($_GET['SortOrder']) && $_GET['SortOrder'] == "desc") {
$sortOrder = 'desc';
} else {
$sortOrder = 'asc';
}
$sortFields = array('productid', 'prodcode', 'prodname', 'prodnumviews', 'instock');
if (isset($_GET['SortBy']) && in_array($_GET['SortBy'], $sortFields)) {
$sortField = $_GET['SortBy'];
SaveDefaultSortField("ProductStatsByInventory", $_REQUEST['SortBy'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ProductStatsByInventory", "instock", $sortOrder);
}
$sortLinks = array("ProductId" => "productid", "Code" => "prodcode", "Name" => "prodname", "Views" => "prodnumviews", "Stock" => "instock");
BuildAdminSortingLinks($sortLinks, "javascript:SortProductsByInventory('%%SORTFIELD%%', '%%SORTORDER%%');", $sortField, $sortOrder);
// Fetch the products and inventory levels for this page
$query = "\n\t\t\t\tSELECT productid, prodcode, prodname, prodnumviews, prodinvtrack,\n\t\t\t\t\tCASE prodinvtrack\n\t\t\t\t\t\tWHEN '0' THEN\n\t\t\t\t\t\t\t-1\n\t\t\t\t\t\tWHEN '1' THEN\n\t\t\t\t\t\t\tprodcurrentinv\n\t\t\t\t\t\tWHEN '2' THEN\n\t\t\t\t\t\t\t\t(SELECT SUM(vcstock) FROM [|PREFIX|]product_variation_combinations WHERE vcproductid=productid)\n\t\t\t\t\t\tEND\n\t\t\t\t\t\tAS instock\n\t\t\t\tFROM [|PREFIX|]products\n\t\t\t\t " . $vendorSql . "\n\t\t\t\tORDER BY " . $sortField . " " . $sortOrder;
// Add the Limit
$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, $per_page);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
switch ($row['prodinvtrack']) {
case 0:
// Not tracking
//.........这里部分代码省略.........
示例8: ManagePages
private function ManagePages($MsgDesc = "", $MsgStatus = "")
{
// Show a list of pages in a table
$GLOBALS['PageGrid'] = "";
$GLOBALS['Nav'] = "";
$numSubPages = 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 = "";
}
$sortLinks = array(
"Title" => "p.pagetitle",
"Type" => "p.pagetype",
"Visible" => "p.pagestatus"
);
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManagePages", $_REQUEST['sortField'], $sortOrder);
}
else {
$sortField = "n.newsdate";
list($sortField, $sortOrder) = GetDefaultSortField("ManagePages", "p.pagesort asc, p.pagetitle asc", "");
}
if (isset($_GET['page'])) {
$page = (int)$_GET['page'];
} else {
$page = 1;
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Get the results for the query
$GLOBALS['Message'] = '';
if($MsgDesc != "") {
$GLOBALS['Message'] .= MessageBox($MsgDesc, $MsgStatus);
}
$GLOBALS['Message'] .= GetFlashMessageBoxes();
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewPages&".$searchURL."&page=".$page, $sortField, $sortOrder);
if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
$vendorId = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId();
}
else {
$vendorId = 0;
}
$GLOBALS['PageGrid'] = $this->_BuildPageList(0, $sortField, $sortOrder, 0, $vendorId);
$GLOBALS['VendorPagesGrid'] = '';
$GLOBALS['HideTabs'] = 'display: none';
if(gzte11(ISC_HUGEPRINT) && $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() == 0) {
// Get all pages that belong to vendors
$GLOBALS['VendorPagesGrid'] = $this->_BuildPageList(0, $sortField, $sortOrder, 0, -1);
if($GLOBALS['VendorPagesGrid']) {
$GLOBALS['HideTabs'] = '';
}
}
// Do we need to disable the delete button?
if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Pages) || !$GLOBALS['PageGrid']) {
$GLOBALS['DisableDelete'] = "disabled='disabled'";
}
if(!$GLOBALS['PageGrid'] && !$GLOBALS['VendorPagesGrid']) {
// There are no news posts in the database
$GLOBALS['DisplayGrid'] = "none";
$GLOBALS['Message'] = MessageBox(GetLang('NoPages'), MSG_SUCCESS);
}
else if(!$GLOBALS['PageGrid']) {
$GLOBALS['NoPagesMessage'] = MessageBox(GetLang('NoPages'), MSG_SUCCESS);
}
else if(!$GLOBALS['VendorPagesGrid']) {
$GLOBALS['NoVendorPagesMessage'] = MessageBox(GetLang('NoVendorPages'), MSG_SUCCESS);
}
$GLOBALS['PageIntro'] = GetLang('ManagePagesIntro');
$this->template->display('pages.manage.tpl');
}
示例9: ManageChangesReportsGrid
public function ManageChangesReportsGrid(&$numChangesReports)
{
// Show a list of news in a table
$page = 0;
$start = 0;
$numChangesReports = 0;
$numPages = 0;
$GLOBALS['ChangesReportGrid'] = "";
$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("Brands" => "b.brandname", "Products" => "products");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageChangesReports", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageChangesReports", "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) {
$start = 1;
} else {
$start = $page * ISC_REPORTS_PER_PAGE - (ISC_REPORTS_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$brandResult = $this->_GetChangesReportList($query, $start, $sortField, $sortOrder, $numChangesReports);
$numPages = ceil($numChangesReports / ISC_REPORTS_PER_PAGE);
if (isset($_GET['days']) && $_GET['days'] != '') {
$days = (int) $_GET['days'];
} else {
$days = 15;
}
// Workout the paging navigation
if ($numChangesReports > ISC_REPORTS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numChangesReports, ISC_REPORTS_PER_PAGE, $page, sprintf("index.php?ToDo=viewChangesReports%s", $sortURL . "&days=" . $days));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewChangesReports&" . $searchURL . "&page=" . $page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_REPORTS_PER_PAGE;
if ($max > count($brandResult)) {
$max = count($brandResult);
}
if ($numChangesReports > 0) {
// Display the news
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($brandResult)) {
$GLOBALS['BrandId'] = (int) $row['brandid'];
$GLOBALS['BrandName'] = isc_html_escape($row['brandname']);
$GLOBALS['TotalProducts'] = (int) $row['totalproducts'];
$GLOBALS['NewProducts'] = (int) $row['newproducts'];
$GLOBALS['ContentModified'] = (int) $row['contentcount'];
$GLOBALS['ApplicationModified'] = (int) $row['applicationcount'];
$GLOBALS['PriceModified'] = (int) $row['pricecount'];
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("changes.report.manage.row");
$GLOBALS['ChangesReportGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("changes.report.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
}
示例10: SearchStatsCorrectionsGrid
/**
* Fetch a data grid for search terms with results.
*/
public function SearchStatsCorrectionsGrid()
{
$GLOBALS['ResultsGrid'] = "";
if (isset($_GET['From']) && isset($_GET['To'])) {
$from_stamp = (int) $_GET['From'];
$to_stamp = (int) $_GET['To'];
// How many records per page?
if (isset($_GET['Show'])) {
$per_page = (int) $_GET['Show'];
} else {
$per_page = 20;
}
$GLOBALS['ResultsPerPage'] = $per_page;
$GLOBALS["IsShowPerPage" . $per_page] = 'selected="selected"';
// Should we limit the records returned?
if (isset($_GET['Page'])) {
$page = (int) $_GET['Page'];
} else {
$page = 1;
}
$GLOBALS['CorrectionsCurrentPage'] = $page;
// Workout the start and end records
$start = $per_page * $page - $per_page;
$end = $start + ($per_page - 1);
// How many searches with results are there in total?
$query = sprintf("select count(distinct(concat(correction,oldsearchtext))) as num\n\t\t\t\t\t\t\t\tfrom [|PREFIX|]search_corrections\n\t\t\t\t\t\t\t\twhere correctdate >= '%d' and correctdate <= '%d'", $from_stamp, $to_stamp);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
$total_results = $row['num'];
if ($total_results == 0) {
$GLOBALS['HidePagingLinks'] = "display: none";
}
// Workout the paging
$num_pages = ceil($total_results / $per_page);
$paging = sprintf(GetLang('PageXOfX'), $page, $num_pages);
$paging .= " ";
// Is there more than one page? If so show the « to jump back to page 1
if ($num_pages > 1) {
$paging .= "<a href='javascript:void(0)' onclick='ChangeSearchCorrectionsPage(1)'>«</a> | ";
} else {
$paging .= "« | ";
}
// Are we on page 2 or above?
if ($page > 1) {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeSearchCorrectionsPage(%d)'>%s</a> | ", $page - 1, GetLang('Prev'));
} else {
$paging .= sprintf("%s | ", GetLang('Prev'));
}
for ($i = 1; $i <= $num_pages; $i++) {
// Only output paging -5 and +5 pages from the page we're on
if ($i >= $page - 6 && $i <= $page + 5) {
if ($page == $i) {
$paging .= sprintf("<strong>%d</strong> | ", $i);
} else {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeSearchCorrectionsPage(%d)'>%d</a> | ", $i, $i);
}
}
}
// Are we on page 2 or above?
if ($page < $num_pages) {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeSearchCorrectionsPage(%d)'>%s</a> | ", $page + 1, GetLang('Next'));
} else {
$paging .= sprintf("%s | ", GetLang('Next'));
}
// Is there more than one page? If so show the » to go to the last page
if ($num_pages > 1) {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeSearchCorrectionsPage(%d)'>»</a> | ", $num_pages);
} else {
$paging .= "» | ";
}
$paging = rtrim($paging, ' |');
$GLOBALS['Paging'] = $paging;
if (isset($_GET['SortOrder']) && $_GET['SortOrder'] == "asc") {
$sortOrder = 'asc';
} else {
$sortOrder = 'desc';
}
$sortFields = array('oldsearchtext', 'oldnumresults', 'correction', 'numresults', 'numoccurances', 'correctiontype');
if (isset($_GET['SortBy']) && in_array($_GET['SortBy'], $sortFields)) {
$sortField = $_GET['SortBy'];
SaveDefaultSortField("SearchStatsCorrections", $_REQUEST['SortBy'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("SearchStatsCorrections", "numoccurances", $sortOrder);
}
$sortLinks = array("SearchTerms" => "oldsearchtext", "ProductsShownBefore" => "oldnumresults", "CorrectedSearchTerms" => "correction", "ProductsShownAfter" => "numresults", "NumberOfOccurances" => "numoccurances", "CorrectionType" => "correctiontype");
BuildAdminSortingLinks($sortLinks, "javascript:SortSearchCorrections('%%SORTFIELD%%', '%%SORTORDER%%');", $sortField, $sortOrder);
// Should we set focus to the grid?
if (isset($_GET['FromLink']) && $_GET['FromLink'] == "true") {
$GLOBALS['JumpToSearchCorrectionsGrid'] = "<script type=\"text/javascript\">document.location.href='#searchCorrectionsAnchor';</script>";
}
$query = sprintf("select count(correctionid) as numoccurances, correctiontype, correction, numresults, oldsearchtext, oldnumresults\n\t\t\t\t\t\t\t\tfrom [|PREFIX|]search_corrections\n\t\t\t\t\t\t\t\twhere numresults > 0\n\t\t\t\t\t\t\t\tand correctdate >= '%d' and correctdate <= '%d'\n\t\t\t\t\t\t\t\tgroup by concat(oldsearchtext,correction)\n\t\t\t\t\t\t\t\torder by %s %s", $from_stamp, $to_stamp, $sortField, $sortOrder);
// Add the Limit
$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, $per_page);
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
if ($row['correctiontype'] == "correction") {
//.........这里部分代码省略.........
示例11: ManageEngineMMYGrid
public function ManageEngineMMYGrid(&$numMake)
{
// Show a list of news in a table
$page = 0;
$start = 0;
$numMake = 0;
$numPages = 0;
$GLOBALS['EngineMMYGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
$searchURL = '';
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'desc';
} else {
$sortOrder = "asc";
}
$sortLinks = array("Make" => "p.make", "Model" => "p.model");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("manageEngineMMY", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("manageEngineMMY", "p.make", $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 MMY returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ISC_MMY_PER_PAGE - (ISC_MMY_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$mmyResult = $this->_GetEngineMMYList($start, $sortField, $sortOrder, $numMake);
$numPages = ceil($numMake / ISC_MMY_PER_PAGE);
// Workout the paging navigation
$con = $this->condition;
if ($numMake > ISC_MMY_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numMake, ISC_MMY_PER_PAGE, $page, sprintf("index.php?ToDo=viewEngineMMY%s" . $con, $sortURL));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewEngineMMY&" . $searchURL . "&page=" . $page . $con, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_MMY_PER_PAGE;
if ($max > count($mmyResult)) {
$max = count($mmyResult);
}
$user = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUser();
$userrole = $user['userrole'];
if ($userrole == 'admin') {
$GLOBALS['DisplayAction'] = '';
} else {
$GLOBALS['DisplayAction'] = 'none';
}
if ($numMake > 0) {
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($mmyResult)) {
$GLOBALS['Id'] = (int) $row['id'];
$GLOBALS['Engid'] = $row['eid'];
$GLOBALS['Year'] = $row['year'];
$GLOBALS['Make'] = isc_html_escape($row['make']);
$GLOBALS['Model'] = isc_html_escape($row['model']);
$GLOBALS['SubModel'] = isc_html_escape($row['submodel']);
$GLOBALS['EngineType'] = isc_html_escape($row['engtype']);
$GLOBALS['Liter'] = isc_html_escape($row['liter']);
$mid = $row['id'];
$eid = $row['eid'];
$mmyedit = GetLang('EngineMMYEdit');
$edit = GetLang('EngineEdit');
// Workout the edit link -- do they have permission to do so?
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Brands)) {
$GLOBALS['EditEngineMMYLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editEngineMMY&Id=%d&eid=%d'>%s</a>", GetLang('EngineMMYEdit'), $row['id'], $row['eid'], GetLang('EngineEdit'));
} else {
$GLOBALS['EditEngineMMYLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
}
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Brands)) {
$GLOBALS['DeleteEngineMMYLink'] = "<a title='" . GetLang('MMYDelete') . "' class='Action' href='#' onclick=\"deleteenginemmyid(" . $row['id'] . ",'" . $row['engtype'] . "','" . $row['liter'] . "')\">" . GetLang('Delete') . "</a>";
//$GLOBALS['DeleteEngineMMYLink'] = sprintf("<a title='%s' class='Action' href='#' onclick=deleteenginemmyid(%d)>%s</a>", GetLang('MMYDelete'), $row['id'], GetLang('Delete'));
} else {
$GLOBALS['DeleteEngineMMYLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Delete'));
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("mmy.engine.manage.row");
$GLOBALS['EngineMMYGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("mmy.engine.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
}
示例12: 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
//lguan_20100612: Category supporting in product rating
if (isset($_GET['catid'])) {
$filterURL .= "&catid=" . trim($_GET['catid']) . "";
}
if (isset($_GET['subcatid'])) {
$filterURL .= "&subcatid=" . trim($_GET['subcatid']) . "";
}
//lguan_20100615: Append information for from and to
if (isset($GLOBALS['FromStamp']) && is_numeric($GLOBALS['FromStamp'])) {
$filterURL .= "&from=" . isc_date('m/d/Y', $GLOBALS['FromStamp']) . "";
}
if (isset($GLOBALS['ToStamp']) && is_numeric($GLOBALS['ToStamp'])) {
$filterURL .= "&to=" . isc_date('m/d/Y', $GLOBALS['ToStamp']) . "";
}
if (isset($_GET['datetype'])) {
$filterURL .= "&datetype=" . $_GET['datetype'] . "";
}
//wiyin_20100628: get the review status
if (isset($_GET['reviewStatus'])) {
$GLOBALS['reviewStatus'] = (int) $_GET['reviewStatus'];
}
if (isset($_GET['ISSelectReplacement_category'])) {
$cateList = $_GET['ISSelectReplacement_category'];
if (is_array($cateList)) {
if (!in_array(0, $cateList)) {
$GLOBALS['CateList'] = $cateList;
}
}
}
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'] == 'asc') {
$sortOrder = 'asc';
} else {
$sortOrder = "desc";
}
$sortLinks = array("OrderId" => "r.orderid", "Review" => "r.revtitle", "Name" => "p.prodname", "By" => "r.revfromname", "Rating" => "r.revrating", "Date" => "r.revdate", "Status" => "r.revstatus", "RatingQuality" => "r.qualityrating", "RatingInstall" => "r.installrating", "RatingValue" => "r.valuerating", "RatingSupport" => "r.supportrating", "RatingDelivery" => "r.deliveryrating");
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
//.........这里部分代码省略.........
示例13: ManageFilesGrid
public function ManageFilesGrid(&$numFiles)
{
$AllFiles = array("product_videos", "install_videos", "audio_clips", "instruction_files", "article_files");
$AllFileTitles = array("Product Videos", "Install Videos", "Audio Clips", "Instruction Files", "Article Files");
$FileStatus = array("Pending", "Download in progress", "Downloaded successful", "Download failed or partially downloaded", "Invalid or unknown URL");
$FilesMainGrid = "";
$GLOBALS['TabTitle'] = "";
$GLOBALS['AllFileTypes'] = "";
foreach ($AllFiles as $FileT) {
$GLOBALS['AllFileTypes'] .= "'" . $FileT . "',";
}
$GLOBALS['AllFileTypes'] = trim($GLOBALS['AllFileTypes'], ",");
//$GLOBALS['AllFileTypes'] = implode(",", $AllFiles);
$index = 0;
foreach ($AllFiles as $FileType) {
$GLOBALS['FileType'] = $FileType;
$tableName = $FileType;
$queryFields = $this->GetQueryFields($FileType);
// Show a list of news in a table
$page = 0;
$start = 0;
$numFiles = 0;
$numPages = 0;
$GLOBALS['FilesGrid'] = "";
$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("FileId" => "fl." . $queryFields['FileId'], "FileURL" => "fl." . $queryFields['FileURL']);
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageQualifierAssociations", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("FilesGrid", "fl." . $queryFields['FileId'], $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 files 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
$filesResult = $this->_GetFilesList($query, $tableName, $queryFields, $start, $sortField, $sortOrder, $numFiles);
$numPages = ceil($numFiles / ISC_BRANDS_PER_PAGE);
/*
// Workout the paging navigation
if($numFiles > ISC_BRANDS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numFiles, ISC_BRANDS_PER_PAGE, $page, sprintf("index.php?ToDo=viewFileMangement%s", $sortURL));
}
else {
$GLOBALS['Nav'] = "";
}
*/
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewFileMangement&" . $searchURL . "&page=" . $page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_BRANDS_PER_PAGE;
if ($max > count($filesResult)) {
$max = count($filesResult);
}
$GLOBALS['DivIndex'] = $index;
$GLOBALS['TabTitle'] .= '<li><a href="#" id="tab' . $index . '" onclick="ShowTab(' . $index . ')">' . $AllFileTitles[$index] . '</a></li>';
if ($numFiles > 0) {
$GLOBALS['DisplayTabGrid'] = "block";
$GLOBALS['TabMessage'] = "";
// Display the news
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($filesResult)) {
$GLOBALS['FileId'] = (int) $row['fileid'];
$GLOBALS['FileURL'] = $row['fileurl'];
//.........这里部分代码省略.........
示例14: 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']);
//.........这里部分代码省略.........
示例15: ManageOrdersGrid
protected function ManageOrdersGrid(&$numOrders, &$numDeletedOrders = 0)
{
// Show a list of products in a table
$page = 0;
$start = 0;
$GLOBALS['OrderGrid'] = "";
$catList = "";
$max = 0;
// Is this a custom search?
if(isset($_GET['searchId'])) {
// 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'];
}
}
if(isset($_GET['searchQuery'])) {
$GLOBALS['QueryEscaped'] = isc_html_escape($_GET['searchQuery']);
}
if(isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") {
$sortOrder = "asc";
}
else {
$sortOrder = "desc";
}
$validSortFields = array('orderid', 'custname', 'orddate', 'ordstatus', 'newmessages', 'total_inc_tax');
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;
}
if (isset($_GET['perpage'])) {
$perPage = (int)$_GET['perpage'];
SaveDefaultPerPage("ManageOrders", $perPage);
}
else {
$perPage = GetDefaultPerPage("ManageOrders", ISC_ORDERS_PER_PAGE);
}
// Build the pagination and sort URL
$searchURL = $_GET;
unset($searchURL['sortField'], $searchURL['sortOrder'], $searchURL['page'], $searchURL['new'], $searchURL['ToDo'], $searchURL['SubmitButton1'], $searchURL['SearchButton_x'], $searchURL['SearchButton_y']);
$searchURL['sortField'] = $sortField;
$searchURL['sortOrder'] = $sortOrder;
$this->template->assign('searchURL', $searchURL);
$sortURL = $searchURL;
unset($sortURL['sortField'], $sortURL['sortOrder']);
// Limit the number of orders returned
if ($page == 1) {
$start = 1;
} else {
$start = ($page * $perPage) - ($perPage-1);
}
$start = $start-1;
// Get the results for the query
$orderResult = $this->_GetOrderList($start, $sortField, $sortOrder, $numOrders, $perPage, $numDeletedOrders);
$GLOBALS['perPage'] = $perPage;
$GLOBALS['numOrders'] = $numOrders;
$GLOBALS['pageURL'] = "index.php?ToDo=viewOrders&" . http_build_query($searchURL);
$GLOBALS['currentPage'] = $page;
$this->template->assign('numDeletedOrders', $numDeletedOrders);
if ($numOrders && $numDeletedOrders) {
$searchGet = $_GET;
if (isset($searchGet['searchId']) && $searchGet['searchId'] == 0) {
unset($searchGet['searchId']);
}
if (count($searchGet) > 1) {
$deletedUrl = $searchGet;
$deletedUrl['searchDeletedOrders'] = 'only';
$deletedUrl = 'index.php?' . http_build_query($deletedUrl);
$this->template->assign('viewDeletedOrdersUrl', $deletedUrl);
unset($deletedUrl);
}
unset($searchGet);
}
if(isset($_GET['searchQuery'])) {
//.........这里部分代码省略.........