first commit
This commit is contained in:
36
modules/leobootstrapmenu/install/index.php
Normal file
36
modules/leobootstrapmenu/install/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
132
modules/leobootstrapmenu/install/install.php
Normal file
132
modules/leobootstrapmenu/install/install.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo Bootstrap Menu
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
$path = dirname(_PS_ADMIN_DIR_);
|
||||
|
||||
include_once($path.'/config/config.inc.php');
|
||||
include_once($path.'/init.php');
|
||||
|
||||
|
||||
$res = (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'btmegamenu` (
|
||||
`id_btmegamenu` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_group` int(11) NOT NULL,
|
||||
`image` varchar(255) NOT NULL,
|
||||
`id_parent` int(11) NOT NULL,
|
||||
`sub_with` varchar(255) NOT NULL,
|
||||
`is_group` tinyint(1) NOT NULL,
|
||||
`width` varchar(255) DEFAULT NULL,
|
||||
`submenu_width` varchar(255) DEFAULT NULL,
|
||||
`submenu_colum_width` varchar(255) DEFAULT NULL,
|
||||
`item` varchar(255) DEFAULT NULL,
|
||||
`item_parameter` varchar(255) DEFAULT NULL,
|
||||
`colums` varchar(255) DEFAULT NULL,
|
||||
`type` varchar(255) NOT NULL,
|
||||
`is_content` tinyint(1) NOT NULL,
|
||||
`show_title` tinyint(1) NOT NULL,
|
||||
`level_depth` smallint(6) NOT NULL,
|
||||
`active` tinyint(1) NOT NULL,
|
||||
`position` int(11) NOT NULL,
|
||||
`submenu_content` text NOT NULL,
|
||||
`show_sub` tinyint(1) NOT NULL,
|
||||
`target` varchar(25) DEFAULT NULL,
|
||||
`privacy` smallint(6) DEFAULT NULL,
|
||||
`position_type` varchar(25) DEFAULT NULL,
|
||||
`menu_class` varchar(255) DEFAULT NULL,
|
||||
`content` text,
|
||||
`icon_class` varchar(255) DEFAULT NULL,
|
||||
`level` int(11) NOT NULL,
|
||||
`left` int(11) NOT NULL,
|
||||
`right` int(11) NOT NULL,
|
||||
`submenu_catids` text,
|
||||
`is_cattree` tinyint(1) DEFAULT \'1\',
|
||||
`date_add` datetime DEFAULT NULL,
|
||||
`date_upd` datetime DEFAULT NULL,
|
||||
`groupBox` varchar(255) DEFAULT "all",
|
||||
`params_widget` LONGTEXT,
|
||||
PRIMARY KEY (`id_btmegamenu`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'btmegamenu_lang` (
|
||||
`id_btmegamenu` int(11) NOT NULL,
|
||||
`id_lang` int(11) NOT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`text` varchar(255) DEFAULT NULL,
|
||||
`url` varchar(255) DEFAULT NULL,
|
||||
`description` text,
|
||||
`content_text` text,
|
||||
`submenu_content_text` text,
|
||||
PRIMARY KEY (`id_btmegamenu`,`id_lang`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'btmegamenu_shop` (
|
||||
`id_btmegamenu` int(11) NOT NULL DEFAULT \'0\',
|
||||
`id_shop` int(11) NOT NULL DEFAULT \'0\',
|
||||
PRIMARY KEY (`id_btmegamenu`,`id_shop`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'btmegamenu_widgets`(
|
||||
`id_btmegamenu_widgets` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(250) NOT NULL,
|
||||
`type` varchar(250) NOT NULL,
|
||||
`params` LONGTEXT,
|
||||
`id_shop` int(11) unsigned NOT NULL,
|
||||
`key_widget` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id_btmegamenu_widgets`,`id_shop`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'btmegamenu_group`(
|
||||
`id_btmegamenu_group` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id_shop` int(10) unsigned NOT NULL,
|
||||
`hook` varchar(64) DEFAULT NULL,
|
||||
`position` int(11) NOT NULL,
|
||||
`active` tinyint(1) unsigned NOT NULL DEFAULT \'1\',
|
||||
`params` text NOT NULL,
|
||||
|
||||
`active_ap` tinyint(1) DEFAULT NULL,
|
||||
`randkey` varchar(255) DEFAULT NULL,
|
||||
`form_id` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_btmegamenu_group`,`id_shop`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
$res &= (bool)Db::getInstance()->execute('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'btmegamenu_group_lang` (
|
||||
`id_btmegamenu_group` int(11) NOT NULL,
|
||||
`id_lang` int(11) NOT NULL,
|
||||
`title` varchar(255) DEFAULT NULL,
|
||||
`title_fo` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_btmegamenu_group`,`id_lang`)
|
||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;
|
||||
');
|
||||
|
||||
|
||||
/* install sample data */
|
||||
$rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_btmegamenu FROM `'._DB_PREFIX_.'btmegamenu`');
|
||||
if (count($rows) <= 0 && file_exists(_PS_MODULE_DIR_.'leobootstrapmenu/install/sample.php')) {
|
||||
include_once(_PS_MODULE_DIR_.'leobootstrapmenu/install/sample.php');
|
||||
}
|
||||
59
modules/leobootstrapmenu/install/sample.php
Normal file
59
modules/leobootstrapmenu/install/sample.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo Bootstrap Menu
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2015 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
$mod_group_sample = new BtmegamenuGroup();
|
||||
$context = Context::getContext();
|
||||
|
||||
foreach ($languages as $language) {
|
||||
$mod_group_sample->title[$language['id_lang']] = 'Sample Megamenu';
|
||||
}
|
||||
$mod_group_sample->hook = 'displayTop';
|
||||
$mod_group_sample->position = 0;
|
||||
$mod_group_sample->id_shop = $context->shop->id;
|
||||
$mod_group_sample->active = 1;
|
||||
$mod_group_sample->params = 'eyJncm91cF90eXBlIjoiaG9yaXpvbnRhbCIsInNob3dfY2F2YXMiOiIxIiwidHlwZV9zdWIiOiJhdXRvIiwiZ3JvdXBfY2xhc3MiOiIifQ==';
|
||||
$mod_group_sample->randkey = 'ac70e5b81cccd4671f8c75a464e569bd';
|
||||
$mod_group_sample->add();
|
||||
|
||||
$id_group_sample = $mod_group_sample->id;
|
||||
|
||||
for ($i = 1; $i <= 3; ++$i) {
|
||||
$mod_menu_sample = new Btmegamenu();
|
||||
$mod_menu_sample->id_parent = 0;
|
||||
$mod_menu_sample->id_group = $id_group_sample;
|
||||
$mod_menu_sample->sub_with = 'submenu';
|
||||
$mod_menu_sample->is_group = 0;
|
||||
$mod_menu_sample->item = 'index';
|
||||
$mod_menu_sample->colums = 1;
|
||||
$mod_menu_sample->type = 'controller';
|
||||
$mod_menu_sample->is_content = 0;
|
||||
$mod_menu_sample->show_title = 1;
|
||||
$mod_menu_sample->level_depth = 1;
|
||||
$mod_menu_sample->active = 1;
|
||||
$mod_menu_sample->position = $i;
|
||||
$mod_menu_sample->show_sub = 0;
|
||||
$mod_menu_sample->target = '_self';
|
||||
$mod_menu_sample->privacy = 0;
|
||||
$mod_menu_sample->level = 0;
|
||||
$mod_menu_sample->left = 0;
|
||||
$mod_menu_sample->right = 0;
|
||||
$mod_menu_sample->is_cattree = 1;
|
||||
|
||||
foreach ($languages as $language) {
|
||||
$mod_menu_sample->title[$language['id_lang']] = 'Sample menu '.$i;
|
||||
}
|
||||
$mod_menu_sample->save();
|
||||
}
|
||||
Reference in New Issue
Block a user