Activation/Désactivation sensefuel
This commit is contained in:
parent
699ff5d806
commit
e54c47815a
@ -4,9 +4,10 @@ include_once _PS_MODULE_DIR_ . 'sensefuel/models/SenseFuelFluxExport.php';
|
|||||||
|
|
||||||
class SenseFuel extends Module
|
class SenseFuel extends Module
|
||||||
{
|
{
|
||||||
|
public static $ACTIVE_VERSION_ARRAY = array('com', 'fr');
|
||||||
public static $ACTIVE_VERSION_ARRAY = array('fr', 'com', 'es', 'it');
|
|
||||||
public static $SETUP_VERSION_ARRAY = array();
|
public static $SETUP_VERSION_ARRAY = array();
|
||||||
|
|
||||||
|
private $display = true;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -21,6 +22,8 @@ class SenseFuel extends Module
|
|||||||
|
|
||||||
$this->version = '1.0';
|
$this->version = '1.0';
|
||||||
$this->author = 'Antadis';
|
$this->author = 'Antadis';
|
||||||
|
|
||||||
|
$this->_checkDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function install()
|
public function install()
|
||||||
@ -36,19 +39,32 @@ class SenseFuel extends Module
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function _checkDisplay()
|
||||||
|
{
|
||||||
|
global $cookie;
|
||||||
|
|
||||||
|
// Groupe test
|
||||||
|
$groups = Customer::getGroupsStatic($cookie->id_customer);
|
||||||
|
if (in_array(2, array_values($groups))) {
|
||||||
|
$this->display = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function hookTop($params)
|
public function hookTop($params)
|
||||||
{
|
{
|
||||||
if(_PS_MOBILE_){
|
if(_PS_MOBILE_){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $site_version, $page_name;
|
global $site_version, $smarty, $page_name, $cookie;
|
||||||
|
|
||||||
if (null !== $site_version &&
|
if (null !== $site_version &&
|
||||||
null !== $page_name &&
|
null !== $page_name &&
|
||||||
in_array($site_version, self::$ACTIVE_VERSION_ARRAY, true) /*&&
|
in_array($site_version, self::$ACTIVE_VERSION_ARRAY, true) /*&&
|
||||||
in_array($page_name, array('index', 'category', 'product'), true)*/
|
in_array($page_name, array('index', 'category', 'product'), true)*/
|
||||||
) {
|
) {
|
||||||
|
$smarty->assign(array('display' => $this->display));
|
||||||
|
|
||||||
return self::display(__FILE__, 'views/top-sensefuel.tpl');
|
return self::display(__FILE__, 'views/top-sensefuel.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,12 +85,16 @@ class SenseFuel extends Module
|
|||||||
if(!_PS_MOBILE_){
|
if(!_PS_MOBILE_){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
global $site_version, $page_name;
|
|
||||||
|
global $site_version, $smarty, $page_name;
|
||||||
|
|
||||||
if (null !== $site_version &&
|
if (null !== $site_version &&
|
||||||
null !== $page_name &&
|
null !== $page_name &&
|
||||||
in_array($site_version, self::$ACTIVE_VERSION_ARRAY , true) /*&&
|
in_array($site_version, self::$ACTIVE_VERSION_ARRAY , true) /*&&
|
||||||
in_array($page_name, array('index', 'category', 'product'), true)*/
|
in_array($page_name, array('index', 'category', 'product'), true)*/
|
||||||
) {
|
) {
|
||||||
|
$smarty->assign(array('display' => $this->display));
|
||||||
|
|
||||||
return self::display(__FILE__, 'views/top-sensefuel.tpl');
|
return self::display(__FILE__, 'views/top-sensefuel.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +113,16 @@ class SenseFuel extends Module
|
|||||||
public function hookFooter($params)
|
public function hookFooter($params)
|
||||||
{
|
{
|
||||||
global $site_version, $smarty;
|
global $site_version, $smarty;
|
||||||
|
|
||||||
|
$display = false;
|
||||||
|
|
||||||
if (null !== $site_version &&
|
if (null !== $site_version &&
|
||||||
( in_array($site_version, self::$ACTIVE_VERSION_ARRAY, true)
|
( in_array($site_version, self::$ACTIVE_VERSION_ARRAY, true)
|
||||||
|| in_array($site_version, self::$SETUP_VERSION_ARRAY, true))) {
|
|| in_array($site_version, self::$SETUP_VERSION_ARRAY, true))) {
|
||||||
$smarty->assign(array('sensefuelversion' => $site_version));
|
$smarty->assign(array('display' => $this->display));
|
||||||
return self::display(__FILE__, 'views/footer.tpl');
|
$smarty->assign(array('sensefuelversion' => $site_version));
|
||||||
|
|
||||||
|
return self::display(__FILE__, 'views/footer.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{if isset($sensefuelversion)}
|
{if isset($sensefuelversion) && $display}
|
||||||
{literal}
|
{literal}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function () {
|
(function () {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{if null !== $cookie && $cookie->isLogged()}
|
{if null !== $cookie && $cookie->isLogged()}
|
||||||
<div id="sensefuel">
|
<div id="sensefuel">
|
||||||
|
{if $display}
|
||||||
<form action="{$base_dir_ssl}search.php" id="search" role="search">
|
<form action="{$base_dir_ssl}search.php" id="search" role="search">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<div class="search_form">
|
<div class="search_form">
|
||||||
@ -8,6 +9,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<style>
|
<style>
|
||||||
#category #shop_category .shop_category_filter.horizontal .search {
|
#category #shop_category .shop_category_filter.horizontal .search {
|
||||||
|
Loading…
Reference in New Issue
Block a user