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'];
                 $GLOBALS['ProductName'] = $row['prodname'];
                 $GLOBALS['FileStatus'] = $FileStatus[$row['isdownloaded']];
                 $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("filemanagement.manage.row");
                 $GLOBALS['FilesGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
             }
         } else {
             $GLOBALS['DisplayTabGrid'] = "none";
             $GLOBALS['TabMessage'] = "No Pending Files Found!";
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("filemanagement.manage.grid");
         $FilesMainGrid .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         $index++;
     }
     return $FilesMainGrid;
 }
 /**
  * _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&amp;sortField=%s&amp;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) &nbsp;&nbsp;&nbsp;", 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&amp;" . $searchURL . "&amp;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&amp;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);
 }
Beispiel #3
0
		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) &nbsp;&nbsp;&nbsp;", 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&amp;".$searchURL."&amp;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";
					}
					else {
						$GLOBALS['DefaultText'] = "";
						$GLOBALS['GridRowSel'] = "";
						$GLOBALS['GridRowSelOver'] = "";
					}

					$GLOBALS['DiscountRules'] = $row['discountrules'];

					switch (strtolower($row['discountmethod'])) {
						case 'percent':
							$GLOBALS['Discount'] = GetLang('DiscountRow', array("price" => FormatNumber($row['discount']) . '%'));
							break;

						case 'fixed':
							$GLOBALS['Discount'] = GetLang('FixedPriceRow', array("price" => FormatPrice($row['discount'])));
							break;

						default:
							$GLOBALS['Discount'] = GetLang('DiscountRow', array("price" => FormatPrice($row['discount'])));
							break;

					}


					$GLOBALS['CustomersInGroup'] = $row['customersingroup'];

					// Show a "view" link if there's more than one customer in the group
					if ($row['customersingroup'] > 0) {
						$GLOBALS['CustomersInGroup'] .= sprintf(" (<a href='index.php?ToDo=searchCustomersRedirect&amp;custGroupId=%d'>%s</a>)", $row['customergroupid'], GetLang("View"));

					}

					$GLOBALS['EditLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editCustomerGroup&amp;groupId=%d'>%s</a>", GetLang('CustomerGroupEdit'), $row['customergroupid'], GetLang('Edit'));

					$GLOBALS['CustomerGroupsGrid'] .= $this->template->render('customers.groups.manage.row.tpl');
				}
			}
			else {
				$GLOBALS['DisplayGrid'] = "none";
			}

			return $this->template->render('customers.groups.manage.grid.tpl');
		}
 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 .= "&nbsp;&nbsp;&nbsp;&nbsp;";
         // Is there more than one page? If so show the &laquo; to jump back to page 1
         if ($num_pages > 1) {
             $paging .= "<a href='javascript:void(0)' onclick='ChangeRevenuePerCustomerPage(1)'>&laquo;</a> | ";
         } else {
             $paging .= "&laquo; | ";
         }
         // 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 &raquo; to go to the last page
         if ($num_pages > 1) {
             $paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeRevenuePerCustomerPage(%d)'>&raquo;</a> | ", $num_pages);
         } else {
             $paging .= "&raquo; | ";
         }
         $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'];
                 }
                 $GLOBALS['CustomerGrid'] .= sprintf("\n\t\t\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\">\n\t\t\t\t\t\t\t<td nowrap height=\"22\" class=\"" . $GLOBALS['SortedFieldCustClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap class=\"" . $GLOBALS['SortedFieldEmailClass'] . "\">\n\t\t\t\t\t\t\t\t<a href=\"mailto:%s\">%s</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap class=\"" . $GLOBALS['SortedFieldDateClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap align='right' class=\"" . $GLOBALS['SortedFieldNumOrdersClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap align='right' class=\"" . $GLOBALS['SortedFieldAmountSpentClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\n\t\t\t\t\t", $customerLink, isc_html_escape($email), isc_html_escape($email), isc_date(GetConfig('DisplayDateFormat'), $row['custdatejoined']), $row['numorders'], FormatPrice($row['revenue']));
             }
         } else {
             $GLOBALS['HideStatsRows'] = "none";
             $GLOBALS['CustomerGrid'] .= sprintf("\n\t\t\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\">\n\t\t\t\t\t\t\t<td nowrap height=\"22\" colspan=\"6\">\n\t\t\t\t\t\t\t\t<em>%s</em>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t", GetLang('StatsNoCustomersForDate'));
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("stats.customers.byrevenue");
         $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     }
 }
 /**
  * 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 .= '&nbsp;&nbsp;&nbsp;<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);
 }
Beispiel #6
0
 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&amp;sortField=%s&amp;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) &nbsp;&nbsp;&nbsp;", 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&amp;" . $searchURL . "&amp;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'];
         $GLOBALS['CustomerId'] = $row['ordcustid'];
         $GLOBALS['OrderId1'] = $row['orderid'];
         $GLOBALS['Customer'] = isc_html_escape($row['custname']);
         $GLOBALS['Date'] = isc_date(GetConfig('DisplayDateFormat'), $row['orddate']);
         $GLOBALS['OrderStatusOptions'] = $this->GetOrderStatusOptions($row['ordstatus']);
         $GLOBALS['Total'] = FormatPriceInCurrency($row['ordtotalamount'], $row['orddefaultcurrencyid'], null, true);
         $GLOBALS['GatewayTotal'] = FormatPriceInCurrency($row['ordgatewayamount'], $row['orddefaultcurrencyid'], null, true);
         $GLOBALS['TrackingNo'] = isc_html_escape($row['ordtrackingno']);
         $orderreview = '';
         switch ($row['ordoverview']) {
             case 0:
                 $orderreview = GetLang('OviewRequestNo');
                 break;
             case 1:
                 $orderreview = GetLang('OviewRequestYes');
                 break;
             case 2:
                 $orderreview = GetLang('OviewRequestSure');
                 break;
             default:
                 $orderreview = GetLang('OviewRequestNo');
                 break;
         }
         $GLOBALS['Review'] = $orderreview;
         // Look up the country for the IP address of this order
         if (gzte11(ISC_LARGEPRINT)) {
             $suspiciousOrder = false;
             $GLOBALS['FlagCellClass'] = $GLOBALS['FlagCellTitle'] = '';
             if ($row['ordgeoipcountrycode'] != '') {
                 $flag = strtolower($row['ordgeoipcountrycode']);
                 // If the GeoIP based country code and the billing country code don't match, we flag this order as a different colour
                 if (strtolower($row['ordgeoipcountrycode']) != strtolower($row['ordbillcountrycode'])) {
                     $GLOBALS['FlagCellClass'] = "Suspicious";
                     $suspiciousOrder = true;
                 }
                 $countryName = $row['ordgeoipcountry'];
             } else {
                 $flag = strtolower($row['ordbillcountrycode']);
                 $countryName = $row['ordbillcountry'];
                 $GLOBALS['FlagCellTitle'] = $row['ordbillcountry'];
             }
             // Do we have a country flag to show?
             if (file_exists(ISC_BASE_PATH . "/lib/flags/" . $flag . ".gif")) {
                 $flag = GetConfig('AppPath') . "/lib/flags/" . $flag . ".gif";
                 if ($suspiciousOrder == true) {
                     $title = sprintf(GetLang('OrderCountriesDontMatch'), $row['ordbillcountry'], $row['ordgeoipcountry']);
                     $GLOBALS['OrderCountryFlag'] = "<span onmouseout=\"HideQuickHelp(this);\" onmouseover=\"ShowQuickHelp(this, '" . GetLang('PossibleFraudulentOrder') . "', '" . $title . "');\"><img src=\"" . $flag . "\" alt='' /></span>";
                 } else {
                     $GLOBALS['OrderCountryFlag'] = "<img src=\"" . $flag . "\" alt='' title=\"" . $countryName . "\" />";
                 }
             } else {
                 $GLOBALS['OrderCountryFlag'] = '';
             }
         } else {
             $GLOBALS['HideCountry'] = "none";
         }
         // Workout the message link -- do they have permission to view order messages?
         $GLOBALS["HideMessages"] = "none";
         if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages) && $row['ordcustid'] > 0) {
             $numMessages = GetLang('Messages');
             if ($row['nummessages'] == 1) {
                 $numMessages = GetLang('OrderMessage');
             }
             $newMessages = '0 ' . GetLang('NewText');
             if ($row['newmessages'] > 0) {
                 $newMessages = "<strong>" . $row['newmessages'] . " " . GetLang('NewText') . "</strong>";
             }
             $GLOBALS['MessageLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=viewOrderMessages&amp;ord\n\t\t\t\t\terId=%d'>%s %s</a><br />(%s)", GetLang('MessageOrder'), $row['orderid'], $row['nummessages'], $numMessages, $newMessages);
             if ($row["numunreadmessages"] > 0 && gzte11(ISC_LARGEPRINT)) {
                 $GLOBALS["HideMessages"] = "";
                 $GLOBALS["NumMessages"] = $row['numunreadmessages'];
             }
         } else {
             $GLOBALS['MessageLink'] = sprintf("<a class='Action' disabled>%s (0)</a>", GetLang('Messages'));
         }
         if (!gzte11(ISC_LARGEPRINT)) {
             $GLOBALS["HideMessages"] = "none";
         }
         // If the customer still exists, link to the customer page
         if (trim($row['custname']) != '') {
             $GLOBALS['CustomerLink'] = "<a href='index.php?ToDo=viewCustomers&amp;idFrom=" . $GLOBALS['CustomerId'] . "&idTo=" . $GLOBALS['CustomerId'] . "'>" . $GLOBALS['Customer'] . "</a>";
         } else {
             $GLOBALS['CustomerLink'] = $row['ordbillfirstname'] . ' ' . $row['ordbilllastname'];
         }
         if ($row['ordcustid'] == 0) {
             $GLOBALS['CustomerLink'] .= " <span style=\"color: gray;\">" . GetLang('GuestCheckoutCustomer') . "</span>";
         }
         // If the order has any notes, flag it
         if ($row['ordnotes'] != '') {
             $GLOBALS['HasNotesClass'] = 'HasNotes';
         } else {
             $GLOBALS['HasNotesClass'] = '';
         }
         // If the order has any shipable items, show the link to ship items
         $GLOBALS['ShipItemsLink'] = '';
         if (isset($row['ordtotalshipped']) && isset($row['ordtotalqty'])) {
             if ($row['ordisdigital'] == 0 && $row['ordtotalqty'] - $row['ordtotalshipped'] > 0) {
                 $GLOBALS['ShipItemsLink'] = '<option id="ShipItemsLink' . $row['orderid'] . '"  value="shipItems">' . GetLang('ShipItems') . '</option>';
             }
         }
         //Show payment status blow order status
         $GLOBALS['PaymentStatus'] = '';
         $GLOBALS['HidePaymentStatus'] = 'display:none;';
         $GLOBALS['PaymentStatusColor'] = '';
         if ($row['ordpaymentstatus'] != '') {
             $GLOBALS['HidePaymentStatus'] = '';
             $GLOBALS['PaymentStatusColor'] = '';
             switch ($row['ordpaymentstatus']) {
                 case 'authorized':
                     $GLOBALS['PaymentStatusColor'] = 'PaymentAuthorized';
                     break;
                 case 'captured':
                     $GLOBALS['PaymentStatus'] = GetLang('Payment') . " " . ucfirst($row['ordpaymentstatus']);
                     $GLOBALS['PaymentStatusColor'] = 'PaymentCaptured';
                     break;
                 case 'refunded':
                 case 'partially refunded':
                 case 'voided':
                     $GLOBALS['PaymentStatus'] = GetLang('Payment') . " " . ucwords($row['ordpaymentstatus']);
                     $GLOBALS['PaymentStatusColor'] = 'PaymentRefunded';
                     break;
             }
         }
         // If the allow payment delayed capture, show the link to Delayed capture
         $GLOBALS['DelayedCaptureLink'] = '';
         $GLOBALS['VoidLink'] = '';
         $GLOBALS['RefundLink'] = '';
         $transactionId = trim($row['ordpayproviderid']);
         //if orginal transaction id exist and payment provider is currently enabled
         if ($transactionId != '' && GetModuleById('checkout', $provider, $row['orderpaymentmodule']) && $provider->IsEnabled() && !gzte11(ISC_HUGEPRINT)) {
             //if the payment module allow delayed capture and the current payment status is authorized
             //display delay capture option
             if (method_exists($provider, "DelayedCapture") && $row['ordpaymentstatus'] == 'authorized') {
                 $GLOBALS['DelayedCaptureLink'] = '<option value="delayedCapture">' . GetLang('CaptureFunds') . '</option>';
                 $GLOBALS['PaymentStatus'] .= '<a onclick="Order.DelayedCapture(' . $row['orderid'] . '); return false;" href="#">' . GetLang('CaptureFunds') . '</a>';
             }
             //if the payment module allow void transaction and the current payment status is authorized
             //display void option
             if (method_exists($provider, "DoVoid") && $row['ordpaymentstatus'] == 'authorized') {
                 $GLOBALS['VoidLink'] = '<option value="voidTransaction">' . GetLang('VoidTransaction') . '</option>';
             }
             //if the payment module allow refund and the current payment status is authorized
             //display refund option
             if (method_exists($provider, "DoRefund") && ($row['ordpaymentstatus'] == 'captured' || $row['ordpaymentstatus'] == 'partially refunded')) {
                 $GLOBALS['RefundLink'] = '<option value="refundOrder">' . GetLang('Refund') . '</option>';
             }
         }
         $GLOBALS["OrderStatusText"] = GetOrderStatusById($row['ordstatus']);
         $GLOBALS['OrderStatusId'] = $row['ordstatus'];
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("order.manage.row");
         $GLOBALS['OrderGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
     // Close the GeoIP database if we used it
     if (isset($gi)) {
         geoip_close($gi);
     }
     // Hide the message box in templates/iphone/MessageBox.html if we're not searching
     if (!isset($_REQUEST["searchQuery"]) && isset($_REQUEST["page"])) {
         $GLOBALS["HideYellowMessage"] = "none";
     }
     $GLOBALS['CurrentPage'] = $page;
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("orders.manage.grid");
     return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
 }
Beispiel #7
0
		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&amp;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');
			}
		}
 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) &nbsp;&nbsp;&nbsp;", 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&amp;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&amp;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&amp;couponId=%d&amp;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&amp;couponId=%d&amp;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("&nbsp;&nbsp;&nbsp;<a href='index.php?ToDo=viewOrders&amp;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);
     }
 }
 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) &nbsp;&nbsp;&nbsp;", 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&amp;" . $searchURL . "&amp;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);
 }
Beispiel #10
0
		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 .= '&amp;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&amp;".$searchURL."&amp;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');
		}
 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) &nbsp;&nbsp;&nbsp;", 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&amp;" . $searchURL . "&amp;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);
     }
 }
Beispiel #12
0
 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) &nbsp;&nbsp;&nbsp;", 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&amp;" . $searchURL . "&amp;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&amp;Id=%d&amp;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);
     }
 }
 /**
  * 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 .= "&nbsp;&nbsp;&nbsp;&nbsp;";
         // Is there more than one page? If so show the &laquo; to jump back to page 1
         if ($num_pages > 1) {
             $paging .= "<a href='javascript:void(0)' onclick='ChangeSearchCorrectionsPage(1)'>&laquo;</a> | ";
         } else {
             $paging .= "&laquo; | ";
         }
         // 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 &raquo; to go to the last page
         if ($num_pages > 1) {
             $paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeSearchCorrectionsPage(%d)'>&raquo;</a> | ", $num_pages);
         } else {
             $paging .= "&raquo; | ";
         }
         $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") {
                     $type = GetLang('SearchCorrection');
                 } else {
                     if ($row['correctiontype'] == "recommendation") {
                         $type = GetLang('SearchRecommendation');
                     }
                 }
                 $GLOBALS['ResultsGrid'] .= sprintf("\n\t\t\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\">\n\t\t\t\t\t\t\t<td nowrap class=\"" . $GLOBALS['SortedFieldSearchTermsClass'] . "\">\n\t\t\t\t\t\t\t\t<a href=\"../search.php?search_query=%s\" target=\"_blank\">%s</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap align='right' class=\"" . $GLOBALS['SortedFieldProductsShownBeforeClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap class=\"" . $GLOBALS['SortedFieldCorrectedSearchTermsClass'] . "\">\n\t\t\t\t\t\t\t\t<a href=\"../search.php?search_query=%s\" target=\"_blank\">%s</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap align='right' class=\"" . $GLOBALS['SortedFieldProductsShownAfterClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap align='right'  class=\"" . $GLOBALS['SortedFieldNumberOfOccurancesClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td nowrap height=\"22\" class=\"" . $GLOBALS['SortedFieldCorrectionTypeClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t", urlencode($row['oldsearchtext']), isc_html_escape($row['oldsearchtext']), number_format($row['oldnumresults']), urlencode($row['correction']), isc_html_escape($row['correction']), number_format($row['numresults']), number_format($row['numoccurances']), isc_html_escape($type));
             }
         } else {
             $GLOBALS['HideStatsRows'] = "none";
             $GLOBALS['ResultsGrid'] .= sprintf("\n\t\t\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\">\n\t\t\t\t\t\t\t<td nowrap height=\"22\" colspan=\"6\">\n\t\t\t\t\t\t\t\t<em>%s</em>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t", GetLang('StatsNoCorrectionsForDate'));
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("stats.search.correctionsgrid");
         $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     }
 }
Beispiel #14
0
 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 .= "&amp;brandid=" . trim($_GET['brandid']) . "";
     }
     if (isset($_GET['seriesid'])) {
         $filterURL .= "&amp;seriesid=" . trim($_GET['seriesid']) . "";
     }
     //Added by Simha Ends
     //lguan_20100612: Category supporting in product rating
     if (isset($_GET['catid'])) {
         $filterURL .= "&amp;catid=" . trim($_GET['catid']) . "";
     }
     if (isset($_GET['subcatid'])) {
         $filterURL .= "&amp;subcatid=" . trim($_GET['subcatid']) . "";
     }
     //lguan_20100615: Append information for from and to
     if (isset($GLOBALS['FromStamp']) && is_numeric($GLOBALS['FromStamp'])) {
         $filterURL .= "&amp;from=" . isc_date('m/d/Y', $GLOBALS['FromStamp']) . "";
     }
     if (isset($GLOBALS['ToStamp']) && is_numeric($GLOBALS['ToStamp'])) {
         $filterURL .= "&amp;to=" . isc_date('m/d/Y', $GLOBALS['ToStamp']) . "";
     }
     if (isset($_GET['datetype'])) {
         $filterURL .= "&amp;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("&amp;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) &nbsp;&nbsp;&nbsp;", 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&amp;" . $searchURL . "&amp;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']);
             }
             //lguan_20100612: Show extra rating options
             $GLOBALS['Rating'] = $this->wrapRatingImages($row['revrating']);
             $GLOBALS['RatingQuality'] = $this->wrapRatingImages($row['qualityrating']);
             $GLOBALS['RatingInstall'] = $this->wrapRatingImages($row['installrating']);
             $GLOBALS['RatingValue'] = $this->wrapRatingImages($row['valuerating']);
             $GLOBALS['RatingSupport'] = $this->wrapRatingImages($row['supportrating']);
             $GLOBALS['RatingDelivery'] = $this->wrapRatingImages($row['deliveryrating']);
             if ($row['revfromname'] != "") {
                 $GLOBALS['PostedBy'] = isc_html_escape($row['revfromname']);
             } else {
                 $GLOBALS['PostedBy'] = GetLang('NA');
             }
             $GLOBALS['Date'] = CDate($row['revdate']);
             $GLOBALS['PreviewLink'] = sprintf("<a title='%s' href='javascript:PreviewReview(%d)'>%s</a>", GetLang('PreviewReview'), $row['reviewid'], GetLang('Preview'));
             if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Reviews)) {
                 $GLOBALS['EditLink'] = sprintf("<a title='%s' href='index.php?ToDo=editReview&amp;reviewId=%d'>%s</a>", GetLang('EditReview'), $row['reviewid'], GetLang('Edit'));
             } else {
                 $GLOBALS['EditLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
             }
             switch ($row['revstatus']) {
                 case "0":
                     $GLOBALS['Status'] = GetLang('Pending');
                     break;
                 case "1":
                     $GLOBALS['Status'] = sprintf("<font color='green'>%s</font>", GetLang('Approved'));
                     break;
                 case "2":
                     $GLOBALS['Status'] = sprintf("<font color='red'>%s</font>", GetLang('Disapproved'));
                     break;
             }
             $revOrderid = $row['orderid'];
             //$orderInformations = $this->GetOrderInformationsByOrderId($revOrderid);
             if (is_numeric($revOrderid) && $revOrderid > 0 && isset($row["ordcustid"])) {
                 //viewOrders&orderId
                 $GLOBALS["OrderId"] = "<a href='index.php?ToDo=viewOrders&orderId=" . $row["orderid"] . "' >" . $row["orderid"] . "</a>";
             } else {
                 $GLOBALS["OrderId"] = "unknown";
             }
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("reviews.manage.row");
             $GLOBALS['ReviewGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("reviews.manage.grid");
         return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
 }
Beispiel #15
0
 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) &nbsp;&nbsp;&nbsp;", 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&amp;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&amp;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&amp;userId=%d&amp;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&amp;userId=%d&amp;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;
             }
             // Can this account be edited?
             if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Users)) {
                 $GLOBALS['EditUserLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editUser&amp;userId=%d'>%s</a>", GetLang('EditUser'), $row['pk_userid'], GetLang('Edit'));
             } else {
                 $GLOBALS['EditUserLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
             }
             // Can this account be copied?
             if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Add_User)) {
                 $GLOBALS['CopyUserLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=copyUser&amp;userId=%d'>%s</a>", GetLang('CopyUser'), $row['pk_userid'], GetLang('Copy'));
             } else {
                 $GLOBALS['CopyUserLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Copy'));
             }
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("user.manage.row");
             $GLOBALS['UserGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("user.manage.grid");
         return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
 }
 public function ManageUsersSweepstakesGrid(&$numMake)
 {
     // Show a list of news in a table
     $page = 0;
     $start = 0;
     $numMake = 0;
     $numPages = 0;
     $GLOBALS['SweepstakesUsersGrid'] = "";
     $GLOBALS['Nav'] = "";
     $max = 0;
     $searchURL = '';
     if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
         $sortOrder = 'asc';
     } else {
         $sortOrder = "desc";
     }
     $sortLinks = array("Createddate" => "s.createddate");
     if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
         $sortField = $_GET['sortField'];
         SaveDefaultSortField("manageUsersSweepstakes", $_REQUEST['sortField'], $sortOrder);
     } else {
         list($sortField, $sortOrder) = GetDefaultSortField("manageUsersSweepstakes", "s.createddate", $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_SWEEPSTAKES_USERS_PER_PAGE - (ISC_SWEEPSTAKES_USERS_PER_PAGE - 1);
     }
     $start = $start - 1;
     // Get the results for the query
     $SweepstakesUsersResult = $this->_GetSweepstakesUsersList($start, $sortField, $sortOrder, $numMake);
     //, &$where
     $numPages = ceil($numMake / ISC_SWEEPSTAKES_USERS_PER_PAGE);
     // Workout the paging navigation
     if ($numMake > ISC_SWEEPSTAKES_USERS_PER_PAGE) {
         $GLOBALS['Nav'] = sprintf("(%s %d of %d) &nbsp;&nbsp;&nbsp;", GetLang('Page'), $page, $numPages);
         $GLOBALS['Nav'] .= BuildPagination($numMake, ISC_SWEEPSTAKES_USERS_PER_PAGE, $page, sprintf("index.php?ToDo=viewerSweepstakes%s", $sortURL));
     } else {
         $GLOBALS['Nav'] = "";
     }
     $GLOBALS['SortField'] = $sortField;
     $GLOBALS['SortOrder'] = $sortOrder;
     BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewerSweepstakes&amp;" . $searchURL . "&amp;page=" . $page, $sortField, $sortOrder);
     // Workout the maximum size of the array
     $max = $start + ISC_SWEEPSTAKES_USERS_PER_PAGE;
     if ($max > count($SweepstakesUsersResult)) {
         $max = count($SweepstakesUsersResult);
     }
     //            echo $numMake;exit;
     if ($numMake > 0) {
         while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($SweepstakesUsersResult)) {
             $GLOBALS['Email'] = $row['email'];
             $GLOBALS['Name'] = $row['firstname'] . " " . $row['lastname'];
             $GLOBALS['PhoneNumber'] = $row['phonenumber'];
             $GLOBALS['City'] = $row['city'];
             $status = $row['status'];
             if ($status == '1') {
                 $GLOBALS['Status'] = "Registered";
             } else {
                 $GLOBALS['Status'] = "Deleted";
             }
             $userid = $row['sweepsuserid'];
             $GLOBALS['ViewSweepstakesUsersLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=viewViewerSweepstakes&amp;sid=%d'>%s</a>", GetLang('ViewUsers'), $userid, GetLang('ViewUsers'));
             $GLOBALS['DeleteSweepstakesUsersLink'] = "<a title='" . GetLang('Delete') . "' class='Action' href='#' onclick=\"deleteSweepstakesUsersid(" . $row['sweepsuserid'] . ")\">" . GetLang('Delete') . "</a>";
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("sweepstakes.users.manage.row");
             $GLOBALS['SweepstakesUsersGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("sweepstakes.users.manage.grid");
         return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
 }
 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&amp;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&amp;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&amp;discountId=%d&amp;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&amp;discountId=%d&amp;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&amp;discountId=%d&amp;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&amp;discountId=%d&amp;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);
     }
 }
Beispiel #18
0
	private function ManageReturnsGrid(&$numReturns)
	{
		// Show a list of products in a table
		$page = 0;
		$start = 0;
		$numPages = 0;
		$GLOBALS['ReturnGrid'] = "";
		$GLOBALS['Nav'] = "";
		$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('returnid', 'retprodname', 'custname', 'retorderid', 'retdaterequested', 'retstatus');
		if(isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) {
			$sortField = $_REQUEST['sortField'];
			SaveDefaultSortField("ManageReturns", $_REQUEST['sortField'], $sortOrder);
		}
		else {
			list($sortField, $sortOrder) = GetDefaultSortField("ManageReturns", "returnid", $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&amp;sortField=%s&amp;sortOrder=%s", $searchURL, $sortField, $sortOrder);

		$GLOBALS['SortURL'] = $sortURL;

		// Limit the number of returns returned
		if ($page == 1) {
			$start = 1;
		} else {
			$start = ($page * ISC_RETURNS_PER_PAGE) - (ISC_RETURNS_PER_PAGE-1);
		}

		$start = $start-1;

		// Get the results for the query
		$returnResult = $this->_GetReturnsList($start, $sortField, $sortOrder, $numReturns);

		$numPages = ceil($numReturns / ISC_RETURNS_PER_PAGE);

		// Add the "(Page x of n)" label
		if($numReturns > ISC_RETURNS_PER_PAGE) {
			$GLOBALS['Nav'] = sprintf("(%s %d of %d) &nbsp;&nbsp;&nbsp;", GetLang('Page'), $page, $numPages);
			$GLOBALS['Nav'] .= BuildPagination($numReturns, ISC_RETURNS_PER_PAGE, $page, sprintf("index.php?ToDo=viewReturns%s", $sortURL));
		}
		else {
			$GLOBALS['Nav'] = "";
		}

		if(isset($_GET['searchQuery'])) {
			$query = $_GET['searchQuery'];
		} else {
			$query = "";
		}

		$GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |');
		$GLOBALS['SearchQuery'] = $query;
		$GLOBALS['SortField'] = $sortField;
		$GLOBALS['SortOrder'] = $sortOrder;

		$sortLinks = array(
			"Id" => "returnid",
			"ReturnItem" => "retprodname",
			"Order" => "retorderid",
			"Cust" => "custname",
			"Date" => "retdaterequested",
			"Status" => "retstatus"
		);
		BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewReturns&amp;".$searchURL."&amp;page=".$page, $sortField, $sortOrder);

		$GLOBALS['ReturnStatusList'] = $this->GetReturnStatusOptions();

		// Display the returns
		while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($returnResult)) {
			$GLOBALS['ReturnId'] = $row['returnid'];
			$GLOBALS['OrderId'] = $row['retorderid'];

			$GLOBALS['ProductId'] = $row['retprodid'];
			$GLOBALS['ProductLink'] = ProdLink($row['retprodname'], $row['retprodname']);
			$GLOBALS['ProdName'] = isc_html_escape($row['retprodname']);

			$GLOBALS['ReturnedProductOptions'] = '';
			if($row['retprodoptions'] != '') {
				$options = @unserialize($row['retprodoptions']);
				if(!empty($options)) {
					$GLOBALS['ReturnedProductOptions'] = "<div style=\"margin-top: 3px; padding-left: 10px;\">(";
					$comma = '';
					foreach($options as $name => $value) {
						$GLOBALS['ReturnedProductOptions'] .= $comma.isc_html_escape($name).": ".isc_html_escape($value);
						$comma = ', ';
					}
					$GLOBALS['ReturnedProductOptions'] .= ")</div>";
				}
			}


			$GLOBALS['ReturnQty'] = (int)$row['retprodqty'] . " x ";

			$returnAmount = $row['retprodcost'] * $row['retprodqty'];

			$GLOBALS['AmountPaid'] = FormatPrice($returnAmount);

			$GLOBALS['CustomerId'] = (int)$row['retcustomerid'];
			$GLOBALS['Customer'] = isc_html_escape($row['custname']);
			$GLOBALS['Date'] = isc_date(GetConfig('DisplayDateFormat'), $row['retdaterequested']);

			$GLOBALS['ReturnStatus'] = (int)$row['retstatus'];
			$GLOBALS['ReturnStatusDisabled'] = '';
			if($row['retstatus'] == 5) {
				//$GLOBALS['ReturnStatusDisabled'] = 'disabled="disabled"';
			}

			$GLOBALS['ReturnStatusOptions'] = $this->GetReturnStatusOptions($row['retstatus']);

			$GLOBALS['IssueCreditLink'] = '';
			if(GetConfig('ReturnCredits') && !$row['retreceivedcredit']) {
				$GLOBALS['IssueCreditLink'] = sprintf("<a href='index.php?ToDo=issueReturnCredit&amp;returnId=%d' class='Action' onclick='return ConfirmIssueCredit(\"%s\");'>%s</a>", $row['returnid'], $GLOBALS['AmountPaid'], GetLang('ReturnIssueCredit'));
			}

			// local context for this render
			$context = array(
				'return' => $row,
			);

			$GLOBALS['ReturnGrid'] .= $this->template->render('returns.manage.row.tpl', $context);
		}
		return $this->template->render('returns.manage.grid.tpl');
	}
 /**
  *	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 .= "&nbsp;&nbsp;&nbsp;&nbsp;";
         // Is there more than one page? If so show the &laquo; to jump back to page 1
         if ($num_pages > 1) {
             $paging .= "<a href='javascript:void(0)' onclick='ChangeProductsByInventoryPage(1)'>&laquo;</a> | ";
         } else {
             $paging .= "&laquo; | ";
         }
         // 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 &raquo; to go to the last page
         if ($num_pages > 1) {
             $paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeProductsByInventoryPage(%d)'>&raquo;</a> | ", $num_pages);
         } else {
             $paging .= "&raquo; | ";
         }
         $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
                         $tracking_method = GetLang('NA');
                         break;
                     case 1:
                         // By product
                         $tracking_method = GetLang('StatsByProduct');
                         break;
                     case 2:
                         // By option
                         $tracking_method = GetLang('StatsByProductOption');
                         break;
                 }
                 switch ($row['instock']) {
                     case -1:
                         $stock_level = GetLang('NA');
                         $edit_link = sprintf("<span class='disabled'>%s</span>", GetLang('UpdateStockLevels'));
                         break;
                     default:
                         $stock_level = number_format($row['instock']);
                         $edit_link = sprintf("<a href='index.php?ToDo=viewProducts&amp;productId=%d' target='_blank'>%s</span>", $row['productid'], GetLang('UpdateStockLevels'));
                         if ($stock_level == 0) {
                             // Flag if zero
                             $stock_level = sprintf("<b style='color:red'>%s</strong>", $stock_level);
                         }
                 }
                 $sku = GetLang('NA');
                 if ($row['prodcode'] != '') {
                     $sku = isc_html_escape($row['prodcode']);
                 }
                 $GLOBALS['OrderGrid'] .= sprintf("\n\t\t\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\"> \n\t\t\t\t\t\t\t<td nowrap height=\"22\" class=\"" . $GLOBALS['SortedFieldProductIdClass'] . "\">\n\t\t\t\t\t\t\t\t%d\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"" . $GLOBALS['SortedFieldCodeClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"" . $GLOBALS['SortedFieldNameClass'] . "\">\n\t\t\t\t\t\t\t\t<a href='%s' target='_blank'>%s</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class=\"" . $GLOBALS['SortedFieldStockClass'] . "\">\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t", $row['productid'], $sku, ProdLink($row['prodname']), isc_html_escape($row['prodname']), $tracking_method, $stock_level, $edit_link);
             }
         }
     } else {
         $GLOBALS['OrderGrid'] .= sprintf("\n\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\">\n\t\t\t\t\t<td nowrap height=\"22\" colspan=\"6\">\n\t\t\t\t\t\t<em>%s</em>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t", GetLang('StatsNoProducts'));
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("stats.products.byinventorygrid");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
Beispiel #20
0
 public function ManageWishListGrid(&$numMake)
 {
     // Show a list of news in a table
     $page = 0;
     $start = 0;
     $numMake = 0;
     $numPages = 0;
     $GLOBALS['WishListGrid'] = "";
     $GLOBALS['Nav'] = "";
     $max = 0;
     $searchURL = '';
     if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
         $sortOrder = 'desc';
     } else {
         $sortOrder = "asc";
     }
     $sortLinks = array("CustomerName" => "c.custconfirstname", "ProductName" => "p.prodname", "Amount" => "p.prodprice");
     if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
         $sortField = $_GET['sortField'];
         SaveDefaultSortField("manageWishList", $_REQUEST['sortField'], $sortOrder);
     } else {
         list($sortField, $sortOrder) = GetDefaultSortField("manageWishList", "c.custconfirstname", $sortOrder);
     }
     if (isset($_GET['page'])) {
         $page = (int) $_GET['page'];
     } else {
         $page = 1;
     }
     $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
     $GLOBALS['SortURL'] = $sortURL;
     // Limit the number of WishList returned
     if ($page == 1) {
         $start = 1;
     } else {
         $start = $page * ISC_WISHLIST_PER_PAGE - (ISC_WISHLIST_PER_PAGE - 1);
     }
     $start = $start - 1;
     // Get the results for the query
     $wishlistResult = $this->_GetWishList($start, $sortField, $sortOrder, $numMake);
     $numPages = ceil($numMake / ISC_WISHLIST_PER_PAGE);
     // Workout the paging navigation
     if ($numMake > ISC_WISHLIST_PER_PAGE) {
         $GLOBALS['Nav'] = sprintf("(%s %d of %d) &nbsp;&nbsp;&nbsp;", GetLang('Page'), $page, $numPages);
         $GLOBALS['Nav'] .= BuildPagination($numMake, ISC_WISHLIST_PER_PAGE, $page, sprintf("index.php?ToDo=wishlist%s", $sortURL));
     } else {
         $GLOBALS['Nav'] = "";
     }
     $GLOBALS['SortField'] = $sortField;
     $GLOBALS['SortOrder'] = $sortOrder;
     BuildAdminSortingLinks($sortLinks, "index.php?ToDo=wishlist&amp;" . $searchURL . "&amp;page=" . $page, $sortField, $sortOrder);
     // Workout the maximum size of the array
     $max = $start + ISC_WISHLIST_PER_PAGE;
     if ($max > count($wishlistResult)) {
         $max = count($wishlistResult);
     }
     if ($numMake > 0) {
         while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($wishlistResult)) {
             $GLOBALS['CustomerName'] = isc_html_escape($row['customername']);
             $GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
             $GLOBALS['Amount'] = number_format($row['prodprice'], 2);
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("wishlist.manage.row");
             $GLOBALS['WishListGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("wishlist.manage.grid");
         return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
 }
 /**
  * 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 . ") &nbsp;&nbsp;&nbsp;";
         $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&amp;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);
 }
 /**
  *	Build the grid that will be shown on the "Orders by Items Sold" tab
  **/
 public function OrderStatsByItemsSoldGrid()
 {
     $GLOBALS['OrderGrid'] = "";
     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['OrdersPerPage'] = $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['OrdersByItemsSoldCurrentPage'] = $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 = " AND prodvendorid='" . $GLOBALS['ISC_CLASS_DB']->Quote($vendorRestriction) . "'";
         }
         // How many orders 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|]order_products\n\t\t\t\t\tINNER JOIN [|PREFIX|]orders ON orderorderid = orderid\n\t\t\t\t\tLEFT JOIN [|PREFIX|]products ON ordprodid = productid\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 . "' AND\n\t\t\t\t\tordprodid != 0\n\t\t\t\t\t" . $vendorSql;
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
         $total_orders = $row['num'];
         if ($total_orders > 0) {
             // Workout the paging
             $num_pages = ceil($total_orders / $per_page);
             $paging = sprintf(GetLang('PageXOfX'), $page, $num_pages);
             $paging .= "&nbsp;&nbsp;&nbsp;&nbsp;";
             // Is there more than one page? If so show the &laquo; to jump back to page 1
             if ($num_pages > 1) {
                 $paging .= "<a href='javascript:void(0)' onclick='ChangeOrdersByItemsSoldPage(1)'>&laquo;</a> | ";
             } else {
                 $paging .= "&laquo; | ";
             }
             // Are we on page 2 or above?
             if ($page > 1) {
                 $paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeOrdersByItemsSoldPage(%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='ChangeOrdersByItemsSoldPage(%d)'>%d</a> | ", $i, $i);
                     }
                 }
             }
             // Are we on page 2 or above?
             if ($page < $num_pages) {
                 $paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeOrdersByItemsSoldPage(%d)'>%s</a> | ", $page + 1, GetLang('Next'));
             } else {
                 $paging .= sprintf("%s | ", GetLang('Next'));
             }
             // Is there more than one page? If so show the &raquo; to go to the last page
             if ($num_pages > 1) {
                 $paging .= sprintf("<a href='javascript:void(0)' onclick='ChangeOrdersByItemsSoldPage(%d)'>&raquo;</a> | ", $num_pages);
             } else {
                 $paging .= "&raquo; | ";
             }
             $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='#ordersByItemsSoldAnchor';</script>";
             }
             if (isset($_GET['SortOrder']) && $_GET['SortOrder'] == "asc") {
                 $sortOrder = 'asc';
             } else {
                 $sortOrder = 'desc';
             }
             $sortFields = array('ordprodid', 'ordprodsku', 'ordprodname', 'numorders', 'revenue', 'numitemssold');
             if (isset($_GET['SortBy']) && in_array($_GET['SortBy'], $sortFields)) {
                 $sortField = $_GET['SortBy'];
                 SaveDefaultSortField("OrderStatsBySold", $_REQUEST['SortBy'], $sortOrder);
             } else {
                 list($sortField, $sortOrder) = GetDefaultSortField("OrderStatsBySold", "numorders", $sortOrder);
             }
             $sortLinks = array("ProductId" => "ordprodid", "Code" => "ordprodsku", "Name" => "ordprodname", "NumOrders" => "numorders", "Revenue" => "revenue", "UnitsSold" => "numitemssold");
             BuildAdminSortingLinks($sortLinks, "javascript:SortOrdersByItemsSold('%%SORTFIELD%%', '%%SORTORDER%%');", $sortField, $sortOrder);
             // Fetch the orders for this page
             $query = "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tordprodid,\n\t\t\t\t\t\tordprodsku,\n\t\t\t\t\t\tordprodname,\n\t\t\t\t\t\tCOUNT(DISTINCT(orderid)) AS numorders,\n\t\t\t\t\t\t(ordprodcost * SUM(ordprodqty)) AS revenue,\n\t\t\t\t\t\tSUM(ordprodqty) AS numitemssold,\n\t\t\t\t\t\tproductid\n\t\t\t\t\tFROM\n\t\t\t\t\t\t[|PREFIX|]order_products\n\t\t\t\t\t\tINNER JOIN [|PREFIX|]orders ON orderorderid = orderid\n\t\t\t\t\t\tLEFT JOIN [|PREFIX|]products ON ordprodid = productid\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tordstatus IN (" . implode(',', GetPaidOrderStatusArray()) . ") AND\n\t\t\t\t\t\torddate >= '" . $from_stamp . "' AND\n\t\t\t\t\t\torddate <= '" . $to_stamp . "' AND\n\t\t\t\t\t\tordprodtype != 'giftcertificate' AND\n\t\t\t\t\t\tordprodid != 0\n\t\t\t\t\t\t" . $vendorSql . "\n\t\t\t\t\tGROUP BY\n\t\t\t\t\t\tordprodid DESC\n\t\t\t\t\tORDER BY\n\t\t\t\t\t\t" . $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)) {
                     $sku = GetLang('NA');
                     if ($row['ordprodsku']) {
                         $sku = isc_html_escape($row['ordprodsku']);
                     }
                     $prodlink = $row['ordprodname'];
                     if (!is_null($row['productid'])) {
                         $prodlink = "<a href='" . ProdLink($row['ordprodname']) . "' target='_blank'>" . isc_html_escape($row['ordprodname']) . "</a>";
                     }
                     $GLOBALS['OrderGrid'] .= sprintf("\n\t\t\t\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\">\n\t\t\t\t\t\t\t\t<td nowrap height=\"22\" class=\"" . $GLOBALS['SortedFieldProductIdClass'] . "\">\n\t\t\t\t\t\t\t\t\t%d\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td nowrap class=\"" . $GLOBALS['SortedFieldCodeClass'] . "\">\n\t\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td nowrap class=\"" . $GLOBALS['SortedFieldNameClass'] . "\">\n\t\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td nowrap class=\"" . $GLOBALS['SortedFieldNumOrdersClass'] . "\">\n\t\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td nowrap class=\"" . $GLOBALS['SortedFieldUnitsSoldClass'] . "\">\n\t\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td nowrap class=\"" . $GLOBALS['SortedFieldRevenueClass'] . "\">\n\t\t\t\t\t\t\t\t\t%s\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t", (int) $row['ordprodid'], $sku, $prodlink, (int) $row['numorders'], (int) $row['numitemssold'], FormatPrice($row['revenue']));
                 }
             }
         } else {
             $GLOBALS['HideStatsRows'] = "none";
             $GLOBALS['OrderGrid'] .= sprintf("\n\t\t\t\t\t<tr class=\"GridRow\" onmouseover=\"this.className='GridRowOver';\" onmouseout=\"this.className='GridRow';\">\n\t\t\t\t\t\t<td nowrap height=\"22\" colspan=\"6\">\n\t\t\t\t\t\t\t<em>%s</em>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t", GetLang('StatsNoOrdersForDate'));
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("stats.orders.byitemssoldgrid");
         $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     }
 }
 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) &nbsp;&nbsp;&nbsp;", 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&amp;" . $searchURL . "&amp;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&amp;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);
     }
 }
