On rajoute encore quelques modules

This commit is contained in:
2020-10-13 14:58:11 +02:00
parent c513c15cdc
commit 25cb197711
201 changed files with 22431 additions and 27 deletions

View File

@@ -0,0 +1,82 @@
<?php
/**
* 2007-2015 IQIT-COMMERCE.COM
*
* NOTICE OF LICENSE
*
* @author IQIT-COMMERCE.COM <support@iqit-commerce.com>
* @copyright 2007-2015 IQIT-COMMERCE.COM
* @license GNU General Public License version 2
*
* You can not resell or redistribute this software.
*/
class IqitMenuHtml extends ObjectModel
{
public $title;
public $html;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'iqitmegamenu_htmlc',
'primary' => 'id_html',
'multilang' => true,
'fields' => array(
'title' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 255),
'html' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString'),
),
);
public function __construct($id_html = null, $id_lang = null, $id_shop = null)
{
parent::__construct($id_html, $id_lang, $id_shop);
}
public function add($autodate = true, $null_values = false)
{
$context = Context::getContext();
$id_shop = $context->shop->id;
$res = parent::add($autodate, $null_values);
$res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'iqitmegamenu_html` (`id_html`, `id_shop`)
VALUES(' . (int) $this->id . ', ' . (int) $id_shop . ')');
return $res;
}
public function delete()
{
$res = true;
$res &= Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'iqitmegamenu_html`
WHERE `id_html` = ' . (int) $this->id);
$res &= parent::delete();
return $res;
}
public static function getHtmls()
{
$context = Context::getContext();
$id_shop = $context->shop->id;
$id_lang = $context->language->id;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT hs.`id_html` as id_html, hss.`title`, hssl.`html`
FROM ' . _DB_PREFIX_ . 'iqitmegamenu_html hs
LEFT JOIN ' . _DB_PREFIX_ . 'iqitmegamenu_htmlc hss ON (hs.id_html = hss.id_html)
LEFT JOIN ' . _DB_PREFIX_ . 'iqitmegamenu_htmlc_lang hssl ON (hs.id_html = hssl.id_html)
WHERE hs.id_shop = ' . (int) $id_shop . '
AND hssl.id_lang = ' . (int) $id_lang);
}
public static function htmlExists($id_html)
{
$req = 'SELECT hs.`id_html` as id_html
FROM `' . _DB_PREFIX_ . 'iqitmegamenu_html` hs
WHERE hs.`id_html` = ' . (int) $id_html;
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($req);
return ($row);
}
}

View File

