本文整理汇总了PHP中Referrer::getReferrers方法的典型用法代码示例。如果您正苦于以下问题:PHP Referrer::getReferrers方法的具体用法?PHP Referrer::getReferrers怎么用?PHP Referrer::getReferrers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Referrer
的用法示例。
在下文中一共展示了Referrer::getReferrers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewcustomer
public function viewcustomer()
{
global $currentIndex, $cookie;
$irow = 0;
$configurations = Configuration::getMultiple(array('PS_LANG_DEFAULT', 'PS_CURRENCY_DEFAULT'));
$defaultLanguage = intval($configurations['PS_LANG_DEFAULT']);
$defaultCurrency = intval($configurations['PS_CURRENCY_DEFAULT']);
$customer = $this->loadObject();
$customerStats = $customer->getStats();
$addresses = $customer->getAddresses($defaultLanguage);
$discounts = Discount::getCustomerDiscounts($defaultLanguage, $customer->id, false, false);
$orders = Order::getCustomerOrders($customer->id);
$carts = Cart::getCustomerCarts($customer->id);
$groups = $customer->getGroups();
$referrers = Referrer::getReferrers($customer->id);
echo '
<div style="float: left">
<fieldset style="width: 400px"><div style="float: right"><a href="' . $currentIndex . '&addcustomer&id_customer=' . $customer->id . '&token=' . $this->token . '"><img src="../img/admin/edit.gif" /></a></div>
<span style="font-weight: bold; font-size: 14px;">' . $customer->firstname . ' ' . $customer->lastname . '</span>
<img src="../img/admin/' . ($customer->id_gender == 2 ? 'female' : ($customer->id_gender == 1 ? 'male' : 'unknown')) . '.gif" style="margin-bottom: 5px" /><br />
<a href="mailto:' . $customer->email . '" style="text-decoration: underline; color: blue">' . $customer->email . '</a><br /><br />
' . $this->l('ID:') . ' ' . sprintf('%06d', $customer->id) . '<br />
' . $this->l('Registration date:') . ' ' . Tools::displayDate($customer->date_add, intval($cookie->id_lang), true) . '<br />
' . $this->l('Last visit:') . ' ' . ($customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], intval($cookie->id_lang), true) : $this->l('never')) . '
</fieldset>
</div>
<div style="float: left; margin-left: 50px">
<fieldset style="width: 300px"><div style="float: right"><a href="' . $currentIndex . '&addcustomer&id_customer=' . $customer->id . '&token=' . $this->token . '"><img src="../img/admin/edit.gif" /></a></div>
' . $this->l('Newsletter:') . ' ' . ($customer->newsletter ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '<br />
' . $this->l('Opt-in:') . ' ' . ($customer->optin ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '<br />
' . $this->l('Age:') . ' ' . $customerStats['age'] . ' ' . (!empty($customer->birthday['age']) ? '(' . Tools::displayDate($customer->birthday, intval($cookie->id_lang)) . ')' : $this->l('unknown')) . '<br /><br />
' . $this->l('Last update:') . ' ' . Tools::displayDate($customer->date_upd, intval($cookie->id_lang), true) . '<br />
' . $this->l('Status:') . ' ' . ($customer->active ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '
</fieldset>
</div>
<div class="clear"> </div>';
// display hook specified to this page : AdminCustomers
if (($hook = Module::hookExec('adminCustomers', array('id_customer' => $customer->id))) !== false) {
echo '<div>' . $hook . '</div>';
}
echo '<h2>' . $this->l('Groups') . ' (' . sizeof($groups) . ')</h2>';
if ($groups and sizeof($groups)) {
echo '
<table cellspacing="0" cellpadding="0" class="table">
<tr>
<th class="center">' . $this->l('ID') . '</th>
<th class="center">' . $this->l('Name') . '</th>
<th class="center">' . $this->l('Actions') . '</th>
</tr>';
$tokenGroups = Tools::getAdminToken('AdminGroups' . intval(Tab::getIdFromClassName('AdminGroups')) . intval($cookie->id_employee));
foreach ($groups as $group) {
$objGroup = new Group($group);
echo '
<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'?tab=AdminGroups&id_group=' . $objGroup->id . '&viewgroup&token=' . $tokenGroups . '\'">
<td class="center">' . $objGroup->id . '</td>
<td>' . $objGroup->name[$defaultLanguage] . '</td>
<td align="center"><a href="?tab=AdminGroups&id_group=' . $objGroup->id . '&viewgroup&token=' . $tokenGroups . '"><img src="../img/admin/details.gif" /></a></td>
</tr>';
}
echo '
</table>';
}
echo '<div class="clear"> </div>';
echo '<h2>' . $this->l('Orders') . ' (' . sizeof($orders) . ')</h2>';
if ($orders and sizeof($orders)) {
echo '
<table cellspacing="0" cellpadding="0" class="table">
<tr>
<th class="center">' . $this->l('ID') . '</th>
<th class="center">' . $this->l('Date') . '</th>
<th class="center">' . $this->l('Quantity') . '</th>
<th class="center">' . $this->l('Total') . '</th>
<th class="center">' . $this->l('Payment') . '</th>
<th class="center">' . $this->l('State') . '</th>
<th class="center">' . $this->l('Actions') . '</th>
</tr>';
$tokenOrders = Tools::getAdminToken('AdminOrders' . intval(Tab::getIdFromClassName('AdminOrders')) . intval($cookie->id_employee));
foreach ($orders as $order) {
echo '
<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order=' . $order['id_order'] . '&vieworder&token=' . $tokenOrders . '\'">
<td class="center">' . sprintf('%06d', $order['id_order']) . '</td>
<td>' . Tools::displayDate($order['date_add'], intval($cookie->id_lang), true) . '</td>
<td align="right">' . $order['nb_products'] . '</td>
<td align="right">' . Tools::displayPrice($order['total_paid'], new Currency(intval($order['id_currency']))) . '</td>
<td>' . $order['payment'] . '</td>
<td>' . $order['order_state'] . '</td>
<td align="center"><a href="?tab=AdminOrders&id_order=' . $order['id_order'] . '&vieworder&token=' . $tokenOrders . '"><img src="../img/admin/details.gif" /></a></td>
</tr>';
}
echo '
</table>';
} else {
echo $customer->firstname . ' ' . $customer->lastname . ' ' . $this->l('has placed no orders yet');
}
echo '<div class="clear"> </div>
<h2>' . $this->l('Addresses') . ' (' . sizeof($addresses) . ')</h2>';
if (sizeof($addresses)) {
echo '
<table cellspacing="0" cellpadding="0" class="table">
<tr>
//.........这里部分代码省略.........
示例2: viewcustomer
public function viewcustomer()
{
global $currentIndex, $cookie, $link;
$irow = 0;
$configurations = Configuration::getMultiple(array('PS_LANG_DEFAULT', 'PS_CURRENCY_DEFAULT'));
$defaultLanguage = (int) $configurations['PS_LANG_DEFAULT'];
$defaultCurrency = (int) $configurations['PS_CURRENCY_DEFAULT'];
if (!($customer = $this->loadObject())) {
return;
}
$customerStats = $customer->getStats();
$addresses = $customer->getAddresses($defaultLanguage);
$products = $customer->getBoughtProducts();
$discounts = Discount::getCustomerDiscounts($defaultLanguage, (int) $customer->id, false, false);
$orders = Order::getCustomerOrders((int) $customer->id, true);
$carts = Cart::getCustomerCarts((int) $customer->id);
$groups = $customer->getGroups();
$messages = CustomerThread::getCustomerMessages((int) $customer->id);
$referrers = Referrer::getReferrers((int) $customer->id);
if ($totalCustomer = Db::getInstance()->getValue('SELECT SUM(total_paid_real) FROM ' . _DB_PREFIX_ . 'orders WHERE id_customer = ' . $customer->id . ' AND valid = 1')) {
Db::getInstance()->getValue('SELECT SQL_CALC_FOUND_ROWS COUNT(*) FROM ' . _DB_PREFIX_ . 'orders WHERE valid = 1 GROUP BY id_customer HAVING SUM(total_paid_real) > ' . $totalCustomer);
$countBetterCustomers = (int) Db::getInstance()->getValue('SELECT FOUND_ROWS()') + 1;
} else {
$countBetterCustomers = '-';
}
echo '
<fieldset style="width:400px;float: left"><div style="float: right"><a href="' . $currentIndex . '&addcustomer&id_customer=' . $customer->id . '&token=' . $this->token . '"><img src="../img/admin/edit.gif" /></a></div>
<span style="font-weight: bold; font-size: 14px;">' . $customer->firstname . ' ' . $customer->lastname . '</span>
<img src="../img/admin/' . ($customer->id_gender == 2 ? 'female' : ($customer->id_gender == 1 ? 'male' : 'unknown')) . '.gif" style="margin-bottom: 5px" /><br />
<a href="mailto:' . $customer->email . '" style="text-decoration: underline; color: blue">' . $customer->email . '</a><br /><br />
' . $this->l('ID:') . ' ' . sprintf('%06d', $customer->id) . '<br />
' . $this->l('Registration date:') . ' ' . Tools::displayDate($customer->date_add, (int) $cookie->id_lang, true) . '<br />
' . $this->l('Last visit:') . ' ' . ($customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], (int) $cookie->id_lang, true) : $this->l('never')) . '<br />
' . ($countBetterCustomers != '-' ? $this->l('Rank: #') . ' ' . (int) $countBetterCustomers . '<br />' : '') . '
</fieldset>
<fieldset style="width:300px;float:left;margin-left:50px">
<div style="float: right">
<a href="' . $currentIndex . '&addcustomer&id_customer=' . $customer->id . '&token=' . $this->token . '"><img src="../img/admin/edit.gif" /></a>
</div>
' . $this->l('Newsletter:') . ' ' . ($customer->newsletter ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '<br />
' . $this->l('Opt-in:') . ' ' . ($customer->optin ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') . '<br />
' . $this->l('Age:') . ' ' . $customerStats['age'] . ' ' . (!empty($customer->birthday['age']) ? '(' . Tools::displayDate($customer->birthday, (int) $cookie->id_lang) . ')' : $this->l('unknown')) . '<br /><br />
' . $this->l('Last update:') . ' ' . Tools::displayDate($customer->date_upd, (int) $cookie->id_lang, true) . '<br />
' . $this->l('Status:') . ' ' . ($customer->active ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />');
if ($customer->isGuest()) {
echo '
<div>
' . $this->l('This customer is registered as') . ' <b>' . $this->l('guest') . '</b>';
if (!Customer::customerExists($customer->email)) {
echo '
<form method="POST" action="index.php?tab=AdminCustomers&id_customer=' . (int) $customer->id . '&token=' . Tools::getAdminTokenLite('AdminCustomers') . '">
<input type="hidden" name="id_lang" value="' . (int) (sizeof($orders) ? $orders[0]['id_lang'] : Configuration::get('PS_LANG_DEFAULT')) . '" />
<p class="center"><input class="button" type="submit" name="submitGuestToCustomer" value="' . $this->l('Transform to customer') . '" /></p>
' . $this->l('This feature generates a random password and sends an e-mail to the customer') . '</form>';
} else {
echo '</div><div><b style="color:red;">' . $this->l('A registered customer account exists with the same email address') . '</b>';
}
echo '
</div>
';
}
echo '
</fieldset>
<div class="clear"> </div>';
echo '<fieldset style="height:190px"><legend><img src="../img/admin/cms.gif" /> ' . $this->l('Add a private note') . '</legend>
<p>' . $this->l('This note will be displayed to all the employees but not to the customer.') . '</p>
<form action="ajax.php" method="post" onsubmit="saveCustomerNote();return false;" id="customer_note">
<textarea name="note" id="noteContent" style="width:600px;height:100px" onkeydown="$(\'#submitCustomerNote\').removeAttr(\'disabled\');">' . Tools::htmlentitiesUTF8($customer->note) . '</textarea><br />
<input type="submit" id="submitCustomerNote" class="button" value="' . $this->l(' Save ') . '" style="float:left;margin-top:5px" disabled="disabled" />
<span id="note_feedback" style="float:left;margin:10px 0 0 10px"></span>
</form>
</fieldset>
<div class="clear"> </div>
<script type="text/javascript">
function saveCustomerNote()
{
$("#note_feedback").html("<img src=\\"../img/loader.gif\\" />").show();
var noteContent = $("#noteContent").val();
$.post("ajax.php", {submitCustomerNote:1,id_customer:' . (int) $customer->id . ',note:noteContent}, function (r) {
$("#note_feedback").html("").hide();
if (r == "ok")
{
$("#note_feedback").html("<b style=\\"color:green\\">' . addslashes($this->l('Your note has been saved')) . '</b>").fadeIn(400);
$("#submitCustomerNote").attr("disabled", "disabled");
}
else if (r == "error:validation")
$("#note_feedback").html("<b style=\\"color:red\\">' . addslashes($this->l('Error: your note is not valid')) . '</b>").fadeIn(400);
else if (r == "error:update")
$("#note_feedback").html("<b style=\\"color:red\\">' . addslashes($this->l('Error: cannot save your note')) . '</b>").fadeIn(400);
$("#note_feedback").fadeOut(3000);
});
}
</script>';
echo '<h2>' . $this->l('Messages') . ' (' . sizeof($messages) . ')</h2>';
if (sizeof($messages)) {
echo '
<table cellspacing="0" cellpadding="0" class="table">
<tr>
<th class="center">' . $this->l('Status') . '</th>
<th class="center">' . $this->l('Message') . '</th>
//.........这里部分代码省略.........
示例3: renderView
//.........这里部分代码省略.........
$sql = 'SELECT SUM(total_paid_real) FROM ' . _DB_PREFIX_ . 'orders WHERE id_customer = %d AND valid = 1';
if ($total_customer = Db::getInstance()->getValue(sprintf($sql, $customer->id))) {
$sql = 'SELECT SQL_CALC_FOUND_ROWS COUNT(*) FROM ' . _DB_PREFIX_ . 'orders WHERE valid = 1 AND id_customer != ' . (int) $customer->id . ' GROUP BY id_customer HAVING SUM(total_paid_real) > %d';
Db::getInstance()->getValue(sprintf($sql, (int) $total_customer));
$count_better_customers = (int) Db::getInstance()->getValue('SELECT FOUND_ROWS()') + 1;
} else {
$count_better_customers = '-';
}
$orders = Order::getCustomerOrders($customer->id, true);
$total_orders = count($orders);
for ($i = 0; $i < $total_orders; $i++) {
$orders[$i]['total_paid_real_not_formated'] = $orders[$i]['total_paid_real'];
$orders[$i]['total_paid_real'] = Tools::displayPrice($orders[$i]['total_paid_real'], new Currency((int) $orders[$i]['id_currency']));
}
$messages = CustomerThread::getCustomerMessages((int) $customer->id);
$total_messages = count($messages);
for ($i = 0; $i < $total_messages; $i++) {
$messages[$i]['message'] = substr(strip_tags(html_entity_decode($messages[$i]['message'], ENT_NOQUOTES, 'UTF-8')), 0, 75);
$messages[$i]['date_add'] = Tools::displayDate($messages[$i]['date_add'], null, true);
if (isset(self::$meaning_status[$messages[$i]['status']])) {
$messages[$i]['status'] = self::$meaning_status[$messages[$i]['status']];
}
}
$groups = $customer->getGroups();
$total_groups = count($groups);
for ($i = 0; $i < $total_groups; $i++) {
$group = new Group($groups[$i]);
$groups[$i] = array();
$groups[$i]['id_group'] = $group->id;
$groups[$i]['name'] = $group->name[$this->default_form_language];
}
$total_ok = 0;
$orders_ok = array();
$orders_ko = array();
foreach ($orders as $order) {
if (!isset($order['order_state'])) {
$order['order_state'] = $this->l('There is no status defined for this order.');
}
if ($order['valid']) {
$orders_ok[] = $order;
$total_ok += $order['total_paid_real_not_formated'];
} else {
$orders_ko[] = $order;
}
}
$products = $customer->getBoughtProducts();
$carts = Cart::getCustomerCarts($customer->id);
$total_carts = count($carts);
for ($i = 0; $i < $total_carts; $i++) {
$cart = new Cart((int) $carts[$i]['id_cart']);
$this->context->cart = $cart;
$summary = $cart->getSummaryDetails();
$currency = new Currency((int) $carts[$i]['id_currency']);
$carrier = new Carrier((int) $carts[$i]['id_carrier']);
$carts[$i]['id_cart'] = sprintf('%06d', $carts[$i]['id_cart']);
$carts[$i]['date_add'] = Tools::displayDate($carts[$i]['date_add'], null, true);
$carts[$i]['total_price'] = Tools::displayPrice($summary['total_price'], $currency);
$carts[$i]['name'] = $carrier->name;
}
$sql = 'SELECT DISTINCT cp.id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop
FROM ' . _DB_PREFIX_ . 'cart_product cp
JOIN ' . _DB_PREFIX_ . 'cart c ON (c.id_cart = cp.id_cart)
JOIN ' . _DB_PREFIX_ . 'product p ON (cp.id_product = p.id_product)
WHERE c.id_customer = ' . (int) $customer->id . '
AND NOT EXISTS (
SELECT 1
FROM ' . _DB_PREFIX_ . 'orders o
JOIN ' . _DB_PREFIX_ . 'order_detail od ON (o.id_order = od.id_order)
WHERE product_id = cp.id_product AND o.valid = 1 AND o.id_customer = ' . (int) $customer->id . '
)';
$interested = Db::getInstance()->executeS($sql);
$total_interested = count($interested);
for ($i = 0; $i < $total_interested; $i++) {
$product = new Product($interested[$i]['id_product'], false, $this->default_form_language, $interested[$i]['id_shop']);
if (!Validate::isLoadedObject($product)) {
continue;
}
$interested[$i]['url'] = $this->context->link->getProductLink($product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, $this->default_form_language), null, null, $interested[$i]['cp_id_shop']);
$interested[$i]['id'] = (int) $product->id;
$interested[$i]['name'] = Tools::htmlentitiesUTF8($product->name);
}
$emails = $customer->getLastEmails();
$connections = $customer->getLastConnections();
if (!is_array($connections)) {
$connections = array();
}
$total_connections = count($connections);
for ($i = 0; $i < $total_connections; $i++) {
$connections[$i]['http_referer'] = $connections[$i]['http_referer'] ? preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) : $this->l('Direct link');
}
$referrers = Referrer::getReferrers($customer->id);
$total_referrers = count($referrers);
for ($i = 0; $i < $total_referrers; $i++) {
$referrers[$i]['date_add'] = Tools::displayDate($referrers[$i]['date_add'], null, true);
}
$customerLanguage = new Language($customer->id_lang);
$shop = new Shop($customer->id_shop);
$this->tpl_view_vars = array('customer' => $customer, 'gender' => $gender, 'gender_image' => $gender_image, 'registration_date' => Tools::displayDate($customer->date_add, null, true), 'customer_stats' => $customer_stats, 'last_visit' => Tools::displayDate($customer_stats['last_visit'], null, true), 'count_better_customers' => $count_better_customers, 'shop_is_feature_active' => Shop::isFeatureActive(), 'name_shop' => $shop->name, 'customer_birthday' => Tools::displayDate($customer->birthday), 'last_update' => Tools::displayDate($customer->date_upd, null, true), 'customer_exists' => Customer::customerExists($customer->email), 'id_lang' => $customer->id_lang, 'customerLanguage' => $customerLanguage, 'customer_note' => Tools::htmlentitiesUTF8($customer->note), 'messages' => $messages, 'groups' => $groups, 'orders' => $orders, 'orders_ok' => $orders_ok, 'orders_ko' => $orders_ko, 'total_ok' => Tools::displayPrice($total_ok, $this->context->currency->id), 'products' => $products, 'addresses' => $customer->getAddresses($this->default_form_language), 'discounts' => CartRule::getCustomerCartRules($this->default_form_language, $customer->id, false, false), 'carts' => $carts, 'interested' => $interested, 'emails' => $emails, 'connections' => $connections, 'referrers' => $referrers, 'show_toolbar' => true);
return parent::renderView();
}