diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php
index f171ff0f1..52b90a571 100644
--- a/admin-dev/ajax.php
+++ b/admin-dev/ajax.php
@@ -87,7 +87,7 @@ if (Tools::isSubmit('ajaxProductManufacturers'))
if (Tools::isSubmit('ajaxReferrers'))
{
- require('tabs/AdminReferrers.php');
+ require(_PS_CONTROLLER_DIR_.'admin/AdminReferrersController.php');
}
if (Tools::isSubmit('ajaxProductSuppliers'))
diff --git a/admin-dev/tabs/AdminReferrers.php b/admin-dev/tabs/AdminReferrers.php
deleted file mode 100644
index ac52b5b72..000000000
--- a/admin-dev/tabs/AdminReferrers.php
+++ /dev/null
@@ -1,471 +0,0 @@
-
-* @copyright 2007-2011 PrestaShop SA
-* @version Release: $Revision: 6844 $
-* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-if (!defined('_PS_ADMIN_DIR_')) define('_PS_ADMIN_DIR_', getcwd().'/..');
-
-if (Tools::getValue('token') == Tools::getAdminToken('AdminReferrers'.(int)(Tab::getIdFromClassName('AdminReferrers')).(int)(Tools::getValue('id_employee'))))
-{
- if (Tools::isSubmit('ajaxProductFilter'))
- Referrer::getAjaxProduct((int)(Tools::getValue('id_referrer')), (int)(Tools::getValue('id_product')), new Employee((int)(Tools::getValue('id_employee'))));
- else if (Tools::isSubmit('ajaxFillProducts'))
- {
- $jsonArray = array();
- $result = Db::getInstance()->executeS('
- SELECT p.id_product, pl.name
- FROM '._DB_PREFIX_.'product p
- LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)(Tools::getValue('id_lang')).')
- '.(Tools::getValue('filter') != 'undefined' ? 'WHERE name LIKE "%'.pSQL(Tools::getValue('filter')).'%"' : ''));
- foreach ($result as $row)
- $jsonArray[] = '{id_product:'.(int)($row['id_product']).',name:\''.addslashes($row['name']).'\'}';
- die ('['.implode(',', $jsonArray).']');
- }
-}
-
-include_once(dirname(__FILE__).'/AdminStats.php');
-
-class AdminReferrers extends AdminTab
-{
- public function __construct()
- {
- $this->table = 'referrer';
- $this->className = 'Referrer';
- $this->view = true;
- $this->edit = true;
- $this->delete = true;
-
- parent::__construct();
-
- $this->_select = 'SUM(sa.cache_visitors) AS cache_visitors, SUM(sa.cache_visits) AS cache_visits, SUM(sa.cache_pages) AS cache_pages,
- SUM(sa.cache_registrations) AS cache_registrations, SUM(sa.cache_orders) AS cache_orders, SUM(sa.cache_sales) AS cache_sales,
- IF(sa.cache_orders > 0, ROUND(sa.cache_sales/sa.cache_orders, 2), 0) as cart, (sa.cache_visits*click_fee) as fee0,
- (sa.cache_orders*base_fee) as fee1, (sa.cache_sales*percent_fee/100) as fee2';
- $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'referrer_shop` sa ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_shop IN ('.implode(', ', $this->context->shop->getListOfID()).'))';
- $this->_group = 'GROUP BY sa.id_referrer';
- $this->fieldsDisplay = array(
- 'id_referrer' => array('title' => $this->l('ID'), 'width' => 25, 'align' => 'center'),
- 'name' => array('title' => $this->l('Name'), 'width' => 80),
- 'cache_visitors' => array('title' => $this->l('Visitors'), 'width' => 30, 'align' => 'center'),
- 'cache_visits' => array('title' => $this->l('Visits'), 'width' => 30, 'align' => 'center'),
- 'cache_pages' => array('title' => $this->l('Pages'), 'width' => 30, 'align' => 'center'),
- 'cache_registrations' => array('title' => $this->l('Reg.'), 'width' => 30, 'align' => 'center'),
- 'cache_orders' => array('title' => $this->l('Ord.'), 'width' => 30, 'align' => 'center'),
- 'cache_sales' => array('title' => $this->l('Sales'), 'width' => 80, 'align' => 'right', 'prefix' => '', 'suffix' => '', 'price' => true),
- 'cart' => array('title' => $this->l('Avg. cart'), 'width' => 50, 'align' => 'right', 'price' => true),
- 'cache_reg_rate' => array('title' => $this->l('Reg. rate'), 'width' => 30, 'align' => 'center'),
- 'cache_order_rate' => array('title' => $this->l('Order rate'), 'width' => 30, 'align' => 'center'),
- 'fee0' => array('title' => $this->l('Click'), 'width' => 30, 'align' => 'right', 'price' => true),
- 'fee1' => array('title' => $this->l('Base'), 'width' => 30, 'align' => 'right', 'price' => true),
- 'fee2' => array('title' => $this->l('Percent'), 'width' => 30, 'align' => 'right', 'price' => true));
- }
-
- private function enableCalendar()
- {
- return (!Tools::isSubmit('add'.$this->table) AND !Tools::isSubmit('submitAdd'.$this->table) AND !Tools::isSubmit('update'.$this->table));
- }
-
- public function displayJavascript()
- {
- $products = Product::getSimpleProducts($this->context->language->id);
- $productsArray = array();
- foreach ($products as $product)
- $productsArray[] = $product['id_product'];
-
- return '
- ';
- }
-
- public function display()
- {
- if (!Tools::isSubmit('viewreferrer'))
- echo $this->displayJavascript();
-
- if ($this->enableCalendar())
- {
- echo '
-
- '.AdminStatsTab::displayCalendarStatic(array('Calendar' => $this->l('Calendar'), 'Day' => $this->l('Today'), 'Month' => $this->l('Month'), 'Year' => $this->l('Year'))).'
-
';
- if (!Tools::isSubmit('viewreferrer'))
- echo '
-
-
-
';
- }
- echo '
';
- parent::display();
- echo '
';
- }
-
- public function postProcess()
- {
- if ($this->enableCalendar())
- {
- $calendarTab = new AdminStats();
- $calendarTab->postProcess();
- }
-
- if (Tools::isSubmit('submitSettings'))
- if ($this->tabAccess['edit'] === '1')
- if (Configuration::updateValue('TRACKING_DIRECT_TRAFFIC', (int)(Tools::getValue('tracking_dt'))))
- Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.Tools::getValue('token'));
-
- if (ModuleGraph::getDateBetween() != Configuration::get('PS_REFERRERS_CACHE_LIKE') OR Tools::isSubmit('submitRefreshCache'))
- Referrer::refreshCache();
- if (Tools::isSubmit('submitRefreshIndex'))
- Referrer::refreshIndex();
-
- return parent::postProcess();
- }
-
- public function displayForm($isMainTab = true)
- {
- parent::displayForm();
-
- if (!($obj = $this->loadObject(true)))
- return;
- foreach (array('http_referer_like', 'http_referer_regexp', 'request_uri_like', 'request_uri_regexp') as $field)
- $obj->{$field} = str_replace('\\', '\\\\', $obj->{$field});
- $uri = Tools::getHttpHost(true, true).__PS_BASE_URI__;
-
- echo '
- ';
- }
-
- public function viewreferrer()
- {
- $referrer = new Referrer((int)(Tools::getValue('id_referrer')));
-
- $displayTab = array(
- 'uniqs' => $this->l('Unique visitors'),
- 'visitors' => $this->l('Visitors'),
- 'visits' => $this->l('Visits'),
- 'pages' => $this->l('Pages viewed'),
- 'registrations' => $this->l('Registrations'),
- 'orders' => $this->l('Orders'),
- 'sales' => $this->l('Sales'),
- 'reg_rate' => $this->l('Registration rate'),
- 'order_rate' => $this->l('Order rate'),
- 'click_fee' => $this->l('Click fee'),
- 'base_fee' => $this->l('Base fee'),
- 'percent_fee' => $this->l('Percent fee'));
- echo '
-
-
- ';
- }
-
- public function displayListContent($token = NULL)
- {
- $irow = 0;
- if ($this->_list)
- foreach ($this->_list AS $tr)
- {
- $id = $tr[$this->identifier];
- echo '
- | ';
- foreach ($this->fieldsDisplay AS $key => $params)
- {
- echo ''.(isset($params['prefix']) ? $params['prefix'] : '');
- if (isset($tr[$key]) AND isset($params['price']))
- echo Tools::displayPrice($tr[$key], $this->context->currency);
- elseif (isset($tr[$key]))
- echo $tr[$key];
- else
- echo '--';
- echo (isset($params['suffix']) ? $params['suffix'] : '').' | ';
- }
- echo '
-
-
-
-
-
-
-
- |
';
- }
- }
-}
-
-
diff --git a/admin-dev/themes/template/helper/form/form.tpl b/admin-dev/themes/template/helper/form/form.tpl
index f3e77b01d..e6b53d81b 100644
--- a/admin-dev/themes/template/helper/form/form.tpl
+++ b/admin-dev/themes/template/helper/form/form.tpl
@@ -90,258 +90,276 @@
{if $form_id}
{/if}
-
- {block name="other_fieldsets"}{/block}
+ {if isset($fields.tinymce) && $fields.tinymce}
+
+
+
+ {/if}
+
+ {block name="other_fieldsets"}{/block}
+ {if isset($fields[$f+1])}
{/if}
+ {/foreach}
{/block}
diff --git a/admin-dev/themes/template/helper/list/list_header.tpl b/admin-dev/themes/template/helper/list/list_header.tpl
index 42e46a93f..a84a89fe9 100644
--- a/admin-dev/themes/template/helper/list/list_header.tpl
+++ b/admin-dev/themes/template/helper/list/list_header.tpl
@@ -79,6 +79,8 @@
{block name="leadin"}{/block}
{/if}
+{block name="override_header"}{/block}
+