[*] BO #PSFV-94 : Added AdminStatsConfController

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10012 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-11-09 16:58:49 +00:00
parent 4068f50cd2
commit f864d987fd
9 changed files with 169 additions and 107 deletions
-2
View File
@@ -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'))))
{
-100
View File
@@ -1,100 +0,0 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/osl-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 <contact@prestashop.com>
* @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 '<script type="text/javascript">var engineDescriptions = '.Tools::jsonEncode($listEngineDescription).';</script>';
$this->displayOptionTypeSelect($key, $field, $value);
echo '<div id="render_engine_description">'.$listEngineDescription[$value].'</div>';
}
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 '<script type="text/javascript">var gridDescriptions = '.Tools::jsonEncode($listEngineDescription).';</script>';
$this->displayOptionTypeSelect($key, $field, $value);
echo '<div id="render_grid_description">'.$listEngineDescription[$value].'</div>';
}
}
@@ -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 <contact@prestashop.com>
* @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"}
<div class="margin-form">
{if $field['type'] == 'selectEngine'}
<script type="text/javascript">var engineDescriptions = {$list_engine_description_stats_js};</script>
<select name="{$key}" {if isset($field['js']) === true} onchange="{$field['js']}"{/if} id="{$key}">
{foreach $field.list as $k => $option}
<option value="{if isset($option['cast'])}{$option[$field.identifier]}{else}{$option[$field['identifier']]}{/if}"
{if $field.value == $option[$field['identifier']]} selected="selected"{/if}>
{$option.name}
</option>
{/foreach}
</select>
<div id="render_engine_description">{$list_engine_description_stats[$field.value]}</div>
{elseif $field['type'] == 'selectGrid'}
<script type="text/javascript">var gridDescriptions = {$list_engine_description_grid_js};</script>
<select name="{$key}" {if isset($field['js']) === true} onchange="{$field['js']}"{/if} id="{$key}">
{foreach $field.list as $k => $option}
<option value="{if isset($option['cast'])}{$option[$field.identifier]}{else}{$option[$field['identifier']]}{/if}"
{if $field.value == $option[$field['identifier']]} selected="selected"{/if}>
{$option.name}
</option>
{/foreach}
</select>
<div id="render_grid_description">{$list_engine_description_grid[$field.value]}</div>
{/if}
{/block}
{block name="end_field_block"}</div>{/block}