Merge branch 'ticket-14698-sensefuel' into develop

This commit is contained in:
Michael RICOIS 2017-12-04 09:48:47 +01:00
commit 6fbc309c2d

View File

@ -7,7 +7,7 @@ class SenseFuel extends Module
public static $ACTIVE_VERSION_ARRAY = array('com', 'fr'); public static $ACTIVE_VERSION_ARRAY = array('com', 'fr');
public static $SETUP_VERSION_ARRAY = array(); public static $SETUP_VERSION_ARRAY = array();
private $display = true; private $display = false;
public function __construct() public function __construct()
{ {
@ -43,13 +43,21 @@ class SenseFuel extends Module
private function _checkDisplay() private function _checkDisplay()
{ {
global $cookie; global $site_version, $smarty, $page_name, $cookie;
// Groupe test // Groupe test
/*$groups = Customer::getGroupsStatic($cookie->id_customer); /*$groups = Customer::getGroupsStatic($cookie->id_customer);
if (in_array(2, array_values($groups))) { if (in_array(2, array_values($groups))) {
$this->display = true; $this->display = true;
}*/ }*/
if (null !== $site_version &&
null !== $page_name &&
in_array($site_version, self::$ACTIVE_VERSION_ARRAY, true) /*&&
in_array($page_name, array('index', 'category', 'product'), true)*/
) {
$this->display = true;
}
} }
public function hookTop($params) public function hookTop($params)
@ -58,28 +66,10 @@ class SenseFuel extends Module
return false; return false;
} }
global $site_version, $smarty, $page_name, $cookie; global $smarty;
$smarty->assign(array('display' => $this->display));
if (null !== $site_version && return self::display(__FILE__, 'views/top-sensefuel.tpl');
null !== $page_name &&
in_array($site_version, self::$ACTIVE_VERSION_ARRAY, true) /*&&
in_array($page_name, array('index', 'category', 'product'), true)*/
) {
$smarty->assign(array('display' => $this->display));
return self::display(__FILE__, 'views/top-sensefuel.tpl');
}
if (null !== $site_version &&
null !== $page_name &&
in_array($site_version, self::$SETUP_VERSION_ARRAY, true) /*&&
in_array($page_name, array('index', 'category', 'product'), true) &&
Tools::isConnectedToBackOffice()*/
) {
return self::display(__FILE__, 'views/top-sensefuel.tpl');
}
return false;
} }
public function hookSubTop($params) public function hookSubTop($params)
@ -88,46 +78,20 @@ class SenseFuel extends Module
return false; return false;
} }
global $site_version, $smarty, $page_name; global $smarty;
$smarty->assign(array('display' => $this->display));
if (null !== $site_version && return self::display(__FILE__, 'views/top-sensefuel.tpl');
null !== $page_name &&
in_array($site_version, self::$ACTIVE_VERSION_ARRAY , true) /*&&
in_array($page_name, array('index', 'category', 'product'), true)*/
) {
$smarty->assign(array('display' => $this->display));
return self::display(__FILE__, 'views/top-sensefuel.tpl');
}
if (null !== $site_version &&
null !== $page_name &&
in_array($site_version, self::$SETUP_VERSION_ARRAY , true) /*&&
in_array($page_name, array('index', 'category', 'product'), true) &&
Tools::isConnectedToBackOffice()*/
) {
return self::display(__FILE__, 'views/top-sensefuel.tpl');
}
return false;
} }
public function hookFooter($params) public function hookFooter($params)
{ {
global $site_version, $smarty; global $smarty;
$display = false; $smarty->assign(array('display' => $this->display));
$smarty->assign(array('sensefuelversion' => $site_version));
if (null !== $site_version &&
( in_array($site_version, self::$ACTIVE_VERSION_ARRAY, true)
|| in_array($site_version, self::$SETUP_VERSION_ARRAY, true))) {
$smarty->assign(array('display' => $this->display));
$smarty->assign(array('sensefuelversion' => $site_version));
return self::display(__FILE__, 'views/footer.tpl'); return self::display(__FILE__, 'views/footer.tpl');
}
return false;
} }
} }