private function ManageGiftCertificatesGrid(&$numGiftCertificates) { // Show a list of products in a table $page = 0; $start = 0; $numPages = 0; $GLOBALS['CompanyGiftCertificatesGrid'] = ""; $GLOBALS['Nav'] = ""; $catList = ""; $max = 0; if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") { $sortOrder = "asc"; } else { $sortOrder = "desc"; } $validSortFields = array('cgcid', 'cgcname', 'cgccode', 'cgcto', 'cgcfrom', 'cgccustid', 'cgcamount', 'cgcbalance', 'cgcstatus', 'cgcpurchasedate', 'cgcexpiry', 'customername'); if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) { $sortField = $_REQUEST['sortField']; SaveDefaultSortField("ManageCompanyGiftCertificates", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageCompanyGiftCertificates", "cgcid", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } // Build the pagination and sort URL $searchURL = ''; foreach ($_GET as $k => $v) { if ($k == "sortField" || $k == "sortOrder" || $k == "page" || $k == "new" || $k == "ToDo" || $k == "SubmitButton1" || !$v) { continue; } $searchURL .= sprintf("&%s=%s", $k, urlencode($v)); } $sortURL = sprintf("%s&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of gift certificates returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE - (ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $certificateResult = $this->_GetCompanyGiftCertificatesList($start, $sortField, $sortOrder, $numGiftCertificates); $numPages = ceil($numGiftCertificates / ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE); // Add the "(Page x of n)" label if ($numGiftCertificates > ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numGiftCertificates, ISC_COMPANY_GIFTCERTIFICATES_PER_PAGE, $page, sprintf("index.php?ToDo=viewCompanyGiftCertificates%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; $GLOBALS['CurrentPageLink'] = "index.php?ToDo=viewCompanyGiftCertificates"; } if (isset($_GET['searchQuery'])) { $query = $_GET['searchQuery']; } else { $query = ""; } $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |'); $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; $sortLinks = array("Id" => "cgcid", "CertificateAmount" => "cgcamount", "CertificateBalance" => "cgcbalance", "CertificateName" => "cgcname", "PurchaseDate" => "cgcpurchasedate", "Status" => "cgcstatus", "Code" => "cgccode", "Cust" => "customername"); BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewCompanyGiftCertificates&page=" . $page, $sortField, $sortOrder); $GLOBALS['GiftCertificateStatusList'] = $this->GetCompanyGiftCertificateStatusOptions(); // Display the gift certificates while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($certificateResult)) { $GLOBALS['cgcId'] = (int) $row['cgcid']; $GLOBALS['cgcCode'] = isc_html_escape($row['cgccode']); $GLOBALS['cgcTo'] = isc_html_escape($row['cgcto']); $GLOBALS['cgcToEmail'] = isc_html_escape($row['cgctoemail']); $GLOBALS['cgcAmount'] = FormatPrice($row['cgcamount']) . ' / ' . FormatPrice($row['cgcbalance']); $GLOBALS['cgcBalance'] = FormatPrice($row['cgcbalance']); $GLOBALS['cgcName'] = isc_html_escape($row['cgcname']); if (count(explode('$', $row['cgcto'])) > 1) { $GLOBALS['cgcTos'] = isc_html_escape(str_replace('$', ', ', $row['cgcto'])); } else { $GLOBALS['cgcTos'] = isc_html_escape($row['cgcto']); } $GLOBALS['cgcPurchaseDate'] = isc_date(GetConfig('DisplayDateFormat'), $row['cgcpurchasedate']); if ($row['cgcexpirydate'] != 0) { $GLOBALS['cgcPurchaseDate'] .= ' / ' . isc_date(GetConfig('DisplayDateFormat'), $row['cgcexpirydate']); } else { $GLOBALS['cgcPurchaseDate'] .= ' / ' . GetLang('GiftCertificateExpireNA'); } // Something of this gift certificate has been sent so we need to show the expand icon if ($row['cgcbalance'] != $row['cgcamount']) { $GLOBALS['ExpandIcon'] = '+'; } else { $GLOBALS['ExpandIcon'] = ''; } $GLOBALS['cgcStatusOptions'] = $this->GetCompanyGiftCertificateStatusOptions($row['cgcstatus']); if (($row['cgcstatus'] == 3 || $row['cgcstatus'] == 4) && !$row['cgcsended']) { // $GLOBALS['cgcAction'] = "<a href='index.php?ToDo=editCompanyGiftCertificate&cgcid=".$row['cgcid']."' >Edit</a>"; } else { $GLOBALS['cgcAction'] = " "; } $GLOBALS['cgcsendedval'] = $row['cgcsended']; $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("company.giftcertificates.manage.row"); $GLOBALS['cgcGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("company.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) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numQValueAssociations, ISC_BRANDS_PER_PAGE, $page, sprintf("index.php?ToDo=viewQValueAssociations%s%s", $sortURL, $resultFilter)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; //$GLOBALS['resultFilter'] = $resultFilter; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewQValueAssociations&" . $searchURL . "&page=" . $page . "&page=" . $page . $resultFilter, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_BRANDS_PER_PAGE; if ($max > count($qValueAssociationResult)) { $max = count($qValueAssociationResult); } if ($numQValueAssociations > 0) { $tempcategoryid = 0; $tempqualifierid = 0; // Display the news while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($qValueAssociationResult)) { $GLOBALS['QValueAssociationId'] = (int) $row['qvalueassocid']; $GLOBALS['QualifierAssociationId'] = (int) $row['associd']; $GLOBALS['QualifierDisplayName'] = isc_html_escape($row['column_name']); $GLOBALS['QValueName'] = isc_html_escape($row['qvalue']); $GLOBALS['AssociationDisplayName'] = $row['displayname']; // Workout the edit link -- do they have permission to do so? if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_QValue_Associations)) { $GLOBALS['EditQValueAssociationLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editQValueAssociations&QValueAssociationId=%d'>%s</a>", GetLang('QValueAssociationEdit'), $row['qvalueassocid'], GetLang('Edit')); } else { $GLOBALS['EditNewsLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit')); } /* if($tempcategoryid != $row['categoryid']) { $GLOBALS['QValueAssociationGrid'] .= '<tr bgcolor="#eeeeee"> <td align="left" style="height:27px;" colspan="5"> <b>'.$row['catname'].'</b> </td> </tr>'; $tempcategoryid = $row['categoryid']; $tempqualifierid = 0; //Need to start new qualifiers for the category } if($tempqualifierid != $row['qualifierid']) { $GLOBALS['QValueAssociationGrid'] .= '<tr bgcolor="#eeeeee"> <td align="left" style="height:27px;" colspan="5"> <b>'.$row['column_name'].'</b> </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> </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); }
public function getRedirectsTable() { GetLib('class.redirects'); GetLib('class.urls'); $perPage = 20; $page = max((int)@$_GET['page'], 1); $start = ($page * $perPage) - $perPage; $NumResults = 0; $GLOBALS['RedirectsGrid'] = ""; $GLOBALS['RedirectPaging'] = ""; $sortOrder = 'desc'; if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'asc') { $sortOrder = 'asc'; } $sortLinks = array( "OldUrl" => "r.redirectpath", "NewUrl" => "r.redirectassoctype", "RedirectId" => "r.redirectid", ); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; } else { $sortField = "r.redirectid"; } $sortURL = '&sortField=' . $sortField . '&sortOrder=' . $sortOrder; $GLOBALS['SortURL'] = $sortURL; // Get the results for the query $redirectResult = $this->getRedirectRows($start, $sortField, $sortOrder, $perPage, $NumResults); $numPages = ceil($NumResults / $perPage); if(($start+1) > $NumResults && $start > 1) { $_GET['page'] = 1; return $this->getRedirectsTable(); } // Add the "(Page x of n)" label if($NumResults > $perPage) { $GLOBALS['RedirectPaging'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['RedirectPaging'] .= BuildPagination($NumResults, $perPage, $page, 'remote.php?remoteSection=redirects&w=getRedirectsTable' . $sortURL); } $GLOBALS['RedirectPaging'] = rtrim($GLOBALS['RedirectPaging'], ' |'); $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "remote.php?remoteSection=redirects&w=getRedirectsTable&page=".$page, $sortField, $sortOrder); if($NumResults > 0) { // Display the redirects while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($redirectResult)) { $GLOBALS['RedirectId'] = $row['redirectid']; $GLOBALS['OldURL'] = $row['redirectpath']; $redirectManual = $row['redirectmanual']; if ($redirectManual == '') { $redirectManual = GetLang('ClickHereToEnterAURL'); } $GLOBALS['NewURL'] = $redirectManual; $GLOBALS['RedirectTypeAutoSelected'] = "selected='selected'"; $GLOBALS['RedirectTypeManualSelected'] = ''; $GLOBALS['RedirectTypeManualDisplay'] = "display: none;"; $GLOBALS['RedirectTypeAutoDisplay'] = ""; $GLOBALS['NewURLTitle'] = ''; $GLOBALS['LinkerTitle'] = GetLang('ChangeLink'); $GLOBALS['RedirectTestLink'] = GetConfig('ShopPath') . $row['redirectpath']; $row['redirectassoctype'] = (int)$row['redirectassoctype']; switch($row['redirectassoctype']) { case ISC_REDIRECTS::REDIRECT_TYPE_NOREDIRECT: case ISC_REDIRECTS::REDIRECT_TYPE_MANUAL: $GLOBALS['RedirectTypeManualSelected'] = "selected='selected'"; $GLOBALS['RedirectTypeAutoSelected'] = ""; $GLOBALS['RedirectTypeManualDisplay'] = ""; $GLOBALS['RedirectTypeAutoDisplay'] = "display: none;"; $GLOBALS['LinkerTitle'] = GetLang('BrowseForLink'); break; case ISC_REDIRECTS::REDIRECT_TYPE_PRODUCT: $urlInfo = ISC_URLS::getProductUrl($row['redirectassocid'], true); if(is_array($urlInfo) && !empty($urlInfo['title'])) { $GLOBALS['NewURL'] = $urlInfo['url']; $GLOBALS['NewURLTitle'] = GetLang('Product') . ': ' . $urlInfo['title']; } break; case ISC_REDIRECTS::REDIRECT_TYPE_CATEGORY: $urlInfo = ISC_URLS::getCategoryUrl($row['redirectassocid'], true); if(is_array($urlInfo) && !empty($urlInfo['title'])) { $GLOBALS['NewURL'] = $urlInfo['url']; $GLOBALS['NewURLTitle'] = GetLang('Category') . ': ' . $urlInfo['title']; } break; case ISC_REDIRECTS::REDIRECT_TYPE_BRAND: $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); }
<a class="button" href="<?php the_permalink(); ?> " title="<?php the_title(); ?> ">Detalii</a> </div> </div> </li> <?php } ?> </ul> <?php BuildPagination(); ?> <?php } else { ?> <h2>Nu exista nici o oferta.</h2> <?php } ?> </div> </div> </div> <div class="sidebar"> <?php get_sidebar('croaziera');
/** * Builds the pagination and navigation links * * @param int $page The current page we're on * @param int $total_items The total number of items to be paginated */ private function GetNav($page, $total_items) { $searchURL = $this->GetSearchURL(); $numPages = ceil($total_items / ITEMS_PER_PAGE); // Add the "(Page x of n)" label if ($total_items > ITEMS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($total_items, ITEMS_PER_PAGE, $page, "index.php?ToDo=startExport" . $searchURL); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |'); }
private function ManageUsersGrid(&$numUsers) { // Show a list of news in a table $page = 0; $start = 0; $numUsers = 0; $numPages = 0; $GLOBALS['UserGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') { $sortOrder = 'desc'; } else { $sortOrder = "asc"; } $sortLinks = array("User" => "username", "Name" => "name", "Email" => "useremail", "Status" => "userstatus", "Vendor" => "vendorname"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("ManageUsers", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageUsers", "username", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of questions returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_USERS_PER_PAGE - (ISC_USERS_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $userResult = $this->_GetUserList($start, $sortField, $sortOrder, $numUsers); $numPages = ceil($numUsers / ISC_USERS_PER_PAGE); // Add the "(Page x of n)" label if ($numUsers > ISC_USERS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numUsers, ISC_USERS_PER_PAGE, $page, sprintf("index.php?ToDo=viewUsers%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |'); $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; $GLOBALS['HideVendorColumn'] = 'display: none'; if (gzte11(ISC_HUGEPRINT) && !$GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { $GLOBALS['HideVendorColumn'] = ''; } BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewUsers&page=" . $page, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_USERS_PER_PAGE; if ($max > count($userResult)) { $max = count($userResult); } if ($numUsers > 0) { // Display the news while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($userResult)) { $GLOBALS['UserId'] = (int) $row['pk_userid']; if ($row['vendorname']) { $GLOBALS['Vendor'] = "<a href='index.php?ToDo=editVendor&vendorId=" . $row['uservendorid'] . "'>" . isc_html_escape($row['vendorname']) . "</a>"; } else { $GLOBALS['Vendor'] = GetLang('NA'); } if ($row['pk_userid'] == 1 || $row['username'] == "admin") { $GLOBALS['CheckDisabled'] = "DISABLED"; } else { $GLOBALS['CheckDisabled'] = ""; } if ($row['name'] == " ") { $GLOBALS['Name'] = GetLang('NA'); } else { $GLOBALS['Name'] = isc_html_escape($row['name']); } $GLOBALS['Username'] = isc_html_escape($row['username']); if (!$row['useremail']) { $GLOBALS['Email'] = GetLang('NA'); } else { $GLOBALS['Email'] = sprintf("<a href='mailto:%s'>%s</a>", urlencode($row['useremail']), isc_html_escape($row['useremail'])); } switch ($row['userstatus']) { case 0: if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Users)) { $GLOBALS['Status'] = sprintf("<a title='%s' href='index.php?ToDo=updateUserStatus&userId=%d&status=1'><img border='0' src='images/cross.gif'></a>", GetLang('UserActiveTip'), $row['pk_userid']); } else { $GLOBALS['Status'] = "<img border='0' src='images/cross.gif'>"; } break; case 1: if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Users) && !($row['pk_userid'] == 1)) { $GLOBALS['Status'] = sprintf("<a title='%s' href='index.php?ToDo=updateUserStatus&userId=%d&status=0'><img border='0' src='images/tick.gif'></a>", GetLang('UserInactiveTip'), $row['pk_userid']); } else { $GLOBALS['Status'] = "<img border='0' src='images/tick.gif'></a>"; } break; } // 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&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&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); } }
private function ManageOrdersGrid(&$numOrders) { // Show a list of products in a table $page = 0; $start = 0; $numPages = 0; $GLOBALS['OrderGrid'] = ""; $GLOBALS['Nav'] = ""; $GLOBALS['SmallNav'] = ""; $catList = ""; $max = 0; // Is this a custom search? if (isset($_GET['searchId'])) { $this->_customSearch = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->LoadSearch($_GET['searchId']); $_REQUEST = array_merge($_REQUEST, (array) $this->_customSearch['searchvars']); // Override custom search sort fields if we have a requested field if (isset($_GET['sortField'])) { $_REQUEST['sortField'] = $_GET['sortField']; } if (isset($_GET['sortOrder'])) { $_REQUEST['sortOrder'] = $_GET['sortOrder']; } } else { if (isset($_GET['searchQuery'])) { $GLOBALS['Query'] = $_GET['searchQuery']; } } if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") { $sortOrder = "asc"; } else { $sortOrder = "desc"; } $validSortFields = array('orderid', 'custname', 'orddate', 'ordstatus', 'newmessages', 'ordtotalamount', 'ordoverview'); if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) { $sortField = $_REQUEST['sortField']; SaveDefaultSortField("ManageOrders", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageOrders", "orderid", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } // Build the pagination and sort URL $searchURL = ''; foreach ($_GET as $k => $v) { if ($k == "sortField" || $k == "sortOrder" || $k == "page" || $k == "new" || $k == "ToDo" || $k == "SubmitButton1" || !$v) { continue; } $searchURL .= sprintf("&%s=%s", $k, urlencode($v)); } $sortURL = sprintf("%s&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of orders returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_ORDERS_PER_PAGE - (ISC_ORDERS_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $orderResult = $this->_GetOrderList($start, $sortField, $sortOrder, $numOrders); $numPages = ceil($numOrders / ISC_ORDERS_PER_PAGE); // Add the "(Page x of n)" label if ($numOrders > ISC_ORDERS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); //alandy_2012-3-28 add. if (isset($_REQUEST['orderOwner']) && $_REQUEST['orderOwner'] != '') { $GLOBALS['Nav'] .= BuildPagination($numOrders, ISC_ORDERS_PER_PAGE, $page, sprintf("index.php?ToDo=viewOrders%s&orderOwner=%s", $sortURL, $_REQUEST['orderOwner'])); } else { $GLOBALS['Nav'] .= BuildPagination($numOrders, ISC_ORDERS_PER_PAGE, $page, sprintf("index.php?ToDo=viewOrders%s", $sortURL)); } } else { $GLOBALS['Nav'] = ""; } if (isset($_GET['searchQuery'])) { $query = $_GET['searchQuery']; } else { $query = ""; } $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |'); $GLOBALS['SmallNav'] = rtrim($GLOBALS['SmallNav'], ' |'); $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; $sortLinks = array("Id" => "orderid", "Cust" => "custname", "Date" => "orddate", "Status" => "ordstatus", "Message" => "newmessages", "Total" => "ordtotalamount", "Review" => "ordoverview"); BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewOrders&" . $searchURL . "&page=" . $page, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_ORDERS_PER_PAGE; if ($max > count($orderResult)) { $max = count($orderResult); } if (!gzte11(ISC_LARGEPRINT)) { $GLOBALS['HideOrderMessages'] = "none"; $GLOBALS['CustomerNameSpan'] = 2; } // Display the orders while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($orderResult)) { $GLOBALS['OrderId'] = $row['orderid']; $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&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&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); }
public function LoadChooseTemplateTab() { $templatePath = ISC_BASE_PATH . "/templates"; GetLib('class.file'); $templateCount = 0; $templates = scandir($templatePath); natcasesort($templates); foreach ($templates as $k => $template) { if ($template == "." || $template == ".." || $template == "CVS" || $template == ".svn" || $template == 'blank.dat' || $template[0] == '_') { continue; } $previewPath = $templatePath . '/' . $template . '/Previews'; if (!is_dir($previewPath)) { continue; } $previews = new FileClass(); $previews->SetLoadDir($previewPath); $doneColors = array(); while (($preview = $previews->NextFile()) !== false) { if (substr($preview, -4) != ".jpg" && substr($preview, -5) != ".jpeg" && substr($preview, -4) != ".gif") { continue; } $templateColor = ucfirst(str_replace(array(".jpg", ".jpeg", "gif", "fixed_", "stretched_"), "", strtolower($preview))); if (in_array($templateColor, $doneColors)) { continue; } $doneColors[] = $templateColor; $templateList[] = array('template' => $template, 'templateName' => ucfirst($template), 'templateColor' => $templateColor, 'preview' => $preview, 'id' => uniqid(5)); ++$templateCount; if (GetConfig('template') == $template && strtolower($templateColor) == GetConfig('SiteColor')) { $GLOBALS['CurrentTemplateImage'] = $preview; } } } if (isset($_REQUEST['page'])) { $pageNumber = (int) $_REQUEST['page']; } else { $pageNumber = 1; } $perPage = 20; if (isset($_REQUEST['perpage'])) { $perPage = (int) $_REQUEST['perpage']; } $startNumber = $pageNumber * $perPage - $perPage; $pageCount = ceil(count($templateList) / $perPage); $GLOBALS['PageNumber'] = $pageNumber; switch ($perPage) { case 10: $GLOBALS['PerPage10Selected'] = 'selected="selected"'; break; case 50: $GLOBALS['PerPage50Selected'] = 'selected="selected"'; break; case 100: $GLOBALS['PerPage100Selected'] = 'selected="selected"'; break; default: $GLOBALS['PerPage20Selected'] = 'selected="selected"'; break; } $GLOBALS['Nav'] = ''; if ($pageCount > 1) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $pageNumber, $pageCount); $GLOBALS['Nav'] .= BuildPagination(count($templateList), $perPage, $pageNumber, "index.php?ToDo=viewTemplates"); } $GLOBALS['TemplateListMap'] = ''; for ($i = $startNumber; $i < $startNumber + $perPage; ++$i) { if (!isset($templateList[$i])) { continue; } $template = $templateList[$i]; $GLOBALS['Template'] = $template['template']; $GLOBALS['TemplateName'] = $template['templateName']; $GLOBALS['TemplateColor'] = $template['templateColor']; $GLOBALS['TemplatePreview'] = $template['preview']; $GLOBALS['TemplateID'] = $template['id']; $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('layout.choosetemplate.row'); $templateCode = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); if (strtolower($template['templateColor']) == strtolower(GetConfig('SiteColor')) && $template['template'] == GetConfig('template')) { $GLOBALS['TemplateListMap'] .= '<div class="TemplateBoxOn" id="' . $GLOBALS['TemplateID'] . '">' . $templateCode . '</div>'; } else { $GLOBALS['TemplateListMap'] .= '<div class="TemplateBox" id="' . $GLOBALS['TemplateID'] . '" onmouseover="this.className=\'TemplateBoxOver\'" onmouseout="this.className=\'TemplateBox\'">' . $templateCode . '</div>'; } } }
public function ManageReviewsGrid(&$numReviews) { // Show a list of reviews in a table $page = 0; $start = 0; $numReviews = 0; $numPages = 0; $GLOBALS['ReviewGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; $searchURL = ''; $filterURL = ''; //Added by Simha if (isset($_GET['brandid'])) { $filterURL .= "&brandid=" . trim($_GET['brandid']) . ""; } if (isset($_GET['seriesid'])) { $filterURL .= "&seriesid=" . trim($_GET['seriesid']) . ""; } //Added by Simha Ends if (isset($_GET['searchQuery'])) { $query = $_GET['searchQuery']; $GLOBALS['Query'] = $query; $searchURL = sprintf("&searchQuery=%s", urlencode($query)); } else { $query = ""; $GLOBALS['Query'] = ""; } if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') { $sortOrder = 'asc'; } else { $sortOrder = "desc"; } $sortLinks = array("Review" => "r.revtitle", "Name" => "p.prodname", "By" => "r.revfromname", "Rating" => "r.revrating", "Date" => "r.revdate", "Status" => "r.revstatus"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("ManageReviews", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageReviews", "r.reviewid", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $GLOBALS['Page'] = $page; $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of questions returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_REVIEWS_PER_PAGE - (ISC_REVIEWS_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $reviewResult = $this->_GetReviewList($query, $start, $sortField, $sortOrder, $numReviews); $numPages = ceil($numReviews / ISC_REVIEWS_PER_PAGE); // Add the "(Page x of n)" label if ($numReviews > ISC_REVIEWS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numReviews, ISC_REVIEWS_PER_PAGE, $page, sprintf("index.php?ToDo=viewReviews%s%s%s", $sortURL, $filterURL, $searchURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |'); $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewReviews&" . $searchURL . "&page=" . $page . $filterURL, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_REVIEWS_PER_PAGE; if ($max > $numReviews) { $max = $numReviews; } if ($numReviews > 0) { // Display the reviews while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($reviewResult)) { $GLOBALS['ReviewId'] = $row['reviewid']; $GLOBALS['ProdName'] = isc_html_escape($row['prodname']); $GLOBALS['ProdLink'] = ProdLink($row['prodname']); if (isc_strlen($row['revtext']) > 100) { $GLOBALS['ReviewTitle'] = isc_html_escape(sprintf("%s...", isc_substr($row['revtitle'], 0, 100))); } else { $GLOBALS['ReviewTitle'] = isc_html_escape($row['revtitle']); } $GLOBALS['Rating'] = ""; $ratingText = sprintf(GetLang('ReviewRated'), $row['revrating']); for ($r = 0; $r < $row['revrating']; $r++) { $GLOBALS['Rating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_on.gif'>", $ratingText); } for ($r = $row['revrating']; $r < 5; $r++) { $GLOBALS['Rating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_off.gif'>", $ratingText); } if ($row['revfromname'] != "") { $GLOBALS['PostedBy'] = isc_html_escape($row['revfromname']); } else { $GLOBALS['PostedBy'] = GetLang('NA'); } $GLOBALS['Date'] = CDate($row['revdate']); $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&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); } }
/** * Generate the grid that shows the shipment results in it. * * @return string The generated grid of shipments for the current page. */ private function ManageShipmentsGrid() { $page = 0; $start = 0; $numPages = 0; $shipmentGrid = ''; $GLOBALS['Nav'] = ''; // Is this a custom view? if (isset($_GET['searchId'])) { $this->customSearch = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->LoadSearch($_GET['searchId']); $_REQUEST = array_merge($_REQUEST, (array) $this->customSearch['searchvars']); // Override the sort fields of the view if (isset($_GET['sortField'])) { $_REQUEST['sortField'] = $_GET['sortField']; } if (isset($_GET['sortOrder'])) { $_REQUEST['sortOrder'] = $_GET['sortOrder']; } } else { if (isset($_REQUEST['searchQuery'])) { $GLOBALS['Query'] = isc_html_escape($_GET['searchQuery']); } } // Validate the sort order if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == 'asc') { $sortOrder = 'asc'; } else { $sortOrder = 'desc'; } // Which fields can we sort by? $validSortFields = array('shipmentid', 'shipdate', 'shiporderid', 'shiporderdate', 'shipfullname'); if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) { $sortField = $_REQUEST['sortField']; SaveDefaultSortField('ManageShipments', $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField('ManageShipments', 'shipmentid', $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } // Build the pagination and sort URL $searchURL = ''; foreach ($_GET as $k => $v) { if ($k == "sortField" || $k == "sortOrder" || $k == "page" || $k == "new" || $k == "ToDo" || !$v) { continue; } $searchURL .= '&' . $k . '=' . urlencode($v); } $sortURL = $searchURL . '&sortField=' . $sortField . '&sortOrder=' . $sortOrder; $GLOBALS['SortURL'] = $sortURL; // Limit the number of shipments returned if ($page == 1) { $start = 0; } else { $start = ($page - 1) * ISC_SHIPMENTS_PER_PAGE; } // Grab the queries we'll be executing $shipmentQueries = $this->BuildShipmentSearchQuery($start, $sortField, $sortOrder); // How many results do we have? $numShipments = $GLOBALS['ISC_CLASS_DB']->FetchOne($shipmentQueries['countQuery']); $numPages = ceil($numShipments / ISC_SHIPMENTS_PER_PAGE); // Add the "(Page x of y)" label if ($numShipments > ISC_SHIPMENTS_PER_PAGE) { $GLOBALS['Nav'] = '(' . GetLang('Page') . ' ' . $page . ' ' . GetLang('Of') . ' ' . $numPages . ') '; $GLOBALS['Nav'] .= BuildPagination($numShipments, ISC_SHIPMENTS_PER_PAGE, $page, 'index.php?ToDo=viewShipments' . $sortURL); } else { $GLOBALS['Nav'] = ''; } $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; $sortLinks = array('Id' => 'shipmentid', 'Date' => 'shipdate', 'OrderId' => 'shiporderid', 'OrderDate' => 'shiporderdate', 'Name' => 'shipfullname'); BuildAdminSortingLinks($sortLinks, 'index.php?ToDo=viewShipments&' . $searchURL . '&page=' . $page, $sortField, $sortOrder); $result = $GLOBALS['ISC_CLASS_DB']->Query($shipmentQueries['query']); // Display the shipments while ($shipment = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $GLOBALS['ShipmentId'] = $shipment['shipmentid']; $GLOBALS['OrderId'] = $shipment['shiporderid']; $GLOBALS['Date'] = isc_date(GetConfig('DisplayDateFormat'), $shipment['shipdate']); $GLOBALS['OrderDate'] = isc_date(GetConfig('DisplayDateFormat'), $shipment['shiporderdate']); // If the customer still exists, link to the customer page $GLOBALS['ShippedTo'] = isc_html_escape($shipment['shipshipfirstname'] . ' ' . $shipment['shipshiplastname']); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('shipments.manage.row'); $shipmentGrid .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } if (!$shipmentGrid) { return ''; } $GLOBALS['ShipmentGrid'] = $shipmentGrid; $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('shipments.manage.grid'); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); }
public function ManageBrandsGrid(&$numBrands) { // Show a list of news in a table $page = 0; $start = 0; $numBrands = 0; $numPages = 0; $GLOBALS['BrandGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; $searchURL = ''; if (isset($_GET['searchQuery'])) { $query = $_GET['searchQuery']; $GLOBALS['Query'] = $query; $searchURL . 'searchQuery=' . urlencode($query); } else { $query = ""; $GLOBALS['Query'] = ""; } if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') { $sortOrder = 'desc'; } else { $sortOrder = "asc"; } $sortLinks = array("Brand" => "b.brandname", "Products" => "products"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("ManageBrands", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageBrands", "b.brandname", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of brands returned if ($page == 1) { } else { $start = $page * ISC_BRANDS_PER_PAGE - (ISC_BRANDS_PER_PAGE - 1); } $start = 1; $start = $start - 1; // Get the results for the query $brandResult = $this->_GetBrandList($query, $start, $sortField, $sortOrder, $numBrands); $numPages = ceil($numBrands / ISC_BRANDS_PER_PAGE); // Workout the paging navigation if ($numBrands > ISC_BRANDS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numBrands, ISC_BRANDS_PER_PAGE, $page, sprintf("index.php?ToDo=viewBrands%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = ""; $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewBrands&" . $searchURL . "&page=" . $page, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_BRANDS_PER_PAGE; if ($max > count($brandResult)) { $max = count($brandResult); } if ($numBrands > 0) { // Display the news $i = 1; while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($brandResult)) { $GLOBALS['BrandId'] = (int) $row['brandid']; $GLOBALS['BrandName'] = isc_html_escape($row['brandname']); $GLOBALS['Products'] = (int) $row['products']; // Workout the edit link -- do they have permission to do so? if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Brands)) { $GLOBALS['EditBrandLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editBrand&brandId=%d'>%s</a>", GetLang('BrandEdit'), $row['brandid'], GetLang('Edit')); } else { $GLOBALS['EditNewsLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit')); } if ($row['prodavgrating'] > 0) { $GLOBALS['Rating'] = ""; $ratingText = sprintf(GetLang('ReviewRated'), $row['prodavgrating']); for ($r = 0; $r < $row['prodavgrating']; $r++) { $GLOBALS['Rating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_on.gif'>", $ratingText); } for ($r = $row['prodavgrating']; $r < 5; $r++) { $GLOBALS['Rating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_off.gif'>", $ratingText); } } else { $GLOBALS['Rating'] = "Not Rated"; } $GLOBALS['ViewFeedbackLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=viewReviews&brandid=%d'>%s</a>", GetLang('ViewFeedback'), $row['brandid'], GetLang('ViewFeedback')); /* To display series under the brands -- Baskaran */ $cntquery = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT COUNT( productid ) as prodcnt FROM [|PREFIX|]products WHERE brandseriesid =" . $row['brandid']); $cntrow = $GLOBALS["ISC_CLASS_DB"]->Fetch($cntquery); $squery = "\n SELECT b.*, FLOOR(SUM(p.prodratingtotal)/SUM(p.prodnumratings)) AS seriesprodavgrating, \n (SELECT count(productid) FROM [|PREFIX|]products where brandseriesid = b.seriesid) as prodcnt \n FROM [|PREFIX|]brand_series b\n LEFT JOIN [|PREFIX|]products p ON p.brandseriesid=b.seriesid\n where b.brandid = " . $row['brandid'] . " GROUP BY b.seriesid order by seriessort asc "; $sresult = $GLOBALS["ISC_CLASS_DB"]->Query($squery); $GLOBALS['Brandidhide'] = 'b' . $row['brandid']; // $GLOBALS['SeriesGrid'] = ''; $GLOBALS['SeriesGrid'] = '<ul class="SortableList" id="SeriesList_' . $i . '">'; //Append Series Row while ($srow = $GLOBALS["ISC_CLASS_DB"]->Fetch($sresult)) { $GLOBALS['SeriesId'] = (int) $srow['seriesid']; $GLOBALS['SeriesName'] = wordwrap(isc_html_escape($srow['seriesname']), 90, '<br>', true); $GLOBALS['Prodcnt'] = $srow['prodcnt']; // Workout the edit link -- do they have permission to do so? if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Brands)) { $GLOBALS['EditSeriesLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editBrandSeries&seriesId=%d'>%s</a>", GetLang('SeriesEdit'), $srow['seriesid'], GetLang('Edit')); } else { $GLOBALS['EditNewsLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit')); } if ($srow['seriesprodavgrating'] > 0) { $GLOBALS['SeriesRating'] = ""; $ratingText = sprintf(GetLang('ReviewRated'), $srow['seriesprodavgrating']); for ($r = 0; $r < $srow['seriesprodavgrating']; $r++) { $GLOBALS['SeriesRating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_on.gif'>", $ratingText); } for ($r = $srow['seriesprodavgrating']; $r < 5; $r++) { $GLOBALS['SeriesRating'] .= sprintf("<img title='%s' width='13' height='12' src='images/rating_off.gif'>", $ratingText); } } else { $GLOBALS['SeriesRating'] = "Not Rated"; } $GLOBALS['ViewSeriesFeedbackLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=viewReviews&brandid=%d&seriesid=%d'>%s</a>", GetLang('ViewFeedback'), $row['brandid'], $srow['seriesid'], GetLang('ViewFeedback')); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("series.manage.row"); $GLOBALS['SeriesGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['SeriesGrid'] .= '</ul>'; $i++; /* Ends here */ $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("brands.manage.row"); $GLOBALS['BrandGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("brands.manage.grid"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } }
public function ManageSeriesGrid(&$numSeries) { // Show a list of news in a table $page = 0; $start = 0; $numSeries = 0; $numPages = 0; $GLOBALS['SeriesGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; $searchURL = ''; /* if (isset($_GET['searchQuery'])) { $query = $_GET['searchQuery']; $GLOBALS['Query'] = $query; $searchURL .'searchQuery='.urlencode($query); } else { $query = ""; $GLOBALS['Query'] = ""; } */ if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') { $sortOrder = 'desc'; } else { $sortOrder = "asc"; } $sortLinks = array("Series" => "b.seriesname"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("ManageSeries", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageSeries", "b.seriesname", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of series returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_SERIES_PER_PAGE - (ISC_SERIES_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $seriesResult = $this->_GetSeriesList($start, $sortField, $sortOrder, $numSeries); $numPages = ceil($numSeries / ISC_SERIES_PER_PAGE); // Workout the paging navigation if ($numSeries > ISC_SERIES_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numSeries, ISC_SERIES_PER_PAGE, $page, sprintf("index.php?ToDo=viewSeries%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; } // $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewSeries&" . $searchURL . "&page=" . $page, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_SERIES_PER_PAGE; if ($max > count($seriesResult)) { $max = count($seriesResult); } if ($numSeries > 0) { // Display the news while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($seriesResult)) { $GLOBALS['SeriesId'] = (int) $row['seriesid']; $GLOBALS['SeriesName'] = wordwrap(isc_html_escape($row['seriesname']), 90, '<br>', true); $GLOBALS['Brandname'] = $this->BrandNameId($row['brandid']); $GLOBALS['FileName'] = isc_html_escape($row['seriesphoto']); // Workout the edit link -- do they have permission to do so? if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Brands)) { $GLOBALS['EditSeriesLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editSeries&seriesId=%d'>%s</a>", GetLang('SeriesEdit'), $row['seriesid'], GetLang('Edit')); } else { $GLOBALS['EditNewsLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit')); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("series.manage.row"); $GLOBALS['SeriesGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("series.manage.grid"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } }
public function _LoadVariationCombinationsTable($VariationId, $ShowInventoryFields, $ProductId=0, $ProductHash='', $filterOptions = array()) { $GLOBALS['HeaderRows'] = ""; $GLOBALS['VariationRows'] = ""; $options = array(); $option_ids = array(); $i = 0; $query = sprintf("SELECT DISTINCT(voname) FROM [|PREFIX|]product_variation_options WHERE vovariationid='%d' ORDER BY vooptionsort, vovaluesort", $VariationId); $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); while($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { $GLOBALS['HeaderRows'] .= sprintf("<td>%s</td>", isc_html_escape($row['voname'])); $options[$row['voname']] = array(); $option_ids[$row['voname']] = array(); } // Now get all of the variation options $query = sprintf("SELECT * FROM [|PREFIX|]product_variation_options WHERE vovariationid='%d' ORDER BY vooptionsort, vovaluesort", $VariationId); $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); while($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { $options[$row['voname']][] = $row['vovalue']; $option_ids[$row['voname']][] = $row['voptionid']; } $newOptions = $options; $newOptionIds = $option_ids; // were filter options submitted? if (!empty($filterOptions)) { foreach ($option_ids as $optionName => $optionValues) { // were values selected for this option? if (isset($filterOptions[$optionName])) { $currentValues = $filterOptions[$optionName]; // ignore filtering if the 'All' value was selected if (!in_array('all', $currentValues)) { // remove any options not in the list $diffValues = array_diff($optionValues, $currentValues); foreach ($diffValues as $value) { $index = array_search($value, $optionValues); unset($newOptions[$optionName][$index]); unset($newOptionIds[$optionName][$index]); } } } } } // create the form for filtering options $filterOptionsHTML = ''; foreach ($option_ids as $optionName => $optionList) { $allSelected = ''; if (!isset($filterOptions[$optionName]) || in_array('all', $filterOptions[$optionName])) { $allSelected = ' selected="selected"'; } $filterOptionsHTML .= '<label>' . isc_html_escape($optionName) . ':</label>'; $filterOptionsHTML .= '<select multiple="multiple" size="4" name="filterOption[' . isc_html_escape($optionName) . '][]"><option value="all"' . $allSelected . '>(' . GetLang('All') . ')</option>'; foreach ($optionList as $optionId) { $key = array_search($optionId, $optionList); $optionValue = $options[$optionName][$key]; $selected = ''; if (isset($filterOptions[$optionName]) && in_array($optionId, $filterOptions[$optionName])) { $selected = ' selected="selected"'; } $filterOptionsHTML .= '<option value="' . isc_html_escape($optionId) . '"' . $selected . '>' . isc_html_escape($optionValue) . '</option>'; } $filterOptionsHTML .= '</select><br />'; } $GLOBALS['FilterOptions'] = $filterOptionsHTML; $page = 0; $start = 0; $numOptions = 1; $numPages = 0; $GLOBALS['Nav'] = ""; $max = 0; /* $validSortFields = array('productid', 'prodcode', 'currentinv', 'prodname', 'prodcalculatedprice', 'prodvisible', $featuredColumn); 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("ManageProducts", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageProducts", "productid", $sortOrder); } */ if(isset($_GET['page'])) { $page = (int)$_GET['page']; } else { $page = 1; } //$sortURL = sprintf("%s&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder); //$GLOBALS['SortURL'] = $sortURL; $sortURL = ''; // Limit the number of questions returned if($page == 1) { $start = 1; } else { $start = ($page * ISC_PRODUCTS_PER_PAGE) - (ISC_PRODUCTS_PER_PAGE-1); } $start = $start-1; foreach ($newOptions as $option) { $numOptions *= count($option); } $numPages = ceil($numOptions / ISC_PRODUCTS_PER_PAGE); $filterQuery = ''; if (!empty($filterOptions)) { $GLOBALS['FilterOptionsQuery'] = http_build_query($filterOptions); $queryOptions = array('filterOption' => $filterOptions); $filterQuery = "&" . http_build_query($queryOptions); } // Add the "(Page x of n)" label if($numOptions > ISC_PRODUCTS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numOptions, ISC_PRODUCTS_PER_PAGE, $page, "remote.php?w=getVariationCombinations&productId=" . $ProductId . "&productHash=" . $ProductHash . "&v=" . $VariationId . "&inv=" . (int)$ShowInventoryFields . $sortURL . $filterQuery); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = preg_replace('# \|$#',"", $GLOBALS['Nav']); //$GLOBALS['SortField'] = $sortField; //$GLOBALS['SortOrder'] = $sortOrder; // Get the variation combinations as text, such as #red#small#modern $GLOBALS["variation_data"] = array(); $GLOBALS['VariationRows'] = ""; $this->GetCombinationText('', $newOptions, 0, ISC_PRODUCTS_PER_PAGE, $start); $GLOBALS["variation_combinations"] = $GLOBALS["variation_data"]; // Get the variation combinations ID's, such as #145#185#195 $GLOBALS["variation_data"] = array(); $this->GetCombinationText('', $newOptionIds, 0, ISC_PRODUCTS_PER_PAGE, $start); $GLOBALS["variation_combination_ids"] = $GLOBALS["variation_data"]; // Setup a counter $count = 0; // Loop through the variation combination ID's and output them as hidden fields foreach($GLOBALS["variation_combination_ids"] as $k => $combo) { $GLOBALS['VariationRows'] .= sprintf(" <input name='options[$count][variationcombination]' type='hidden' value='%s' /></td>", $combo); ++$count; } // Reset the counter $count = 0; // Now loop through all of the options and output the combinations if(!empty($GLOBALS["variation_combinations"]) && $GLOBALS["variation_combinations"][0] != "") { foreach($GLOBALS["variation_combinations"] as $k => $combo) { // Set the default values $enabled = 'checked="checked"'; $sku = ''; $price = ''; $weight = ''; $add_p_checked = ''; $add_w_checked = ''; $show_price = 'none'; $show_weight = 'none'; $fixed_p_checked = ''; $fixed_w_checked = ''; $subtract_p_checked = ''; $subtract_w_checked = ''; if (isId($ProductId) || $ProductHash !== '') { // Get the variation combination's existing details from the product_variation_combinations table $combo_ids = preg_replace("/^#/", "", $GLOBALS["variation_combination_ids"][$count]); //$combo_ids = str_replace("#", ",", $combo_ids); $optionIds = explode("#", $combo_ids); $optionWhere = ""; foreach ($optionIds as $optionId) { $optionWhere .= " AND FIND_IN_SET(" . $optionId . ", vcoptionids)"; } $query = "SELECT * FROM [|PREFIX|]product_variation_combinations WHERE "; if (empty($ProductHash)) { $query .= "vcproductid=" . (int)$ProductId; } else { $query .= "vcproducthash='" . $GLOBALS['ISC_CLASS_DB']->Quote($ProductHash) . "'"; } $query .= $optionWhere; $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); $row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result); // Are there any option details? if($row !== false) { if($row['vcenabled'] == 1) { $enabled = 'checked="checked"'; } else { $enabled = ""; } $sku = $row['vcsku']; $price = ''; $show_price = 'none'; $add_p_checked = ''; $fixed_p_checked = ''; $subtract_p_checked = ''; switch($row['vcpricediff']) { case "add": { $add_p_checked = 'selected="selected"'; $show_price = ""; $price = FormatPrice($row['vcprice'], false, false); break; } case "subtract": { $subtract_p_checked = 'selected="selected"'; $show_price = ""; $price = FormatPrice($row['vcprice'], false, false); break; } case "fixed": { $fixed_p_checked = 'selected="selected"'; $show_price = ""; $price = FormatPrice($row['vcprice'], false, false); break; } } $add_w_checked = ''; $subtract_w_checked = ''; $fixed_w_checked = ''; $show_weight = 'none'; $weight = ''; switch($row['vcweightdiff']) { case "add": { $add_w_checked = 'selected="selected"'; $show_weight = ""; $weight = FormatWeight($row['vcweight'], false); $show_weight = ""; break; } case "subtract": { $subtract_w_checked = 'selected="selected"'; $show_weight = ""; $weight = FormatWeight($row['vcweight'], false); $show_weight = ""; break; } case "fixed": { $fixed_w_checked = 'selected="selected"'; $show_weight = ""; $weight = FormatWeight($row['vcweight'], false); $show_weight = ""; break; } } } } $GLOBALS['VariationRows'] .= sprintf("<input type='hidden' name='options[$count][id]' value='%d' />", $row['combinationid']); $GLOBALS['VariationRows'] .= "<tr class=\"GridRow CombinationRow\">"; $GLOBALS['VariationRows'] .= sprintf(" <td style='padding-left:4px'><input name='options[$count][enabled]' type='checkbox' %s value='ON' /></td>", $enabled); $combo = preg_replace("/^#/", "", $combo); $combos = explode("#", $combo); foreach($combos as $c) { $GLOBALS['VariationRows'] .= sprintf(" <td>%s</td>", isc_html_escape($c)); } $GLOBALS['VariationRows'] .= sprintf(" <td><input name='options[$count][sku]' type='text' class='Field50' value='%s' /></td>", isc_html_escape($sku)); $GLOBALS['VariationRows'] .= sprintf(" <td> <select class='PriceDrop' name='options[$count][pricediff]' onchange=\"if(this.selectedIndex>0) { $(this).parent().find('span').show(); $(this).parent().find('span input').focus(); $(this).parent().find('span input').select(); } else { $(this).parent().find('span').hide(); } \"> <option value=''>%s</option> <option %s value='add'>%s</option> <option %s value='subtract'>%s</option> <option %s value='fixed'>%s</option> </select> <span style='display:%s'> %s <input name='options[$count][price]' type='text' class='Field50 PriceBox' style='width:40px' value='%s' /> %s </span> </td>", GetLang("NoChange"), $add_p_checked, GetLang("VariationAdd"), $subtract_p_checked, GetLang("VariationSubtract"), $fixed_p_checked, GetLang("VariationFixed"), $show_price, $GLOBALS['CurrencyTokenLeft'], $price, $GLOBALS['CurrencyTokenRight']); $GLOBALS['VariationRows'] .= sprintf(" <td> <select class='WeightDrop' name='options[$count][weightdiff]' onchange=\"if(this.selectedIndex>0) { $(this).parent().find('span').show(); $(this).parent().find('span input').focus(); $(this).parent().find('span input').select(); } else { $(this).parent().find('span').hide(); } \"> <option value=''>%s</option> <option %s value='add'>%s</option> <option %s value='subtract'>%s</option> <option %s value='fixed'>%s</option> </select> <span style='display:%s'> <input name='options[$count][weight]' type='text' class='Field50 WeightBox' style='width:40px' value='%s' /> %s </span> </td>", GetLang("NoChange"), $add_w_checked, GetLang("VariationAdd"), $subtract_w_checked, GetLang("VariationSubtract"), $fixed_w_checked, GetLang("VariationFixed"), $show_weight, $weight, GetConfig('WeightMeasurement')); $GLOBALS['VariationRows'] .= " <td><input name='options[$count][image]' type='file' class='Field150 OptionImage' />"; if($row['vcimage'] != "") { $GLOBALS['VariationRows'] .= sprintf(" <br /><input name='options[$count][delimage]' id='variation_delete_image_$count' type='checkbox' value='ON' /> <label for='variation_delete_image_$count'>%s</label> %s <a href='%s' target='_blank'>%s</a>", GetLang("DeleteVariationImage"), GetLang("Currently"), sprintf("%s/%s/%s", $GLOBALS['ShopPath'], GetConfig('ImageDirectory'), $row['vcimage']), $row['vcimage']); } $GLOBALS['VariationRows'] .= " </td>"; // Is inventory tracking enabled for variations? if($ShowInventoryFields) { $InventoryFieldsHide = "display: auto;"; } else { $InventoryFieldsHide = "display: none;"; } $GLOBALS['VariationRows'] .= sprintf(" <td class=\"VariationStockColumn\" style=\"".$InventoryFieldsHide."\"><input name='options[$count][currentstock]' type='text' class='Field50 StockLevel' value='%d' /></td>", $row['vcstock']); $GLOBALS['VariationRows'] .= sprintf(" <td class=\"VariationStockColumn\" style=\"".$InventoryFieldsHide."\"><input name='options[$count][lowstock]' type='text' class='Field50 LowStockLevel' value='%d' /></td>", $row['vclowstock']); $GLOBALS['VariationRows'] .= "</tr>"; $count++; } } $GLOBALS['ColSpan'] = count($newOptions) + 5; if($ShowInventoryFields) { $GLOBALS['ColSpan'] += 2; } else { $GLOBALS['HideInv'] = "none"; } $GLOBALS['VariationId'] = $VariationId; $GLOBALS['ShowInv'] = (int)$ShowInventoryFields; if (!empty($ProductHash)) { $GLOBALS['VProductId'] = ''; $GLOBALS['VProductHash'] = $ProductHash; } else { $GLOBALS['VProductId'] = $ProductId; $GLOBALS['VProductHash'] = ''; } if (!isset($_COOKIE['showVariationFilter']) || $_COOKIE['showVariationFilter'] == 'true') { $GLOBALS['ShowFilterChecked'] = 'checked="checked"'; } else { $GLOBALS['ShowVariationFilter'] = 'none'; } return $this->template->render('products.variation.combination.tpl'); }
/** * Generate a grid containing vendor payments for the current result set. * * @return string The generated payment grid. */ private function ManageVendorPaymentsGrid() { $page = 0; $start = 0; $numPages = 0; $paymentGrid = ''; $GLOBALS['Nav'] = ''; // Validate the sort order if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == 'asc') { $sortOrder = 'asc'; } else { $sortOrder = 'desc'; } // Which fields can we sort by? $validSortFields = array('paymentid', 'paymentfrom', 'vendorname', 'paymentamount', 'paymentmethod', 'paymentdate'); if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) { $sortField = $_REQUEST['sortField']; SaveDefaultSortField('ManageVendorPayments', $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField('ManageVendorPayments', 'paymentid', $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } // Build the pagination and sort URL $searchURL = ''; foreach ($_GET as $k => $v) { if ($k == "sortField" || $k == "sortOrder" || $k == "page" || $k == "new" || $k == "ToDo" || !$v) { continue; } $searchURL .= '&' . $k . '=' . urlencode($v); } $sortURL = $searchURL . '&sortField=' . $sortField . '&sortOrder=' . $sortOrder; $GLOBALS['SortURL'] = $sortURL; // Limit the number of payments returned if ($page == 1) { $start = 0; } else { $start = ($page - 1) * ISC_VENDOR_PAYMENTS_PER_PAGE; } // Grab the queries we'll be executing $paymentQueries = $this->BuildVendorPaymentSearchQuery($start, $sortField, $sortOrder); // How many results do we have? $numPayments = $GLOBALS['ISC_CLASS_DB']->FetchOne($paymentQueries['countQuery']); $numPages = ceil($numPayments / ISC_VENDOR_PAYMENTS_PER_PAGE); // Add the "(Page x of y)" label if ($numPayments > ISC_VENDOR_PAYMENTS_PER_PAGE) { $GLOBALS['Nav'] = '(' . GetLang('Page') . ' ' . $page . ' ' . GetLang('Of') . ' ' . $numPages . ') '; $GLOBALS['Nav'] .= BuildPagination($numPayments, ISC_VENDOR_PAYMENTS_PER_PAGE, $page, 'index.php?ToDo=viewVendorPayments' . $sortURL); } else { $GLOBALS['Nav'] = ''; } $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; $sortLinks = array('Id' => 'paymentid', 'Date' => 'paymentfrom', 'Vendor' => 'vendorname', 'Amount' => 'paymentamount', 'Method' => 'paymentmethod', 'PaymentDate' => 'paymentdate'); BuildAdminSortingLinks($sortLinks, 'index.php?ToDo=viewVendorPayments&' . $searchURL . '&page=' . $page, $sortField, $sortOrder); // Display the payments $result = $GLOBALS['ISC_CLASS_DB']->Query($paymentQueries['query']); while ($payment = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $GLOBALS['PaymentId'] = $payment['paymentid']; $GLOBALS['PaymentAmount'] = FormatPrice($payment['paymentamount']); $GLOBALS['PaymentMethod'] = isc_html_escape($payment['paymentmethod']); $GLOBALS['PaymentDate'] = CDate($payment['paymentdate']); $GLOBALS['PaymentFrom'] = CDate($payment['paymentfrom']); $GLOBALS['PaymentTo'] = CDate($payment['paymentto']); $GLOBALS['PaymentComments'] = nl2br(isc_html_escape($payment['paymentcomments'])); $GLOBALS['Vendor'] = isc_html_escape($payment['vendorname']); if (!$GLOBALS['PaymentComments']) { $GLOBALS['HideExpandLink'] = 'display: none'; } else { $GLOBALS['HideExpandLink'] = ''; } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('vendorpayments.manage.row'); $paymentGrid .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } if (!$paymentGrid) { return ''; } $GLOBALS['PaymentGrid'] = $paymentGrid; $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('vendorpayments.manage.grid'); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); }
public function ManageWishListGrid(&$numMake) { // Show a list of news in a table $page = 0; $start = 0; $numMake = 0; $numPages = 0; $GLOBALS['WishListGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; $searchURL = ''; if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') { $sortOrder = 'desc'; } else { $sortOrder = "asc"; } $sortLinks = array("CustomerName" => "c.custconfirstname", "ProductName" => "p.prodname", "Amount" => "p.prodprice"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("manageWishList", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("manageWishList", "c.custconfirstname", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of WishList returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_WISHLIST_PER_PAGE - (ISC_WISHLIST_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $wishlistResult = $this->_GetWishList($start, $sortField, $sortOrder, $numMake); $numPages = ceil($numMake / ISC_WISHLIST_PER_PAGE); // Workout the paging navigation if ($numMake > ISC_WISHLIST_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numMake, ISC_WISHLIST_PER_PAGE, $page, sprintf("index.php?ToDo=wishlist%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=wishlist&" . $searchURL . "&page=" . $page, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_WISHLIST_PER_PAGE; if ($max > count($wishlistResult)) { $max = count($wishlistResult); } if ($numMake > 0) { while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($wishlistResult)) { $GLOBALS['CustomerName'] = isc_html_escape($row['customername']); $GLOBALS['ProductName'] = isc_html_escape($row['prodname']); $GLOBALS['Amount'] = number_format($row['prodprice'], 2); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("wishlist.manage.row"); $GLOBALS['WishListGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("wishlist.manage.grid"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } }
public function ManageReviewsGrid(&$numReviews) { // Show a list of reviews in a table $page = 0; $start = 0; $numReviews = 0; $numPages = 0; $GLOBALS['ReviewGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; $searchURL = ''; $filterURL = ''; //Added by Simha if (isset($_GET['brandid'])) { $filterURL .= "&brandid=" . trim($_GET['brandid']) . ""; } if (isset($_GET['seriesid'])) { $filterURL .= "&seriesid=" . trim($_GET['seriesid']) . ""; } //Added by Simha Ends //lguan_20100612: Category supporting in product rating if (isset($_GET['catid'])) { $filterURL .= "&catid=" . trim($_GET['catid']) . ""; } if (isset($_GET['subcatid'])) { $filterURL .= "&subcatid=" . trim($_GET['subcatid']) . ""; } //lguan_20100615: Append information for from and to if (isset($GLOBALS['FromStamp']) && is_numeric($GLOBALS['FromStamp'])) { $filterURL .= "&from=" . isc_date('m/d/Y', $GLOBALS['FromStamp']) . ""; } if (isset($GLOBALS['ToStamp']) && is_numeric($GLOBALS['ToStamp'])) { $filterURL .= "&to=" . isc_date('m/d/Y', $GLOBALS['ToStamp']) . ""; } if (isset($_GET['datetype'])) { $filterURL .= "&datetype=" . $_GET['datetype'] . ""; } //wiyin_20100628: get the review status if (isset($_GET['reviewStatus'])) { $GLOBALS['reviewStatus'] = (int) $_GET['reviewStatus']; } if (isset($_GET['ISSelectReplacement_category'])) { $cateList = $_GET['ISSelectReplacement_category']; if (is_array($cateList)) { if (!in_array(0, $cateList)) { $GLOBALS['CateList'] = $cateList; } } } if (isset($_GET['searchQuery'])) { $query = $_GET['searchQuery']; $GLOBALS['Query'] = $query; $searchURL = sprintf("&searchQuery=%s", urlencode($query)); } else { $query = ""; $GLOBALS['Query'] = ""; } if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'asc') { $sortOrder = 'asc'; } else { $sortOrder = "desc"; } $sortLinks = array("OrderId" => "r.orderid", "Review" => "r.revtitle", "Name" => "p.prodname", "By" => "r.revfromname", "Rating" => "r.revrating", "Date" => "r.revdate", "Status" => "r.revstatus", "RatingQuality" => "r.qualityrating", "RatingInstall" => "r.installrating", "RatingValue" => "r.valuerating", "RatingSupport" => "r.supportrating", "RatingDelivery" => "r.deliveryrating"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("ManageReviews", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageReviews", "r.reviewid", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $GLOBALS['Page'] = $page; $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of questions returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_REVIEWS_PER_PAGE - (ISC_REVIEWS_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $reviewResult = $this->_GetReviewList($query, $start, $sortField, $sortOrder, $numReviews); $numPages = ceil($numReviews / ISC_REVIEWS_PER_PAGE); // Add the "(Page x of n)" label if ($numReviews > ISC_REVIEWS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numReviews, ISC_REVIEWS_PER_PAGE, $page, sprintf("index.php?ToDo=viewReviews%s%s%s", $sortURL, $filterURL, $searchURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |'); $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewReviews&" . $searchURL . "&page=" . $page . $filterURL, $sortField, $sortOrder); // Workout the maximum size of the array $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&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); } }
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&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of gift certificates returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_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) ", 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&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 ManageEngineMMYGrid(&$numMake) { // Show a list of news in a table $page = 0; $start = 0; $numMake = 0; $numPages = 0; $GLOBALS['EngineMMYGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; $searchURL = ''; if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') { $sortOrder = 'desc'; } else { $sortOrder = "asc"; } $sortLinks = array("Make" => "p.make", "Model" => "p.model"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("manageEngineMMY", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("manageEngineMMY", "p.make", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of MMY returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_MMY_PER_PAGE - (ISC_MMY_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $mmyResult = $this->_GetEngineMMYList($start, $sortField, $sortOrder, $numMake); $numPages = ceil($numMake / ISC_MMY_PER_PAGE); // Workout the paging navigation $con = $this->condition; if ($numMake > ISC_MMY_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numMake, ISC_MMY_PER_PAGE, $page, sprintf("index.php?ToDo=viewEngineMMY%s" . $con, $sortURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewEngineMMY&" . $searchURL . "&page=" . $page . $con, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_MMY_PER_PAGE; if ($max > count($mmyResult)) { $max = count($mmyResult); } $user = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUser(); $userrole = $user['userrole']; if ($userrole == 'admin') { $GLOBALS['DisplayAction'] = ''; } else { $GLOBALS['DisplayAction'] = 'none'; } if ($numMake > 0) { while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($mmyResult)) { $GLOBALS['Id'] = (int) $row['id']; $GLOBALS['Engid'] = $row['eid']; $GLOBALS['Year'] = $row['year']; $GLOBALS['Make'] = isc_html_escape($row['make']); $GLOBALS['Model'] = isc_html_escape($row['model']); $GLOBALS['SubModel'] = isc_html_escape($row['submodel']); $GLOBALS['EngineType'] = isc_html_escape($row['engtype']); $GLOBALS['Liter'] = isc_html_escape($row['liter']); $mid = $row['id']; $eid = $row['eid']; $mmyedit = GetLang('EngineMMYEdit'); $edit = GetLang('EngineEdit'); // Workout the edit link -- do they have permission to do so? if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Brands)) { $GLOBALS['EditEngineMMYLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editEngineMMY&Id=%d&eid=%d'>%s</a>", GetLang('EngineMMYEdit'), $row['id'], $row['eid'], GetLang('EngineEdit')); } else { $GLOBALS['EditEngineMMYLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit')); } if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Brands)) { $GLOBALS['DeleteEngineMMYLink'] = "<a title='" . GetLang('MMYDelete') . "' class='Action' href='#' onclick=\"deleteenginemmyid(" . $row['id'] . ",'" . $row['engtype'] . "','" . $row['liter'] . "')\">" . GetLang('Delete') . "</a>"; //$GLOBALS['DeleteEngineMMYLink'] = sprintf("<a title='%s' class='Action' href='#' onclick=deleteenginemmyid(%d)>%s</a>", GetLang('MMYDelete'), $row['id'], GetLang('Delete')); } else { $GLOBALS['DeleteEngineMMYLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Delete')); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("mmy.engine.manage.row"); $GLOBALS['EngineMMYGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("mmy.engine.manage.grid"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } }
public function ManageCustomerYMMGrid() { // Show a list of products in a table $page = 0; $start = 0; $numAddresses = 0; $numPages = 0; $GLOBALS['Nav'] = ""; $max = 0; $customerId = 0; $customerHash = ""; if (isset($_GET['customerId'])) { $customerId = $_GET['customerId']; } else { if (isset($GLOBALS['CustomerId'])) { $customerId = $GLOBALS['CustomerId']; } } if (isset($_REQUEST['customerHash'])) { $customerHash = $_POST['customerHash']; } else { if (isset($GLOBALS['CustomerHash'])) { $customerHash = $GLOBALS['CustomerHash']; } } $customerId = urlencode(isc_html_escape($customerId)); $customerHash = urlencode(isc_html_escape($customerHash)); if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } if ($page < 1) { $page = 1; } // Limit the number of questions returned if ($page == 1) { $start = 0; } else { $start = ($page - 1) * ISC_CUSTOMER_ADDRESS_PER_PAGE; } //$result = $this->_GetCustomerYMMList($start, $numAddresses, $customerId, $customerHash); //$numPages = ceil($numAddresses / ISC_CUSTOMER_ADDRESS_PER_PAGE); $numPages = 0; // Add the "(Page x of n)" label if ($numAddresses > ISC_CUSTOMER_ADDRESS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numAddresses); $GLOBALS['Nav'] .= BuildPagination($numAddresses, ISC_CUSTOMER_ADDRESS_PER_PAGE, $page, 'index.php?ToDo=viewCustomerAddressGrid&customerId=' . $customerId . '&customerHash=' . $customerHash); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['AddressGrid'] = ''; $query = "SELECT * FROM [|PREFIX|]user_ymm WHERE user_id = '" . $customerId . "'"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $row = array_map('isc_html_escape', $row); $GLOBALS['ymmyear'] = $row['year']; $GLOBALS['ymmmake'] = $row['make']; $GLOBALS['ymmmodel'] = ucfirst($row['model']); $GLOBALS['bedsize'] = $row['cab_size']; $GLOBALS['cabsize'] = $row['bed_size']; $GLOBALS['ymmId'] = $row['id']; // Are we allowed to edit this address? if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Customers)) { $GLOBALS['EditYMMLink'] = '<a title="' . GetLang('EditCustomerAddress') . ' class="Action" href="index.php?ToDo=editCustomerYMM&customerId=' . urlencode(isc_html_escape($row['shipcustomerid'])) . '&addressId=' . urlencode(isc_html_escape($row['id'])) . '">' . GetLang('Edit') . '</a>'; } else { $GLOBALS['EditYMMLink'] = '<a class="Action" disabled>' . GetLang('Edit') . '</a>'; } // Are we allowed to delete this address? if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Customers)) { $GLOBALS['DeleteYMMLink'] = '<a href="#" onclick="confirmDeleteYMM(' . (int) $row['id'] . ',\'single\'); return false;">' . GetLang('Delete') . '</a>'; } else { $GLOBALS['DeleteYMMLink'] = '<a class="Action" disabled>' . GetLang('Delete') . '</a>'; } if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Customers)) { $GLOBALS['CustomerAddressDeleteDisabled'] = 'DISABLED'; } if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Customers)) { $GLOBALS['CustomerAddressDeleteDisabled'] = 'DISABLED'; } $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("customer.ymm.manage.row"); $GLOBALS['AddressGrid'] .= $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(true); } $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("customer.ymm.manage.grid"); return $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(true); }
public function ManageChangesReportsGrid(&$numChangesReports) { // Show a list of news in a table $page = 0; $start = 0; $numChangesReports = 0; $numPages = 0; $GLOBALS['ChangesReportGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; $searchURL = ''; if (isset($_GET['searchQuery'])) { $query = $_GET['searchQuery']; $GLOBALS['Query'] = $query; $searchURL . 'searchQuery=' . urlencode($query); } else { $query = ""; $GLOBALS['Query'] = ""; } if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') { $sortOrder = 'desc'; } else { $sortOrder = "asc"; } $sortLinks = array("Brands" => "b.brandname", "Products" => "products"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("ManageChangesReports", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageChangesReports", "b.brandname", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of brands returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_REPORTS_PER_PAGE - (ISC_REPORTS_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $brandResult = $this->_GetChangesReportList($query, $start, $sortField, $sortOrder, $numChangesReports); $numPages = ceil($numChangesReports / ISC_REPORTS_PER_PAGE); if (isset($_GET['days']) && $_GET['days'] != '') { $days = (int) $_GET['days']; } else { $days = 15; } // Workout the paging navigation if ($numChangesReports > ISC_REPORTS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numChangesReports, ISC_REPORTS_PER_PAGE, $page, sprintf("index.php?ToDo=viewChangesReports%s", $sortURL . "&days=" . $days)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewChangesReports&" . $searchURL . "&page=" . $page, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_REPORTS_PER_PAGE; if ($max > count($brandResult)) { $max = count($brandResult); } if ($numChangesReports > 0) { // Display the news while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($brandResult)) { $GLOBALS['BrandId'] = (int) $row['brandid']; $GLOBALS['BrandName'] = isc_html_escape($row['brandname']); $GLOBALS['TotalProducts'] = (int) $row['totalproducts']; $GLOBALS['NewProducts'] = (int) $row['newproducts']; $GLOBALS['ContentModified'] = (int) $row['contentcount']; $GLOBALS['ApplicationModified'] = (int) $row['applicationcount']; $GLOBALS['PriceModified'] = (int) $row['pricecount']; $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("changes.report.manage.row"); $GLOBALS['ChangesReportGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("changes.report.manage.grid"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } }
/** * Generate a grid containing the different types of configured gift wrapping. * * @param int The number of gift wrapping types (passed by reference) * @return string the HTML for the grid of gift wrapping types. */ private function ManageGiftWrappingGrid(&$numGiftWrap) { $page = 0; $start = 0; $numGiftWrap = 0; $GLOBALS['GiftWrapGrid'] = ''; $GLOBALS['Nav'] = ''; if (isset($_REQUEST['page'])) { $page = (int) $_REQUEST['page']; } else { $page = 1; } // Where are we starting at? if ($page == 1) { $start = 0; } else { $start = $page * ISC_GIFTWRAP_PER_PAGE - ISC_GIFTWRAP_PER_PAGE; } // Fetch the list of available gift wrapping $query = "SELECT COUNT(wrapid) FROM [|PREFIX|]gift_wrapping"; $numGiftWrap = $GLOBALS['ISC_CLASS_DB']->FetchOne($query); // If there aren't any wrapping papers set up, just return nothing here if ($numGiftWrap == 0) { return ''; } $validSortFields = array('wrapname', 'wrapprice', 'wrapvisible'); if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") { $sortOrder = "asc"; } else { $sortOrder = "desc"; } if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) { $sortField = $_REQUEST['sortField']; SaveDefaultSortField("ManageGiftWrapping", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageGiftWrapping", "wrapname", $sortOrder); } $numPages = ceil($numGiftWrap / ISC_GIFTWRAP_PER_PAGE); // Add the "(Page x of n)" label if ($numGiftWrap > ISC_GIFTWRAP_PER_PAGE) { $GLOBALS['Nav'] = "(" . GetLang('Page') . " " . $page . " of " . $numPages . ") "; $pagingUrl = "index.php?ToDo=viewGiftWrapping&sortOrder=" . $sortOrder . "&sortField=" . $sortField; $GLOBALS['Nav'] .= BuildPagination($numGiftWrap, ISC_GIFTWRAP_PER_PAGE, $page, $pagingUrl); } else { $GLOBALS['Nav'] = ""; $GLOBALS['HidePaging'] = 'display: none'; } $sortLinks = array("WrapName" => "wrapname", "WrapPrice" => "wrapprice", "WrapVisible" => "wrapvisible"); BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewGiftWrapping&page=" . $page, $sortField, $sortOrder); // Start fetching out the actual wrapping types $query = "\n\t\t\tSELECT *\n\t\t\tFROM [|PREFIX|]gift_wrapping\n\t\t\tORDER BY " . $sortField . " " . $sortOrder . "\n\t\t"; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, ISC_GIFTWRAP_PER_PAGE); $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); while ($wrap = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $GLOBALS['WrapName'] = isc_html_escape($wrap['wrapname']); $GLOBALS['WrapId'] = $wrap['wrapid']; $GLOBALS['WrapPrice'] = FormatPrice($wrap['wrapprice']); if ($wrap['wrapvisible'] == 1) { $GLOBALS['WrapVisibleImage'] = 'tick.gif'; } else { $GLOBALS['WrapVisibleImage'] = 'cross.gif'; } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("giftwrapping.manage.row"); $GLOBALS['GiftWrapGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("giftwrapping.manage.grid"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); }
private function ManageCouponsGrid(&$numCoupons) { // Show a list of coupons in a table $page = 0; $start = 0; $numCoupons = 0; $numPages = 0; $GLOBALS['CouponGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') { $sortOrder = 'desc'; } else { $sortOrder = "asc"; } $sortLinks = array("Name" => "c.couponname", "Coupon" => "c.couponcode", "Discount" => "c.couponamount", "Expiry" => "c.couponexpires", "NumUses" => "c.couponnumuses", "Enabled" => "c.couponenabled"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("ManageCoupons", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageCoupons", "c.couponid", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of questions returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_COUPONS_PER_PAGE - (ISC_COUPONS_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $couponResult = $this->_GetCouponList($start, $sortField, $sortOrder, $numCoupons); $numPages = ceil($numCoupons / ISC_COUPONS_PER_PAGE); if ($numCoupons > ISC_COUPONS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numCoupons, ISC_COUPONS_PER_PAGE, $page, sprintf("index.php?ToDo=viewCoupons%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['SortField'] = $sortField; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewCoupons&page=" . $page, $sortField, $sortOrder); $max = $start + ISC_COUPONS_PER_PAGE; if ($max > count($couponResult)) { $max = count($couponResult); } if ($numCoupons > 0) { // Display the coupons while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($couponResult)) { $GLOBALS['Name'] = isc_html_escape($row['couponname']); $GLOBALS['CouponId'] = (int) $row['couponid']; $GLOBALS['Coupon'] = isc_html_escape($row['couponcode']); if ($row['coupontype'] == 0) { // Dollar value coupon code $GLOBALS['Discount'] = sprintf("%s", FormatPrice($row['couponamount'])); } else { // Percentage value coupon code $GLOBALS['Discount'] = sprintf("%s%%", number_format($row['couponamount'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), GetConfig('ThousandsToken'))); } if ($row['couponexpires'] > 0) { $GLOBALS['Date'] = CDate($row['couponexpires']); } else { $GLOBALS['Date'] = GetLang('NA'); } if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Coupons)) { $GLOBALS['EditCouponLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editCoupon&couponId=%d'>%s</a>", GetLang('CouponEdit'), $row['couponid'], GetLang('Edit')); if ($row['couponenabled'] == 1) { $GLOBALS['Enabled'] = sprintf("<a title='%s' href='index.php?ToDo=editCouponEnabled&couponId=%d&enabled=0'><img border='0' src='images/tick.gif'></a>", GetLang('ClickToDisableCoupon'), $row['couponid']); } else { $GLOBALS['Enabled'] = sprintf("<a title='%s' href='index.php?ToDo=editCouponEnabled&couponId=%d&enabled=1'><img border='0' src='images/cross.gif'></a>", GetLang('ClickToEnableCoupon'), $row['couponid']); } } else { $GLOBALS['EditCouponLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit')); if ($row['couponenabled'] == 1) { $GLOBALS['Enabled'] = '<img border="0" src="images/tick.gif" alt="tick" />'; } else { $GLOBALS['Enabled'] = '<img border="0" src="images/cross.gif" alt="cross" />'; } } $GLOBALS['NumUses'] = number_format($row['couponnumuses']); $GLOBALS['ViewOrdersLink'] = ''; if ($row['couponnumuses'] > 0) { $GLOBALS['ViewOrdersLink'] = sprintf(" <a href='index.php?ToDo=viewOrders&couponCode=%s' title='%s'>%s</a>", $row['couponcode'], GetLang('ViewOrdersWithCoupon'), GetLang('ViewOrders')); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("coupons.manage.row"); $GLOBALS['CouponGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("coupons.manage.grid"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } }
private function ManageCabsizeGrid(&$numCab) { // Show a list of news in a table $page = 0; $start = 0; $numCab = 0; $numPages = 0; $GLOBALS['CabsizeGrid'] = ''; $GLOBALS['Nav'] = ""; $max = 0; $searchURL = ''; if (isset($_GET['searchQuery'])) { $query = $_GET['searchQuery']; $GLOBALS['Query'] = $query; $searchURL . 'searchQuery=' . urlencode($query); } else { $query = ""; $GLOBALS['Query'] = ""; } if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') { $sortOrder = 'desc'; } else { $sortOrder = "asc"; } $sortLinks = array("Irregularvalue" => "c.irregular_value", "Generalizevalue" => "c.generalize_value"); if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) { $sortField = $_GET['sortField']; SaveDefaultSortField("ManageCabsize", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ManageCabsize", "c.irregular_value", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of brands returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_CABSIZE_PER_PAGE - (ISC_CABSIZE_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $cabsizeResult = $this->_GetCabsizeList($start, $sortField, $sortOrder, $numCab); $numPages = ceil($numCab / ISC_CABSIZE_PER_PAGE); // Workout the paging navigation if ($numCab > ISC_CABSIZE_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numCab, ISC_CABSIZE_PER_PAGE, $page, sprintf("index.php?ToDo=viewCabsizeSettings%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewCabsizeSettings&" . $searchURL . "&page=" . $page, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_CABSIZE_PER_PAGE; if ($max > count($cabsizeResult)) { $max = count($cabsizeResult); } if ($numCab > 0) { while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($cabsizeResult)) { $GLOBALS['Prodstartyear'] = isc_html_escape($row['prodstartyear']); $GLOBALS['Prodendyear'] = isc_html_escape($row['prodendyear']); $GLOBALS['Prodmake'] = isc_html_escape($row['prodmake']); $GLOBALS['Prodmodel'] = isc_html_escape($row['prodmodel']); $GLOBALS['Irregularvalue'] = isc_html_escape($row['irregular_value']); $GLOBALS['Generalizevalue'] = isc_html_escape($row['generalize_value']); $GLOBALS['EditCabsizeLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editCabsizesettings&cabId=%d'>%s</a>", GetLang('Edit'), $row['id'], GetLang('Edit')); $GLOBALS['DeleteCabsizeLink'] = sprintf("<a title='%s' class='Action' href='#' onclick=deleteCabid(%d)>%s</a>", GetLang('Delete'), $row['id'], GetLang('Delete')); $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("cabsize.manage.row"); $GLOBALS['CabsizeGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("cabsize.manage.grid"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } }
function ManageOverViewGrid(&$numView) { $page = 0; $start = 0; $numPages = 0; $max = 0; if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } if ($page == 1) { $start = 1; } else { $start = $page * ISC_ORDERS_PER_PAGE - (ISC_ORDERS_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $viewResult = $this->_GetOverViewList($start, $numView); $numPages = ceil($numView / ISC_ORDERS_PER_PAGE); // Add the "(Page x of n)" label if ($numView > ISC_ORDERS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numView, ISC_ORDERS_PER_PAGE, $page, sprintf("index.php?ToDo=viewSales%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; } if (isset($_GET['searchQuery'])) { $query = $_GET['searchQuery']; } else { $query = ""; } $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |'); $GLOBALS['SmallNav'] = rtrim($GLOBALS['SmallNav'], ' |'); $GLOBALS['TotalOrdersSS'] = $numView; $GLOBALS['SearchQuery'] = $query; $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; $sortLinks = array("Id" => "orderid", "Cust" => "custname", "Date" => "orddate", "Status" => "ordstatus", "Message" => "newmessages", "Total" => "ordtotalamount"); BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewSales&" . $searchURL . "&page=" . $page, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_ORDERS_PER_PAGE; if ($max > count($orderResult)) { $max = count($orderResult); } $Query = "SELECT us.username, os.statusid, os.statusdesc\n\t\t\t\t\t\t\tFROM `isc_users` us\n\t\t\t\t\tLEFT JOIN isc_orders od ON us.`pk_userid` = od.orderowner\n\t\t\t\t\tLEFT JOIN isc_order_status os ON os.statusid = od.ordstatus\n\t\t\t\t\tORDER BY us.username"; $orderResult = $GLOBALS['ISC_CLASS_DB']->Query($Query); /************************************************************************* Sample Array : orders['mayank']['Completed']=5; orders['mayank']['Pending']=10; orders['mayank']['Return']=2; orders['mayank']['Cancelled']=4; /***************************************************************************/ $orders = array(); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($orderResult)) { $orders[$row['username']]['dump'] = ''; if ($row['statusid'] == '10') { # Completed $orders[$row['username']]['Completed']++; } else { if ($row['statusid'] == '5') { # Cancelled $orders[$row['username']]['Cancelled']++; } else { if ($row['statusid'] == '6' || $row['statusid'] == '4') { # Returned $orders[$row['username']]['Returned']++; } else { if ($row['statusid'] == '1' || $row['statusid'] == '2' || $row['statusid'] == '3' || $row['statusid'] == '7' || $row['statusid'] == '8' || $row['statusid'] == '9' || $row['statusid'] == '11') { #Pending $orders[$row['username']]['Pending']++; } } } } } #while $Query = "SELECT username FROM isc_users order by username"; $userResult = $GLOBALS['ISC_CLASS_DB']->Query($Query); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($userResult)) { $GLOBALS["UserName"] = $row['username']; $GLOBALS['Completed'] = isset($orders[$row['username']]['Completed']) ? $orders[$row['username']]['Completed'] : 0; $GLOBALS["Cancelled"] = isset($orders[$row['username']]['Cancelled']) ? $orders[$row['username']]['Cancelled'] : 0; $GLOBALS['Pending'] = isset($orders[$row['username']]['Pending']) ? $orders[$row['username']]['Pending'] : 0; $GLOBALS['Returned'] = isset($orders[$row['username']]['Returned']) ? $orders[$row['username']]['Returned'] : 0; $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("sales.manage.overview.row"); $GLOBALS['OrderOverviewGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("sales.manage.overview.grid"); return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); }
/** * _GetVariationGrid * Get all of the product variations from the database and return them as a grid * * @param Int $NumVariations A reference variable to store the number of variations found * @return String */ public function _GetVariationGrid(&$NumVariations) { // Show a list of variations in a table $page = 0; $start = 0; $numVariations = 0; $numPages = 0; $GLOBALS['VariationsGrid'] = ""; $GLOBALS['Nav'] = ""; $max = 0; $validSortFields = array('vname', 'vnumoptions'); if (isset($_REQUEST['sortOrder']) && $_REQUEST['sortOrder'] == "asc") { $sortOrder = "asc"; } else { $sortOrder = "desc"; } if (isset($_REQUEST['sortField']) && in_array($_REQUEST['sortField'], $validSortFields)) { $sortField = $_REQUEST['sortField']; SaveDefaultSortField("ViewProductVariations", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("ViewProductVariations", "vname", $sortOrder); } if (isset($_GET['page'])) { $page = (int) $_GET['page']; } else { $page = 1; } // Build the pagination and sort URL $searchURL = ''; foreach ($_GET as $k => $v) { if ($k == "sortField" || $k == "sortOrder" || $k == "page" || $k == "new" || $k == "ToDo" || $k == "SubmitButton1" || !$v) { continue; } if (is_array($v)) { foreach ($v as $v2) { $searchURL .= sprintf("&%s[]=%s", $k, urlencode($v2)); } } else { $searchURL .= sprintf("&%s=%s", $k, urlencode($v)); } } $sortURL = sprintf("%s&sortField=%s&sortOrder=%s", $searchURL, $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; // Limit the number of questions returned if ($page == 1) { $start = 1; } else { $start = $page * ISC_PRODUCTS_PER_PAGE - (ISC_PRODUCTS_PER_PAGE - 1); } $start = $start - 1; // Get the results for the query $variation_result = $this->_GetVariationList($start, $sortField, $sortOrder, $numVariations); $numPages = ceil($numVariations / ISC_PRODUCTS_PER_PAGE); $NumVariations = $numVariations; // Add the "(Page x of n)" label if ($numVariations > ISC_PRODUCTS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numVariations, ISC_PRODUCTS_PER_PAGE, $page, sprintf("index.php?ToDo=viewProductVariations%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = preg_replace('# \\|$#', "", $GLOBALS['Nav']); $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; $sortLinks = array("Name" => "vname", "Options" => "vnumoptions"); BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewProductVariations&" . $searchURL . "&page=" . $page, $sortField, $sortOrder); // Workout the maximum size of the array $max = $start + ISC_PRODUCTS_PER_PAGE; if ($max > $numVariations) { $max = $numVariations; } if ($numVariations > 0) { // Display the products while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($variation_result)) { $GLOBALS['VariationId'] = (int) $row['variationid']; $GLOBALS['Name'] = isc_html_escape($row['vname']); if (gzte11(ISC_HUGEPRINT) && $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() == 0 && $row['vendorname']) { $GLOBALS['Name'] .= ' <small><strong>(' . GetLang('Vendor') . ': ' . $row['vendorname'] . ')</strong></small>'; } $GLOBALS['NumOptions'] = (int) $row['vnumoptions']; $GLOBALS['Edit'] = '<a class="Action" href="index.php?ToDo=editProductVariation&variationId=' . $row['variationid'] . '" title="' . GetLang('ProductVariationEdit') . '">' . GetLang('Edit') . '</a>'; $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("product.variations.manage.row"); $GLOBALS['VariationsGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true); } } $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("products.variations.manage.grid"); return $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate(true); }
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) ", 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&" . $searchURL . "&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&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); } }
/** * Return the customer address grid * * Method will return the customer address HTML grid * * @access public * @return string The customer address HTML grid */ public function ManageCustomerAddressGrid() { // Show a list of products in a table $page = 0; $start = 0; $numAddresses = 0; $numPages = 0; $GLOBALS['Nav'] = ""; $max = 0; $customerId = 0; $customerHash = ""; if (isset($_GET['customerId'])) { $customerId = $_GET['customerId']; } else if (isset($GLOBALS['CustomerId'])) { $customerId = $GLOBALS['CustomerId']; } if (isset($_REQUEST['customerHash'])) { $customerHash = $_POST['customerHash']; } else if (isset($GLOBALS['CustomerHash'])) { $customerHash = $GLOBALS['CustomerHash']; } $customerId = urlencode(isc_html_escape($customerId)); $customerHash = urlencode(isc_html_escape($customerHash)); if (isset($_GET['page'])) { $page = (int)$_GET['page']; } else { $page = 1; } if ($page < 1) { $page = 1; } // Limit the number of questions returned if ($page == 1) { $start = 0; } else { $start = ($page - 1) * ISC_CUSTOMER_ADDRESS_PER_PAGE; } $result = $this->_GetCustomerShippingList($start, $numAddresses, $customerId, $customerHash); $numPages = ceil($numAddresses / ISC_CUSTOMER_ADDRESS_PER_PAGE); // Add the "(Page x of n)" label if($numAddresses > ISC_CUSTOMER_ADDRESS_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numAddresses); $GLOBALS['Nav'] .= BuildPagination($numAddresses, ISC_CUSTOMER_ADDRESS_PER_PAGE, $page, 'index.php?ToDo=viewCustomerAddressGrid&customerId=' . $customerId . '&customerHash=' . $customerHash); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['AddressGrid'] = ''; while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $row = array_map('isc_html_escape', $row); $GLOBALS['AddressId'] = $row['shipid']; $GLOBALS['CustomerId'] = $row['shipcustomerid']; $GLOBALS['FullName'] = trim($row['shipfirstname'] . ' ' . $row['shiplastname']); $GLOBALS['StreetAddress'] = $row['shipaddress1']; if (!is_null($row['shipaddress2']) && $row['shipaddress2'] !== '') { $GLOBALS['StreetAddress'] .= '<br />' . $row['shipaddress2']; } $GLOBALS['City'] = $row['shipcity']; $GLOBALS['State'] = $row['shipstate']; $GLOBALS['PostCode'] = $row['shipzip']; $GLOBALS['Country'] = $row['shipcountry']; $GLOBALS['CountryCode'] = $row['shipcountrycode']; $GLOBALS['Phone'] = $row['shipphone']; if (file_exists(ISC_BASE_PATH . '/lib/flags/' . strtolower($row['shipcountrycode']) . '.gif')) { $GLOBALS['CountryImg'] = '<img src="' . GetConfig('AppPath') . '/lib/flags/' . strtolower($row['shipcountrycode']) . '.gif" alt="" style="vertical-align: middle;" />'; } else { $GLOBALS['CountryImg'] = ''; } // Are we allowed to edit this address? if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Customers)) { $GLOBALS['EditCustomerLink'] = '<a title="' . GetLang('EditCustomerAddress') . ' class="Action" href="index.php?ToDo=editCustomerAddress&customerId=' . urlencode(isc_html_escape($row['shipcustomerid'])) . '&addressId=' . urlencode(isc_html_escape($row['shipid'])) . '">' . GetLang('Edit') . '</a>'; } else { $GLOBALS['EditCustomerLink'] = '<a class="Action" disabled>' . GetLang('Edit') . '</a>'; } // Are we allowed to delete this address? if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Customers)) { $GLOBALS['DeleteCustomerLink'] = '<a href="#" onclick="confirmDeleteAddressBoxes(' . (int)$row['shipid'] . '); return false;">' . GetLang('Delete') . '</a>'; } else { $GLOBALS['DeleteCustomerLink'] = '<a class="Action" disabled>' . GetLang('Delete') . '</a>'; } if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Customers)) { $GLOBALS['CustomerAddressDeleteDisabled'] = 'DISABLED'; } if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_Customers)) { $GLOBALS['CustomerAddressDeleteDisabled'] = 'DISABLED'; } $GLOBALS['AddressGrid'] .= $this->template->render('customer.address.manage.row.tpl'); } return $this->template->render('customer.address.manage.grid.tpl'); }
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&sortField=%s&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) ", 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&".$searchURL."&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&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'); }
/** * Generate a grid containing a list of vendors. * * @param int The number of vendors currently set up (by reference) * @return string The HTML for the vendor grid. */ private function ManageVendorsGrid(&$numVendors) { $page = 0; $start = 0; $numVendors = 0; $GLOBALS['VendorsGrid'] = ''; $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_VENDORS_PER_PAGE) - (ISC_VENDORS_PER_PAGE); } // Fetch the list of vendors $query = "SELECT COUNT(vendorid) FROM [|PREFIX|]vendors"; $numVendors = $GLOBALS['ISC_CLASS_DB']->FetchOne($query); // If there aren't any vendors set up, just return nothing here if($numVendors == 0) { return ''; } $numPages = ceil($numVendors / ISC_VENDORS_PER_PAGE); // Add the "(Page x of n)" label if($numVendors > ISC_VENDORS_PER_PAGE) { $GLOBALS['Nav'] = "(".GetLang('Page')." ".$page." of ".$numPages.") "; $GLOBALS['Nav'] .= BuildPagination($numVendors, ISC_VENDORS_PER_PAGE, $page, "index.php?ToDo=viewVendors¤tTab=1"); } else { $GLOBALS['Nav'] = ""; $GLOBALS['HidePaging'] = 'display: none'; } // Fetch out the list of users associated with vendors $vendorUsers = array(); $query = "SELECT * FROM [|PREFIX|]users WHERE uservendorid!='0'"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while($user = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $vendorUsers[$user['uservendorid']][] = $user; } // Start fetching out the actual vendors $query = " SELECT * FROM [|PREFIX|]vendors ORDER BY vendorname ASC "; $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, ISC_VENDORS_PER_PAGE); $result = $GLOBALS["ISC_CLASS_DB"]->Query($query); while($vendor = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $GLOBALS['VendorName'] = isc_html_escape($vendor['vendorname']); $GLOBALS['VendorId'] = $vendor['vendorid']; if(isset($vendorUsers[$vendor['vendorid']])) { $userList = array(); foreach($vendorUsers[$vendor['vendorid']] as $user) { $userList[] = '<a href="index.php?ToDo=editUser&userId='.$user['pk_userid'].'">'.isc_html_escape($user['username']).'</a>'; } $userList = implode(', ', $userList); } else { $userList = GetLang('xNone'); } $GLOBALS['VendorUsers'] = $userList; $GLOBALS['VendorsGrid'] .= $this->template->render('vendors.manage.row.tpl'); } return $this->template->render('vendors.manage.grid.tpl'); }
private function SystemLogGrid() { // Show a the system log in a data grid. $page = 1; $start = 0; $numEntries = 0; $numPages = 0; $GLOBALS['LogGrid'] = ''; $GLOBALS['Nav'] = ''; if(isset($_GET['sortOrder']) && $_GET['sortOrder'] == "asc") { $sortOrder = "asc"; } else { $sortOrder = "desc"; } $validSortFields = array("logtype", "logmodule", "logseverity", "logsummary", "logdate"); if(isset($_GET['sortField']) && in_array($_GET['sortField'], $validSortFields)) { $sortField = $_GET['sortField']; SaveDefaultSortField("SystemLog", $_REQUEST['sortField'], $sortOrder); } else { list($sortField, $sortOrder) = GetDefaultSortField("SystemLog", "logdate", $sortOrder); } if (isset($_GET['page'])) { $page = (int)$_GET['page']; } else { $page = 1; } $GLOBALS['HideClearResults'] = "none"; $where = "1=1"; $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder); $GLOBALS['SortURL'] = $sortURL; if(isset($_REQUEST['logseverity']) && $_REQUEST['logseverity'] != 0) { $where .= sprintf(" AND logseverity='%d'", $GLOBALS['ISC_CLASS_DB']->Quote((int)$_REQUEST['logseverity'])); $sortURL .= sprintf("&logseverity=%d", (int)$_REQUEST['logseverity']); $GLOBALS['Severity'.(int)$_REQUEST['logseverity'].'Selected'] = "selected=\"selected\""; $GLOBALS['HideClearResults'] = ''; } if(isset($_REQUEST['logtype']) && $_REQUEST['logtype'] != '') { $where .= sprintf(" AND logtype='%s'", $GLOBALS['ISC_CLASS_DB']->Quote($_REQUEST['logtype'])); $sortURL .= sprintf("&logtype=%s", urlencode($_REQUEST['logtype'])); $GLOBALS['HideClearResults'] = ''; } if(isset($_REQUEST['logsummary']) && $_REQUEST['logsummary'] != '') { $where .= sprintf(" AND (logsummary LIKE '%%%s%%' OR logmodule LIKE '%%%s%%')", $GLOBALS['ISC_CLASS_DB']->Quote($_REQUEST['logsummary']), $GLOBALS['ISC_CLASS_DB']->Quote($_REQUEST['logsummary'])); $sortURL .= sprintf("&logsummary=%d", $_REQUEST['logsummary']); $GLOBALS['HideClearResults'] = ''; $GLOBALS['SummaryValue'] = $_REQUEST['logsummary']; } // Are there any log types we're hiding? if(GetConfig('HiddenStoreLogTypes')) { $hiddenTypes = explode(',', GetConfig('HiddenStoreLogTypes')); $hiddenTypes = array_map('trim', $hiddenTypes); $where .= " AND logtype NOT IN ('".implode("','", $hiddenTypes)."')"; } // Build the list of log types $logTypes = array( 'general' => GetLang('LogSearchGeneral'), 'payment' => GetLang('LogSearchPayment'), 'shipping' => GetLang('LogSearchShipping'), 'notification' => GetLang('LogSearchNotification'), 'sql' => GetLang('LogSearchSQL'), 'php' => GetLang('LogSearchPHP'), 'emailintegration' => GetLang('LogSearchEmailIntegration'), 'ebay' => GetLang('LogSearchEbay'), 'shoppingcomparison' => GetLang('LogSearchShoppingComparison'), ); $GLOBALS['LogSearchTypeSelect'] = ''; foreach($logTypes as $type => $label) { if(isset($hiddenTypes) && in_array($type, $hiddenTypes)) { continue; } $sel = ''; if(isset($_REQUEST['logtype'])) { $sel = 'selected="selected"'; } $GLOBALS['LogSearchTypeSelect'] .= '<option value="'.$type.'" '.$sel.'">'.isc_html_escape($label).'</option>'; } // Limit the number of of log entries returned if ($page == 1) { $start = 1; } else { $start = ($page * ISC_LOG_ENTRIES_PER_PAGE) - (ISC_LOG_ENTRIES_PER_PAGE-1); } $start = $start-1; // Get the results for the query $query = sprintf("SELECT COUNT(logid) FROM [|PREFIX|]system_log WHERE %s", $where); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $numEntries = $GLOBALS['ISC_CLASS_DB']->FetchOne($result); $numPages = ceil($numEntries / ISC_LOG_ENTRIES_PER_PAGE); if($numEntries > ISC_LOG_ENTRIES_PER_PAGE) { $GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages); $GLOBALS['Nav'] .= BuildPagination($numEntries, ISC_LOG_ENTRIES_PER_PAGE, $page, sprintf("index.php?ToDo=systemLogGrid%s", $sortURL)); } else { $GLOBALS['Nav'] = ""; } $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |'); $GLOBALS['SortField'] = $sortField; $GLOBALS['SortOrder'] = $sortOrder; $sortLinks = array( "Severity" => "logseverity", "Type" => "logtype", "Module" => "logmodule", "Summary" => "logsummary", "Date" => "logdate" ); BuildAdminSortingLinks($sortLinks, "index.php?ToDo=systemLogGrid&".$sortURL."&page=".$page, $sortField, $sortOrder); if ($numEntries > 0) { $query = sprintf("SELECT * FROM [|PREFIX|]system_log WHERE %s ORDER BY %s %s, logid DESC", $where, $sortField, $sortOrder); $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, ISC_LOG_ENTRIES_PER_PAGE); $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) { if(!$row['logsummary']) { $row['logsummary'] = $row['logmsg']; } $GLOBALS['LogId'] = $row['logid']; $GLOBALS['Summary'] = $row['logsummary']; $GLOBALS['Type'] = GetLang('LogType'.ucfirst($row['logtype'])); if($row['logmodule']) { $GLOBALS['Module'] = $row['logmodule']; } else { $GLOBALS['Module'] = GetLang('NA'); } if($row['logmsg'] && $row['logmsg'] != $row['logsummary']) { $GLOBALS['ExpandLink'] = sprintf("<a href=\"#\" onclick=\"ShowLogInfo('%d'); return false;\"><img id=\"expand%d\" src=\"images/plus.gif\" align=\"left\" width=\"19\" class=\"ExpandLink\" height=\"16\" title=\"%s\" border=\"0\"></a>", $row['logid'], $row['logid'], GetLang('ClickToViewLogInfo')); } else { $GLOBALS['ExpandLink'] = ' '; } $GLOBALS['SeverityClass'] = "severity".$row['logseverity']; $GLOBALS['Severity'] = GetLang('LogSeverity'.$row['logseverity']); $GLOBALS['Date'] = isc_date(GetConfig('ExtendedDisplayDateFormat'), $row['logdate']); $GLOBALS['LogGrid'] .= $this->template->render('logs.system.row.tpl'); } } else { $GLOBALS['LogGrid'] = ''; } $GLOBALS['DisableDelete'] = ''; if(!$GLOBALS['LogGrid']) { if($GLOBALS['HideClearResults'] == "none") { $msg = GetLang('SystemLogEmpty'); } else { $msg = GetLang('SystemLogNoResults'); } $GLOBALS['DisableDelete'] = "disabled=\"disabled\""; $GLOBALS['LogGrid'] = "<tr> <td colspan=\"8\"><em>".$msg."</em></td> </tr>"; } return $this->template->render('logs.system.grid.tpl'); }