101 lines
2.8 KiB
PHP
101 lines
2.8 KiB
PHP
<?php
|
|
if (!defined('_PS_VERSION_'))
|
|
exit;
|
|
|
|
class Antadis_Iframefacebook extends Module
|
|
{
|
|
|
|
public static $ModuleRoutes = array(
|
|
'module-antadis_iframefacebook-stores' => array(
|
|
'controller' => 'stores',
|
|
'rule' => 'the-stores',
|
|
'keywords' =>array(
|
|
'fc' => array(),
|
|
'module' => array(),
|
|
'controller' => array(),
|
|
),
|
|
'params' => array(
|
|
'fc' => 'module',
|
|
'module' => 'antadis_iframefacebook',
|
|
'controller' => 'stores',
|
|
)
|
|
),
|
|
);
|
|
|
|
|
|
public function __construct()
|
|
{
|
|
$this->name = 'antadis_iframefacebook';
|
|
$this->tab = 'advertising_marketing';
|
|
$this->version = '1.0';
|
|
$this->author = 'Antadis';
|
|
$this->need_instance = 0;
|
|
|
|
parent::__construct();
|
|
|
|
$this->displayName = $this->l('Page pour Iframe facebook');
|
|
$this->description = $this->l('Page Magasin pour onglet facebook');
|
|
$this->confirmUninstall = $this->l('Etes vous sur de vouloir désinstaller ce module ?');
|
|
}
|
|
|
|
public function install()
|
|
{
|
|
if (!parent::install() || !$this->installDb()){
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function installDb()
|
|
{
|
|
$prefix = _DB_PREFIX_ ;
|
|
$engine = _MYSQL_ENGINE_;
|
|
|
|
$statements = array();
|
|
/*$statements[] = sprintf('CREATE TABLE IF NOT EXISTS `%` (
|
|
`` int(11) NOT NULL AUTO_INCREMENT,
|
|
`` int(11),
|
|
PRIMARY KEY (``)
|
|
) ENGINE=%s DEFAULT CHARSET=utf8 ;', $prefix, $engine);*/
|
|
$this->registerHook('moduleRoutes');
|
|
|
|
return $this->uninstallDb() && $this->updateDb($statements);
|
|
}
|
|
|
|
public function updateDb($statements)
|
|
{
|
|
foreach($statements as $statement){
|
|
if( !Db::getInstance()->execute($statement)){
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function uninstallDb()
|
|
{
|
|
$prefix = _DB_PREFIX_ ;
|
|
$statements = array();
|
|
|
|
/* $statements[] = sprintf('DROP TABLE IF EXISTS `%`;', $prefix );*/
|
|
$this->updateDb($statements);
|
|
|
|
return $this->updateDb($statements);
|
|
}
|
|
|
|
public function uninstall()
|
|
{
|
|
if(!parent::uninstall() || !$this->uninstallDb()){
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function hookModuleRoutes($ModuleRoutes)
|
|
{
|
|
$ModuleRoutes = self::$ModuleRoutes;
|
|
$url = $this->l('the-stores');
|
|
$ModuleRoutes['module-antadis_iframefacebook-stores']['rule'] = $url;
|
|
return $ModuleRoutes;
|
|
}
|
|
} |