Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
This commit is contained in:
@@ -68,27 +68,27 @@
|
||||
<ul class="dropdown-menu">
|
||||
{foreach $pagination AS $value}
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="pagination-items-page" data-items="{$value|intval}">{$value}</a>
|
||||
<a href="javascript:void(0);" class="pagination-items-page" data-items="{$value|intval}" data-list-id="{$list_id}">{$value}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
/ {$list_total} {l s='result(s)'}
|
||||
<input type="hidden" id="pagination-items-page" name="{$list_id}_pagination" value="{$selected_pagination|intval}" />
|
||||
<input type="hidden" id="{$list_id}-pagination-items-page" name="{$list_id}_pagination" value="{$selected_pagination|intval}" />
|
||||
</span>
|
||||
<script type="text/javascript">
|
||||
$('.pagination-items-page').on('click',function(e){
|
||||
e.preventDefault();
|
||||
$('#pagination-items-page').val($(this).data("items")).closest("form").submit();
|
||||
$('#'+$(this).data("list-id")+'-pagination-items-page').val($(this).data("items")).closest("form").submit();
|
||||
});
|
||||
</script>
|
||||
<ul class="pagination pull-right">
|
||||
<li {if $page <= 1}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="1">
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="1" data-list-id="{$list_id}">
|
||||
<i class="icon-double-angle-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li {if $page <= 1}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$page - 1}">
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$page - 1}" data-list-id="{$list_id}">
|
||||
<i class="icon-angle-left"></i>
|
||||
</a>
|
||||
</li>
|
||||
@@ -106,17 +106,17 @@
|
||||
{assign p $total_pages}
|
||||
{else}
|
||||
<li {if $p == $page}class="active"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$p}">{$p}</a>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$p}" data-list-id="{$list_id}">{$p}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/while}
|
||||
<li {if $page > $total_pages}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$page + 1}">
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$page + 1}" data-list-id="{$list_id}">
|
||||
<i class="icon-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li {if $page > $total_pages}class="disabled"{/if}>
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$total_pages}">
|
||||
<a href="javascript:void(0);" class="pagination-link" data-page="{$total_pages}" data-list-id="{$list_id}">
|
||||
<i class="icon-double-angle-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
@@ -124,7 +124,7 @@
|
||||
<script type="text/javascript">
|
||||
$('.pagination-link').on('click',function(e){
|
||||
e.preventDefault();
|
||||
$('#submitFilter'+'{$list_id}').val($(this).data("page")).closest("form").submit();
|
||||
$('#submitFilter'+$(this).data("list-id")).val($(this).data("page")).closest("form").submit();
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -533,7 +533,6 @@ class HelperListCore extends Helper
|
||||
isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null
|
||||
);
|
||||
|
||||
|
||||
if ($this->position_identifier && (int)Tools::getValue($this->position_identifier, 1))
|
||||
$table_id = substr($this->identifier, 3, strlen($this->identifier));
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ function refreshDashboard(module_name, use_push)
|
||||
action:'refreshDashboard',
|
||||
module:module_list[module_id],
|
||||
dashboard_use_push:Number(use_push)
|
||||
},
|
||||
},
|
||||
dataType: 'json',
|
||||
success : function(widgets){
|
||||
for (var widget_name in widgets)
|
||||
|
||||
@@ -96,76 +96,16 @@ class BlockWishList extends Module
|
||||
$this->_html .= '<div class="alert error">'.$this->l('Activate module : Invalid choice.').'</div>';
|
||||
$this->_html .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>';
|
||||
}
|
||||
$this->_displayForm();
|
||||
return ($this->_html);
|
||||
|
||||
$this->_html .= $this->renderJS();
|
||||
$this->_html .= $this->renderForm();
|
||||
if (Tools::getValue('id_customer') && Tools::getValue('id_wishlist'))
|
||||
$this->_html .= $this->renderList((int)Tools::getValue('id_wishlist'));
|
||||
|
||||
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
private function _displayForm()
|
||||
{
|
||||
$this->_displayFormView();
|
||||
}
|
||||
|
||||
private function _displayFormView()
|
||||
{
|
||||
$customers = Customer::getCustomers();
|
||||
if (!sizeof($customers))
|
||||
return;
|
||||
$id_customer = (int)(Tools::getValue('id_customer'));
|
||||
if (!$id_customer)
|
||||
$id_customer = $customers[0]['id_customer'];
|
||||
$this->_html .= '<br />
|
||||
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" id="listing">
|
||||
<fieldset>
|
||||
<legend><img src="'.$this->_path.'img/icon/package_go.png" alt="" title="" />'.$this->l('Listing').'</legend>
|
||||
|
||||
<label>'.$this->l('Customers').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_customer" onchange="$(\'#listing\').submit();">';
|
||||
foreach ($customers as $customer)
|
||||
{
|
||||
$this->_html .= '<option value="'.(int)($customer['id_customer']).'"';
|
||||
if ($customer['id_customer'] == $id_customer)
|
||||
$this->_html .= ' selected="selected"';
|
||||
$this->_html .= '>'.htmlentities($customer['firstname'], ENT_COMPAT, 'UTF-8').' '.htmlentities($customer['lastname'], ENT_COMPAT, 'UTF-8').'</option>';
|
||||
}
|
||||
$this->_html .= '
|
||||
</select>
|
||||
</div>';
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
$wishlists = WishList::getByIdCustomer($id_customer);
|
||||
if (!sizeof($wishlists))
|
||||
return ($this->_html .= '</fieldset></form>');
|
||||
$id_wishlist = false;
|
||||
foreach ($wishlists AS $row)
|
||||
if ($row['id_wishlist'] == Tools::getValue('id_wishlist'))
|
||||
{
|
||||
$id_wishlist = (int)(Tools::getValue('id_wishlist'));
|
||||
break;
|
||||
}
|
||||
if (!$id_wishlist)
|
||||
$id_wishlist = $wishlists[0]['id_wishlist'];
|
||||
$this->_html .= '
|
||||
<label>'.$this->l('Wishlists').'</label>
|
||||
<div class="margin-form">
|
||||
<select name="id_wishlist" onchange="$(\'#listing\').submit();">';
|
||||
foreach ($wishlists as $wishlist)
|
||||
{
|
||||
$this->_html .= '<option value="'.(int)($wishlist['id_wishlist']).'"';
|
||||
if ($wishlist['id_wishlist'] == $id_wishlist)
|
||||
{
|
||||
$this->_html .= ' selected="selected"';
|
||||
$counter = $wishlist['counter'];
|
||||
}
|
||||
$this->_html .= '>'.htmlentities($wishlist['name'], ENT_COMPAT, 'UTF-8').'</option>';
|
||||
}
|
||||
$this->_html .= '
|
||||
</select>
|
||||
</div>';
|
||||
$this->_displayProducts((int)($id_wishlist));
|
||||
$this->_html .= '</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$this->context->controller->addCSS(($this->_path).'blockwishlist.css', 'all');
|
||||
@@ -332,5 +272,137 @@ class BlockWishList extends Module
|
||||
{
|
||||
return $this->l('You must be logged in to manage your wishlists.');
|
||||
}
|
||||
}
|
||||
|
||||
public function renderJS()
|
||||
{
|
||||
return "<script>
|
||||
$(document).ready(function () { $('#id_customer, #id_wishlist').change( function () { $('#module_form').submit(); }) });
|
||||
</script>";
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$customers = Customer::getCustomers();
|
||||
foreach ($customers as $key => $val)
|
||||
$customers[$key]['name'] = $val['firstname'].' '.$val['lastname'];
|
||||
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Listing'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Customers :'),
|
||||
'name' => 'id_customer',
|
||||
'options' => array(
|
||||
'default' => array('value' => 0, 'label' => $this->l('Choose customer')),
|
||||
'query' => $customers,
|
||||
'id' => 'id_customer',
|
||||
'name' => 'name'
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if ($id_customer = Tools::getValue('id_customer'))
|
||||
{
|
||||
require_once(dirname(__FILE__).'/WishList.php');
|
||||
$wishlists = WishList::getByIdCustomer($id_customer);
|
||||
$fields_form['form']['input'][] = array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Wishlist :'),
|
||||
'name' => 'id_wishlist',
|
||||
'options' => array(
|
||||
'default' => array('value' => 0, 'label' => $this->l('Choose wishlist')),
|
||||
'query' => $wishlists,
|
||||
'id' => 'id_wishlist',
|
||||
'name' => 'name'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->fields_form = array();
|
||||
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitModule';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'id_customer' => Tools::getValue('id_customer'),
|
||||
'id_wishlist' => Tools::getValue('id_wishlist'),
|
||||
);
|
||||
}
|
||||
|
||||
public function renderList($id_wishlist)
|
||||
{
|
||||
$wishlist = new WishList($id_wishlist);
|
||||
$products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $this->context->language->id);
|
||||
|
||||
foreach ($products as $key => $val)
|
||||
{
|
||||
$image = Image::getCover($val['id_product']);
|
||||
$products[$key]['image'] = $this->context->link->getImageLink($val['link_rewrite'], $image['id_image'], 'small');
|
||||
}
|
||||
|
||||
$fields_list = array(
|
||||
'image' => array(
|
||||
'title' => $this->l('Image'),
|
||||
'type' => 'image',
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Product'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'attributes_small' => array(
|
||||
'title' => $this->l('Combination'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'quantity' => array(
|
||||
'title' => $this->l('Quantity'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'priority' => array(
|
||||
'title' => $this->l('Priority'),
|
||||
'type' => 'priority',
|
||||
'values' => array($this->l('High'), $this->l('Medium'), $this->l('Low')),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$helper = new HelperList();
|
||||
$helper->shopLinkType = '';
|
||||
$helper->simple_header = true;
|
||||
$helper->actions = array();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->module = $this;
|
||||
$helper->identifier = 'image';
|
||||
$helper->title = $this->l('Product list');
|
||||
$helper->table = $this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
|
||||
$helper->tpl_vars = array('priority' => array($this->l('High'), $this->l('Medium'), $this->l('Low')));
|
||||
|
||||
return $helper->generateList($products, $fields_list);
|
||||
}
|
||||
}
|
||||
@@ -115,13 +115,7 @@ class Dashactivity extends Module
|
||||
'.($maintenance_ips ? 'AND ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '');
|
||||
$online_visitor = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
$order_nbr = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE `invoice_date` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER));
|
||||
|
||||
|
||||
$pending_orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
@@ -210,7 +204,6 @@ class Dashactivity extends Module
|
||||
|
||||
return array(
|
||||
'data_value' => array(
|
||||
'order_nbr' => $order_nbr,
|
||||
'pending_orders' => $pending_orders,
|
||||
'return_exchanges' => $return_exchanges,
|
||||
'abandoned_cart' => $abandoned_cart,
|
||||
@@ -352,6 +345,8 @@ class Dashactivity extends Module
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'DASHACTIVITY_SHOW_STOCK' => Configuration::get('PS_STOCK_MANAGEMENT'),
|
||||
'DASHACTIVITY_SHOW_RETURNS' => Configuration::get('PS_ORDER_RETURN'),
|
||||
'DASHACTIVITY_SHOW_PENDING' => Tools::getValue('DASHACTIVITY_SHOW_PENDING', Configuration::get('DASHACTIVITY_SHOW_PENDING')),
|
||||
'DASHACTIVITY_SHOW_NOTIFICATION' => Tools::getValue('DASHACTIVITY_SHOW_NOTIFICATION', Configuration::get('DASHACTIVITY_SHOW_NOTIFICATION')),
|
||||
'DASHACTIVITY_SHOW_CUSTOMERS' => Tools::getValue('DASHACTIVITY_SHOW_CUSTOMERS', Configuration::get('DASHACTIVITY_SHOW_CUSTOMERS')),
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*}
|
||||
<section id="dashactivity" class="panel widget{if $allow_push} allow_push{/if}">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-time"></i> {l s='Recent Activity'}
|
||||
<i class="icon-time"></i> {l s="Activity overview" mod="dashactivity"}
|
||||
<span class="panel-heading-action">
|
||||
<a class="list-toolbar-btn" href="#" onclick="toggleDashConfig('dashactivity'); return false;" title="configure">
|
||||
<i class="process-icon-configure"></i>
|
||||
@@ -38,49 +38,64 @@
|
||||
<header><i class="icon-wrench"></i> {l s='Configuration'}</header>
|
||||
{$dashactivity_config_form}
|
||||
</section>
|
||||
<section id="dash_orders" class="loading">
|
||||
<section id="dash_live" class="loading">
|
||||
<ul class="data_list_large">
|
||||
<li>
|
||||
<span class="data_label size_l">
|
||||
{l s='Orders'}<br/>
|
||||
<small class="text-muted">{l s='Within the last seven days'}</small>
|
||||
{l s='Online Visitor'}
|
||||
<small class="text-muted"><br/>
|
||||
{l s='In the last 30 minutes'}
|
||||
</small>
|
||||
</span>
|
||||
<span class="data_value size_xxl">
|
||||
<span id="order_nbr">
|
||||
</span><br/>
|
||||
<small class="dash_trend dash_trend_up"><span id="orders_trends"></span>%</small>
|
||||
<span id="online_visitor"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label size_l">
|
||||
{l s='Active Shopping Carts'}
|
||||
<small class="text-muted"><br/>
|
||||
{l s='In the last 30 minutes'}
|
||||
</small>
|
||||
</span>
|
||||
<span class="data_value size_xxl">
|
||||
<span id="active_shopping_cart"></span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
{if $DASHACTIVITY_SHOW_PENDING}
|
||||
<section id="dash_pending" class="loading">
|
||||
<header><i class="icon-time"></i> {l s='Pending'}</header>
|
||||
<header><i class="icon-time"></i> {l s='Currently Pending'}</header>
|
||||
<ul class="data_list">
|
||||
<li>
|
||||
<span class="data_label">{l s='Pending Orders'}</span>
|
||||
<span class="data_label">{l s='Orders'}</span>
|
||||
<span class="data_value size_l">
|
||||
<span id="pending_orders"></span>
|
||||
</span>
|
||||
</li>
|
||||
{if $DASHACTIVITY_SHOW_RETURNS}
|
||||
<li>
|
||||
<span class="data_label">{l s='Return/Exchanges'}</span>
|
||||
<span class="data_value size_l">
|
||||
<span id="return_exchanges"></span>
|
||||
</span>
|
||||
</li>
|
||||
{/if}
|
||||
<li>
|
||||
<span class="data_label">{l s='Abandoned Carts'}</span>
|
||||
<span class="data_value size_l">
|
||||
<span id="abandoned_cart"></span>
|
||||
</span>
|
||||
</li>
|
||||
{if $DASHACTIVITY_SHOW_STOCK}
|
||||
<li>
|
||||
<span class="data_label">{l s='Products Out of Stock'}</span>
|
||||
<span class="data_value size_l">
|
||||
<span id="products_out_of_stock"></span>
|
||||
</span>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
</section>
|
||||
{/if}
|
||||
@@ -111,7 +126,7 @@
|
||||
{/if}
|
||||
{if $DASHACTIVITY_SHOW_CUSTOMERS}
|
||||
<section id="dash_customers" class="loading">
|
||||
<header><i class="icon-user"></i> {l s='Customers'}</header>
|
||||
<header><i class="icon-user"></i> {l s='Customers & Newsletters'}</header>
|
||||
<ul class="data_list">
|
||||
<li>
|
||||
<span class="data_label">{l s='New Customers'}</span>
|
||||
@@ -120,31 +135,7 @@
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label">{l s='Online Visitor'}</span>
|
||||
<span class="data_value size_md">
|
||||
<span id="online_visitor"></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="data_label">
|
||||
{l s='Active Shopping Carts'}
|
||||
<small class="text-muted"><br/>
|
||||
{l s='In the last 30 minutes'}
|
||||
</small>
|
||||
</span>
|
||||
<span class="data_value size_md">
|
||||
<span id="active_shopping_cart"></span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
{/if}
|
||||
{if $DASHACTIVITY_SHOW_NEWSLETTER}
|
||||
<section id="dash_newsletter" class="loading">
|
||||
<header><i class="icon-envelope"></i> {l s='Newsletter'}</header>
|
||||
<ul class="data_list">
|
||||
<li>
|
||||
<span class="data_label">{l s='New Registrations'}</span>
|
||||
<span class="data_label">{l s='New Subscriptions'}</span>
|
||||
<span class="data_value size_md">
|
||||
<span id="new_registrations"></span>
|
||||
</span>
|
||||
|
||||
@@ -111,7 +111,6 @@ class Dashtrends extends Module
|
||||
$tmp_data['visits_score'][strtotime($row['date'])] = $row['visits_score'];
|
||||
}
|
||||
|
||||
// First we retrieve the
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT
|
||||
LEFT(`invoice_date`, 10) as date,
|
||||
|
||||
Reference in New Issue
Block a user