118 lines
3.9 KiB
PHP
118 lines
3.9 KiB
PHP
<?php
|
|
if (!defined('_PS_VERSION_'))
|
|
exit;
|
|
|
|
class Ant_Support extends Module
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
$this->name = 'ant_support';
|
|
$this->tab = 'administration';
|
|
$this->author = 'Antadis';
|
|
$this->version = '1.0';
|
|
$this->need_instance = 0;
|
|
|
|
parent::__construct();
|
|
|
|
$this->displayName = $this->l('Help and contact section');
|
|
$this->description = $this->l('Creating sections, questions and answers for help section');
|
|
}
|
|
|
|
public function install()
|
|
{
|
|
|
|
$query = '
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'support_section` (
|
|
`id_section` INTEGER NOT NULL AUTO_INCREMENT,
|
|
`status` BOOL NOT NULL,
|
|
`position` INTEGER,
|
|
PRIMARY KEY(`id_section`)
|
|
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
|
';
|
|
if(!Db::getInstance()->Execute($query)) {
|
|
return false;
|
|
}
|
|
$query = '
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'support_section_lang` (
|
|
`id_section` INTEGER NOT NULL,
|
|
`id_lang` INTEGER NOT NULL,
|
|
`title` VARCHAR(255) NOT NULL,
|
|
`description` TEXT,
|
|
PRIMARY KEY(`id_section`, `id_lang`)
|
|
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
|
';
|
|
if(!Db::getInstance()->Execute($query)) {
|
|
return false;
|
|
}
|
|
$query = '
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'support_question` (
|
|
`id_question` INTEGER NOT NULL AUTO_INCREMENT,
|
|
`id_section` INTEGER NOT NULL,
|
|
`status` BOOL NOT NULL,
|
|
`position` INTEGER,
|
|
PRIMARY KEY(`id_question`)
|
|
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
|
';
|
|
if(!Db::getInstance()->Execute($query)) {
|
|
return false;
|
|
}
|
|
$query = '
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'support_question_lang` (
|
|
`id_question` INTEGER NOT NULL,
|
|
`id_lang` INTEGER NOT NULL,
|
|
`title` TEXT,
|
|
`answer` TEXT,
|
|
PRIMARY KEY(`id_question`, `id_lang`)
|
|
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
|
';
|
|
if(!Db::getInstance()->Execute($query)) {
|
|
return false;
|
|
}
|
|
/* $query = '
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'support_answer` (
|
|
`id_answer` INTEGER NOT NULL AUTO_INCREMENT,
|
|
`id_section` INTEGER NOT NULL,
|
|
`status` BOOL NOT NULL,
|
|
PRIMARY KEY(`id_answer`)
|
|
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
|
';
|
|
if(!Db::getInstance()->Execute($query)) {
|
|
return false;
|
|
}
|
|
$query = '
|
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'support_answer_lang` (
|
|
`id_answer` INTEGER NOT NULL,
|
|
`id_lang` INTEGER NOT NULL,
|
|
`content` TEXT,
|
|
PRIMARY KEY(`id_answer`, `id_lang`)
|
|
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
|
';
|
|
if(!Db::getInstance()->Execute($query)) {
|
|
return false;
|
|
}*/
|
|
|
|
if(!(parent::install())) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function uninstall() {
|
|
|
|
if(parent::uninstall() == false) {
|
|
return false;
|
|
}
|
|
|
|
Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'support_section`');
|
|
Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'support_section_lang`');
|
|
Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'support_question`');
|
|
Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'support_question_lang`');
|
|
/*Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'support_answer`');
|
|
Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'support_answer_lang`');*/
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|