本文整理汇总了PHP中BuildAdminSortingLinks函数的典型用法代码示例。如果您正苦于以下问题:PHP BuildAdminSortingLinks函数的具体用法?PHP BuildAdminSortingLinks怎么用?PHP BuildAdminSortingLinks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BuildAdminSortingLinks函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'];
//.........这里部分代码省略.........
示例2: _GetVariationGrid
/**
* _GetVariationGrid
* Get all of the product variations from the database and return them as a grid
*
* @param Int $NumVariations A reference variable to store the number of variations found
* @return String
*/
public function _GetVariationGrid(&$NumVariations)
{
// Show a list of variations in a table
$page = 0;
$start = 0;
$numVariations = 0;
$numPages = 0;
$GLOBALS['VariationsGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
$validSortFields = array('vname', 'vnumoptions');
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("ViewProductVariations", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ViewProductVariations", "vname", $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;
}
if (is_array($v)) {
foreach ($v as $v2) {
$searchURL .= sprintf("&%s[]=%s", $k, urlencode($v2));
}
} else {
$searchURL .= sprintf("&%s=%s", $k, urlencode($v));
}
}
$sortURL = sprintf("%s&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder);
$GLOBALS['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;
// Get the results for the query
$variation_result = $this->_GetVariationList($start, $sortField, $sortOrder, $numVariations);
$numPages = ceil($numVariations / ISC_PRODUCTS_PER_PAGE);
$NumVariations = $numVariations;
// Add the "(Page x of n)" label
if ($numVariations > ISC_PRODUCTS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numVariations, ISC_PRODUCTS_PER_PAGE, $page, sprintf("index.php?ToDo=viewProductVariations%s", $sortURL));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['Nav'] = preg_replace('# \\|$#', "", $GLOBALS['Nav']);
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
$sortLinks = array("Name" => "vname", "Options" => "vnumoptions");
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewProductVariations&" . $searchURL . "&page=" . $page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_PRODUCTS_PER_PAGE;
if ($max > $numVariations) {
$max = $numVariations;
}
if ($numVariations > 0) {
// Display the products
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($variation_result)) {
$GLOBALS['VariationId'] = (int) $row['variationid'];
$GLOBALS['Name'] = isc_html_escape($row['vname']);
if (gzte11(ISC_HUGEPRINT) && $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() == 0 && $row['vendorname']) {
$GLOBALS['Name'] .= ' <small><strong>(' . GetLang('Vendor') . ': ' . $row['vendorname'] . ')</strong></small>';
}
$GLOBALS['NumOptions'] = (int) $row['vnumoptions'];
$GLOBALS['Edit'] = '<a class="Action" href="index.php?ToDo=editProductVariation&variationId=' . $row['variationid'] . '" title="' . GetLang('ProductVariationEdit') . '">' . GetLang('Edit') . '</a>';
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("product.variations.manage.row");
$GLOBALS['VariationsGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
}
$GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("products.variations.manage.grid");
return $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(true);
}
示例3: ManageCustomerGroupsGrid
private function ManageCustomerGroupsGrid(&$numCustomerGroups)
{
// Show a list of customer groups in a table
$page = 0;
$start = 0;
$numCustomerGroups = 0;
$numPages = 0;
$GLOBALS['CustomerGroupsGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") {
$sortOrder = "asc";
}
else {
$sortOrder = "desc";
}
$validSortFields = array('groupname', 'discount', 'discountrules', 'customersingroup');
if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) {
$sortField = $_REQUEST['sortField'];
SaveDefaultSortField("ViewCustomerGroups", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ViewCustomerGroups", "customergroupid", "asc");
}
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 questions returned
if ($page == 1) {
$start = 1;
}
else {
$start = ($page * ISC_CUSTOMER_GROUPS_PER_PAGE) - (ISC_CUSTOMER_GROUPS_PER_PAGE-1);
}
$start = $start-1;
// Get the results for the query
$customerGroupResult = $this->_GetCustomerGroupList($start, $sortField, $sortOrder, $numCustomerGroups);
$numPages = ceil($numCustomerGroups / ISC_CUSTOMER_GROUPS_PER_PAGE);
// Add the "(Page x of n)" label
if ($numCustomerGroups > ISC_CUSTOMER_GROUPS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numCustomerGroups, ISC_CUSTOMER_GROUPS_PER_PAGE, $page, sprintf("index.php?ToDo=viewCustomerGroups%s", $sortURL));
}
else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
$sortLinks = array(
"GroupName" => "groupname",
"Discount" => "discount",
"DiscountMethod" => "discountmethod",
"DiscountRules" => "discountrules",
"CustomersInGroup" => "customersingroup"
);
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewCustomerGroups&".$searchURL."&page=".$page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + ISC_CUSTOMER_GROUPS_PER_PAGE;
if ($max > $GLOBALS["ISC_CLASS_DB"]->CountResult($customerGroupResult)) {
$max = $GLOBALS["ISC_CLASS_DB"]->CountResult($customerGroupResult);
}
if ($numCustomerGroups > 0) {
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($customerGroupResult)) {
$GLOBALS['CustomerGroupId'] = (int) $row['customergroupid'];
$GLOBALS['GroupName'] = isc_html_escape($row['groupname']);
// Show the row as yellow if it's default
if ($row['isdefault'] == 1) {
$GLOBALS['DefaultText'] = "<span style='margin-left: 10px; font-size: 0.8em; font-weight: bold;'>(default)</span>";
$GLOBALS['GridRowSel'] = "GridRowSel";
$GLOBALS['GridRowSelOver'] = "GridRowSelOver";
}
//.........这里部分代码省略.........
示例4: CustomerStatsByRevenueGrid
public function CustomerStatsByRevenueGrid()
{
$GLOBALS['CustomerGrid'] = "";
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['CustomersPerPage'] = $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['RevenueByCustomersCurrentPage'] = $page;
// Workout the start and end records
$start = $per_page * $page - $per_page;
$end = $start + ($per_page - 1);
// How many customers with orders between this period are there in total?
$query = "\n\t\t\t\tSELECT\n\t\t\t\t\tCOUNT(*) AS num\n\t\t\t\tFROM\n\t\t\t\t\t[|PREFIX|]orders\n\t\t\t\t\tLEFT JOIN [|PREFIX|]customers ON ordcustid = customerid\n\t\t\t\tWHERE\n\t\t\t\t\tordstatus IN (" . implode(',', GetPaidOrderStatusArray()) . ") AND\n\t\t\t\t\torddate >= '" . $from_stamp . "' AND\n\t\t\t\t\torddate <= '" . $to_stamp . "'\n\t\t\t\tGROUP BY\n\t\t\t\t\tordcustid\n\t\t\t";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
$total_customers = $row['num'];
// Workout the paging
$num_pages = ceil($total_customers / $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='ChangeRevenuePerCustomerPage(1)'>«</a> | ";
} else {
$paging .= "« | ";
}
// Are we on page 2 or above?
if ($page > 1) {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeRevenuePerCustomerPage(%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='ChangeRevenuePerCustomerPage(%d)'>%d</a> | ", $i, $i);
}
}
}
// Are we on page 2 or above?
if ($page < $num_pages) {
$paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeRevenuePerCustomerPage(%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='ChangeRevenuePerCustomerPage(%d)'>»</a> | ", $num_pages);
} else {
$paging .= "» | ";
}
$paging = rtrim($paging, ' |');
$GLOBALS['Paging'] = $paging;
// Should we set focus to the grid?
if (isset($_GET['FromLink']) && $_GET['FromLink'] == "true") {
$GLOBALS['JumpToOrdersByItemsSoldGrid'] = "<script type=\"text/javascript\">document.location.href='#revenuePerCustomerAnchor';</script>";
}
if (isset($_GET['SortOrder']) && $_GET['SortOrder'] == "asc") {
$sortOrder = 'asc';
} else {
$sortOrder = 'desc';
}
$sortFields = array('customerid', 'name', 'custconemail', 'custdatejoined', 'numorders', 'revenue');
if (isset($_GET['SortBy']) && in_array($_GET['SortBy'], $sortFields)) {
$sortField = $_GET['SortBy'];
SaveDefaultSortField("CustomerStatsByRevenue", $_REQUEST['SortBy'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("CustomerStatsByRevenue", "revenue", $sortOrder);
}
$sortLinks = array("Cust" => "name", "Email" => "custconemail", "Date" => "custdatejoined", "NumOrders" => "numorders", "AmountSpent" => "revenue");
BuildAdminSortingLinks($sortLinks, "javascript:SortRevenuePerCustomer('%%SORTFIELD%%', '%%SORTORDER%%');", $sortField, $sortOrder);
// Fetch the actual results for this page
$query = sprintf("\n\t\t\t\tSELECT\n\t\t\t\t\tcustomerid,\n\t\t\t\t\tCONCAT(custconfirstname, ' ', custconlastname) AS name,\n\t\t\t\t\tcustconemail,\n\t\t\t\t\tCONCAT(ordbillfirstname, ' ', ordbilllastname) AS billname,\n\t\t\t\t\tordbillemail,\n\t\t\t\t\tcustdatejoined,\n\t\t\t\t\tCOUNT(orderid) AS numorders,\n\t\t\t\t\tSUM(ordtotalamount) AS revenue\n\t\t\t\tFROM\n\t\t\t\t\t[|PREFIX|]orders\n\t\t\t\t\tLEFT JOIN [|PREFIX|]customers ON ordcustid = customerid\n\t\t\t\tWHERE\n\t\t\t\t\tordstatus IN (" . implode(',', GetPaidOrderStatusArray()) . ") AND\n\t\t\t\t\torddate >= '%d' AND\n\t\t\t\t\torddate <= '%d'\n\t\t\t\tGROUP BY\n\t\t\t\t\tordcustid\n\t\t\t\tORDER BY\n\t\t\t\t\t%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 (!is_null($row['customerid'])) {
$customerLink = "<a href=\"index.php?ToDo=viewCustomers&searchQuery=" . (int) $row['customerid'] . "\">" . isc_html_escape($row['name']) . "</a>";
$email = $row['custconemail'];
} else {
$customerLink = isc_html_escape($row['billname']);
$email = $row['ordbillemail'];
//.........这里部分代码省略.........
示例5: BuildTemplatesGrid
/**
* Generates a grid that lists the templates
*
*/
private function BuildTemplatesGrid()
{
// set sort order
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'asc') {
$sortOrder = 'asc';
} else {
$sortOrder = "desc";
}
// define our sortable fields
$sortLinks = array("Title" => "importtemplatename", "Vendor" => "vendorname");
// get the field to sort on
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageImportTemplates", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageImportTemplates", "builtin", $sortOrder);
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
// get templates
$result = $this->GetTemplates(true, true, $sortField, $sortOrder);
if (!$GLOBALS['ISC_CLASS_DB']->CountResult($result)) {
return "";
}
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewimporttemplates", $sortField, $sortOrder);
if (gzte11(ISC_HUGEPRINT) && !$GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
//&& !$show_builtin
$showvendor = true;
$GLOBALS['VendorLabel'] = GetLang('VendorLabel');
$GLOBALS['HideVendorColumn'] = "";
} else {
$showvendor = false;
$GLOBALS['VendorLabel'] = "";
$GLOBALS['HideVendorColumn'] = 'style="display: none;"';
}
// Build the items for the grid
$templateGridData = "";
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$id = $row['importtemplateid'];
$GLOBALS['importtemplateid'] = $row['importtemplateid'];
$GLOBALS['ExportTemplateName'] = $row['importtemplatename'];
$GLOBALS['CheckTemplate'] = "<input type=\"checkbox\" name=\"exporttemplates[" . $row['importtemplateid'] . "]\" value=\"1\" >";
if ($showvendor) {
if ($row['vendorname']) {
$vendorname = $row['vendorname'];
} else {
$vendorname = "N/A";
}
$GLOBALS['VendorName'] = $vendorname;
} else {
$GLOBALS['VendorName'] = "";
}
// generate actions for this template
$types = explode(",", $row['usedtypes']);
$options = "";
// does user have permission to manage templates
if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_ExportTemplates)) {
// show copy option for built in templates
$options .= '<A HREF="index.php?ToDo=editImportTemplate&tempId=' . $id . '">' . GetLang("EditThisTemplate") . '</A>';
$options .= ' <A HREF="index.php?ToDo=dloadImportTemplate&tempId=' . $id . '">Download Template</A>';
}
$GLOBALS['TemplateActions'] = $options;
$GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("importtemplates.manage.grid.row");
$templateGridData .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ExportTemplateGridData'] = $templateGridData;
// Generate and return the grid
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("importtemplates.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
示例6: 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'];
//.........这里部分代码省略.........
示例7: 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",
"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['DiscountGrid'] .= $this->BuildDiscountGridRow($row);
}
return $this->template->render('discounts.manage.grid.tpl');
}
}
示例8: ManageCouponsGrid
private function ManageCouponsGrid(&$numCoupons)
{
// Show a list of coupons in a table
$page = 0;
$start = 0;
$numCoupons = 0;
$numPages = 0;
$GLOBALS['CouponGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'desc';
} else {
$sortOrder = "asc";
}
$sortLinks = array("Name" => "c.couponname", "Coupon" => "c.couponcode", "Discount" => "c.couponamount", "Expiry" => "c.couponexpires", "NumUses" => "c.couponnumuses", "Enabled" => "c.couponenabled");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageCoupons", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageCoupons", "c.couponid", $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_COUPONS_PER_PAGE - (ISC_COUPONS_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$couponResult = $this->_GetCouponList($start, $sortField, $sortOrder, $numCoupons);
$numPages = ceil($numCoupons / ISC_COUPONS_PER_PAGE);
if ($numCoupons > ISC_COUPONS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numCoupons, ISC_COUPONS_PER_PAGE, $page, sprintf("index.php?ToDo=viewCoupons%s", $sortURL));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['SortField'] = $sortField;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewCoupons&page=" . $page, $sortField, $sortOrder);
$max = $start + ISC_COUPONS_PER_PAGE;
if ($max > count($couponResult)) {
$max = count($couponResult);
}
if ($numCoupons > 0) {
// Display the coupons
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($couponResult)) {
$GLOBALS['Name'] = isc_html_escape($row['couponname']);
$GLOBALS['CouponId'] = (int) $row['couponid'];
$GLOBALS['Coupon'] = isc_html_escape($row['couponcode']);
if ($row['coupontype'] == 0) {
// Dollar value coupon code
$GLOBALS['Discount'] = sprintf("%s", FormatPrice($row['couponamount']));
} else {
// Percentage value coupon code
$GLOBALS['Discount'] = sprintf("%s%%", number_format($row['couponamount'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), GetConfig('ThousandsToken')));
}
if ($row['couponexpires'] > 0) {
$GLOBALS['Date'] = CDate($row['couponexpires']);
} else {
$GLOBALS['Date'] = GetLang('NA');
}
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Coupons)) {
$GLOBALS['EditCouponLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editCoupon&couponId=%d'>%s</a>", GetLang('CouponEdit'), $row['couponid'], GetLang('Edit'));
if ($row['couponenabled'] == 1) {
$GLOBALS['Enabled'] = sprintf("<a title='%s' href='index.php?ToDo=editCouponEnabled&couponId=%d&enabled=0'><img border='0' src='images/tick.gif'></a>", GetLang('ClickToDisableCoupon'), $row['couponid']);
} else {
$GLOBALS['Enabled'] = sprintf("<a title='%s' href='index.php?ToDo=editCouponEnabled&couponId=%d&enabled=1'><img border='0' src='images/cross.gif'></a>", GetLang('ClickToEnableCoupon'), $row['couponid']);
}
} else {
$GLOBALS['EditCouponLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
if ($row['couponenabled'] == 1) {
$GLOBALS['Enabled'] = '<img border="0" src="images/tick.gif" alt="tick" />';
} else {
$GLOBALS['Enabled'] = '<img border="0" src="images/cross.gif" alt="cross" />';
}
}
$GLOBALS['NumUses'] = number_format($row['couponnumuses']);
$GLOBALS['ViewOrdersLink'] = '';
if ($row['couponnumuses'] > 0) {
$GLOBALS['ViewOrdersLink'] = sprintf(" <a href='index.php?ToDo=viewOrders&couponCode=%s' title='%s'>%s</a>", $row['couponcode'], GetLang('ViewOrdersWithCoupon'), GetLang('ViewOrders'));
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("coupons.manage.row");
$GLOBALS['CouponGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("coupons.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
}
示例9: ManageOverViewGrid
function ManageOverViewGrid(&$numView)
{
$page = 0;
$start = 0;
$numPages = 0;
$max = 0;
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
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
$viewResult = $this->_GetOverViewList($start, $numView);
$numPages = ceil($numView / ISC_ORDERS_PER_PAGE);
// Add the "(Page x of n)" label
if ($numView > ISC_ORDERS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numView, ISC_ORDERS_PER_PAGE, $page, sprintf("index.php?ToDo=viewSales%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['TotalOrdersSS'] = $numView;
$GLOBALS['SearchQuery'] = $query;
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
$sortLinks = array("Id" => "orderid", "Cust" => "custname", "Date" => "orddate", "Status" => "ordstatus", "Message" => "newmessages", "Total" => "ordtotalamount");
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewSales&" . $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);
}
$Query = "SELECT us.username, os.statusid, os.statusdesc\n\t\t\t\t\t\t\tFROM `isc_users` us\n\t\t\t\t\tLEFT JOIN isc_orders od ON us.`pk_userid` = od.orderowner\n\t\t\t\t\tLEFT JOIN isc_order_status os ON os.statusid = od.ordstatus\n\t\t\t\t\tORDER BY us.username";
$orderResult = $GLOBALS['ISC_CLASS_DB']->Query($Query);
/*************************************************************************
Sample Array :
orders['mayank']['Completed']=5;
orders['mayank']['Pending']=10;
orders['mayank']['Return']=2;
orders['mayank']['Cancelled']=4;
/***************************************************************************/
$orders = array();
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($orderResult)) {
$orders[$row['username']]['dump'] = '';
if ($row['statusid'] == '10') {
# Completed
$orders[$row['username']]['Completed']++;
} else {
if ($row['statusid'] == '5') {
# Cancelled
$orders[$row['username']]['Cancelled']++;
} else {
if ($row['statusid'] == '6' || $row['statusid'] == '4') {
# Returned
$orders[$row['username']]['Returned']++;
} else {
if ($row['statusid'] == '1' || $row['statusid'] == '2' || $row['statusid'] == '3' || $row['statusid'] == '7' || $row['statusid'] == '8' || $row['statusid'] == '9' || $row['statusid'] == '11') {
#Pending
$orders[$row['username']]['Pending']++;
}
}
}
}
}
#while
$Query = "SELECT username FROM isc_users order by username";
$userResult = $GLOBALS['ISC_CLASS_DB']->Query($Query);
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($userResult)) {
$GLOBALS["UserName"] = $row['username'];
$GLOBALS['Completed'] = isset($orders[$row['username']]['Completed']) ? $orders[$row['username']]['Completed'] : 0;
$GLOBALS["Cancelled"] = isset($orders[$row['username']]['Cancelled']) ? $orders[$row['username']]['Cancelled'] : 0;
$GLOBALS['Pending'] = isset($orders[$row['username']]['Pending']) ? $orders[$row['username']]['Pending'] : 0;
$GLOBALS['Returned'] = isset($orders[$row['username']]['Returned']) ? $orders[$row['username']]['Returned'] : 0;
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("sales.manage.overview.row");
$GLOBALS['OrderOverviewGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("sales.manage.overview.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
示例10: 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');
}
示例11: 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);
}
}
示例12: 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);
}
}
示例13: 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") {
//.........这里部分代码省略.........
示例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
//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
//.........这里部分代码省略.........
示例15: 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;
}
//.........这里部分代码省略.........