本文整理汇总了PHP中CDate函数的典型用法代码示例。如果您正苦于以下问题:PHP CDate函数的具体用法?PHP CDate怎么用?PHP CDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ExportOrders
/**
* An additional action that's called by this module when the above form is submitted.
*/
public function ExportOrders()
{
// Load up the orders class
$GLOBALS['ISC_CLASS_ADMIN_ORDERS'] = GetClass('ISC_ADMIN_ORDERS');
// Get the value of the order status setting
if ($this->GetValue('orderstatus') == 'shipped') {
$_GET['orderStatus'] = 2;
}
$numOrders = 0;
$ordersResult = $GLOBALS['ISC_CLASS_ADMIN_ORDERS']->_GetOrderList(0, 'orderid', 'desc', $numOrders, true);
if ($numOrders == 0) {
$GLOBALS['ISC_CLASS_ADMIN_ORDERS']->ManageOrders(GetLang('NoOrders'));
return;
}
require_once ISC_BASE_PATH . '/lib/class.xml.php';
$xml = new ISC_XML_PARSER();
$tags = array();
while ($order = $GLOBALS['ISC_CLASS_DB']->Fetch($ordersResult)) {
$orderTags = array();
$orderTags[] = $xml->MakeXMLTag('amount', number_format($order['ordtotalamount'], 2));
$orderTags[] = $xml->MakeXMLTag('customer', $order['ordbillfirstname'] . ' ' . $order['ordbilllastname'], true);
$orderTags[] = $xml->MakeXMLTag('date', CDate($order['orddate']), true);
$attributes = array('orderid' => $order['orderid']);
$tags[] = $xml->MakeXMLTag('order', implode('', $orderTags), false, $attributes);
}
@ob_end_clean();
$xml->SendXMLHeader();
$xml->SendXMLResponse($tags);
exit;
}
示例2: data_changed
function data_changed($entry)
{
$text = $entry->get_text();
if (strlen($text) && $this->field && $this->field_print) {
$this->filter = $this->field . ' LIKE ' . String(CDate($text) . '%');
$this->filter_print = $this->field_print . ' LIKE ' . String(CDate($text) . '%');
} else {
$this->filter = '';
$this->filter_print = '';
}
}
示例3: GetVendorPaymentDetails
/**
* Fetch the payment details (outstanding balance etc) for a specific vendor.
*/
private function GetVendorPaymentDetails()
{
if (!isset($_REQUEST['vendorId'])) {
exit;
}
$paymentClass = GetClass('ISC_ADMIN_VENDOR_PAYMENTS');
$paymentDetails = $paymentClass->CalculateOutstandingVendorBalance($_REQUEST['vendorId']);
$tags[] = $this->MakeXMLTag('status', 1);
$tags[] = $this->MakeXMLTag('fromDate', CDate($paymentDetails['lastPaymentDate']), true);
$tags[] = $this->MakeXMLTag('toDate', CDate(time()), true);
$tags[] = $this->MakeXMLTag('outstandingBalance', FormatPrice($paymentDetails['outstandingBalance']), true);
$tags[] = $this->MakeXMLTag('balanceForward', FormatPrice($paymentDetails['balanceForward']), true);
$tags[] = $this->MakeXMLTag('profitMargin', FormatPrice($paymentDetails['profitMargin']), true);
$tags[] = $this->MakeXMLTag('profitMarginPercentage', $paymentDetails['profitMarginPercentage'], true);
$tags[] = $this->MakeXMLTag('totalOrders', FormatPrice($paymentDetails['totalOrders']), true);
$this->SendXMLHeader();
$this->SendXMLResponse($tags);
exit;
}
示例4: PreviewRequest
/**
* Generate the 'Quick View' for a particular request.
*
* @param int The request ID.
* @return string The generated quick view for the request.
*/
public function PreviewRequest()
{
if (!isset($_REQUEST['orderId'])) {
exit;
}
$order = GetOrder($_REQUEST['orderId'], true);
/*
if(!isset($order['orderid']) || $order['ordisdigital'] == 1 || ($order['ordtotalqty']-$order['ordtotalshipped']) <= 0) {
exit;
}
*/
$GLOBALS['OrderId'] = $order['orderid'];
$GLOBALS['OrderDate'] = CDate($order['orddate']);
if (isset($_GET['templateId'])) {
$templateId = $_GET['templateId'];
} else {
$templateId = 1;
}
$GLOBALS['TemplateId'] = $templateId;
$GLOBALS['PreviewTemplate'] = $this->paserRequestTemplate($templateId);
$GLOBALS['RemindMessage'] = GetLang('PreviewReviewIntro');
$GLOBALS['ShowSendBtn'] = '';
$query = "\n\t\t\tSELECT *\n\t\t\tFROM [|PREFIX|]requests\n\t\t\tWHERE orderid=" . $GLOBALS['OrderId'] . "\n\t\t";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
if ($row = $GLOBALS['ISC_CLASS_DB']->fetch($result)) {
if ($row['requeststatus'] == 2) {
$GLOBALS['ShowSendBtn'] = 'none';
$GLOBALS['RemindMessage'] = GetLang('NoResendWarning');
} else {
$GLOBALS['RemindMessage'] = sprintf(GetLang('ResendWarning'), $row['requestdate'], $row['requestowner']);
//$this->RecordReviewRequest($order['orderid'], true,$templateId,false);
}
} else {
//$this->RecordReviewRequest($order['orderid'], true,$templateId,false);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('requests.preview');
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
}
示例5: ManageCustomersGrid
//.........这里部分代码省略.........
$GLOBALS['SortField'] = $sortField;
$GLOBALS['SortOrder'] = $sortOrder;
$sortLinks = array(
"CustId" => "customerid",
"Name" => "custconlastname",
"Email" => "custconemail",
"Phone" => "custconphone",
"StoreCredit" => "custstorecredit",
"Date" => "custdatejoined",
"NumOrders" => "numorders"
);
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewCustomers&".http_build_query($sortURL)."&page=".$page, $sortField, $sortOrder);
// Workout the maximum size of the array
$max = $start + $perPage;
if ($max > $GLOBALS["ISC_CLASS_DB"]->CountResult($customerResult)) {
$max = $GLOBALS["ISC_CLASS_DB"]->CountResult($customerResult);
}
if (!empty($this->_customerGroups)) {
$showGroups = true;
}
else {
$showGroups = false;
}
if ($numCustomers > 0) {
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($customerResult)) {
$GLOBALS['CustomerId'] = (int) $row['customerid'];
$GLOBALS['Name'] = isc_html_escape($row['custfullname']);
$GLOBALS['Email'] = sprintf("<a href='mailto:%s'>%s</a>", urlencode($row['custconemail']), isc_html_escape($row['custconemail']));
if ($row['custconphone'] != "") {
$GLOBALS['Phone'] = isc_html_escape($row['custconphone']);
} else {
$GLOBALS['Phone'] = GetLang('NA');
}
$GLOBALS['Group'] = "";
if ($showGroups) {
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Customers)) {
$GLOBALS['Group'] = $this->_BuildGroupDropdown($row['customerid'], $row['custgroupid'], $row['custfullname']);
}
elseif ($row['custgroupid']) {
$GLOBALS['Group'] = $this->_customerGroups[$row['custgroupid']]['groupname'];
}
}
if ($row['custconcompany'] != "") {
$GLOBALS['Company'] = isc_html_escape($row['custconcompany']);
} else {
$GLOBALS['Company'] = GetLang('NA');
}
$GLOBALS['Date'] = CDate($row['custdatejoined']);
$GLOBALS['NumOrders'] = (int) $row['numorders'];
// Hide the plus symbol if the customer has no orders
if ($row['numorders'] == 0) {
$GLOBALS['HideExpand'] = "none";
} else {
$GLOBALS['HideExpand'] = "";
}
// If the customer has any notes, flag them
$HasNotesClass = '';
if($row['custnotes'] != '') {
$HasNotesClass = 'HasNotes';
}
// Workout which links the user can have
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Customers)) {
$GLOBALS['StoreCreditAmount'] = FormatPrice($row['custstorecredit'], false, false, false);
$GLOBALS['StoreCredit'] = $this->template->render('Snippets/CustomerRowStoreCredit.html');
$GLOBALS['LoginLink'] = "<a href='index.php?ToDo=loginCustomer&customerId=" . $row['customerid'] . "' class='Action' target='_blank'>" . GetLang('CustomerLoginAsThem') . "</a>";
$GLOBALS['ViewNotesLink'] = "<a href='#' class='" . $HasNotesClass . " ViewNotesLink' onclick='Customers.ViewNotes(".$row['customerid']."); return false;'>" . GetLang("CustomerNotesLink") . "</a>";
$GLOBALS['EditCustomerLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editCustomer&customerId=%d'>%s</a>", GetLang('CustomerEdit'), $row['customerid'], GetLang('Edit'));
} else {
$GLOBALS['StoreCredit'] = FormatPrice($row['custstorecredit']);
$GLOBALS['LoginLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('CustomerLoginAsThem'));
$GLOBALS['ViewNotesLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('CustomerNotesLink'));
$GLOBALS['EditCustomerLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
}
$GLOBALS['CustomerGrid'] .= $this->template->render('customers.manage.row.tpl');
}
}
else {
if (isset($_REQUEST['letter'])) {
$GLOBALS['CustomerGrid'] = sprintf('<tr>
<td colspan="11" style="padding:10px"><em>%s</em></td>
</tr>', sprintf(GetLang('CustomerLetterSortNoResults'), isc_strtoupper($_REQUEST['letter'])));
}
}
return $this->template->render('customers.manage.grid.tpl');
}
示例6: generateGiftCertificateHTML
/**
* Generates the HTML for a gift certificate using this theme.
*
* @param array gift certificate placeholder data
*
* @return string the generated gift certificate html
*/
public function generateGiftCertificateHTML($certificate)
{
$template = TEMPLATE::getInstance();
if(!isset($GLOBALS['ShopPathNormal'])) {
$GLOBALS['ShopPathNormal'] = $GLOBALS['ShopPath'];
}
// Fetch the store logo or store title
if(GetConfig('UseAlternateTitle')) {
$text = GetConfig('AlternateTitle');
}
else {
$text = GetConfig('StoreName');
}
$text = explode(" ", $text, 2);
$text[0] = "<span class=\"Logo1stWord\">".$text[0]."</span>";
$GLOBALS['LogoText'] = implode(" ", $text);
$GLOBALS['HeaderLogo'] = $template->GetSnippet("LogoText");
// Set gift certificate details
$GLOBALS['CharacterSet']=GetConfig('CharacterSet');
$GLOBALS['GiftCertificateTo'] = isc_html_escape($certificate['giftcertto']);
$GLOBALS['GiftCertificateToEmail'] = isc_html_escape($certificate['giftcerttoemail']);
$GLOBALS['GiftCertificateFrom'] = isc_html_escape($certificate['giftcertfrom']);
$GLOBALS['GiftCertificateFromEmail'] = isc_html_escape($certificate['giftcertfromemail']);
$GLOBALS['GiftCertificateAmount'] = CurrencyConvertFormatPrice($certificate['giftcertamount']);
$GLOBALS['GiftCertificateMessage'] = isc_html_escape($certificate['giftcertmessage']);
$GLOBALS['GiftCertificateCode'] = isc_html_escape($certificate['giftcertcode']);
if(isset($certificate['giftcertexpirydate']) && $certificate['giftcertexpirydate'] != 0) {
$GLOBALS['GiftCertificateExpiryInfo'] = sprintf(GetLang('GiftCertificateExpiresOn'), CDate($certificate['giftcertexpirydate']));
}
else {
$GLOBALS['GiftCertificateExpiryInfo'] = '';
}
// Build the html
$html = $template->ParseTemplate(true, $this->getTemplateContents());
return $html;
}
示例7: grava_dados
function grava_dados()
{
if (!$this->check_dados()) {
return;
}
$db = new Database($this, false);
if (!$db->link) {
return;
}
$num_doc = $this->num_doc->get_text();
$parcela = $this->parcela->get_text();
$vencimento = CDate($this->vencimento->get_text());
$valor = CommaToPoint($this->valor->get_text());
$anotacoes = $this->anotacoes->get_text();
if ($this->operacao == 'i') {
$sql = 'call SP_Conta_Receber_Inc';
} else {
$sql = 'call SP_Conta_Receber_Alt';
}
$data = $sql . '(' . String($this->tipo_doc->CodTipoDoc) . ',' . String($this->filial->CodFilial) . ',' . String($this->clientes->CodCliente) . ',' . String($num_doc) . ',' . String($parcela) . ',' . String($vencimento) . ',' . String($valor) . ',' . String($anotacoes) . ',' . $GLOBALS['CodUsuario'] . ');';
if (!$db->multi_query($data)) {
return;
}
$line = $db->line();
$db->free_result();
new Message($this, $line['Mensagem']);
return true;
}
示例8: EmailOnStatusChange
/**
* Send an email notification to a customer when the status of their order changes.
*
* @param int The ID of the order to email the invoice for.
* @return boolean True if successful.
*/
function EmailOnStatusChange($orderId, $status)
{
// Load the order
$order = GetOrder($orderId);
if (!$order) {
return false;
}
// Load the customer we'll be contacting
if ($order['ordcustid'] > 0) {
$customer = GetCustomer($order['ordcustid']);
$GLOBALS['ViewOrderStatusLink'] = '<a href="'.$GLOBALS['ShopPathSSL'].'/orderstatus.php">'.GetLang('ViewOrderStatus').'</a>';
} else {
$customer['custconemail'] = $order['ordbillemail'];
$customer['custconfirstname'] = $order['ordbillfirstname'];
$GLOBALS['ViewOrderStatusLink'] = '';
}
if (empty($customer['custconemail'])) {
return;
}
// All prices in the emailed invoices will be shown in the default currency of the store
$defaultCurrency = GetDefaultCurrency();
$statusName = GetOrderStatusById($status);
$GLOBALS['OrderStatusChangedHi'] = sprintf(GetLang('OrderStatusChangedHi'), isc_html_escape($customer['custconfirstname']));
$GLOBALS['OrderNumberStatusChangedTo'] = sprintf(GetLang('OrderNumberStatusChangedTo'), $order['orderid'], $statusName);
$GLOBALS['OrderTotal'] = FormatPrice($order['total_inc_tax'], false, true, false, $defaultCurrency, true);
$GLOBALS['DatePlaced'] = CDate($order['orddate']);
if ($order['orderpaymentmethod'] === 'giftcertificate') {
$GLOBALS['PaymentMethod'] = GetLang('PaymentGiftCertificate');
}
else if ($order['orderpaymentmethod'] === 'storecredit') {
$GLOBALS['PaymentMethod'] = GetLang('PaymentStoreCredit');
}
else {
$GLOBALS['PaymentMethod'] = $order['orderpaymentmethod'];
}
$query = "
SELECT COUNT(*)
FROM [|PREFIX|]order_products
WHERE ordprodtype='digital'
AND orderorderid='".$GLOBALS['ISC_CLASS_DB']->Quote($orderId)."'
";
$numDigitalProducts = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
$emailTemplate = FetchEmailTemplateParser();
$GLOBALS['SNIPPETS']['CartItems'] = "";
if (OrderIsComplete($status) && $numDigitalProducts > 0) {
$query = "
SELECT *
FROM [|PREFIX|]order_products op INNER JOIN [|PREFIX|]products p ON (op.ordprodid = p.productid)
WHERE ordprodtype='digital'
AND orderorderid='".$GLOBALS['ISC_CLASS_DB']->Quote($orderId)."'
";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while ($product_row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
$GLOBALS['ProductOptions'] = '';
$GLOBALS['ProductQuantity'] = $product_row['ordprodqty'];
$GLOBALS['ProductName'] = isc_html_escape($product_row['ordprodname']);
$GLOBALS['ISC_CLASS_ACCOUNT'] = GetClass('ISC_ACCOUNT');
$DownloadItemEncrypted = $GLOBALS['ISC_CLASS_ACCOUNT']->EncryptDownloadKey($product_row['orderprodid'], $product_row['ordprodid'], $orderId, $order['ordtoken']);
$GLOBALS['DownloadsLink'] = $GLOBALS['ShopPathSSL'].'/account.php?action=download_item&data='.$DownloadItemEncrypted;
$GLOBALS['SNIPPETS']['CartItems'] .= $emailTemplate->GetSnippet("StatusCompleteDownloadItem");
}
}
$GLOBALS['SNIPPETS']['OrderTrackingLink'] = "";
$shipments = $GLOBALS['ISC_CLASS_DB']->Query("
SELECT shipmentid, shipdate, shiptrackno, shipping_module, shipmethod, shipcomments
FROM [|PREFIX|]shipments
WHERE shiporderid = " . (int)$orderId . "
ORDER BY shipdate, shipmentid
");
$GLOBALS['TrackingLinkList'] = '';
while($shipment = $GLOBALS['ISC_CLASS_DB']->Fetch($shipments)) {
if (!$shipment['shiptrackno']) {
continue;
}
GetModuleById('shipping', /** @var ISC_SHIPPING */$module, $shipment['shipping_module']);
if ($module) {
//.........这里部分代码省略.........
示例9: ManageCouponsGrid
private function ManageCouponsGrid(&$numCoupons)
{
// Show a list of coupons in a table
$page = 0;
$start = 0;
$numCoupons = 0;
$numPages = 0;
$GLOBALS['CouponGrid'] = "";
$GLOBALS['Nav'] = "";
$max = 0;
if (isset($_GET['sortOrder']) && $_GET['sortOrder'] == 'desc') {
$sortOrder = 'desc';
} else {
$sortOrder = "asc";
}
$sortLinks = array("Name" => "c.couponname", "Coupon" => "c.couponcode", "Discount" => "c.couponamount", "Expiry" => "c.couponexpires", "NumUses" => "c.couponnumuses", "Enabled" => "c.couponenabled");
if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
$sortField = $_GET['sortField'];
SaveDefaultSortField("ManageCoupons", $_REQUEST['sortField'], $sortOrder);
} else {
list($sortField, $sortOrder) = GetDefaultSortField("ManageCoupons", "c.couponid", $sortOrder);
}
if (isset($_GET['page'])) {
$page = (int) $_GET['page'];
} else {
$page = 1;
}
$sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
$GLOBALS['SortURL'] = $sortURL;
// Limit the number of questions returned
if ($page == 1) {
$start = 1;
} else {
$start = $page * ISC_COUPONS_PER_PAGE - (ISC_COUPONS_PER_PAGE - 1);
}
$start = $start - 1;
// Get the results for the query
$couponResult = $this->_GetCouponList($start, $sortField, $sortOrder, $numCoupons);
$numPages = ceil($numCoupons / ISC_COUPONS_PER_PAGE);
if ($numCoupons > ISC_COUPONS_PER_PAGE) {
$GLOBALS['Nav'] = sprintf("(%s %d of %d) ", GetLang('Page'), $page, $numPages);
$GLOBALS['Nav'] .= BuildPagination($numCoupons, ISC_COUPONS_PER_PAGE, $page, sprintf("index.php?ToDo=viewCoupons%s", $sortURL));
} else {
$GLOBALS['Nav'] = "";
}
$GLOBALS['SortField'] = $sortField;
BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewCoupons&page=" . $page, $sortField, $sortOrder);
$max = $start + ISC_COUPONS_PER_PAGE;
if ($max > count($couponResult)) {
$max = count($couponResult);
}
if ($numCoupons > 0) {
// Display the coupons
while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($couponResult)) {
$GLOBALS['Name'] = isc_html_escape($row['couponname']);
$GLOBALS['CouponId'] = (int) $row['couponid'];
$GLOBALS['Coupon'] = isc_html_escape($row['couponcode']);
if ($row['coupontype'] == 0) {
// Dollar value coupon code
$GLOBALS['Discount'] = sprintf("%s", FormatPrice($row['couponamount']));
} else {
// Percentage value coupon code
$GLOBALS['Discount'] = sprintf("%s%%", number_format($row['couponamount'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), GetConfig('ThousandsToken')));
}
if ($row['couponexpires'] > 0) {
$GLOBALS['Date'] = CDate($row['couponexpires']);
} else {
$GLOBALS['Date'] = GetLang('NA');
}
if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_Coupons)) {
$GLOBALS['EditCouponLink'] = sprintf("<a title='%s' class='Action' href='index.php?ToDo=editCoupon&couponId=%d'>%s</a>", GetLang('CouponEdit'), $row['couponid'], GetLang('Edit'));
if ($row['couponenabled'] == 1) {
$GLOBALS['Enabled'] = sprintf("<a title='%s' href='index.php?ToDo=editCouponEnabled&couponId=%d&enabled=0'><img border='0' src='images/tick.gif'></a>", GetLang('ClickToDisableCoupon'), $row['couponid']);
} else {
$GLOBALS['Enabled'] = sprintf("<a title='%s' href='index.php?ToDo=editCouponEnabled&couponId=%d&enabled=1'><img border='0' src='images/cross.gif'></a>", GetLang('ClickToEnableCoupon'), $row['couponid']);
}
} else {
$GLOBALS['EditCouponLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
if ($row['couponenabled'] == 1) {
$GLOBALS['Enabled'] = '<img border="0" src="images/tick.gif" alt="tick" />';
} else {
$GLOBALS['Enabled'] = '<img border="0" src="images/cross.gif" alt="cross" />';
}
}
$GLOBALS['NumUses'] = number_format($row['couponnumuses']);
$GLOBALS['ViewOrdersLink'] = '';
if ($row['couponnumuses'] > 0) {
$GLOBALS['ViewOrdersLink'] = sprintf(" <a href='index.php?ToDo=viewOrders&couponCode=%s' title='%s'>%s</a>", $row['couponcode'], GetLang('ViewOrdersWithCoupon'), GetLang('ViewOrders'));
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("coupons.manage.row");
$GLOBALS['CouponGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("coupons.manage.grid");
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
}
}
示例10: ManageReviewsGrid
//.........这里部分代码省略.........
$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);
}
}
示例11: GeneratePerformanceIndicatorsTable
/**
* Generate the KPI table for orders, visitors, conversion rate etc.
* Will use the time period from the request if one exists (GET or COOKIE)
* or falls back to the last week.
*
* @return string The generated HTML for the performance indicators table.
*/
public function GeneratePerformanceIndicatorsTable()
{
if (!$this->auth->HasPermission(AUTH_Statistics_Overview)) {
return false;
}
// If we don't have a period coming in via the URL, use the default
if (!isset($_GET['period'])) {
// Is it set in a cookie?
if (isset($_COOKIE['DashboardPerformanceIndicatorsPeriod'])) {
$period = $_COOKIE['DashboardPerformanceIndicatorsPeriod'];
} else {
$period = 'week';
}
} else {
$period = $_GET['period'];
}
// Determine for which dates we need to fetch the statistics
switch ($period) {
case 'week':
$lastPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d') - 13, isc_date('y'));
$thisPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d') - 6, isc_date('y'));
break;
case 'month':
$lastPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m') - 2, isc_date('d'), isc_date('y'));
$thisPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m') - 1, isc_date('d'), isc_date('y'));
break;
case 'year':
$lastPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d'), isc_date('y') - 2);
$thisPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d'), isc_date('y') - 1);
break;
default:
$period = 'day';
$lastPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d') - 1, isc_date('y'));
$thisPeriodFrom = isc_gmmktime(0, 0, 0, isc_date('m'), isc_date('d'), isc_date('y'));
}
$this->template->Assign('LastPeriodHeader', GetLang('Last' . ucfirst($period)));
$this->template->Assign('ThisPeriodHeader', GetLang('This' . ucfirst($period)));
// Run up until 1 second before the current period. Subtracting 1 second allows us to generate displayable dates for the period.
$lastPeriodTo = $thisPeriodFrom - 1;
if ($period != 'day') {
$this->template->Assign('LastPeriodDateRange', CDate($lastPeriodFrom) . ' - ' . CDate($lastPeriodTo));
$this->template->Assign('ThisPeriodDateRange', CDate($thisPeriodFrom) . ' - ' . CDate(time()));
} else {
$this->template->Assign('LastPeriodDateRange', CDate($lastPeriodFrom));
$this->template->Assign('ThisPeriodDateRange', CDate($thisPeriodFrom));
}
// Calculate the number of orders and the total revenue
$vendorAdd = '';
if ($this->auth->GetVendorId()) {
$vendorAdd .= " AND ordvendorid='" . $this->auth->GetVendorId() . "'";
}
$query = "\n\t\t\tSELECT SUM(ordtotalamount) AS totalrevenue, COUNT(orderid) AS numorders\n\t\t\tFROM [|PREFIX|]orders\n\t\t\tWHERE ordstatus IN (" . implode(',', GetPaidOrderStatusArray()) . ") AND orddate >= '" . $lastPeriodFrom . "' AND orddate <= '" . $lastPeriodTo . "' " . $vendorAdd . "\n\t\t";
$result = $this->db->Query($query);
$lastPeriodOrderStats = $this->db->Fetch($result);
$query = "\n\t\t\tSELECT SUM(ordtotalamount) AS totalrevenue, COUNT(orderid) AS numorders\n\t\t\tFROM [|PREFIX|]orders\n\t\t\tWHERE ordstatus IN (" . implode(',', GetPaidOrderStatusArray()) . ") AND orddate >= '" . $thisPeriodFrom . "' " . $vendorAdd . "\n\t\t";
$result = $this->db->Query($query);
$thisPeriodOrderStats = $this->db->Fetch($result);
// Calculate the number of visitors
if (!$this->auth->GetVendorId()) {
$query = "\n\t\t\t\tSELECT SUM(numuniques)\n\t\t\t\tFROM [|PREFIX|]unique_visitors\n\t\t\t\tWHERE datestamp >= '" . $lastPeriodFrom . "' AND datestamp <= '" . $lastPeriodTo . "'\n\t\t\t";
$lastPeriodVisitorStats = $this->db->FetchOne($query);
$query = "\n\t\t\t\tSELECT SUM(numuniques)\n\t\t\t\tFROM [|PREFIX|]unique_visitors\n\t\t\t\tWHERE datestamp >= '" . $thisPeriodFrom . "'\n\t\t\t";
$thisPeriodVisitorStats = $this->db->FetchOne($query);
// Calculate the percentage change in visitors between the last period and the current period
$visitorChange = $thisPeriodVisitorStats - $lastPeriodVisitorStats;
$prefix = '';
if ($visitorChange == 0) {
$visitorChangePercent = 0;
} else {
if ($lastPeriodVisitorStats > 0) {
$visitorChangePercent = round($visitorChange / $lastPeriodVisitorStats * 100, 2);
} else {
$visitorChangePercent = 100;
}
}
if ($visitorChangePercent > 0) {
$prefix = '+';
$this->template->Assign('NumVisitorsChangeClass', 'Positive');
} else {
if ($visitorChangePercent < 0) {
$this->template->Assign('NumVisitorsChangeClass', 'Negative');
}
}
$visitorChangePercent = $prefix . number_format($visitorChangePercent, 2) . '%';
$this->template->Assign('LastPeriodNumVisitors', number_format($lastPeriodVisitorStats));
$this->template->Assign('ThisPeriodNumVisitors', number_format($thisPeriodVisitorStats));
$this->template->Assign('NumVisitorsChange', $visitorChangePercent);
$lastConversion = 0;
if ($lastPeriodVisitorStats > 0) {
$lastConversion = $lastPeriodOrderStats['numorders'] / $lastPeriodVisitorStats * 100;
}
$this->template->Assign('LastPeriodConversionRate', number_format(round($lastConversion, 2), 2));
$thisConversion = 0;
//.........这里部分代码省略.........
示例12: PreviewNews
public function PreviewNews()
{
// Print a packing slip for an order
ob_end_clean();
if (isset($_GET['newsId'])) {
$newsId = $_GET['newsId'];
$newsId = (int) $newsId;
// Get the details for this news post from the database
$query = sprintf("select * from [|PREFIX|]news where newsid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($newsId));
$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
$GLOBALS['Title'] = $row['newstitle'];
$GLOBALS['Content'] = $row['newscontent'];
$GLOBALS['NewsDate'] = CDate($row['newsdate']);
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("news.preview");
$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
die;
} else {
echo "<script type=\"text/javascript\">window.close();</script>";
}
} else {
echo "<script type=\"text/javascript\">window.close();</script>";
}
}
示例13: SavePendingOrder
/**
* Create the pending order in the database with the customers selected payment details, etc.
*
* @return array An array containing information about what needs to be done next.
*/
public function SavePendingOrder()
{
$provider = null;
$verifyPaymentProvider = true;
$redirectToFinishOrder = false;
$providerId = '';
$pendingOrderResult = array();
if (!isset($_SESSION['CHECKOUT']['PENDING_DATA'])) {
return false;
}
// Did they agree to signup to any mailing lists?
if (isset($_POST['join_mailing_list'])) {
ISC_SetCookie("JOIN_MAILING_LIST", 1, time() + 3600 * 24 * 7);
}
if (isset($_POST['join_order_list'])) {
ISC_SetCookie("JOIN_ORDER_LIST", 1, time() + 3600 * 24 * 7);
}
$orderTotal = $_SESSION['CHECKOUT']['PENDING_DATA']['ORDER_TOTAL'];
$giftCertificateAmount = $_SESSION['CHECKOUT']['PENDING_DATA']['GIFTCERTIFICATE_AMOUNT'];
$gatewayAmount = $_SESSION['CHECKOUT']['PENDING_DATA']['GATEWAY_AMOUNT'];
$creditUsed = 0;
$giftCertificates = array();
// Find out what currency we are using. We'll need this later to display their previous orders in the currency that they have selected
$selectedCurrency = GetCurrencyById($GLOBALS['CurrentCurrency']);
if (isset($_SESSION['OFFERCART']['GIFTCERTIFICATES']) && is_array($_SESSION['OFFERCART']['GIFTCERTIFICATES'])) {
$giftCertificates = $_SESSION['OFFERCART']['GIFTCERTIFICATES'];
// Now we check that the gift certificates can actually be applied to the order
$GLOBALS['ISC_CLASS_GIFT_CERTIFICATES'] = GetClass('ISC_GIFTCERTIFICATES');
$badCertificates = array();
$remainingBalance = 0;
$GLOBALS['ISC_CLASS_GIFT_CERTIFICATES']->GiftCertificatesApplicableToOrder($orderTotal, $giftCertificates, $remainingBalance, $badCertificates);
// One or more gift certificates were invalid so this order is now invalid
if (count($badCertificates) > 0) {
$badCertificatesList = '<strong>' . GetLang('BadGiftCertificates') . '</strong><ul>';
foreach ($badCertificates as $code => $reason) {
if (is_array($reason) && $reason[0] == "expired") {
$reason = sprintf(GetLang('BadGiftCertificateExpired'), CDate($reason[1]));
} else {
$reason = GetLang('BadGiftCertificate' . ucfirst($reason));
}
$badCertificatesList .= sprintf("<li>%s - %s", isc_html_escape($code), $reason);
}
$badCertificatesList .= "</ul>";
$pendingOrderResult = array('error' => GetLang('OrderContainedInvalidGiftCertificates'), 'errorDetails' => $badCertificatesList);
return $pendingOrderResult;
} else {
if ($orderTotal == $giftCertificateAmount && $remainingBalance > 0) {
$pendingOrderResult = array('error' => GetLang('OrderTotalStillRemainingCertificates'));
return $pendingOrderResult;
} else {
if ($orderTotal == $giftCertificateAmount) {
$providerId = 'giftcertificate';
$verifyPaymentProvider = false;
$redirectToFinishOrder = true;
}
}
}
}
// If the order total is 0, then we just forward the user on to the "Thank You" page and set the payment provider to ''
if ($orderTotal == 0) {
$providerId = '';
$verifyPaymentProvider = false;
$redirectToFinishOrder = true;
}
if ($verifyPaymentProvider) {
if (isset($_POST['credit_checkout_provider']) && $_POST['credit_checkout_provider'] != "") {
$_POST['checkout_provider'] = $_POST['credit_checkout_provider'];
}
$selected_provider = "";
$providers = GetCheckoutModulesThatCustomerHasAccessTo(true);
// If there's more than one, use the value they've chosen
if (count($providers) > 1 && isset($_POST['checkout_provider']) || isset($_SESSION['CHECKOUT']['ProviderListHTML'])) {
$selected_provider = $_POST['checkout_provider'];
} else {
if (count($providers) == 1) {
$selected_provider = $providers[0]['object']->GetId();
$_POST['checkout_provider'] = $selected_provider;
} else {
$selected_provider = '';
}
}
if (!isset($_POST['checkout_provider'])) {
$_POST['checkout_provider'] = '';
}
// Are we using our store credit?
$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
$customer = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerDataByToken();
if (isset($_POST['store_credit']) && $_POST['store_credit'] == 1 && $customer['custstorecredit'] > 0) {
// User has not chosen a payment provider and can't afford this order using only store credit, throw back as error
if (!$_POST['checkout_provider'] && $customer['custstorecredit'] < $orderTotal) {
return false;
} else {
$onlyCredit = false;
$updateExtra = '';
// If we're only using store credit
//.........这里部分代码省略.........
示例14: ViewOrderReview
/**
* Showing the customer review for the order.
*/
public function ViewOrderReview()
{
if (!isset($_REQUEST['orderId'])) {
exit;
}
$order = GetOrder($_REQUEST['orderId'], true);
if (!isset($order['orderid']) || $order['ordisdigital'] == 1 || $order['ordtotalqty'] - $order['ordtotalshipped'] <= 0) {
exit;
}
$GLOBALS['OrderId'] = $order['orderid'];
$GLOBALS['OrderDate'] = CDate($order['orddate']);
$GLOBALS['ReviewContent'] = '<tr><th>ProductId</th><th>ProductName</th><th>ReviewText</th><th>ReviewRating</th></tr>';
$resultCnt = 0;
$query = "\n SELECT r.*, p.productid, p.prodname\n\t\t\t\tFROM [|PREFIX|]reviews r\n\t\t\t\tLEFT JOIN [|PREFIX|]products p ON (p.productid=r.revproductid)\n\t\t\t\tLEFT JOIN [|PREFIX|]order_products o ON (o.ordprodid=p.productid)\n\t\t\t\tWHERE o.orderorderid='" . $GLOBALS['OrderId'] . "'\n\t\t\t\tAND r.orderid='" . $GLOBALS['OrderId'] . "'\n\t\t\t\tAND r.reviewtype=1\n\t\t\t\tORDER BY revdate DESC";
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
if (isc_strlen($row['prodname']) > 100) {
$prodName = isc_html_escape(sprintf("%s...", isc_substr($row['prodname'], 0, 100)));
} else {
$prodName = isc_html_escape($row['prodname']);
}
if (isc_strlen($row['revtext']) > 100) {
$reviewText = isc_html_escape(sprintf("%s...", isc_substr($row['revtext'], 0, 100)));
} else {
if (isc_strlen($row['revtext']) == 0) {
$reviewText = '[no comment]';
} else {
$reviewText = isc_html_escape($row['revtext']);
}
}
$resultCnt++;
$reviewRate = sprintf("<img width=\"64\" height=\"12\" src=\"%s/images/IcoRating%s.gif\" alt=\"\" />", $GLOBALS['TPL_PATH'], $row['revrating']);
$GLOBALS['ReviewContent'] .= '<tr><td>' . $row['productid'] . '</td><td>' . $prodName . '</td><td>' . $reviewText . '</td><td>' . $reviewRate . '</td></tr>';
}
if ($resultCnt == 0) {
$GLOBALS['ReviewContent'] = '<tr>
<td class="ReviewContent">
' . GetLang('NoReviewReceived') . '
</td>
</tr>';
}
//$GLOBALS['ShowApprove'] = '';
$GLOBALS['ShowApprove'] = 'none';
$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('order.review');
return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
}
示例15: exportEnd
/**
* Called by the export task at the end of an export. Updates the
* date and time of the last generated export if this is the active
* export task.
*
* @param object The job controller passed by the export task.
*/
public function exportEnd($controller)
{
if($this->getCurrentExportId() != $controller->getId())
return;
$date = CDate(time());
$time = isc_date('h:i a', time());
$this->setLastExportDetails($date, $time);
$this->clearCurrentExportId();
$this->logSuccess(
getLang('ShoppingComparisonExportJobComplete',
array("name" => $this->getName())
)
);
}