diff --git a/admin-dev/tabs/AdminReferrers.php b/admin-dev/tabs/AdminReferrers.php index 90c2f3ced..ac52b5b72 100644 --- a/admin-dev/tabs/AdminReferrers.php +++ b/admin-dev/tabs/AdminReferrers.php @@ -26,8 +26,6 @@ */ if (!defined('_PS_ADMIN_DIR_')) define('_PS_ADMIN_DIR_', getcwd().'/..'); -include_once(_PS_ADMIN_DIR_.'/../config/config.inc.php'); -include_once(_PS_ADMIN_DIR_.'/init.php'); if (Tools::getValue('token') == Tools::getAdminToken('AdminReferrers'.(int)(Tab::getIdFromClassName('AdminReferrers')).(int)(Tools::getValue('id_employee')))) { diff --git a/admin-dev/tabs/AdminStatsConf.php b/admin-dev/tabs/AdminStatsConf.php deleted file mode 100644 index 882ee5755..000000000 --- a/admin-dev/tabs/AdminStatsConf.php +++ /dev/null @@ -1,100 +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 -*/ - -include_once(dirname(__FILE__).'/AdminStatsTab.php'); -include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); - -class AdminStatsConf extends AdminPreferences -{ - public function __construct() - { - parent::__construct(); - - $autocleanPeriod = array( - array('value' => 'never', 'name' => $this->l('Never')), - array('value' => 'week', 'name' => $this->l('Week')), - array('value' => 'month', 'name' => $this->l('Month')), - array('value' => 'year', 'name' => $this->l('Year')), - ); - - $this->optionsList = array( - 'general' => array( - 'title' => $this->l('General'), - 'icon' => 'tab-preferences', - 'fields' => array( - 'PS_STATS_RENDER' => array('title' => $this->l('Graph engine'), 'validation' => 'isGenericName', 'cast' => 'strval', 'type' => 'selectEngine'), - 'PS_STATS_GRID_RENDER' => array('title' => $this->l('Grid engine'), 'validation' => 'isGenericName', 'cast' => 'strval', 'type' => 'selectGrid'), - 'PS_STATS_OLD_CONNECT_AUTO_CLEAN' => array('title' => $this->l('Auto-clean period'), 'validation' => 'isGenericName', 'type' => 'select', 'list' => $autocleanPeriod, 'identifier' => 'value'), - ), - ), - ); - } - - public function displayOptionTypeSelectEngine($key, $field, $value) - { - $listEngineDescription = array(); - $listEngine = array(); - foreach (ModuleGraphEngine::getGraphEngines() as $k => $engine) - { - $listEngine[] = array( - 'name' => $engine[0], - 'value' => $k, - ); - $listEngineDescription[$k] = $engine[1]; - } - - $field['list'] = $listEngine; - $field['identifier'] = 'value'; - $field['js'] = '$(\'#render_engine_description\').html(engineDescriptions[$(this).val()])'; - - echo ''; - $this->displayOptionTypeSelect($key, $field, $value); - echo '
'.$listEngineDescription[$value].'
'; - } - - public function displayOptionTypeSelectGrid($key, $field, $value) - { - $listEngineDescription = array(); - $listEngine = array(); - foreach (ModuleGridEngine::getGridEngines() as $k => $engine) - { - $listEngine[] = array( - 'name' => $engine[0], - 'value' => $k, - ); - $listEngineDescription[$k] = $engine[1]; - } - - $field['list'] = $listEngine; - $field['identifier'] = 'value'; - $field['js'] = '$(\'#render_grid_description\').html(gridDescriptions[$(this).val()])'; - - echo ''; - $this->displayOptionTypeSelect($key, $field, $value); - echo '
'.$listEngineDescription[$value].'
'; - } -} diff --git a/admin-dev/themes/template/stats_conf/options.tpl b/admin-dev/themes/template/stats_conf/options.tpl new file mode 100644 index 000000000..23a37f2e4 --- /dev/null +++ b/admin-dev/themes/template/stats_conf/options.tpl @@ -0,0 +1,56 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 9540 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{extends file="helper/options/options.tpl"} + +{block name="start_field_block"} +
+ {if $field['type'] == 'selectEngine'} + + +
{$list_engine_description_stats[$field.value]}
+ {elseif $field['type'] == 'selectGrid'} + + +
{$list_engine_description_grid[$field.value]}
+ {/if} +{/block} + +{block name="end_field_block"}
{/block} \ No newline at end of file diff --git a/classes/AdminController.php b/classes/AdminController.php index 60102b4c5..dd371bd36 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -73,6 +73,7 @@ class AdminControllerCore extends Controller public $tpl_form_vars = array(); public $tpl_list_vars = array(); + public $tpl_option_vars = array(); public $tpl_view_vars = array(); public $fields_value = false; @@ -1439,6 +1440,7 @@ class AdminControllerCore extends Controller $helper->override_folder = $this->tpl_folder; $helper->id = $this->id; $helper->token = $this->token; + $helper->tpl_vars = $this->tpl_option_vars; $helper->shopLinkType = $this->shopLinkType; $helper->table = $this->table; $helper->currentIndex = self::$currentIndex; diff --git a/classes/HelperForm.php b/classes/HelperForm.php index b2a4c2e4a..dcc19394b 100644 --- a/classes/HelperForm.php +++ b/classes/HelperForm.php @@ -83,6 +83,8 @@ class HelperFormCore extends Helper $this->tpl->assign(array( 'submit_action' => $this->submit_action, 'toolbar_btn' => $this->toolbar_btn, + 'show_toolbar' => $this->show_toolbar, + 'toolbar_fix' => $this->toolbar_fix, 'title' => $this->title, 'firstCall' => $this->first_call, 'current' => $this->currentIndex, @@ -102,8 +104,6 @@ class HelperFormCore extends Helper 'iso' => file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en', 'path_css' => _THEME_CSS_DIR_, 'ad' => dirname($_SERVER["PHP_SELF"]), - 'show_toolbar' => $this->show_toolbar, - 'toolbar_fix' => $this->toolbar_fix, )); return parent::generate(); diff --git a/classes/HelperOptions.php b/classes/HelperOptions.php index 48efcaaee..f6ae3d968 100644 --- a/classes/HelperOptions.php +++ b/classes/HelperOptions.php @@ -158,9 +158,9 @@ class HelperOptionsCore extends Helper 'option_list' => $option_list, 'current_id_lang' => $this->context->language->id, 'required_fields' => isset($required_fields) ? $required_fields : false, - 'languages' => isset($languages) ? $languages : null, + 'languages' => isset($languages) ? $languages : null )); - return $this->tpl->fetch(); + return parent::generate(); } /** diff --git a/controllers/admin/AdminStatsConfController.php b/controllers/admin/AdminStatsConfController.php new file mode 100644 index 000000000..5ac940f17 --- /dev/null +++ b/controllers/admin/AdminStatsConfController.php @@ -0,0 +1,105 @@ + +* @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 +*/ + +class AdminStatsConfControllerCore extends AdminPreferencesControllerCore +{ + public function __construct() + { + $autoclean_period = array( + array('value' => 'never', 'name' => $this->l('Never')), + array('value' => 'week', 'name' => $this->l('Week')), + array('value' => 'month', 'name' => $this->l('Month')), + array('value' => 'year', 'name' => $this->l('Year')), + ); + + $list_engine_description_stats = array(); + $list_select_stats = array(); + foreach (ModuleGraphEngine::getGraphEngines() as $k => $engine) + { + $list_select_stats[] = array( + 'name' => $engine[0], + 'value' => $k, + ); + $list_engine_description_stats[$k] = $engine[1]; + } + + $list_engine_description_grid = array(); + $list_select_grid = array(); + foreach (ModuleGridEngine::getGridEngines() as $k => $engine) + { + $list_select_grid[] = array( + 'name' => $engine[0], + 'value' => $k, + ); + $list_engine_description_grid[$k] = $engine[1]; + } + + $this->options = array( + 'general' => array( + 'title' => $this->l('General'), + 'icon' => 'tab-preferences', + 'fields' => array( + 'PS_STATS_RENDER' => array( + 'title' => $this->l('Graph engine'), + 'validation' => 'isGenericName', + 'cast' => 'strval', + 'type' => 'selectEngine', + 'list' => $list_select_stats, + 'identifier' => 'value', + 'js' => '$(\'#render_engine_description\').html(engineDescriptions[$(this).val()])' + ), + 'PS_STATS_GRID_RENDER' => array( + 'title' => $this->l('Grid engine'), + 'validation' => 'isGenericName', + 'cast' => 'strval', + 'type' => 'selectGrid', + 'list' => $list_select_grid, + 'identifier' => 'value', + 'js' => '$(\'#render_engine_description\').html(engineDescriptions[$(this).val()])' + ), + 'PS_STATS_OLD_CONNECT_AUTO_CLEAN' => array( + 'title' => $this->l('Auto-clean period'), + 'validation' => 'isGenericName', + 'type' => 'select', + 'list' => $autoclean_period, + 'identifier' => 'value' + ) + ), + 'submit' => array() + ) + ); + + $this->tpl_option_vars = array ( + 'list_engine_description_stats_js' => Tools::jsonEncode($list_engine_description_stats), + 'list_engine_description_stats' => $list_engine_description_stats, + 'list_engine_description_grid_js' => Tools::jsonEncode($list_engine_description_grid), + 'list_engine_description_grid' => $list_engine_description_grid + ); + + parent::__construct(); + } +} diff --git a/controllers/admin/AdminStatsTabController.php b/controllers/admin/AdminStatsTabController.php index 1e14a723b..3b0d73a6c 100644 --- a/controllers/admin/AdminStatsTabController.php +++ b/controllers/admin/AdminStatsTabController.php @@ -36,6 +36,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor public function initContent() { + $this->toolbar_title = $this->l('Stats'); if ($this->display == 'view') { // Some controllers use the view action without an object diff --git a/modules/statsforecast/statsforecast.php b/modules/statsforecast/statsforecast.php index e92f4ab2d..63caa2004 100644 --- a/modules/statsforecast/statsforecast.php +++ b/modules/statsforecast/statsforecast.php @@ -66,7 +66,7 @@ class StatsForecast extends Module public function hookAdminStatsModules() { - $ru = AdminTab::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token'); + $ru = AdminController::$currentIndex.'&module='.$this->name.'&token='.Tools::getValue('token'); $db = Db::getInstance();