Beispiel #24
0
		private function ManageBannersGrid(&$numBanners)
		{
			$GLOBALS['BannerGrid'] = '';
			$GLOBALS['Nav'] = '';
			$searchURL = '';

			if (isset($_GET['searchQuery'])) {
				$query = $_GET['searchQuery'];
				$GLOBALS['Query'] = isc_html_escape($query);
				$searchURL .= '&amp;searchQuery='.urlencode($query);
			} else {
				$query = "";
				$GLOBALS['Query'] = "";
			}

			if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
				$sortOrder = 'desc';
			} else {
				$sortOrder = "asc";
			}

			$sortLinks = array(
				"Name" => "name",
				"Location" => "page",
				"Date" => "datecreated",
				"Status" => "status"
			);

			if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
				$sortField = $_GET['sortField'];
				SaveDefaultSortField("ManageBanners", $_REQUEST['sortField'], $sortOrder);
			}
			else {
				list($sortField, $sortOrder) = GetDefaultSortField("ManageBanners", "name", $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
			$bannerResult = $this->_GetBannerList($query, $sortField, $sortOrder, $numBanners);

			if(!$numBanners) {
				return '';
			}

			$GLOBALS['SearchQuery'] = isc_html_escape($query);
			$GLOBALS['SortField'] = $sortField;
			$GLOBALS['SortOrder'] = $sortOrder;

			BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewBanners&amp;".$searchURL."&amp;page=".$page, $sortField, $sortOrder);


			$GLOBALS['NameSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=name&sortOrder=asc", $query);
			$GLOBALS['NameSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=name&sortOrder=desc", $query);

			$GLOBALS['LocationSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=page&sortOrder=asc", $query);
			$GLOBALS['LocationSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=page&sortOrder=desc", $query);

			$GLOBALS['DateSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=datecreated&sortOrder=asc", $query);
			$GLOBALS['DateSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=datecreated&sortOrder=desc", $query);

			$GLOBALS['StatusSortUpLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&&sortField=status&sortOrder=asc", $query);
			$GLOBALS['StatusSortDownLink'] = sprintf("index.php?ToDo=viewBanners&searchQuery=%s&sortField=status&sortOrder=desc", $query);

			while ($banner = $GLOBALS["ISC_CLASS_DB"]->Fetch($bannerResult)) {
				$GLOBALS['BannerId'] = (int) $banner['bannerid'];
				$GLOBALS['Name'] = isc_html_escape($banner['name']);

				$GLOBALS['Location'] = "";

				switch ($banner['page']) {
					case "home_page": {
						$GLOBALS['Location'] = sprintf("<a target='_blank' href='../'>%s</a>", GetLang('BannerHomePage'));
						break;
					}
					case "category_page": {
						$GLOBALS['Location'] = sprintf("<a target='_blank' href='%s'>%s %s</a>", CatLink($banner['catorbrandid'], $banner["location_name"]), $banner['name'], GetLang('BannerCategory'));
						break;
					}
					case "brand_page": {
						$GLOBALS['Location'] = sprintf("<a target='_blank' href='%s'>%s %s</a>", BrandLink($banner['location_name']), $banner["location_name"], GetLang('ProductsPage'));
						break;
					}
					case "search_page": {
						$GLOBALS['Location'] = sprintf("<a target='_blank' href='../search.php?mode=advanced'>%s</a>", GetLang('SearchResultsPage'));
						break;
					}
				}

				if ($banner['location'] == "top") {
					$GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerTopOfPage'));
				}
				else {
					$GLOBALS['Location'] .= sprintf(" (%s)", GetLang('BannerBottomOfPage'));
				}

				$GLOBALS['Date'] = isc_date(GetConfig('ExportDateFormat'), $banner['datecreated']);

				if ($banner['status'] == 1) {
					$GLOBALS['Visible'] = sprintf("<a title='%s' href='index.php?ToDo=editBannerVisibility&amp;bannerId=%d&amp;visible=0'><img border='0' src='images/tick.gif'></a>", GetLang('ClickToHideBanner'), $banner['bannerid']);
				}
				else {
					$GLOBALS['Visible'] = sprintf("<a title='%s' href='index.php?ToDo=editBannerVisibility&amp;bannerId=%d&amp;visible=1'><img border='0' src='images/cross.gif'></a>", GetLang('ClickToShowBanner'), $banner['bannerid']);
				}

				$GLOBALS['BannerGrid'] .= $this->template->render('banner.manage.row.tpl');
			}
			return $this->template->render('banners.manage.grid.tpl');
		}
Beispiel #25
0
 /**
  * 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) . "&amp;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 . " &nbsp; %%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;
 }
 private function ManageGiftCertificatesGrid(&$numGiftCertificates)
 {
     // Show a list of products in a table
     $page = 0;
     $start = 0;
     $numPages = 0;
     $GLOBALS['GiftCertificatesGrid'] = "";
     $GLOBALS['Nav'] = "";
     $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('giftcertid', 'giftcertcode', 'giftcertto', 'giftcertfrom', 'giftcertcustid', 'giftcertamount', 'giftcertbalance', 'giftcertstatus', 'giftcertpurchasedate', 'giftcertexpiry', 'customername');
     if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) {
         $sortField = $_REQUEST['sortField'];
         SaveDefaultSortField("ManageGiftCertificates", $_REQUEST['sortField'], $sortOrder);
     } else {
         list($sortField, $sortOrder) = GetDefaultSortField("ManageGiftCertificates", "giftcertid", $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&amp;sortField=%s&amp;sortOrder=%s", $searchURL, $sortField, $sortOrder);
     $GLOBALS['SortURL'] = $sortURL;
     // Limit the number of gift certificates returned
     if ($page == 1) {
         $start = 1;
     } else {
         $start = $page * ISC_GIFTCERTIFICATES_PER_PAGE - (ISC_GIFTCERTIFICATES_PER_PAGE - 1);
     }
     $start = $start - 1;
     // Get the results for the query
     $certificateResult = $this->_GetGiftCertificatesList($start, $sortField, $sortOrder, $numGiftCertificates);
     $numPages = ceil($numGiftCertificates / ISC_GIFTCERTIFICATES_PER_PAGE);
     // Add the "(Page x of n)" label
     if ($numGiftCertificates > ISC_GIFTCERTIFICATES_PER_PAGE) {
         $GLOBALS['Nav'] = sprintf("(%s %d of %d) &nbsp;&nbsp;&nbsp;", GetLang('Page'), $page, $numPages);
         $GLOBALS['Nav'] .= BuildPagination($numGiftCertificates, ISC_GIFTCERTIFICATES_PER_PAGE, $page, sprintf("index.php?ToDo=viewGiftCertificates%s", $sortURL));
     } else {
         $GLOBALS['Nav'] = "";
     }
     if (isset($_GET['searchQuery'])) {
         $query = $_GET['searchQuery'];
     } else {
         $query = "";
     }
     $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |');
     $GLOBALS['SearchQuery'] = $query;
     $GLOBALS['SortField'] = $sortField;
     $GLOBALS['SortOrder'] = $sortOrder;
     $sortLinks = array("Id" => "giftcertid", "CertificateAmount" => "giftcertamount", "CertificateBalance" => "giftcertbalance", "PurchaseDate" => "giftcertpurchasedate", "Status" => "giftcertstatus", "Code" => "giftcertcode", "Cust" => "customername");
     BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewGiftCertificates&amp;page=" . $page, $sortField, $sortOrder);
     $GLOBALS['GiftCertificateStatusList'] = $this->GetGiftCertificateStatusOptions();
     // Display the gift certificates
     while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($certificateResult)) {
         $GLOBALS['GiftCertificateId'] = (int) $row['giftcertid'];
         $GLOBALS['GiftCertificateCode'] = isc_html_escape($row['giftcertcode']);
         $GLOBALS['GiftCertificateTo'] = isc_html_escape($row['giftcertto']);
         $GLOBALS['GiftCertificateToEmail'] = isc_html_escape($row['giftcerttoemail']);
         $GLOBALS['GiftCertificateFrom'] = isc_html_escape($row['giftcertfrom']);
         $GLOBALS['GiftCertificateFromEmail'] = isc_html_escape($row['giftcertfromemail']);
         $GLOBALS['GiftCertificateCustomerId'] = (int) $row['giftcertcustid'];
         $GLOBALS['GiftCertificateCustomerName'] = isc_html_escape($row['customername']);
         $GLOBALS['GiftCertificateAmount'] = FormatPrice($row['giftcertamount']);
         $GLOBALS['GiftCertificateBalance'] = FormatPrice($row['giftcertbalance']);
         $GLOBALS['GiftCertificatePurchaseDate'] = isc_date(GetConfig('DisplayDateFormat'), $row['giftcertpurchasedate']);
         if ($row['giftcertexpirydate'] != 0) {
             $GLOBALS['GiftCertificateExpiryDate'] = isc_date(GetConfig('DisplayDateFormat'), $row['giftcertexpirydate']);
         } else {
             $GLOBALS['GiftCertificateExpiryDate'] = GetLang('NA');
         }
         // Something of this gift certificate has been sent so we need to show the expand icon
         if ($row['giftcertbalance'] != $row['giftcertamount']) {
             $GLOBALS['ExpandIcon'] = '+';
         } else {
             $GLOBALS['ExpandIcon'] = '';
         }
         $GLOBALS['GiftCertificateStatusOptions'] = $this->GetGiftCertificateStatusOptions($row['giftcertstatus']);
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("giftcertificates.manage.row");
         $GLOBALS['GiftCertificatesGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("giftcertificates.manage.grid");
     return $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(true);
 }
 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) &nbsp;&nbsp;&nbsp;", 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&amp;" . $searchURL . "&amp;page=" . $page . "&amp;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&amp;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">
                                                                 &nbsp;&nbsp;<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">
                                                                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>'.$row['column_name'].'</b>
                                                             </td>
                                                         </tr>';
                 $tempqualifierid = $row['qualifierid'];
             }
             */
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("qvalue.associations.manage.row");
             $GLOBALS['QValueAssociationGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         }
     }
     $GLOBALS['QValueAssociationGrid'] .= "<tr><td>&nbsp;</td><td colspan='4'><a href='#' onclick='AssignNewQValues(" . $_GET['associd'] . ")'>New Qualifier Value<a></td></tr>";
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("qvalue.associations.manage.grid");
     return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
 }
Beispiel #28
0
		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'])) {
				$query = $_GET['searchQuery'];
			} else {
				$query = "";
			}

			$GLOBALS['SearchQuery'] = $query;
			$GLOBALS['SortField'] = $sortField;
			$GLOBALS['SortOrder'] = $sortOrder;

			$sortLinks = array(
				"Id" => "orderid",
				"Cust" => "custname",
				"Date" => "orddate",
				"Status" => "ordstatus",
				"Message" => "newmessages",
				"Total" => "total_inc_tax"
			);
			BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewOrders&amp;".http_build_query($sortURL)."&amp;page=".$page, $sortField, $sortOrder);

			// Workout the maximum size of the array
			$max = $start + $perPage;

			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)) {
				$this->template->assign('order', $row);
				$GLOBALS['OrderId'] = $row['orderid'];
				$GLOBALS['CustomerId'] = $row['ordcustid'];
				$GLOBALS['OrderId1'] = $row['orderid'];
				$GLOBALS['Customer'] = isc_html_escape($row['custname']);

				$GLOBALS['Date'] = isc_date(GetConfig('DisplayDateFormat'), $row['orddate']);
				$GLOBALS['OrderStatusOptions'] = $this->GetOrderStatusOptions($row['ordstatus']);

				$GLOBALS['Total'] = FormatPriceInCurrency($row['total_inc_tax'], $row['orddefaultcurrencyid'], null, true);

				$GLOBALS['NotesIcon'] = "";
				$GLOBALS['CommentsIcon'] = "";

				// Look up the country for the IP address of this order
				if(gzte11(ISC_LARGEPRINT)) {
					$suspiciousOrder = false;
					$GLOBALS['FlagCellClass'] = $GLOBALS['FlagCellTitle'] = '';
					if($row['ordgeoipcountrycode'] != '') {
						$flag = strtolower($row['ordgeoipcountrycode']);
						// If the GeoIP based country code and the billing country code don't match, we flag this order as a different colour
						if(strtolower($row['ordgeoipcountrycode']) != strtolower($row['ordbillcountrycode'])) {
							$GLOBALS['FlagCellClass'] = "Suspicious";
							$suspiciousOrder = true;

						}
						$countryName = $row['ordgeoipcountry'];
					}
					else {
						$flag = strtolower($row['ordbillcountrycode']);
						$countryName = $row['ordbillcountry'];
						$GLOBALS['FlagCellTitle'] = $row['ordbillcountry'];
					}
					// Do we have a country flag to show?
					if(file_exists(ISC_BASE_PATH."/lib/flags/".$flag.".gif")) {
						$flag = GetConfig('AppPath')."/lib/flags/".$flag.".gif";
						if($suspiciousOrder == true) {
							$title = sprintf(GetLang('OrderCountriesDontMatch'), $row['ordbillcountry'], $row['ordgeoipcountry']);
							$GLOBALS['OrderCountryFlag'] = "<span onmouseout=\"HideQuickHelp(this);\" onmouseover=\"ShowQuickHelp(this, '".GetLang('PossibleFraudulentOrder')."', '".$title."');\"><img src=\"".$flag."\" alt='' /></span>";
						}
						else {
							$GLOBALS['OrderCountryFlag'] = "<img src=\"".$flag."\" alt='' title=\"".$countryName."\" />";
						}
					}
					else {
						$GLOBALS['OrderCountryFlag'] = '';
					}
				}
				else {
					$GLOBALS['HideCountry'] = "none";
				}

				// If this is ebay item, we will have the icon as eBay icon
				$GLOBALS['OrderIcon'] = 'order.gif';
				if ($row['ebay_order_id'] != '0') {
					$GLOBALS['OrderIcon'] = 'ebay.gif';
				}

				// Workout the message link -- do they have permission to view order messages?
				$GLOBALS["HideMessages"] = "none";

				if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Order_Messages) && $row['ordcustid'] > 0) {
					$numMessages = GetLang('Messages');
					if($row['nummessages'] == 1) {
						$numMessages = GetLang('OrderMessage');
					}
					$newMessages = '0 '.GetLang('NewText');
					if($row['newmessages'] > 0) {
						$newMessages = "<strong>" . $row['newmessages'] . " " . GetLang('NewText') . "</strong>";
					}
					$GLOBALS['MessageLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=viewOrderMessages&amp;ord
					erId=%d'>%s %s</a><br />(%s)",
						GetLang('MessageOrder'),
						$row['orderid'],
						$row['nummessages'],
						$numMessages,
						$newMessages
					);

					if($row["numunreadmessages"] > 0 && gzte11(ISC_LARGEPRINT)) {
						$GLOBALS["HideMessages"] = "";
						$GLOBALS["NumMessages"] = $row['numunreadmessages'];
					}
				}
				else {
					$GLOBALS['MessageLink'] = sprintf("<a class='Action' disabled>%s (0)</a>", GetLang('Messages'));
				}

				if(!gzte11(ISC_LARGEPRINT)) {
					$GLOBALS["HideMessages"] = "none";
				}

				// If the customer still exists, link to the customer page
				if(trim($row['custname']) != '') {
					$GLOBALS['CustomerLink'] = "<a href='index.php?ToDo=viewCustomers&amp;idFrom=".$GLOBALS['CustomerId']."&idTo=".$GLOBALS['CustomerId']."'>".$GLOBALS['Customer']."</a>";
				}
				else {
					$GLOBALS['CustomerLink'] = $row['ordbillfirstname'].' '.$row['ordbilllastname'];
				}

				if($row['ordcustid'] == 0) {
					$GLOBALS['CustomerLink'] .= " <span style=\"color: gray;\">".GetLang('GuestCheckoutCustomer')."</span>";
				}

				// If the order has any notes, flag it
				if($row['ordnotes'] != '') {
					$GLOBALS['NotesIcon'] = '<a href="#" onclick="Order.HandleAction(' . $row['orderid'] . ', \'orderNotes\');"><img src="images/note.png" alt="" title="' . GetLang('OrderHasNotes') . '" style="border-style: none;" /></a>';
					$GLOBALS['HasNotesClass'] = 'HasNotes';
				}
				else {
					$GLOBALS['HasNotesClass'] = '';
				}

				// does the order have a customer message?
				if (!empty($row['ordcustmessage'])) {
					$GLOBALS['CommentsIcon'] = '<a href="#" onclick="Order.HandleAction(' . $row['orderid'] . ', \'orderNotes\');"><img src="images/user_comment.png" alt="" title="' . GetLang('OrderHasComments') . '" style="border-style: none;" /></a>';
				}

				// If the order has any shipable items, show the link to ship items
				$GLOBALS['ShipItemsLink'] = '';
				if (!$row['deleted'] && isset($row['ordtotalshipped']) && isset($row['ordtotalqty'])) {
					if($row['ordisdigital'] == 0 && ($row['ordtotalqty']-$row['ordtotalshipped']) > 0) {
						$addClass = '';
						if($row['shipping_address_count'] > 1) {
							$addClass = 'MultipleAddresses';
						}
						$GLOBALS['ShipItemsLink'] = '<option id="ShipItemsLink'.$row['orderid'].'"  value="shipItems'.$addClass.'">'.GetLang('ShipItems').'</option>';
					}
				}

				//Show payment status blow order status
				$GLOBALS['PaymentStatus'] = '';
				$GLOBALS['HidePaymentStatus'] = 'display:none;';
				$GLOBALS['PaymentStatusColor'] = '';
				if($row['ordpaymentstatus'] != '') {
					$GLOBALS['HidePaymentStatus'] = '';
					$GLOBALS['PaymentStatusColor'] = '';
					switch($row['ordpaymentstatus']) {
						case 'authorized':
							$GLOBALS['PaymentStatusColor'] = 'PaymentAuthorized';
							break;
						case 'captured':
							$GLOBALS['PaymentStatus'] = GetLang('Payment')." ".ucfirst($row['ordpaymentstatus']);
							$GLOBALS['PaymentStatusColor'] = 'PaymentCaptured';
							break;
						case 'refunded':
						case 'partially refunded':
						case 'voided':
							$GLOBALS['PaymentStatus'] = GetLang('Payment')." ".ucwords($row['ordpaymentstatus']);
							$GLOBALS['PaymentStatusColor'] = 'PaymentRefunded';
							break;
					}
				}


				// If the allow payment delayed capture, show the link to Delayed capture
				$GLOBALS['DelayedCaptureLink'] = '';
				$GLOBALS['VoidLink'] = '';
				$GLOBALS['RefundLink'] ='';
				$transactionId = trim($row['ordpayproviderid']);

				//if orginal transaction id exist and payment provider is currently enabled
				if($transactionId != '' && GetModuleById('checkout', $provider, $row['orderpaymentmodule']) && $provider->IsEnabled() && !gzte11(ISC_HUGEPRINT)) {
					//if the payment module allow delayed capture and the current payment status is authorized
					//display delay capture option
					if(method_exists($provider, "DelayedCapture") && $row['ordpaymentstatus'] == 'authorized') {
						$GLOBALS['DelayedCaptureLink'] = '<option value="delayedCapture">'.GetLang('CaptureFunds').'</option>';

						$GLOBALS['PaymentStatus'] .= '<a onclick="Order.DelayedCapture('.$row['orderid'].'); return false;" href="#">'.GetLang('CaptureFunds').'</a>';
					}

					//if the payment module allow void transaction and the current payment status is authorized
					//display void option
					if(method_exists($provider, "DoVoid") && $row['ordpaymentstatus'] == 'authorized') {
						$GLOBALS['VoidLink'] = '<option value="voidTransaction">'.GetLang('VoidTransaction').'</option>';
					}

					//if the payment module allow refund and the current payment status is authorized
					//display refund option
					if(method_exists($provider, "DoRefund") && ($row['ordpaymentstatus'] == 'captured' || $row['ordpaymentstatus'] == 'partially refunded')) {
						$GLOBALS['RefundLink'] = '<option value="refundOrder">'.GetLang('Refund').'</option>';
					}
				}

				$GLOBALS["OrderStatusText"] = GetOrderStatusById($row['ordstatus']);
				$GLOBALS['OrderStatusId'] = $row['ordstatus'];
				$GLOBALS['OrderGrid'] .= $this->template->render('order.manage.row.tpl');
			}

			// Close the GeoIP database if we used it
			if(isset($gi)) {
				geoip_close($gi);
			}

			// Hide the message box in templates/iphone/MessageBox.html if we're not searching
			if(!isset($_REQUEST["searchQuery"]) && isset($_REQUEST["page"])) {
				$GLOBALS["HideYellowMessage"] = "none";
			}

			$GLOBALS['CurrentPage'] = $page;

			return $this->template->render('orders.manage.grid.tpl');
		}
Beispiel #29
0
	public function getRedirectsTable()
	{
		GetLib('class.redirects');
		GetLib('class.urls');

		$perPage = 20;
		$page    = max((int)@$_GET['page'], 1);
		$start   = ($page * $perPage) - $perPage;
		$NumResults = 0;
		$GLOBALS['RedirectsGrid']  = "";
		$GLOBALS['RedirectPaging'] = "";

		$sortOrder = 'desc';

		if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'asc') {
			$sortOrder = 'asc';
		}

		$sortLinks = array(
			"OldUrl" => "r.redirectpath",
			"NewUrl" => "r.redirectassoctype",
			"RedirectId" => "r.redirectid",
		);

		if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
			$sortField = $_GET['sortField'];
		}
		else {
			$sortField = "r.redirectid";
		}

		$sortURL = '&sortField=' . $sortField . '&sortOrder=' . $sortOrder;
		$GLOBALS['SortURL'] = $sortURL;

		// Get the results for the query
		$redirectResult = $this->getRedirectRows($start, $sortField, $sortOrder, $perPage, $NumResults);
		$numPages = ceil($NumResults / $perPage);

		if(($start+1) > $NumResults && $start > 1) {
			$_GET['page'] = 1;
			return $this->getRedirectsTable();
		}

		// Add the "(Page x of n)" label
		if($NumResults > $perPage) {
			$GLOBALS['RedirectPaging'] = sprintf("(%s %d of %d) &nbsp;&nbsp;&nbsp;", GetLang('Page'), $page, $numPages);
			$GLOBALS['RedirectPaging'] .= BuildPagination($NumResults, $perPage, $page, 'remote.php?remoteSection=redirects&w=getRedirectsTable' . $sortURL);
		}

		$GLOBALS['RedirectPaging'] = rtrim($GLOBALS['RedirectPaging'], ' |');
		$GLOBALS['SortField'] = $sortField;
		$GLOBALS['SortOrder'] = $sortOrder;

		BuildAdminSortingLinks($sortLinks, "remote.php?remoteSection=redirects&amp;w=getRedirectsTable&amp;page=".$page, $sortField, $sortOrder);

		if($NumResults > 0) {
			// Display the redirects
			while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($redirectResult))
			{
				$GLOBALS['RedirectId'] = $row['redirectid'];
				$GLOBALS['OldURL'] = $row['redirectpath'];
				$redirectManual = $row['redirectmanual'];
				if ($redirectManual == '') {
					$redirectManual = GetLang('ClickHereToEnterAURL');
				}
				$GLOBALS['NewURL'] = $redirectManual;
				$GLOBALS['RedirectTypeAutoSelected'] = "selected='selected'";
				$GLOBALS['RedirectTypeManualSelected'] = '';
				$GLOBALS['RedirectTypeManualDisplay'] = "display: none;";
				$GLOBALS['RedirectTypeAutoDisplay'] = "";
				$GLOBALS['NewURLTitle'] = '';
				$GLOBALS['LinkerTitle'] = GetLang('ChangeLink');
				$GLOBALS['RedirectTestLink'] = GetConfig('ShopPath') . $row['redirectpath'];

				$row['redirectassoctype'] = (int)$row['redirectassoctype'];

				switch($row['redirectassoctype']) {
					case ISC_REDIRECTS::REDIRECT_TYPE_NOREDIRECT:
					case ISC_REDIRECTS::REDIRECT_TYPE_MANUAL:
						$GLOBALS['RedirectTypeManualSelected'] = "selected='selected'";
						$GLOBALS['RedirectTypeAutoSelected'] = "";
						$GLOBALS['RedirectTypeManualDisplay'] = "";
						$GLOBALS['RedirectTypeAutoDisplay'] = "display: none;";
						$GLOBALS['LinkerTitle'] = GetLang('BrowseForLink');
						break;
					case ISC_REDIRECTS::REDIRECT_TYPE_PRODUCT:
						$urlInfo = ISC_URLS::getProductUrl($row['redirectassocid'], true);
						if(is_array($urlInfo)  && !empty($urlInfo['title'])) {
							$GLOBALS['NewURL'] = $urlInfo['url'];
							$GLOBALS['NewURLTitle'] = GetLang('Product') . ': ' . $urlInfo['title'];
						}
						break;
					case ISC_REDIRECTS::REDIRECT_TYPE_CATEGORY:
						$urlInfo = ISC_URLS::getCategoryUrl($row['redirectassocid'], true);
						if(is_array($urlInfo)  && !empty($urlInfo['title'])) {
							$GLOBALS['NewURL'] = $urlInfo['url'];
							$GLOBALS['NewURLTitle'] = GetLang('Category') . ': ' .  $urlInfo['title'];
						}
						break;
					case ISC_REDIRECTS::REDIRECT_TYPE_BRAND:
						$urlInfo = ISC_URLS::getBrandUrl($row['redirectassocid'], true);
						if(is_array($urlInfo)  && !empty($urlInfo['title'])) {
							$GLOBALS['NewURL'] = $urlInfo['url'];
							$GLOBALS['NewURLTitle'] = GetLang('Brand') . ': ' . $urlInfo['title'];
						}
						break;
					case ISC_REDIRECTS::REDIRECT_TYPE_PAGE:
						$urlInfo = ISC_URLS::getPageUrl($row['redirectassocid'], true);
						if(is_array($urlInfo)  && !empty($urlInfo['title'])) {
							$GLOBALS['NewURL'] = $urlInfo['url'];
							$GLOBALS['NewURLTitle'] = GetLang('Page') . ': ' . $urlInfo['title'];
						}
						break;
				}

				$GLOBALS['RedirectsGrid'] .= $this->template->render('redirects.row.tpl');
			}
		}

		return array($this->template->render('redirects.grid.tpl'), $NumResults);
	}
 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 .= "&amp;brandid=" . trim($_GET['brandid']) . "";
     }
     if (isset($_GET['seriesid'])) {
         $filterURL .= "&amp;seriesid=" . trim($_GET['seriesid']) . "";
     }
     //Added by Simha Ends
     if (isset($_GET['searchQuery'])) {
         $query = $_GET['searchQuery'];
         $GLOBALS['Query'] = $query;
         $searchURL = sprintf("&amp;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) &nbsp;&nbsp;&nbsp;", 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&amp;" . $searchURL . "&amp;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']);
             $GLOBALS['PreviewLink'] = sprintf("<a title='%s' href='javascript:PreviewReview(%d)'>%s</a>", GetLang('PreviewReview'), $row['reviewid'], GetLang('Preview'));
             if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Reviews)) {
                 $GLOBALS['EditLink'] = sprintf("<a title='%s' href='index.php?ToDo=editReview&amp;reviewId=%d'>%s</a>", GetLang('EditReview'), $row['reviewid'], GetLang('Edit'));
             } else {
                 $GLOBALS['EditLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
             }
             switch ($row['revstatus']) {
                 case "0":
                     $GLOBALS['Status'] = GetLang('Pending');
                     break;
                 case "1":
                     $GLOBALS['Status'] = sprintf("<font color='green'>%s</font>", GetLang('Approved'));
                     break;
                 case "2":
                     $GLOBALS['Status'] = sprintf("<font color='red'>%s</font>", GetLang('Disapproved'));
                     break;
             }
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("reviews.manage.row");
             $GLOBALS['ReviewGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("reviews.manage.grid");
         return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
 }