@@ -0,0 +1,132 @@
<?php
/**
* 2007-2015 IQIT-COMMERCE.COM
*
* NOTICE OF LICENSE
*
* @author IQIT-COMMERCE.COM <support@iqit-commerce.com>
* @copyright 2007-2015 IQIT-COMMERCE.COM
* @license GNU General Public License version 2
*
* You can not resell or redistribute this software.
*/
class IqitMenuLinks
{
public static function gets($id_lang, $id_shop, $id_iqitmenulinks = null)
{
$sql = 'SELECT l.id_iqitmenulinks, l.new_window, s.name, ll.link, ll.label
FROM ' . _DB_PREFIX_ . 'iqitmenulinks l
LEFT JOIN ' . _DB_PREFIX_ . 'iqitmenulinks_lang ll ON (l.id_iqitmenulinks = ll.id_iqitmenulinks AND ll.id_lang = ' . (int) $id_lang . ' AND ll.id_shop=' . (int) $id_shop . ')
LEFT JOIN ' . _DB_PREFIX_ . 'shop s ON l.id_shop = s.id_shop
WHERE 1 ' . ((!is_null($id_iqitmenulinks)) ? ' AND l.id_iqitmenulinks = "' . (int) $id_iqitmenulinks . '"' : '') . '
AND l.id_shop IN (0, ' . (int) $id_shop . ')';
return Db::getInstance()->executeS($sql);
}
public static function get($id_iqitmenulinks, $id_lang, $id_shop)
{
return self::gets($id_lang, $id_shop, $id_iqitmenulinks);
}
public static function getLinkLang($id_iqitmenulinks, $id_shop)
{
$ret = Db::getInstance()->executeS('SELECT l.id_iqitmenulinks, l.new_window, ll.link, ll.label, ll.id_lang FROM ' . _DB_PREFIX_ . 'iqitmenulinks l
LEFT JOIN ' . _DB_PREFIX_ . 'iqitmenulinks_lang ll ON (l.id_iqitmenulinks = ll.id_iqitmenulinks AND ll.id_shop=' . (int) $id_shop . ')
WHERE 1
' . ((!is_null($id_iqitmenulinks)) ? ' AND l.id_iqitmenulinks = "' . (int) $id_iqitmenulinks . '"' : '') . '
AND l.id_shop IN (0, ' . (int) $id_shop . ')');
$link = array();
$label = array();
$new_window = false;
foreach ($ret as $line) {
$link[$line['id_lang']] = Tools::safeOutput($line['link']);
$label[$line['id_lang']] = Tools::safeOutput($line['label']);
$new_window = (bool) $line['new_window'];
}
return array('link' => $link, 'label' => $label, 'new_window' => $new_window);
}
public static function add($link, $label, $id_shop, $newWindow = 0)
{
if (!is_array($label)) {
return false;
}
if (!is_array($link)) {
return false;
}
Db::getInstance()->insert(
'iqitmenulinks',
array(
'new_window' => (int) $newWindow,
'id_shop' => (int) $id_shop,
)
);
$id_iqitmenulinks = Db::getInstance()->Insert_ID();
$result = true;
foreach ($label as $id_lang => $label) {
$result &= Db::getInstance()->insert(
'iqitmenulinks_lang',
array(
'id_iqitmenulinks' => (int) $id_iqitmenulinks,
'id_lang' => (int) $id_lang,
'id_shop' => (int) $id_shop,
'label' => pSQL($label),
'link' => pSQL($link[$id_lang]),
)
);
}
return $result;
}
public static function update($link, $labels, $id_shop, $id_link, $newWindow = 0)
{
if (!is_array($labels)) {
return false;
}
if (!is_array($link)) {
return false;
}
Db::getInstance()->update(
'iqitmenulinks',
array(
'new_window' => (int) $newWindow,
'id_shop' => (int) $id_shop,
),
'id_iqitmenulinks = ' . (int) $id_link
);
foreach ($labels as $id_lang => $label) {
Db::getInstance()->update(
'iqitmenulinks_lang',
array(
'id_shop' => (int) $id_shop,
'label' => pSQL($label),
'link' => pSQL($link[$id_lang]),
),
'id_iqitmenulinks = ' . (int) $id_link . ' AND id_lang = ' . (int) $id_lang
);
}
return true;
}
public static function remove($id_iqitmenulinks, $id_shop)
{
$result = true;
$result &= Db::getInstance()->delete('iqitmenulinks', 'id_iqitmenulinks = ' . (int) $id_iqitmenulinks . ' AND id_shop = ' . (int) $id_shop);
$result &= Db::getInstance()->delete('iqitmenulinks_lang', 'id_iqitmenulinks = ' . (int) $id_iqitmenulinks);
return $result;
}
}

View File

@@ -0,0 +1,309 @@
<?php
/**
* 2007-2015 IQIT-COMMERCE.COM
*
* NOTICE OF LICENSE
*
* @author IQIT-COMMERCE.COM <support@iqit-commerce.com>
* @copyright 2007-2015 IQIT-COMMERCE.COM
* @license GNU General Public License version 2
*
* You can not resell or redistribute this software.
*/
class IqitMenuTab extends ObjectModel
{
public $id;
public $menu_type;
public $id_tab;
public $id_shop_list;
public $id_shop;
public $active;
public $active_label;
public $position;
public $url_type;
public $id_url;
public $icon_type;
public $icon_class;
public $icon;
public $legend_icon;
public $new_window;
public $float;
public $submenu_type;
public $submenu_width;
public $submenu_bg_color;
public $submenu_image;
public $submenu_repeat;
public $submenu_bg_position;
public $submenu_link_color;
public $submenu_hover_color;
public $submenu_content;
public $submenu_title_color;
public $submenu_title_colorh;
public $submenu_titleb_color;
public $submenu_border_t;
public $submenu_border_r;
public $submenu_border_b;
public $submenu_border_l;
public $submenu_border_i;
public $title;
public $label;
public $url;
public $bg_color;
public $txt_color;
public $h_bg_color;
public $h_txt_color;
public $labelbg_color;
public $labeltxt_color;
public $group_access;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'iqitmegamenu_tabs',
'primary' => 'id_tab',
'multilang' => true,
'fields' => array(
'menu_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
'active_label' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'url_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'id_url' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'icon_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'icon_class' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'legend_icon' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'icon' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 255),
'new_window' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
'float' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
'submenu_content' => array('type' => self::TYPE_STRING),
'submenu_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'submenu_width' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'submenu_bg_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_image' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_repeat' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'submenu_bg_position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'submenu_link_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_hover_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_title_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_title_colorh' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_titleb_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_border_t' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_border_r' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_border_b' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_border_l' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'submenu_border_i' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'bg_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'txt_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'h_bg_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'h_txt_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'labelbg_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'labeltxt_color' => array('type' => self::TYPE_STRING, 'validate' => 'isString'),
'title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 255),
'label' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 255),
'url' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isUrl', 'size' => 255),
'group_access' => array('type' => self::TYPE_STRING),
),
);
public function __construct($id_menu = null, $id_lang = null, $id_shop = null)
{
Shop::addTableAssociation('iqitmegamenu_tabs', array('type' => 'shop'));
parent::__construct($id_menu, $id_lang, $id_shop);
}
public function add($autodate = true, $null_values = false)
{
$res = parent::add($autodate, $null_values);
$this->associateTo($this->id_shop_list);
return $res;
}
public function delete()
{
$res = true;
$tab = new IqitMenuTab((int) $this->id);
$res &= $this->reOrderPositions($tab->menu_type);
$res &= Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'iqitmegamenu_tabs_shop`
WHERE `id_tab` = ' . (int) $this->id);
$res &= parent::delete();
return $res;
}
public function update($null_values = false)
{
if (isset($this->id)) {
Db::getInstance()->delete('iqitmegamenu_tabs_shop', 'id_tab = ' . (int) $this->id);
}
$this->associateTo($this->id_shop_list);
return parent::update();
}
public static function getTabs($menu_type)
{
$context = Context::getContext();
$id_shop = $context->shop->id;
$id_lang = $context->language->id;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT hs.`id_tab` as id_tab, hssl.`title`, hss.`position`
FROM ' . _DB_PREFIX_ . 'iqitmegamenu_tabs_shop hs
LEFT JOIN ' . _DB_PREFIX_ . 'iqitmegamenu_tabs hss ON (hs.id_tab = hss.id_tab)
LEFT JOIN ' . _DB_PREFIX_ . 'iqitmegamenu_tabs_lang hssl ON (hss.id_tab = hssl.id_tab)
WHERE id_shop = ' . (int) $id_shop . ' AND menu_type = ' . (int) $menu_type . '
AND hssl.id_lang = ' . (int) $id_lang . '
ORDER BY hss.position');
}
public static function getTabsFrontend($menu_type, $css_generator)
{
$context = Context::getContext();
$id_shop = $context->shop->id;
$id_lang = $context->language->id;
$tabs = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT hs.`id_tab` as id_tab, hssl.`title`, hssl.`label`, hssl.`url`,
hss.`position`, hss.`active_label`, hss.`url_type`, hss.`id_url`, hss.`icon_type`, hss.`icon_class`, hss.`icon`, hss.`legend_icon`,
hss.`new_window`, hss.`float`, hss.`submenu_type`, hss.`submenu_content`, hss.`submenu_width`, hss.`group_access`
' . ($css_generator ? ', hss.`bg_color`, hss.`txt_color`, hss.`h_bg_color`, hss.`h_txt_color`, hss.`labelbg_color`, hss.`labeltxt_color`,
hss.`submenu_bg_color`, hss.`submenu_image`, hss.`submenu_repeat`, hss.`submenu_bg_position`,
hss.`submenu_link_color`, hss.`submenu_hover_color`, hss.`submenu_link_color`, hss.`submenu_hover_color`, hss.`submenu_title_color`,
hss.`submenu_title_colorh`, hss.`submenu_titleb_color`, hss.`submenu_border_t`, hss.`submenu_border_r`, hss.`submenu_border_b`,
hss.`submenu_border_l`, hss.`submenu_border_i` ' : '') . '
FROM ' . _DB_PREFIX_ . 'iqitmegamenu_tabs_shop hs
LEFT JOIN ' . _DB_PREFIX_ . 'iqitmegamenu_tabs hss ON (hs.id_tab = hss.id_tab)
LEFT JOIN ' . _DB_PREFIX_ . 'iqitmegamenu_tabs_lang hssl ON (hss.id_tab = hssl.id_tab)
WHERE id_shop = ' . (int) $id_shop . ' AND menu_type = ' . (int) $menu_type . ' AND active = 1
AND hssl.id_lang = ' . (int) $id_lang . '
ORDER BY hss.position');
if (Context::getContext()->customer) {
foreach ($tabs as $key => $tab) {
if ($userGroups = Context::getContext()->customer->getGroups()) {
$tmpLinkGroups = unserialize($tab['group_access']);
$linkGroups = array();
foreach ($tmpLinkGroups as $groupID => $status) {
if ($status) {
$linkGroups[] = $groupID;
}
}
$intersect = array_intersect($userGroups, $linkGroups);
if (!count($intersect)) {
unset($tabs[$key]);
}
}
}
return $tabs;
} else {
return $tabs;
}
}
public static function getNextPosition($menu_type)
{
$context = Context::getContext();
$id_shop = $context->shop->id;
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT MAX(hss.`position`) AS `next_position`
FROM `' . _DB_PREFIX_ . 'iqitmegamenu_tabs` hss, `' . _DB_PREFIX_ . 'iqitmegamenu_tabs_shop` hs
WHERE hss.`id_tab` = hs.`id_tab` AND hss.`menu_type` = ' . (int) $menu_type . ' AND hs.`id_shop` = ' . (int) $id_shop);
return (++$row['next_position']);
}
public static function tabExists($id_tab)
{
$req = 'SELECT hs.`id_tab` as id_tab
FROM `' . _DB_PREFIX_ . 'iqitmegamenu_tabs_shop` hs
WHERE hs.`id_tab` = ' . (int) $id_tab;
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($req);
return ($row);
}
public static function getAllShopTabs()
{
$id_shop = Context::getContext()->shop->id;
$req = 'SELECT hs.`id_tab` as id_tab
FROM `' . _DB_PREFIX_ . 'iqitmegamenu_tabs_shop` hs
WHERE hs.`id_shop` = ' . (int) $id_shop;
$rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($req);
$tabs = array();
foreach ($rows as $id => $tab) {
$tabs[$tab['id_tab']] = new IqitMenuTab($tab['id_tab']);
$tabs[$tab['id_tab']]->id_shop_list = $id_shop;
}
return $tabs;
}
public static function importTabs($id_tab)
{
$req = 'SELECT hs.`id_tab` as id_tab
FROM `' . _DB_PREFIX_ . 'iqitmegamenu_tabs_shop` hs
WHERE hs.`id_tab` = ' . (int) $id_tab;
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($req);
return ($row);
}
public function reOrderPositions($menu_type)
{
$id_tab = $this->id;
$context = Context::getContext();
$id_shop = $context->shop->id;
$max = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT MAX(hss.`position`) as position
FROM `' . _DB_PREFIX_ . 'iqitmegamenu_tabs` hss, `' . _DB_PREFIX_ . 'iqitmegamenu_tabs_shop` hs
WHERE hss.`id_tab` = hs.`id_tab` AND hss.`menu_type` = ' . (int) $menu_type . ' AND hs.`id_shop` = ' . (int) $id_shop);
if ((int) $max == (int) $id_tab) {
return true;
}
$rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT hss.`position` as position, hss.`id_tab` as id_tab
FROM `' . _DB_PREFIX_ . 'iqitmegamenu_tabs` hss
LEFT JOIN `' . _DB_PREFIX_ . 'iqitmegamenu_tabs_shop` hs ON (hss.`id_tab` = hs.`id_tab`)
WHERE hs.`id_shop` = ' . (int) $id_shop . ' AND hss.`menu_type` = ' . (int) $menu_type . ' AND hss.`position` > ' . (int) $this->position);
foreach ($rows as $row) {
$current_tab = new IqitMenuTab($row['id_tab']);
--$current_tab->position;
$current_tab->update();
unset($current_tab);
}
return true;
}
public function verifyAccess()
{
if (Context::getContext()->customer) {
if ($userGroups = Context::getContext()->customer->getGroups()) {
$tmpLinkGroups = unserialize($this->group_access);
$linkGroups = array();
foreach ($tmpLinkGroups as $groupID => $status) {
if ($status) {
$linkGroups[] = $groupID;
}
}
$intersect = array_intersect($userGroups, $linkGroups);
if (!count($intersect)) {
return false;
}
}
return true;
} else {
return true;
}
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2014 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-2014 PrestaShop SA
* @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;