bebeboutik/modules/sensefuel/sensefuel.php
Michael RICOIS 030d9c812d global var
2017-12-04 09:53:55 +01:00

97 lines
2.5 KiB
PHP

<?php
include_once _PS_MODULE_DIR_ . 'sensefuel/models/SenseFuelFluxExport.php';
class SenseFuel extends Module
{
public static $ACTIVE_VERSION_ARRAY = array('com', 'fr');
public static $SETUP_VERSION_ARRAY = array();
private $display = false;
public function __construct()
{
$this->name = 'sensefuel';
$this->tab = 'shipping_logistics';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('Create Sensefuel flux');
$this->description = $this->l('Allows the creation of a google shopping flux for indexing motor sensefuel');
$this->version = '1.0';
$this->author = 'Antadis';
if (!Tools::isCli()) {
$this->_checkDisplay();
}
}
public function install()
{
if (!parent::install()
|| !$this->registerHook('footer')
|| !$this->registerHook('top')
|| !$this->registerHook('subtop')
) {
return false;
}
return true;
}
private function _checkDisplay()
{
global $site_version, $smarty, $page_name, $cookie;
// Groupe test
/*$groups = Customer::getGroupsStatic($cookie->id_customer);
if (in_array(2, array_values($groups))) {
$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)
{
if(_PS_MOBILE_){
return false;
}
global $smarty;
$smarty->assign(array('display' => $this->display));
return self::display(__FILE__, 'views/top-sensefuel.tpl');
}
public function hookSubTop($params)
{
if(!_PS_MOBILE_){
return false;
}
global $smarty;
$smarty->assign(array('display' => $this->display));
return self::display(__FILE__, 'views/top-sensefuel.tpl');
}
public function hookFooter($params)
{
global $smarty, $site_version;
$smarty->assign(array('display' => $this->display));
$smarty->assign(array('sensefuelversion' => $site_version));
return self::display(__FILE__, 'views/footer.tpl');
}
}