bebeboutik/modules/sensefuel/sensefuel.php
2017-11-21 14:55:52 +01:00

106 lines
3.1 KiB
PHP

<?php
include_once _PS_MODULE_DIR_ . 'sensefuel/models/SenseFuelFluxExport.php';
class SenseFuel extends Module
{
public static $ACTIVE_VERSION_ARRAY = array('fr', 'com', 'es', 'it');
public static $SETUP_VERSION_ARRAY = array();
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';
}
public function install()
{
if (!parent::install()
|| !$this->registerHook('footer')
|| !$this->registerHook('top')
|| !$this->registerHook('subtop')
) {
return false;
}
return true;
}
public function hookTop($params)
{
if(_PS_MOBILE_){
return false;
}
global $site_version, $page_name;
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)
) {
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)
{
if(!_PS_MOBILE_){
return false;
}
global $site_version, $page_name;
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)
) {
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)
{
global $site_version, $smarty;
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('sensefuelversion' => $site_version));
return self::display(__FILE__, 'views/footer.tpl');
}
return false;
}
}