本文整理汇总了PHP中Formatter::date方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::date方法的具体用法?PHP Formatter::date怎么用?PHP Formatter::date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter::date方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
protected function getList()
{
$this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SETTINGS_DASHBOARD'), 'href' => $this->url->link('settings/dashboard')));
$this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_USERS_OVERVIEW')));
// Initiate pagination
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$data = array('start' => ($page - 1) * 25, 'limit' => 25);
$user_total = $this->model_user_user->getTotalUsers();
foreach ($this->model_user_user->getUsers($data) as $result) {
$this->data['users'][] = array_merge($result, array('status' => $result['status'] ? Language::getVar('SUMO_NOUN_ENABLED') : Language::getVar('SUMO_NOUN_DISABLED'), 'date_added' => Formatter::date($result['date_added']), 'date_last_seen' => $result['date_last_seen'] != '0000-00-00 00:00:00' ? Formatter::date($result['date_last_seen']) : '—', 'edit' => $this->url->link('user/user/update', 'token=' . $this->session->data['token'] . '&user_id=' . $result['user_id'], 'SSL')));
}
$pagination = new Pagination();
$pagination->total = $user_total;
$pagination->page = $page;
$pagination->limit = 25;
$pagination->text = '';
$pagination->url = $this->url->link('sale/return', 'token=' . $this->session->data['token'] . '&page={page}', 'SSL');
$this->data = array_merge($this->data, array('pagination' => $pagination->renderAdmin(), 'insert' => $this->url->link('user/user/insert', 'token=' . $this->session->data['token'], 'SSL'), 'delete' => $this->url->link('user/user/delete', 'token=' . $this->session->data['token'], 'SSL'), 'u_users' => $this->url->link('user/user', 'token=' . $this->session->data['token'], 'SSL'), 'u_permissions' => $this->url->link('user/user_permission', 'token=' . $this->session->data['token'], 'SSL')));
$this->template = 'user/user_list.tpl';
$this->children = array('common/header', 'common/footer');
$this->response->setOutput($this->render());
}
示例2: index
public function index()
{
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('account/download', '', 'SSL');
$this->redirect($this->url->link('account/login', '', 'SSL'));
}
$this->document->setTitle(Language::getVar('SUMO_DOWNLOAD_TITLE'));
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
$this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
$this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_DOWNLOAD_TITLE'), 'href' => $this->url->link('account/download', '', 'SSL'));
$this->load->model('account/download');
$totalDownloads = $this->model_account_download->getTotalDownloads();
if ($totalDownloads) {
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$this->data['downloads'] = array();
$results = $this->model_account_download->getDownloads(($page - 1) * $this->config->get('catalog_limit'), $this->config->get('catalog_limit'));
foreach ($results as $result) {
if (file_exists(DIR_DOWNLOAD . $result['filename'])) {
$size = filesize(DIR_DOWNLOAD . $result['filename']);
$i = 0;
$suffix = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
while ($size / 1024 > 1) {
$size = $size / 1024;
$i++;
}
$this->data['downloads'][] = array('order_id' => str_pad($result['order_id'], 6, 0, STR_PAD_LEFT), 'date' => Formatter::date($result['order_date']), 'name' => $result['name'], 'remaining' => $result['remaining'], 'size' => round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i], 'download' => $this->url->link('account/download/download', 'order_download_id=' . $result['order_download_id'], 'SSL'));
}
}
$pagination = new Pagination();
$pagination->total = $totalDownloads;
$pagination->page = $page;
$pagination->limit = $this->config->get('config_catalog_limit');
$pagination->url = $this->url->link('account/download', 'page={page}', 'SSL');
$this->data['pagination'] = $pagination->render();
$this->data['continue'] = $this->url->link('account/account', '', 'SSL');
} else {
$this->data['downloads'] = $this->data['pagination'] = false;
}
$this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
$this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
}
$this->template = 'account/download.tpl';
$this->children = array('common/footer', 'common/header');
$this->response->setOutput($this->render());
}
示例3: index
public function index()
{
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('account/transaction', '', 'SSL');
$this->redirect($this->url->link('account/login', '', 'SSL'));
}
$this->document->setTitle(Language::getVar('SUMO_ACCOUNT_TRANSACTION_TITLE'));
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
$this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
$this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TRANSACTION_TITLE'), 'href' => $this->url->link('account/transaction', '', 'SSL'));
$this->load->model('account/transaction');
//$this->data['column_amount'] = sprintf(Language::getVar('SUMO_ACCOUNT_TRANSACTION_AMOUNT'), $this->config->get('config_currency'));
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$this->data['transactions'] = array();
$data = array('sort' => 'date_added', 'order' => 'DESC', 'start' => ($page - 1) * 10, 'limit' => 10);
$transaction_total = $this->model_account_transaction->getTotalTransactions($data);
foreach ($this->model_account_transaction->getTransactions($data) as $result) {
$this->data['transactions'][] = array('transaction_id' => str_pad($result['customer_transaction_id'], 9, 0, STR_PAD_LEFT), 'amount' => Formatter::currency($result['amount']), 'description' => $result['description'], 'date_added' => Formatter::date($result['date_added']));
}
$pagination = new Pagination();
$pagination->total = $transaction_total;
$pagination->page = $page;
$pagination->limit = 10;
$pagination->url = $this->url->link('account/transaction', 'page={page}', 'SSL');
$this->data['pagination'] = $pagination->render();
$this->data['total'] = $this->currency->format($this->customer->getBalance());
$this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
$this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
}
$this->template = 'account/transaction.tpl';
$this->children = array('common/footer', 'common/header');
$this->response->setOutput($this->render());
}
示例4: index
public function index()
{
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('account/reward', '', 'SSL');
$this->redirect($this->url->link('account/login', '', 'SSL'));
}
$this->document->setTitle(Language::getVar('SUMO_ACCOUNT_REWARD_TITLE'));
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
$this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
$this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_REWARD_TITLE'), 'href' => $this->url->link('account/reward', '', 'SSL'));
$this->load->model('account/reward');
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$this->data['rewards'] = array();
$data = array('sort' => 'date_added', 'order' => 'DESC', 'start' => ($page - 1) * 10, 'limit' => 10);
$reward_total = $this->model_account_reward->getTotalRewards($data);
foreach ($this->model_account_reward->getRewards($data) as $result) {
$this->data['rewards'][] = array('order_id' => $result['order_id'], 'points' => $result['points'], 'description' => $result['description'], 'date_added' => Formatter::date($result['date_added']), 'order' => $this->url->link('account/order/info', 'order_id=' . $result['order_id'], 'SSL'));
}
$pagination = new Pagination();
$pagination->total = $reward_total;
$pagination->page = $page;
$pagination->limit = 10;
$pagination->url = $this->url->link('account/reward', 'page={page}', 'SSL');
$this->data['pagination'] = $pagination->render();
$this->data['total'] = (int) $this->customer->getRewardPoints();
$this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
$this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
}
$this->template = 'account/reward.tpl';
$this->children = array('common/footer', 'common/header');
$this->response->setOutput($this->render());
}
示例5: updateStatus
public function updateStatus($order_id, $status_id, $extra = '', $notify = null)
{
if ($status_id == 1) {
$notify = true;
} else {
$old = $this->get($order_id);
if (!isset($old['status_id']) || isset($old['status_id']) && isset($data['status_id']) && $old['status_id'] != $data['status_id']) {
//$this->updateStatus($order_id, !empty($data['status_id']) ? $data['status_id'] : 1, !empty($data['status']['comment']) ? $data['status']['comment'] : !empty($data['comment']) ? $data['comment'] : '');
if ($notify == null) {
$notify = $this->config->get('customer_notify_email');
}
} else {
//$this->updateStatus($order_id, 1, !empty($data['comment']) ? $data['comment'] : '');
if ($notify == null) {
$notify = false;
}
}
}
$this->query("UPDATE PREFIX_orders\n SET order_status = :status\n WHERE order_id = :id", array('status' => $status_id, 'id' => $order_id));
if ($notify || $this->config->get('admin_notify_email')) {
$template = Mailer::getTemplate('update_order_status_' . $status_id);
$content = $template['content'];
if ($status_id == 1) {
$this->load->model('account/order');
$orderInfo = $this->model_account_order->getOrder($order_id);
Mailer::setOrder($orderInfo);
// Grab order totals
foreach ($this->model_account_order->getOrderTotals($order_id) as $total) {
if (!empty($total['label_inject'])) {
$label = sprintf(Language::getVar($total['label'] . '_INJ'), $total['label_inject']);
} else {
$label = Language::getVar($total['label']);
}
$totals[] = array_merge($total, array('label' => $label));
}
// Grab order products
foreach ($this->model_account_order->getOrderProducts($order_id) as $product) {
$price = $product['price'] * (1 + $product['tax_percentage'] / 100);
$products[] = array_merge($product, array('price' => Formatter::currency($price), 'total' => Formatter::currency($price * $product['quantity']), 'return' => $this->url->link('account/return/insert', 'order_id=' . $orderInfo['order_id'] . '&product_id=' . $product['product_id'], 'SSL')));
}
/**
* Parse address info
*/
// 1. Shipping
$shippingAddress = str_replace('{address_1}', '{address_1} {number}{addon}', $orderInfo['customer']['shipping_address']['address_format']);
foreach ($orderInfo['customer']['shipping_address'] as $key => $value) {
$shippingAddress = str_replace('{' . $key . '}', $value, $shippingAddress);
}
// 2. Payment
$paymentAddress = str_replace('{address_1}', '{address_1} {number}{addon}', $orderInfo['customer']['payment_address']['address_format']);
foreach ($orderInfo['customer']['payment_address'] as $key => $value) {
$paymentAddress = str_replace('{' . $key . '}', $value, $paymentAddress);
}
// Remove remaining vars and excessive line breaks
$shippingAddress = preg_replace("/\\{([a-z0-9_\\-]+)\\}/", '', $shippingAddress);
$shippingAddress = preg_replace("/[\r\n]+/", "\n", $shippingAddress);
// Remove remaining vars and excessive line breaks
$paymentAddress = preg_replace("/\\{([a-z0-9_\\-]+)\\}/", '', $paymentAddress);
$paymentAddress = preg_replace("/[\r\n]+/", "\n", $paymentAddress);
// Other data
$order_date = Formatter::date(time());
$order_id = str_pad($order_id, 6, 0, STR_PAD_LEFT);
$payment_method = $orderInfo['payment']['name'];
$shipping_method = $orderInfo['shipping']['name'];
$order_view = '<hr />
<div class="row">
<div class="col-sm-6">
<h4>' . Language::getVar('SUMO_NOUN_INVOICE_ADDRESS') . '</h4>
<p>' . nl2br($paymentAddress) . '</p>
</div>
<div class="col-sm-6">
<h4>' . Language::getVar('SUMO_NOUN_SHIPPING_ADDRESS') . '</h4>
<p>' . nl2br($shippingAddress) . '</p>
</div>
</div>
<hr>
<div class="row">
<div class="col-sm-6">
<dl class="info">
<dt>' . Language::getVar('SUMO_NOUN_ORDER_NO') . ':</dt>
<dd>' . $order_id . '</dd>
</dl>
</div>
<div class="col-sm-6">
<dl class="info">
<dt>' . Language::getVar('SUMO_NOUN_ORDER_DATE') . ':</dt>
<dd>' . $order_date . '</dd>
</dl>
</div>
</div>
<table class="table" style="margin-top: 30px; font-size: 100%;">
<thead>
<tr>
<th style="width: 65px; font-size: 14px;">' . Language::getVar('SUMO_NOUN_QUANTITY') . '</th>
<th>' . Language::getVar('SUMO_NOUN_PRODUCT') . '</th>
<th style="width: 75px;">' . Language::getVar('SUMO_NOUN_MODEL') . '</th>
<th class="text-right" style="width: 75px;">' . Language::getVar('SUMO_NOUN_PRICE') . '</th>
<th class="text-right" style="width: 75px;">' . Language::getVar('SUMO_NOUN_TOTAL') . '</th>
<th style="width: 30px;"></th>
//.........这里部分代码省略.........
示例6: testDateDefault
/**
* @covers Formatter::date
*/
public function testDateDefault()
{
$actual = $this->formatter->date(null, "2015-05-01");
$excepted = "2015-05-01";
$this->assertEquals($excepted, $actual);
}
示例7: history
public function history()
{
$this->load->model('sale/coupon');
$this->data['histories'] = array();
$results = $this->model_sale_coupon->getCouponHistories($this->request->get['coupon_id'], 0, 10);
foreach ($results as $result) {
$this->data['histories'][] = array_merge($result, array('date_added' => Formatter::date($result['date_added'])));
}
}
示例8: getDataCoupons
private function getDataCoupons($filters)
{
$cache = 'report.coupons.' . json_encode($filters);
$data = Cache::find($cache);
if (is_array($data) && count($data)) {
return $data;
}
$sql = "SELECT ch.coupon_id, ch.amount, ch.date_added, c.name, c.code, c.type, c.discount FROM PREFIX_coupon_history AS ch LEFT JOIN PREFIX_coupon AS c ON c.coupon_id = ch.coupon_id WHERE 1 = 1";
if (!empty($filters['date_start'])) {
$sql .= " AND DATE(ch.date_added) >= '" . Formatter::dateReverse($filters['date_start']) . "'";
}
if (!empty($filters['date_end'])) {
$sql .= " AND DATE(ch.date_added) <= '" . Formatter::dateReverse($filters['date_end']) . "'";
}
if (isset($filters['start']) && !empty($filters['limit'])) {
$sql .= " LIMIT " . (int) $filters['start'] . "," . (int) $filter['limit'];
} else {
return $sql;
}
if (empty($filters['group'])) {
$filters['group'] = 'week';
}
$coupons = $this->fetchAll($sql);
$return = array();
foreach ($coupons as $list) {
$put = '';
$return_time = strtotime($list['date_added']);
switch ($filters['group']) {
case 'day':
$put .= date('Y-m-d', $return_time);
$start_time = $end_time = $return_time;
break;
case 'month':
$put .= date('Y-m', $return_time);
$start_time = strtotime('first day of this month', $return_time);
$end_time = strtotime('last day of this month', $return_time);
break;
case 'year':
$put .= date('Y', $return_time);
$start_time = strtotime(date('Y-01-01', $return_time));
$end_time = strtotime(date('Y-12-31', $return_time));
break;
default:
$put .= date('Y', $return_time);
$put .= 'W';
$put .= str_pad(date('W', $return_time), 2, '0', STR_PAD_LEFT);
$tmp = strtotime($put);
$start_time = strtotime('monday this week', $tmp);
$end_time = strtotime('sunday this week', $tmp);
break;
}
if (!isset($return[$put])) {
$return[$put] = array(1 => Formatter::date($start_time), 2 => Formatter::date($end_time), 3 => $list['name'], 4 => $list['code'], 5 => 0, 6 => 0, 7 => 0);
}
$return[$put][5] += 1;
$return[$put][6] += $list['amount'];
if (strtolower($list['type']) == 'p') {
$return[$put][7] += $list['amount'] / 100 * $list['discount'];
} else {
$return[$put][7] += $list['discount'];
}
}
foreach ($return as $key => $list) {
$return[$key][6] = Formatter::currency($return[$key][6]) . '<br /><span class="alert-danger">- ' . Formatter::currency($return[$key][7]) . '</span>';
unset($return[$key][7]);
}
return $return;
}
示例9: getForm
protected function getForm()
{
if (isset($this->request->get['product_special_id'])) {
$productSpecialData = $this->model_catalog_special->getSpecial($this->request->get['product_special_id']);
$formAction = $this->url->link('catalog/special/update', 'token=' . $this->session->data['token'] . '&product_special_id=' . $this->request->get['product_special_id'], 'SSL');
} else {
$formAction = $this->url->link('catalog/special/insert', 'token=' . $this->session->data['token'], 'SSL');
}
$fields = array('product' => '', 'product_id' => 0, 'discount' => '', 'discount_suffix' => '', 'date_start' => Formatter::date(time()), 'date_end' => Formatter::date(strtotime('+1 month')));
// Find value for field in A: Post-array or B: Existing specialdata array
foreach ($fields as $key => $defaultVal) {
if (isset($this->request->post[$key])) {
$fields[$key] = $this->request->post[$key];
} elseif (isset($productSpecialData[$key])) {
if ($key == 'date_start' || $key == 'date_end') {
$fields[$key] = Formatter::date($productSpecialData[$key]);
} else {
$fields[$key] = $productSpecialData[$key];
}
}
}
$this->data = array_merge($this->data, $fields, array('cancel' => $this->url->link('catalog/special', 'token=' . $this->session->data['token'], 'SSL'), 'action' => $formAction, 'token' => $this->request->get['token']));
$this->document->addScript('view/js/jquery/jquery.autocomplete.js');
$this->document->addScript('view/js/pages/special.js');
}
示例10: index
public function index()
{
$this->document->setTitle(Language::getVar('SUMO_ADMIN_NOUN_DASHBOARD'));
$this->document->addStyle('view/css/pages/dashboard.css');
$this->document->addScript('view/js/pages/dashboard.js');
$this->document->addScript('view/js/jquery/jquery.flot.js');
$this->document->addScript('view/js/jquery/jquery.flot.pie.js');
$this->document->addScript('view/js/jquery/jquery.flot.resize.js');
$this->data['token'] = $this->session->data['token'];
$this->load->model('sale/orders');
$this->data['total_sale'] = Formatter::currency($this->model_sale_orders->getTotalSales());
$this->data['total_sale_year'] = Formatter::currency($this->model_sale_orders->getTotalSalesByYear(date('Y')));
$this->data['total_order'] = $this->model_sale_orders->getOrdersTotal();
$this->load->model('sale/customer');
$this->data['total_customer'] = $this->model_sale_customer->getTotalCustomers();
$this->data['total_customer_approval'] = $this->model_sale_customer->getTotalCustomersAwaitingApproval();
$this->load->model('catalog/review');
$this->data['total_review'] = $this->model_catalog_review->getTotalReviews();
$this->data['total_review_approval'] = $this->model_catalog_review->getTotalReviewsAwaitingApproval();
$this->data['orders'] = array();
$data = array('sort' => 'o.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => 10);
$results = $this->model_sale_orders->getOrders($data);
foreach ($results as $result) {
if (!empty($result['middlename'])) {
$name = $result['customer']['firstname'] . ' ' . $result['customer']['middlename'] . ' ' . $result['customer']['lastname'];
} else {
$name = $result['customer']['firstname'] . ' ' . $result['customer']['lastname'];
}
$this->data['orders'][] = array('order_id' => $result['order_id'], 'customer' => $name, 'status' => $result['status'], 'date_added' => Formatter::date($result['order_date']), 'total' => Formatter::currency($result['total']), 'info' => $this->url->link('sale/orders/info', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'], 'SSL'));
}
// Get last ten customers
$data = array('sort' => 'date_added', 'order' => 'DESC', 'start' => 0, 'limit' => 10);
$results = $this->model_sale_customer->getCustomers($data);
foreach ($results as $result) {
if (!empty($result['middlename'])) {
$name = $result['firstname'] . ' ' . $result['middlename'] . ' ' . $result['lastname'];
} else {
$name = $result['firstname'] . ' ' . $result['lastname'];
}
// Get address
if ($result['address_id'] > 0) {
$addressInfo = $this->model_sale_customer->getAddress($result['address_id']);
$result['city'] = $addressInfo['city'];
} else {
$result['city'] = '—';
}
$this->data['visitors'][] = array('customer_id' => $result['customer_id'], 'customer' => $name, 'city' => $result['city'], 'info' => $this->url->link('sale/customer/edit', 'token=' . $this->session->data['token'] . '&customer_id=' . $result['customer_id'], 'SSL'));
}
// Get countries for customers
/*
$this->load->model('sale/customer');
$countries = $this->model_sale_customer->getCustomersPerCountry();
$colors = array("#93e529", "#ffffff", "#f97f32", "#40a5c3");
foreach ($countries as $i => $country) {
$this->data['countries'][] = array(
'label' => $country['country_name'],
'data' => $country['customers'],
'color' => $colors[$i]
);
}
*/
$this->load->model('user/user');
$this->data = array_merge($this->data, array('todo' => $this->model_user_user->getTodos(), 'uri_orders' => $this->url->link('sale/orders', 'token=' . $this->session->data['token']), 'uri_customers' => $this->url->link('sale/customers', 'token=' . $this->session->data['token'])));
/*
$this->data['visitors'] = array();
$this->load->model('report/online');
$results = Database::fetchAll("SELECT customer_id FROM PREFIX_customer ORDER BY date_added DESC LIMIT 0,5");
foreach ($results as $list) {
if ($list['customer_id'] >= 1) {
$tmp = Database::query("SELECT city, firstname, lastname FROM PREFIX_address WHERE customer_id = :id LIMIT 1", array('id' => $list['customer_id']))->fetch();
$list['city'] = $tmp['city'];
$list['customer'] = $tmp['firstname'] . ' ' . $tmp['lastname'];
}
else {
$list['city'] = '';
$list['customer'] = Language::getVar('SUMO_NOUN_GUEST');
}
$this->data['visitors'][] = $list;
}
if ($this->config->get('currency_auto')) {
$this->load->model('localisation/currency');
$this->model_localisation_currency->updateCurrencies();
}
*/
$this->assembleCharts();
$this->template = 'common/home.tpl';
$this->children = array('common/header', 'common/footer');
$this->response->setOutput($this->render());
}
示例11: foreach
<th style="width:2em">#</th>
<th style="width:8em">Fecha</th>
<th style="width:30em">Aceptado por</th>
<th style="width:8em">Monto <?php
echo SB_CURRENCY;
?>
</th>
</tr>
</thead>
<tbody>
<?php
$totalPaid = 0;
foreach ($payments as $payment) {
echo "<tr>";
echo "<td class='number'>{$payment->line}</td>";
echo "<td class='date'>" . Formatter::date($payment->date) . "</td>";
echo "<td>{$payment->createdBy}</td>";
echo "<td class='number'>" . Formatter::number($payment->amount) . "</td>";
echo "</tr>";
$totalPaid += $payment->amount;
}
$outstanding = $total - $totalPaid;
?>
</tbody>
<tfoot>
<tr>
<td colspan="3" style="text-align:right">Total: </td>
<td class="number total"><?php
echo Formatter::number($totalPaid);
?>
</td>
示例12: copyProduct
public function copyProduct($product_id)
{
$query = $this->query("SELECT DISTINCT *\n FROM PREFIX_product p\n LEFT JOIN PREFIX_product_description pd\n ON (p.product_id = pd.product_id)\n WHERE p.product_id = :pid\n AND pd.language_id = :lang", array('pid' => $product_id, 'lang' => $this->config->get('language_id')))->fetch();
if (count($query)) {
$data = array();
$data = $query;
/*$data['sku'] = '';
$data['upc'] = '';*/
$data['viewed'] = '0';
$data['keyword'] = '';
$data['status'] = '0';
$data['date_available'] = Formatter::date($data['date_available']);
$productImages = array();
// Don't forget about the default image...
$productImages[0] = $data['image'];
foreach ($this->getProductImages($product_id) as $productImage) {
$productImages[] = $productImage['image'];
}
$data = array_merge($data, array('product_price' => $data['price'], 'product_points' => $data['points'], 'product_weight' => $data['weight']));
$data = array_merge($data, array('attribute' => $this->getProductAttributes($product_id)));
$data = array_merge($data, array('product_description' => $this->getProductDescriptions($product_id)));
$data = array_merge($data, array('product_discount' => $this->getProductDiscounts($product_id)));
$data = array_merge($data, array('product_image' => $productImages));
$data = array_merge($data, array('product_option' => $this->getProductOptions($product_id)));
$data = array_merge($data, array('product_related' => $this->getProductRelated($product_id)));
$data = array_merge($data, array('product_special' => $this->getProductSpecials($product_id)));
$data = array_merge($data, array('product_category' => $this->getProductCategories($product_id)));
$data = array_merge($data, array('product_download' => $this->getProductDownloads($product_id)));
$data = array_merge($data, array('product_store' => $this->getProductStores($product_id)));
$new_id = $this->addProduct();
$data['model'] = 'P' . $new_id;
$this->editProduct($new_id, $data);
$this->query("\n UPDATE PREFIX_product\n SET image = '" . $data['image'] . "',\n status = " . $data['status'] . "\n WHERE product_id = " . $new_id);
}
Cache::removeAll();
}
示例13: history
public function history()
{
$this->load->model('sale/return');
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
$this->model_sale_return->addReturnHistory($this->request->get['return_id'], $this->request->post);
}
$this->data['histories'] = array();
$results = $this->model_sale_return->getReturnHistories($this->request->get['return_id'], 0, 10);
foreach ($results as $result) {
$this->data['histories'][] = array('notify' => $result['notify'] ? Language::getVar('SUMO_NOUN_YES') : Language::getVar('SUMO_NOUN_NO'), 'status' => $result['status'], 'comment' => nl2br($result['comment']), 'date_added' => Formatter::date($result['date_added']));
}
}
示例14: reward
public function reward()
{
$this->load->model('sale/customer');
if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->user->hasPermission('modify', 'sale/customer')) {
$this->model_sale_customer->addReward($this->request->get['customer_id'], $this->request->post['description'], $this->request->post['points']);
$return = array('success' => Language::getVar('SUMO_SUCCESS_REWARD_ADDED'));
$this->response->setOutput(json_encode($return));
}
if ($this->request->server['REQUEST_METHOD'] == 'POST' && !$this->user->hasPermission('modify', 'sale/customer')) {
$return = array('error' => Language::getVar('SUMO_ERROR_NO_PERMISSION'));
$this->response->setOutput(json_encode($return));
}
$this->data['rewards'] = array();
$results = $this->model_sale_customer->getRewards($this->request->get['customer_id']);
foreach ($results as $result) {
$this->data['rewards'][] = array_merge($result, array('date_added' => Formatter::date($result['date_added'])));
}
$this->data['points_balance'] = $this->model_sale_customer->getRewardTotal($this->request->get['customer_id']);
}
示例15: getList
private function getList()
{
$this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SALES_DASHBOARD'), 'href' => $this->url->link('sale/dashboard')));
$this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SALES_INVOICES')));
// Find invoices
$allowedFilters = array('concept', 'sent', 'partially_paid', 'paid', 'credit', 'expired');
if (isset($this->request->get['filter']) && in_array($this->request->get['filter'], $allowedFilters)) {
$status = mb_strtoupper($this->request->get['filter']);
} else {
$status = array('CONCEPT', 'SENT', 'PARTIALLY_PAID', 'PAID', 'CREDIT');
}
$limit = 20;
$page_total_ex = $page_total_in = 0;
$page = isset($this->request->get['page']) ? $this->request->get['page'] : 1;
$filter = array('status' => $status, 'limit' => $limit, 'start' => ($page - 1) * $limit);
foreach ($this->model_sale_invoice->getInvoices($filter) as $invoice) {
// Customer is corporate or private?
if (!empty($invoice['customer_company_name'])) {
$customer = $invoice['customer_company_name'];
} else {
$customer = $invoice['customer_name'];
}
// Sent to the view
$this->data['invoices'][] = array('invoice_id' => $invoice['invoice_id'], 'invoice_no' => $invoice['invoice_no'], 'customer' => $customer, 'date' => Formatter::date($invoice['invoice_date']), 'amount' => Formatter::currency($invoice['total_amount']), 'status' => $invoice['status'], 'send' => $this->url->link('sale/invoice/send', 'token=' . $this->session->data['token'] . '&invoice_id=' . $invoice['invoice_id'], 'SSL'), 'view' => $this->url->link('sale/invoice/view', 'token=' . $this->session->data['token'] . '&invoice_id=' . $invoice['invoice_id'], 'SSL'), 'download' => $this->url->link('sale/invoice/download', 'token=' . $this->session->data['token'] . '&invoice_id=' . $invoice['invoice_id'], 'SSL'), 'update' => $this->url->link('sale/invoice/update', 'token=' . $this->session->data['token'] . '&invoice_id=' . $invoice['invoice_id'], 'SSL'));
$page_total_ex += $invoice['amount'] - $invoice['tax'];
$page_total_in += $invoice['amount'];
}
// In need of pagination?
$invoiceTotal = $this->model_sale_invoice->getTotalInvoices($filter);
if ($invoiceTotal > $limit) {
$pagination = new Pagination();
$pagination->total = $product_total;
$pagination->limit = $limit;
$pagination->page = $page;
$pagination->url = $this->url->link('sale/invoice', 'token=' . $this->session->data['token'] . '&page={page}' . (!is_array($status) ? '&status=' . $status : ''));
$this->data['pagination'] = $pagination->renderAdmin();
} else {
$this->data['pagination'] = false;
}
$this->data = array_merge($this->data, array('page_total_ex' => Formatter::currency($page_total_ex), 'page_total_in' => Formatter::currency($page_total_in), 'status' => !is_array($status) ? Language::getVar('SUMO_NOUN_' . mb_strtoupper($status)) : Language::getVar('SUMO_NOUN_DEFAULT'), 'delete' => $this->url->link('sale/invoice/delete', 'token=' . $this->session->data['token'], 'SSL'), 'insert' => $this->url->link('sale/invoice/insert', 'token=' . $this->session->data['token'], 'SSL'), 'filter' => $this->url->link('sale/invoice', 'token=' . $this->session->data['token'] . '&filter=', 'SSL'), 'overview' => $this->url->link('sale/invoice', 'token=' . $this->session->data['token'], 'SSL')));
$this->template = 'sale/invoice_list.tpl';
$this->children = array('common/header', 'common/footer');
$this->response->setOutput($this->render());
}