Remove blockcms

This commit is contained in:
Abhishek Kumar
2022-04-26 19:52:42 +05:30
parent 6e46505ab3
commit 76d2d0ab80
26 changed files with 0 additions and 2460 deletions

View File

@@ -63,7 +63,6 @@
<module action="enable" name="blockuserinfo"/>
<module action="disable" name="blockadvertising"/>
<module action="disable" name="blockcategories"/>
<module action="disable" name="blockcms"/>
<module action="disable" name="blockcmsinfo"/>
<module action="disable" name="blockcustomerprivacy"/>
<module action="disable" name="blockfacebook"/>

View File

@@ -2088,7 +2088,6 @@ class AdminThemesControllerCore extends AdminController
'blockadvertising',
'blockcart',
'blockcategories',
'blockcms',
'blockcmsinfo',
'blockcurrencies',
'blockcustomerprivacy',

View File

@@ -148,10 +148,6 @@ UPDATE `PREFIX_hook_module` SET position = 3
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockcategories')
AND id_hook = @id_hook;
UPDATE `PREFIX_hook_module` SET position = 4
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockcms')
AND id_hook = @id_hook;
UPDATE `PREFIX_hook_module` SET position = 5
WHERE id_module = (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockmyaccountfooter')
AND id_hook = @id_hook;

View File

@@ -1,623 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class BlockCMSModel extends ObjectModel
{
public $id_cms_block;
public $id_cms_category;
public $location;
public $position;
public $display_store;
const LEFT_COLUMN = 0;
const RIGHT_COLUMN = 1;
const FOOTER = 2;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'cms_block',
'primary' => 'id_cms_block',
'fields' => array(
'id_cms_block' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'id_cms_category' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'location' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
'display_store' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true)
),
);
public static function createTables()
{
return (
BlockCMSModel::createCMSBlockTable() &&
BlockCMSModel::createCMSBlockLangTable() &&
BlockCMSModel::createCMSBlockPageTable() &&
BlockCMSModel::createCMSBlockShopTable()
);
}
public static function dropTables()
{
$sql = 'DROP TABLE
`'._DB_PREFIX_.'cms_block`,
`'._DB_PREFIX_.'cms_block_page`,
`'._DB_PREFIX_.'cms_block_lang`,
`'._DB_PREFIX_.'cms_block_shop`';
return Db::getInstance()->execute($sql);
}
public static function createCMSBlockTable()
{
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block`(
`id_cms_block` int(10) unsigned NOT NULL auto_increment,
`id_cms_category` int(10) unsigned NOT NULL,
`location` tinyint(1) unsigned NOT NULL,
`position` int(10) unsigned NOT NULL default \'0\',
`display_store` tinyint(1) unsigned NOT NULL default \'1\',
PRIMARY KEY (`id_cms_block`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
return Db::getInstance()->execute($sql);
}
public static function createCMSBlockLangTable()
{
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_lang`(
`id_cms_block` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(40) NOT NULL default \'\',
PRIMARY KEY (`id_cms_block`, `id_lang`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
return Db::getInstance()->execute($sql);
}
public static function createCMSBlockPageTable()
{
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_page`(
`id_cms_block_page` int(10) unsigned NOT NULL auto_increment,
`id_cms_block` int(10) unsigned NOT NULL,
`id_cms` int(10) unsigned NOT NULL,
`is_category` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id_cms_block_page`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
return Db::getInstance()->execute($sql);
}
public static function createCMSBlockShopTable()
{
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_shop` (
`id_cms_block` int(10) unsigned NOT NULL auto_increment,
`id_shop` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_cms_block`, `id_shop`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
return Db::getInstance()->execute($sql);
}
public static function insertCMSBlock($id_category, $location, $position, $display_store)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block` (`id_cms_category`, `location`, `position`, `display_store`)
VALUES('.(int)$id_category.', '.(int)$location.', '.(int)$position.', '.(int)$display_store.')';
if (Db::getInstance()->execute($sql))
return Db::getInstance()->Insert_ID();
return false;
}
public static function insertCMSBlockLang($id_cms_block, $id_lang)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`, `name`)
VALUES('.(int)$id_cms_block.', '.(int)$id_lang.', "'.pSQL(Tools::getValue('block_name_'.$id_lang)).'")';
Db::getInstance()->execute($sql);
return Db::getInstance()->Insert_ID();
}
public static function insertCMSBlockPage($id_cms_block, $id_cms, $is_category)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block_page` (`id_cms_block`, `id_cms`, `is_category`)
VALUES('.(int)$id_cms_block.', '.(int)$id_cms.', '.(int)$is_category.')';
Db::getInstance()->execute($sql);
return Db::getInstance()->Insert_ID();
}
public static function insertCMSBlockShop($id_cms_block, $id_shop)
{
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block_shop` (`id_cms_block`, `id_shop`)
VALUES('.(int)$id_cms_block.', '.(int)$id_shop.')';
Db::getInstance()->execute($sql);
return Db::getInstance()->Insert_ID();
}
public static function updateCMSBlock($id_cms_block, $id_cms_category, $position, $location, $display_store)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `location` = '.(int)$location.',
`id_cms_category` = '.(int)$id_cms_category.',
`position` = '.(int)$position.',
`display_store` = '.(int)$display_store.'
WHERE `id_cms_block` = '.(int)$id_cms_block;
Db::getInstance()->execute($sql);
}
public static function updatePositions($position, $new_position, $location)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `position` = '.(int)$new_position.' WHERE `position` > '.(int)$position.'
AND `location` = '.(int)$location;
Db::getInstance()->execute($sql);
}
public static function updateCMSBlockPositions($id_cms_block, $position, $new_position, $location)
{
$query = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `position` = '.(int)$new_position.'
WHERE `position` = '.(int)$position.'
AND `location` = '.(int)$location;
$sub_query = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `position` = '.(int)$position.'
WHERE `id_cms_block` = '.(int)$id_cms_block;
if (Db::getInstance()->execute($query))
Db::getInstance()->execute($sub_query);
}
public static function updateCMSBlockPosition($id_cms_block, $position)
{
$query = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `position` = '.(int)$position.'
WHERE `id_cms_block` = '.(int)$id_cms_block;
Db::getInstance()->execute($query);
}
public static function updateCMSBlockLang($id_cms_block, $block_name, $id_lang)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms_block_lang`
SET `name` = "'.pSQL($block_name).'"
WHERE `id_cms_block` = '.(int)$id_cms_block.'
AND `id_lang`= '.(int)$id_lang;
Db::getInstance()->execute($sql);
}
public static function updateDisplayStores($display_store)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms_block`
SET `display_store` = '.(int)$display_store;
Db::getInstance()->execute($sql);
}
public static function deleteCMSBlock($id_cms_block)
{
$sql = 'DELETE FROM `'._DB_PREFIX_.'cms_block`
WHERE `id_cms_block` = '.(int)$id_cms_block;
Db::getInstance()->execute($sql);
}
public static function deleteCMSBlockPage($id_cms_block)
{
$sql = 'DELETE FROM `'._DB_PREFIX_.'cms_block_page`
WHERE `id_cms_block` = '.(int)$id_cms_block;
Db::getInstance()->execute($sql);
}
public static function getMaxPosition($location)
{
$sql = 'SELECT COUNT(*)
FROM `'._DB_PREFIX_.'cms_block`
WHERE `location` = '.(int)$location;
return Db::getInstance()->getValue($sql);
}
public static function getCMSTitlesFooter()
{
$context = Context::getContext();
$footerCms = Configuration::get('FOOTER_CMS');
if (empty($footerCms))
return array();
$cmsCategories = explode('|', $footerCms);
foreach ($cmsCategories as $cmsCategory)
{
$ids = explode('_', $cmsCategory);
if ($ids[0] == 1 && isset($ids[1]))
{
$query = BlockCMSModel::getBlockName($ids[1]);
$content[$cmsCategory]['link'] = $context->link->getCMSCategoryLink((int)$ids[1], $query['link_rewrite']);
$content[$cmsCategory]['meta_title'] = $query['name'];
}
else if ($ids[0] == 0 && isset($ids[1]))
{
$query = BlockCMSModel::getCMSMetaTitle($ids[1]);
$content[$cmsCategory]['link'] = $context->link->getCMSLink((int)$ids[1], $query['link_rewrite']);
$content[$cmsCategory]['meta_title'] = $query['meta_title'];
}
}
return $content;
}
public static function getBlockName($id)
{
$sql = 'SELECT cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_category_lang` cl
INNER JOIN `'._DB_PREFIX_.'cms_category` c
ON (cl.`id_cms_category` = c.`id_cms_category`)
WHERE cl.`id_cms_category` = '.(int)$id.'
AND (c.`active` = 1 OR c.`id_cms_category` = 1)
AND cl.`id_lang` = '.(int)Context::getContext()->language->id;
return Db::getInstance()->getRow($sql);
}
public static function getBlockMetaTitle($id)
{
$sql = 'SELECT cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_category_lang` cl
INNER JOIN `'._DB_PREFIX_.'cms_category` c
ON (cl.`id_cms_category` = c.`id_cms_category`)
WHERE cl.`id_cms_category` = '.(int)$id.'
AND (c.`active` = 1 OR c.`id_cms_category` = 1)
AND cl.`id_lang` = '.(int)Context::getContext()->language->id;
return Db::getInstance()->getRow($sql);
}
public static function getCMSMetaTitle($id)
{
$context = Context::getContext();
$id_shop = (int)$context->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false) {
$where_shop = ' AND cl.`id_shop` = '.(int)$id_shop;
}
$sql = 'SELECT cl.`meta_title`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_lang` cl
INNER JOIN `'._DB_PREFIX_.'cms` c
ON (cl.`id_cms` = c.`id_cms`)
WHERE cl.`id_cms` = '.(int)$id.'
AND (c.`active` = 1 OR c.`id_cms` = 1)'.
$where_shop.'
AND cl.`id_lang` = '.(int)Context::getContext()->language->id;
return Db::getInstance()->getRow($sql);
}
public static function getCMSCategoriesByLocation($location, $id_shop = false)
{
$context = Context::getContext();
$id_shop = ($id_shop != false) ? $id_shop : $context->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false)
$where_shop = ' AND ccl.`id_shop` = '.(int)$id_shop;
$sql = 'SELECT bc.`id_cms_block`, bc.`id_cms_category`, bc.`display_store`, ccl.`link_rewrite`, ccl.`name` category_name, bcl.`name` block_name
FROM `'._DB_PREFIX_.'cms_block` bc
LEFT JOIN `'._DB_PREFIX_.'cms_block_shop` bcs
ON (bcs.id_cms_block = bc.id_cms_block)
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl
ON (bc.`id_cms_category` = ccl.`id_cms_category`)
INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl
ON (bc.`id_cms_block` = bcl.`id_cms_block`)
WHERE bc.`location` = '.(int)$location.'
AND ccl.`id_lang` = '.(int)$context->language->id.'
AND bcl.`id_lang` = '.(int)$context->language->id.'
AND bcs.id_shop = '.($id_shop ? (int)$id_shop : (int)$context->shop->id).
$where_shop.'
ORDER BY `position`';
return Db::getInstance()->executeS($sql);
}
public static function getCMSPages($id_cms_category, $id_shop = false)
{
$id_shop = ($id_shop != false) ? $id_shop : Context::getContext()->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false)
$where_shop = ' AND cl.`id_shop` = '.(int)$id_shop;
$sql = 'SELECT c.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms` c
INNER JOIN `'._DB_PREFIX_.'cms_shop` cs
ON (c.`id_cms` = cs.`id_cms`)
INNER JOIN `'._DB_PREFIX_.'cms_lang` cl
ON (c.`id_cms` = cl.`id_cms`)
WHERE c.`id_cms_category` = '.(int)$id_cms_category.'
AND cs.`id_shop` = '.(int)$id_shop.'
AND cl.`id_lang` = '.(int)Context::getContext()->language->id.
$where_shop.'
AND c.`active` = 1
ORDER BY `position`';
return Db::getInstance()->executeS($sql);
}
public static function getCMSBlockPages($id_block, $id_shop = false)
{
$id_shop = ($id_shop != false) ? $id_shop : Context::getContext()->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false)
$where_shop = ' AND cl.`id_shop` = '.(int)$id_shop;
$sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_block_page` bcp
INNER JOIN `'._DB_PREFIX_.'cms_lang` cl
ON (bcp.`id_cms` = cl.`id_cms`)
INNER JOIN `'._DB_PREFIX_.'cms` c
ON (bcp.`id_cms` = c.`id_cms`)
INNER JOIN `'._DB_PREFIX_.'cms_shop` cs
ON (c.`id_cms` = cs.`id_cms`)
WHERE bcp.`id_cms_block` = '.(int)$id_block.'
AND cs.`id_shop` = '.(int)$id_shop.'
AND cl.`id_lang` = '.(int)Context::getContext()->language->id.
$where_shop.'
AND bcp.`is_category` = 0
AND c.`active` = 1
ORDER BY `position`';
return Db::getInstance()->executeS($sql);
}
public static function getCMSBlockPagesCategories($id_cms_block)
{
$sql = 'SELECT bcp.`id_cms`, cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_block_page` bcp
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
ON (bcp.`id_cms` = cl.`id_cms_category`)
WHERE bcp.`id_cms_block` = '.(int)$id_cms_block.'
AND cl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bcp.`is_category` = 1';
return Db::getInstance()->executeS($sql);
}
public static function getCMSCategories($recursive = false, $parent = 0, $id_shop = false)
{
$id_shop = ($id_shop != false) ? $id_shop : Context::getContext()->shop->id;
$join_shop = '';
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true)
{
$join_shop = ' INNER JOIN `'._DB_PREFIX_.'cms_category_shop` cs
ON (bcp.`id_cms_category` = cs.`id_cms_category`)';
$where_shop = ' AND cs.`id_shop` = '.(int)$id_shop.' AND cl.`id_shop` = '.(int)$id_shop;
}
if ($recursive === false)
{
$sql = 'SELECT bcp.`id_cms_category`, bcp.`id_parent`, bcp.`level_depth`, bcp.`active`, bcp.`position`, cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_category` bcp'.
$join_shop.'
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
ON (bcp.`id_cms_category` = cl.`id_cms_category`)
WHERE cl.`id_lang` = '.(int)Context::getContext()->language->id.
$where_shop;
if ($parent)
$sql .= ' AND bcp.`id_parent` = '.(int)$parent;
return Db::getInstance()->executeS($sql);
}
else
{
$sql = 'SELECT bcp.`id_cms_category`, bcp.`id_parent`, bcp.`level_depth`, bcp.`active`, bcp.`position`, cl.`name`, cl.`link_rewrite`
FROM `'._DB_PREFIX_.'cms_category` bcp'.
$join_shop.'
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
ON (bcp.`id_cms_category` = cl.`id_cms_category`)
WHERE cl.`id_lang` = '.(int)Context::getContext()->language->id.
$where_shop;
if ($parent)
$sql .= ' AND bcp.`id_parent` = '.(int)$parent;
$results = Db::getInstance()->executeS($sql);
foreach ($results as $result)
{
$sub_categories = BlockCMSModel::getCMSCategories(true, $result['id_cms_category']);
if ($sub_categories && count($sub_categories) > 0)
$result['sub_categories'] = $sub_categories;
$categories[] = $result;
}
return isset($categories) ? $categories : false;
}
}
/* Get a single CMS block by its ID */
public static function getBlockCMS($id_cms_block)
{
$sql = 'SELECT cb.`id_cms_category`, cb.`location`, cb.`position`, cb.`display_store`, cbl.id_lang, cbl.name
FROM `'._DB_PREFIX_.'cms_block` cb
LEFT JOIN `'._DB_PREFIX_.'cms_block_lang` cbl
ON (cbl.`id_cms_block` = cb.`id_cms_block`)
WHERE cb.`id_cms_block` = '.(int)$id_cms_block;
$cmsBlocks = Db::getInstance()->executeS($sql);
foreach ($cmsBlocks as $cmsBlock)
{
$results[(int)$cmsBlock['id_lang']] = $cmsBlock;
$restuls[(int)$cmsBlock['id_lang']]['name'] = $cmsBlock['name'];
}
return $results;
}
/* Get all CMS blocks by location */
public static function getCMSBlocksByLocation($location, $id_shop = false)
{
$context = Context::getContext();
$id_shop = ($id_shop != false) ? $id_shop : $context->shop->id;
$where_shop = '';
if (Tools::version_compare(_PS_VERSION_, '1.6.0.12', '>=') == true && $id_shop != false)
$where_shop = ' AND ccl.`id_shop` = '.$id_shop;
$sql = 'SELECT bc.`id_cms_block`, bcl.`name` block_name, ccl.`name` category_name, bc.`position`, bc.`id_cms_category`, bc.`display_store`
FROM `'._DB_PREFIX_.'cms_block` bc
LEFT JOIN `'._DB_PREFIX_.'cms_block_shop` bcs
ON (bcs.id_cms_block = bc.id_cms_block)
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl
ON (bc.`id_cms_category` = ccl.`id_cms_category`)
INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl
ON (bc.`id_cms_block` = bcl.`id_cms_block`)
WHERE ccl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bcl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bc.`location` = '.(int)$location.
$where_shop.'
AND bcs.id_shop = '.$id_shop.'
ORDER BY bc.`position`';
return Db::getInstance()->executeS($sql);
}
/* Get all CMS blocks */
public static function getCMSBlocks()
{
$sql = 'SELECT bc.`id_cms_block`, bcl.`name` block_name, ccl.`name` category_name, bc.`position`, bc.`id_cms_category`, bc.`display_store`
FROM `'._DB_PREFIX_.'cms_block` bc
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl
ON (bc.`id_cms_category` = ccl.`id_cms_category`)
INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl
ON (bc.`id_cms_block` = bcl.`id_cms_block`)
WHERE ccl.`id_lang` = '.(int)Context::getContext()->language->id.'
AND bcl.`id_lang` = '.(int)Context::getContext()->language->id.'
ORDER BY bc.`position`';
return Db::getInstance()->executeS($sql);
}
/* Get all CMS blocks */
public static function getAllCMSStructure($id_shop = false)
{
$id_shop = ($id_shop != false) ? $id_shop : Context::getContext()->shop->id;
$categories = BlockCMSModel::getCMSCategories(false, 0, $id_shop);
foreach ($categories as $key => $value)
$categories[$key]['cms_pages'] = BlockCMSModel::getCMSPages($value['id_cms_category'], $id_shop);
return $categories;
}
public static function getAllCMSTitles()
{
$titles = array_merge(
BlockCMSModel::getCMSTitles(BlockCMSModel::LEFT_COLUMN),
BlockCMSModel::getCMSTitles(BlockCMSModel::RIGHT_COLUMN)
);
foreach ($titles as $key => $title)
{
unset(
$titles[$key]['category_link'],
$titles[$key]['category_name'],
$titles[$key]['categories'],
$titles[$key]['name']
);
}
return $titles;
}
public static function getCMSTitles($location, $id_shop = false)
{
$content = array();
$context = Context::getContext();
$cmsCategories = BlockCMSModel::getCMSCategoriesByLocation($location, $id_shop);
if (is_array($cmsCategories) && count($cmsCategories))
{
foreach ($cmsCategories as $cmsCategory)
{
$key = (int)$cmsCategory['id_cms_block'];
$content[$key]['display_store'] = $cmsCategory['display_store'];
$content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block'], $id_shop);
$links = array();
if (count($content[$key]['cms']))
{
foreach ($content[$key]['cms'] as $row)
{
$row['link'] = $context->link->getCMSLink((int)$row['id_cms'], $row['link_rewrite']);
$links[] = $row;
}
}
$content[$key]['cms'] = $links;
$content[$key]['categories'] = BlockCMSModel::getCMSBlockPagesCategories($cmsCategory['id_cms_block']);
$links = array();
if (count($content[$key]['categories']))
{
foreach ($content[$key]['categories'] as $row)
{
$row['link'] = $context->link->getCMSCategoryLink((int)$row['id_cms'], $row['link_rewrite']);
$links[] = $row;
}
}
$content[$key]['categories'] = $links;
$content[$key]['name'] = $cmsCategory['block_name'];
$content[$key]['category_link'] = $context->link->getCMSCategoryLink((int)$cmsCategory['id_cms_category'], $cmsCategory['link_rewrite']);
$content[$key]['category_name'] = $cmsCategory['category_name'];
}
}
return $content;
}
}

View File

@@ -1,9 +0,0 @@
2014-04-22 18:56:59 +0200 // Changelog updated
2014-04-03 19:04:37 +0200 // blockcms, unassigned vars #PSCSX-1424
2014-03-28 10:19:50 +0100 // added default value for new configuration options
2014-03-26 12:42:47 +0100 [*] MO : blockcms : options added to display each links
2014-03-24 12:20:38 +0100 Merge branch 'master' of https://github.com/PrestaShop/blockcms
2014-03-24 11:43:28 +0100 / MO blockcms : ps_versions_compliancy modified (1.5.6.1 => 1.6)
2014-03-24 11:01:34 +0100 / MO blockcms : ps_versions_compliancy added
2014-03-24 10:54:46 +0100 [*] BO : updating labels and descriptions for blockcms.
2014-03-20 14:20:55 +0100 Initial commit

View File

@@ -1,930 +0,0 @@
<?php
/*
* 2007-2016 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-2016 PrestaShop SA
* @version Release: $Revision: 7060 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!defined('_CAN_LOAD_FILES_'))
exit;
include_once(dirname(__FILE__) . '/BlockCMSModel.php');
class BlockCms extends Module
{
protected $_html;
protected $_display;
public function __construct()
{
$this->name = 'blockcms';
$this->tab = 'front_office_features';
$this->version = '2.1.2';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('CMS block');
$this->description = $this->l('Adds a block with several CMS links.');
$this->secure_key = Tools::encrypt($this->name);
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99');
}
public function install()
{
if (!parent::install()
|| !$this->registerHook('leftColumn')
|| !$this->registerHook('rightColumn')
|| !$this->registerHook('header')
|| !$this->registerHook('footer')
|| !$this->registerHook('actionObjectCmsUpdateAfter')
|| !$this->registerHook('actionObjectCmsDeleteAfter')
|| !$this->registerHook('actionShopDataDuplication')
|| !$this->registerHook('actionAdminStoresControllerUpdate_optionsAfter')
|| !BlockCMSModel::createTables()
|| !Configuration::updateValue('FOOTER_CMS', '')
|| !Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', 1)
|| !Configuration::updateValue('FOOTER_POWEREDBY', 1)
|| !Configuration::updateValue('FOOTER_PRICE-DROP', 1)
|| !Configuration::updateValue('FOOTER_NEW-PRODUCTS', 1)
|| !Configuration::updateValue('FOOTER_BEST-SALES', 1)
|| !Configuration::updateValue('FOOTER_CONTACT', 1)
|| !Configuration::updateValue('FOOTER_SITEMAP', 1)
)
return false;
$this->_clearCache('blockcms.tpl');
// Install fixtures for blockcms
$default = Db::getInstance()->insert('cms_block', array(
'id_cms_category' => 1,
'location' => 0,
'position' => 0,
));
if (!$default)
return false;
$result = true;
$id_cms_block = Db::getInstance()->Insert_ID();
$shops = Shop::getShops(true, null, true);
foreach ($shops as $shop)
$result &= Db::getInstance()->insert('cms_block_shop', array(
'id_cms_block' => $id_cms_block,
'id_shop' => $shop
));
$languages = Language::getLanguages(false);
foreach ($languages as $lang)
$result &= Db::getInstance()->insert('cms_block_lang', array(
'id_cms_block' => $id_cms_block,
'id_lang' => $lang['id_lang'],
'name' => $this->l('Information'),
));
$pages = CMS::getCMSPages(null, 1);
foreach ($pages as $cms)
$result &= Db::getInstance()->insert('cms_block_page', array(
'id_cms_block' => $id_cms_block,
'id_cms' => $cms['id_cms'],
'is_category' => 0,
));
return $result;
}
public function uninstall()
{
$this->_clearCache('blockcms.tpl');
if (!parent::uninstall() ||
!BlockCMSModel::DropTables() ||
!Configuration::deleteByName('FOOTER_CMS') ||
!Configuration::deleteByName('FOOTER_BLOCK_ACTIVATION') ||
!Configuration::deleteByName('FOOTER_POWEREDBY') ||
!Configuration::deleteByName('FOOTER_PRICE-DROP') ||
!Configuration::deleteByName('FOOTER_NEW-PRODUCTS') ||
!Configuration::deleteByName('FOOTER_BEST-SALES') ||
!Configuration::deleteByName('FOOTER_CONTACT') ||
!Configuration::deleteByName('FOOTER_SITEMAP')
)
return false;
return true;
}
public function initToolbar()
{
$current_index = AdminController::$currentIndex;
$token = Tools::getAdminTokenLite('AdminModules');
$back = Tools::safeOutput(Tools::getValue('back', ''));
if (!isset($back) || empty($back))
$back = $current_index.'&amp;configure='.$this->name.'&token='.$token;
switch ($this->_display)
{
case 'add':
$this->toolbar_btn['cancel'] = array(
'href' => $back,
'desc' => $this->l('Cancel')
);
break;
case 'edit':
$this->toolbar_btn['cancel'] = array(
'href' => $back,
'desc' => $this->l('Cancel')
);
break;
case 'index':
$this->toolbar_btn['new'] = array(
'href' => $current_index.'&amp;configure='.$this->name.'&amp;token='.$token.'&amp;addBlockCMS',
'desc' => $this->l('Add new')
);
break;
default:
break;
}
return $this->toolbar_btn;
}
protected function displayForm()
{
$this->context->controller->addJqueryPlugin('tablednd');
if (version_compare(_PS_VERSION_, '1.6.0.11', '>=') === true)
$this->context->controller->addJS(_PS_JS_DIR_.'admin/dnd.js');
else
$this->context->controller->addJS(_PS_JS_DIR_.'admin-dnd.js');
$current_index = AdminController::$currentIndex;
$token = Tools::getAdminTokenLite('AdminModules');
$this->_display = 'index';
$this->fields_form[0]['form'] = array(
'legend' => array(
'title' => $this->l('CMS block configuration'),
'icon' => 'icon-list-alt'
),
'input' => array(
array(
'type' => 'cms_blocks',
'label' => $this->l('CMS Blocks'),
'name' => 'cms_blocks',
'values' => array(
0 => BlockCMSModel::getCMSBlocksByLocation(BlockCMSModel::LEFT_COLUMN, Shop::getContextShopID()),
1 => BlockCMSModel::getCMSBlocksByLocation(BlockCMSModel::RIGHT_COLUMN, Shop::getContextShopID()))
)
),
'buttons' => array(
'newBlock' => array(
'title' => $this->l('New block'),
'href' => $current_index.'&amp;configure='.$this->name.'&amp;token='.$token.'&amp;addBlockCMS',
'class' => 'pull-right',
'icon' => 'process-icon-new'
)
)
);
$this->fields_form[1]['form'] = array(
'tinymce' => true,
'legend' => array(
'title' => $this->l('Configuration of the various links in the footer'),
'icon' => 'icon-link'
),
'input' => array(
array(
'type' => 'checkbox',
'name' => 'cms_footer',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display various links and information in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'cms_pages',
'label' => $this->l('Footer links'),
'name' => 'footerBox[]',
'values' => BlockCMSModel::getAllCMSStructure(),
'desc' => $this->l('Please mark every page that you want to display in the footer CMS block.')
),
array(
'type' => 'textarea',
'label' => $this->l('Footer information'),
'name' => 'footer_text',
'rows' => 5,
'cols' => 60,
'lang' => true
),
array(
'type' => 'checkbox',
'name' => 'PS_STORES_DISPLAY_FOOTER',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Our stores" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_price-drop',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Price drop" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_new-products',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "New products" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_best-sales',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Best sales" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_contact',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Contact us" link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_display_sitemap',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display sitemap link in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'checkbox',
'name' => 'cms_footer_powered_by',
'values' => array(
'query' => array(
array(
'id' => 'on',
'name' => $this->l('Display "Powered by PrestaShop" in the footer'),
'val' => '1'
),
),
'id' => 'id',
'name' => 'name'
)
)
),
'submit' => array(
'name' => 'submitFooterCMS',
'title' => $this->l('Save'),
)
);
$this->context->controller->getLanguages();
$tmp = Configuration::get('FOOTER_CMS');
$footer_boxes = explode('|', $tmp);
if ($footer_boxes && is_array($footer_boxes))
foreach ($footer_boxes as $key => $value)
$this->fields_value[$value] = true;
$this->fields_value['cms_footer_on'] = Configuration::get('FOOTER_BLOCK_ACTIVATION');
$this->fields_value['cms_footer_powered_by_on'] = Configuration::get('FOOTER_POWEREDBY');
$this->fields_value['PS_STORES_DISPLAY_FOOTER_on'] = Configuration::get('PS_STORES_DISPLAY_FOOTER');
$this->fields_value['cms_footer_display_price-drop_on'] = Configuration::get('FOOTER_PRICE-DROP');
$this->fields_value['cms_footer_display_new-products_on'] = Configuration::get('FOOTER_NEW-PRODUCTS');
$this->fields_value['cms_footer_display_best-sales_on'] = Configuration::get('FOOTER_BEST-SALES');
$this->fields_value['cms_footer_display_contact_on'] = Configuration::get('FOOTER_CONTACT');
$this->fields_value['cms_footer_display_sitemap_on'] = Configuration::get('FOOTER_SITEMAP');
foreach ($this->context->controller->_languages as $language)
{
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.$language['id_lang']);
$this->fields_value['footer_text'][$language['id_lang']] = $footer_text;
}
$helper = $this->initForm();
$helper->submit_action = '';
$helper->title = $this->l('CMS Block configuration');
$helper->fields_value = $this->fields_value;
$this->_html .= $helper->generateForm($this->fields_form);
return;
}
protected function displayAddForm()
{
$token = Tools::getAdminTokenLite('AdminModules');
$back = Tools::safeOutput(Tools::getValue('back', ''));
$current_index = AdminController::$currentIndex;
if (!isset($back) || empty($back))
$back = $current_index.'&amp;configure='.$this->name.'&token='.$token;
if (Tools::isSubmit('editBlockCMS') && Tools::getValue('id_cms_block'))
{
$this->_display = 'edit';
$id_cms_block = (int)Tools::getValue('id_cms_block');
$cmsBlock = BlockCMSModel::getBlockCMS($id_cms_block);
$cmsBlockCategories = BlockCMSModel::getCMSBlockPagesCategories($id_cms_block);
$cmsBlockPages = BlockCMSModel::getCMSBlockPages(Tools::getValue('id_cms_block'));
}
else
$this->_display = 'add';
$this->fields_form[0]['form'] = array(
'tinymce' => true,
'legend' => array(
'title' => isset($cmsBlock) ? $this->l('Edit the CMS block.') : $this->l('New CMS block'),
'icon' => isset($cmsBlock) ? 'icon-edit' : 'icon-plus-square'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Name of the CMS block'),
'name' => 'block_name',
'lang' => true,
'desc' => $this->l('If you leave this field empty, the block name will use the category name by default.')
),
array(
'type' => 'select_category',
'label' => $this->l('CMS category'),
'name' => 'id_category',
'options' => array(
'query' => BlockCMSModel::getCMSCategories(true),
'id' => 'id_cms_category',
'name' => 'name'
)
),
array(
'type' => 'select',
'label' => $this->l('Location'),
'name' => 'block_location',
'options' => array(
'query' => array(
array(
'id' => BlockCMSModel::LEFT_COLUMN,
'name' => $this->l('Left column')),
array(
'id' => BlockCMSModel::RIGHT_COLUMN,
'name' => $this->l('Right column')),
),
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'switch',
'label' => $this->l('Add link to Store Locator'),
'name' => 'display_stores',
'is_bool' => true,
'values' => array(
array(
'id' => 'display_stores_on',
'value' => 1,
'label' => $this->l('Yes')),
array(
'id' => 'display_stores_off',
'value' => 0,
'label' => $this->l('No')),
),
'desc' => $this->l('Adds the "Our stores" link at the end of the block.')
),
array(
'type' => 'cms_pages',
'label' => $this->l('CMS content'),
'name' => 'cmsBox[]',
'values' => BlockCMSModel::getAllCMSStructure(),
'desc' => $this->l('Please mark every page that you want to display in this block.')
),
),
'buttons' => array(
'cancelBlock' => array(
'title' => $this->l('Cancel'),
'href' => $back,
'icon' => 'process-icon-cancel'
)
),
'submit' => array(
'name' => 'submitBlockCMS',
'title' => $this->l('Save'),
)
);
$this->context->controller->getLanguages();
foreach ($this->context->controller->_languages as $language)
{
if (Tools::getValue('block_name_'.$language['id_lang']))
$this->fields_value['block_name'][$language['id_lang']] = Tools::getValue('block_name_'.$language['id_lang']);
else if (isset($cmsBlock) && isset($cmsBlock[$language['id_lang']]['name']))
$this->fields_value['block_name'][$language['id_lang']] = $cmsBlock[$language['id_lang']]['name'];
else
$this->fields_value['block_name'][$language['id_lang']] = '';
}
if (Tools::getValue('display_stores'))
$this->fields_value['display_stores'] = Tools::getValue('display_stores');
else if (isset($cmsBlock) && isset($cmsBlock[1]['display_store']))
$this->fields_value['display_stores'] = $cmsBlock[1]['display_store'];
else
$this->fields_value['display_stores'] = '';
if (Tools::getValue('id_category'))
$this->fields_value['id_category'] = (int)Tools::getValue('id_category');
else if (isset($cmsBlock) && isset($cmsBlock[1]['id_cms_category']))
$this->fields_value['id_category'] = $cmsBlock[1]['id_cms_category'];
if (Tools::getValue('block_location'))
$this->fields_value['block_location'] = Tools::getValue('block_location');
else if (isset($cmsBlock) && isset($cmsBlock[1]['location']))
$this->fields_value['block_location'] = $cmsBlock[1]['location'];
else
$this->fields_value['block_location'] = 0;
if ($cmsBoxes = Tools::getValue('cmsBox'))
foreach ($cmsBoxes as $key => $value)
$this->fields_value[$value] = true;
else
{
if (isset($cmsBlockPages) && is_array($cmsBlockPages) && count($cmsBlockPages) > 0)
foreach ($cmsBlockPages as $item)
$this->fields_value['0_'.$item['id_cms']] = true;
if (isset($cmsBlockCategories) && is_array($cmsBlockCategories) && count($cmsBlockCategories) > 0)
foreach ($cmsBlockCategories as $item)
$this->fields_value['1_'.$item['id_cms']] = true;
}
$helper = $this->initForm();
if (isset($id_cms_block))
{
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name.'&id_cms_block='.$id_cms_block;
$helper->submit_action = 'editBlockCMS';
}
else
$helper->submit_action = 'addBlockCMS';
$helper->fields_value = isset($this->fields_value) ? $this->fields_value : array();
$this->_html .= $helper->generateForm($this->fields_form);
return;
}
protected function initForm()
{
$helper = new HelperForm();
$helper->module = $this;
$helper->name_controller = 'blockcms';
$helper->identifier = $this->identifier;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->languages = $this->context->controller->_languages;
$helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
$helper->default_form_language = $this->context->controller->default_form_language;
$helper->allow_employee_form_lang = $this->context->controller->allow_employee_form_lang;
$helper->toolbar_scroll = true;
$helper->toolbar_btn = $this->initToolbar();
return $helper;
}
protected function changePosition()
{
if (!Validate::isInt(Tools::getValue('position')) ||
(Tools::getValue('location') != BlockCMSModel::LEFT_COLUMN &&
Tools::getValue('location') != BlockCMSModel::RIGHT_COLUMN) ||
(Tools::getValue('way') != 0 && Tools::getValue('way') != 1))
Tools::displayError();
$this->_html .= 'pos change!';
$position = (int)Tools::getValue('position');
$location = (int)Tools::getValue('location');
$id_cms_block = (int)Tools::getValue('id_cms_block');
if (Tools::getValue('way') == 0)
$new_position = $position + 1;
else if (Tools::getValue('way') == 1)
$new_position = $position - 1;
BlockCMSModel::updateCMSBlockPositions($id_cms_block, $position, $new_position, $location);
Tools::redirectAdmin('index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules'));
}
protected function _postValidation()
{
$this->_errors = array();
if (Tools::isSubmit('submitBlockCMS'))
{
$this->context->controller->getLanguages();
$cmsBoxes = Tools::getValue('cmsBox');
if (!Validate::isInt(Tools::getValue('display_stores')) || (Tools::getValue('display_stores') != 0 && Tools::getValue('display_stores') != 1))
$this->_errors[] = $this->l('Invalid store display value.');
if (!Validate::isInt(Tools::getValue('block_location')) || (Tools::getValue('block_location') != BlockCMSModel::LEFT_COLUMN && Tools::getValue('block_location') != BlockCMSModel::RIGHT_COLUMN))
$this->_errors[] = $this->l('Invalid block location.');
if (!is_array($cmsBoxes))
$this->_errors[] = $this->l('You must choose at least one page -- or subcategory -- in order to create a CMS block.');
else
{
foreach ($cmsBoxes as $cmsBox)
if (!preg_match('#^[01]_[0-9]+$#', $cmsBox))
$this->_errors[] = $this->l('Invalid CMS page and/or category.');
foreach ($this->context->controller->_languages as $language)
if (strlen(Tools::getValue('block_name_'.$language['id_lang'])) > 40)
$this->_errors[] = $this->l('The block name is too long.');
}
}
else if (Tools::isSubmit('deleteBlockCMS') && !Validate::isInt(Tools::getValue('id_cms_block')))
{
$this->_errors[] = $this->l('Invalid id_cms_block');
}
else if (Tools::isSubmit('submitFooterCMS'))
{
if (Tools::getValue('footerBox') && is_array(Tools::getValue('footerBox')))
{
foreach (Tools::getValue('footerBox') as $cmsBox)
if (!preg_match('#^[01]_[0-9]+$#', $cmsBox))
$this->_errors[] = $this->l('Invalid CMS page and/or category.');
}
$empty_footer_text = true;
$footer_text = array((int)Configuration::get('PS_LANG_DEFAULT') => Tools::getValue('footer_text_'.(int)Configuration::get('PS_LANG_DEFAULT')));
$this->context->controller->getLanguages();
foreach ($this->context->controller->_languages as $language)
{
if ($language['id_lang'] == (int)Configuration::get('PS_LANG_DEFAULT'))
continue;
$footer_text_value = Tools::getValue('footer_text_'.(int)$language['id_lang']);
if (!empty($footer_text_value))
{
$empty_footer_text = false;
$footer_text[(int)$language['id_lang']] = $footer_text_value;
}
else
$footer_text[(int)$language['id_lang']] = $footer_text[(int)Configuration::get('PS_LANG_DEFAULT')];
}
if (!$empty_footer_text && empty($footer_text[(int)Configuration::get('PS_LANG_DEFAULT')]))
$this->_errors[] = $this->l('Please provide footer text for the default language.');
else
{
foreach ($this->context->controller->_languages as $language)
Configuration::updateValue('FOOTER_CMS_TEXT_'.(int)$language['id_lang'], $footer_text[(int)$language['id_lang']], true);
}
if ((Tools::getValue('cms_footer_on') != 0) && (Tools::getValue('cms_footer_on') != 1))
$this->_errors[] = $this->l('Invalid footer activation.');
}
if (count($this->_errors))
{
foreach ($this->_errors as $err)
$this->_html .= '<div class="alert alert-danger">'.$err.'</div>';
return false;
}
return true;
}
protected function _postProcess()
{
if ($this->_postValidation() == false)
return false;
$this->_clearCache('blockcms.tpl');
$this->_errors = array();
if (Tools::isSubmit('submitBlockCMS'))
{
$this->context->controller->getLanguages();
$id_cms_category = (int)Tools::getvalue('id_category');
$display_store = (int)Tools::getValue('display_stores');
$location = (int)Tools::getvalue('block_location');
$position = BlockCMSModel::getMaxPosition($location);
if (Tools::isSubmit('addBlockCMS'))
{
$id_cms_block = BlockCMSModel::insertCMSBlock($id_cms_category, $location, $position, $display_store);
if ($id_cms_block !== false)
{
foreach ($this->context->controller->_languages as $language)
BlockCMSModel::insertCMSBlockLang($id_cms_block, $language['id_lang']);
$shops = Shop::getContextListShopID();
foreach ($shops as $shop)
BlockCMSModel::insertCMSBlockShop($id_cms_block, $shop);
}
$this->_errors[] = $this->l('Cannot create a block!');
}
elseif (Tools::isSubmit('editBlockCMS'))
{
$id_cms_block = Tools::getvalue('id_cms_block');
$old_block = BlockCMSModel::getBlockCMS($id_cms_block);
BlockCMSModel::deleteCMSBlockPage($id_cms_block);
if ($old_block[1]['location'] != (int)Tools::getvalue('block_location'))
BlockCMSModel::updatePositions($old_block[1]['position'], $old_block[1]['position'] + 1, $old_block[1]['location']);
BlockCMSModel::updateCMSBlock($id_cms_block, $id_cms_category, $position, $location, $display_store);
foreach ($this->context->controller->_languages as $language)
{
$block_name = Tools::getValue('block_name_'.$language['id_lang']);
BlockCMSModel::updateCMSBlockLang($id_cms_block, $block_name, $language['id_lang']);
}
}
$cmsBoxes = Tools::getValue('cmsBox');
if ($cmsBoxes)
{
foreach ($cmsBoxes as $cmsBox)
{
$cms_properties = explode('_', $cmsBox);
BlockCMSModel::insertCMSBlockPage($id_cms_block, $cms_properties[1], $cms_properties[0]);
}
}
if (Tools::isSubmit('addBlockCMS'))
$redirect = 'addBlockCMSConfirmation';
elseif (Tools::isSubmit('editBlockCMS'))
$redirect = 'editBlockCMSConfirmation';
Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&'.$redirect);
}
elseif (Tools::isSubmit('deleteBlockCMS') && Tools::getValue('id_cms_block'))
{
$id_cms_block = Tools::getvalue('id_cms_block');
if ($id_cms_block)
{
BlockCMSModel::deleteCMSBlock((int)$id_cms_block);
BlockCMSModel::deleteCMSBlockPage((int)$id_cms_block);
Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&deleteBlockCMSConfirmation');
}
else
$this->_html .= $this->displayError($this->l('Error: You are trying to delete a non-existing CMS block.'));
}
elseif (Tools::isSubmit('submitFooterCMS'))
{
$powered_by = Tools::getValue('cms_footer_powered_by_on') ? 1 : 0;
$footer_boxes = Tools::getValue('footerBox') ? implode('|', Tools::getValue('footerBox')) : '';
$block_activation = (Tools::getValue('cms_footer_on') == 1) ? 1 : 0;
Configuration::updateValue('PS_STORES_DISPLAY_FOOTER', Tools::getValue('PS_STORES_DISPLAY_FOOTER_on'));
Configuration::updateValue('FOOTER_CMS', rtrim($footer_boxes, '|'));
Configuration::updateValue('FOOTER_POWEREDBY', $powered_by);
Configuration::updateValue('FOOTER_BLOCK_ACTIVATION', $block_activation);
Configuration::updateValue('FOOTER_PRICE-DROP', (int)Tools::getValue('cms_footer_display_price-drop_on'));
Configuration::updateValue('FOOTER_NEW-PRODUCTS', (int)Tools::getValue('cms_footer_display_new-products_on'));
Configuration::updateValue('FOOTER_BEST-SALES', (int)Tools::getValue('cms_footer_display_best-sales_on'));
Configuration::updateValue('FOOTER_CONTACT', (int)Tools::getValue('cms_footer_display_contact_on'));
Configuration::updateValue('FOOTER_SITEMAP', (int)Tools::getValue('cms_footer_display_sitemap_on'));
$this->_html .= $this->displayConfirmation($this->l('Your footer information has been updated.'));
}
elseif (Tools::isSubmit('addBlockCMSConfirmation'))
$this->_html .= $this->displayConfirmation($this->l('CMS block added.'));
elseif (Tools::isSubmit('editBlockCMSConfirmation'))
$this->_html .= $this->displayConfirmation($this->l('CMS block edited.'));
elseif (Tools::isSubmit('deleteBlockCMSConfirmation'))
$this->_html .= $this->displayConfirmation($this->l('Deletion successful.'));
elseif (Tools::isSubmit('id_cms_block') && Tools::isSubmit('way') && Tools::isSubmit('position') && Tools::isSubmit('location'))
$this->changePosition();
elseif (Tools::isSubmit('updatePositions'))
$this->updatePositionsDnd();
if (count($this->_errors))
{
foreach ($this->_errors as $err)
$this->_html .= '<div class="alert error">'.$err.'</div>';
}
}
public function getContent()
{
$this->_html = '';
$this->_postProcess();
if (Tools::isSubmit('addBlockCMS') || Tools::isSubmit('editBlockCMS'))
$this->displayAddForm();
else
$this->displayForm();
return $this->_html;
}
public function displayBlockCMS($column)
{
if (!$this->isCached('blockcms.tpl', $this->getCacheId($column)))
{
$cms_titles = BlockCMSModel::getCMSTitles($column);
$this->smarty->assign(array(
'block' => 1,
'cms_titles' => $cms_titles,
'contact_url' => (_PS_VERSION_ >= 1.5) ? 'contact' : 'contact-form'
));
}
return $this->display(__FILE__, 'blockcms.tpl', $this->getCacheId($column));
}
protected function getCacheId($name = null)
{
return parent::getCacheId('blockcms|'.$name);
}
public function hookActionAdminStoresControllerUpdate_optionsAfter()
{
if (Tools::getIsset('PS_STORES_DISPLAY_FOOTER'))
$this->_clearCache('blockcms.tpl');
}
public function hookActionObjectCmsUpdateAfter()
{
$this->_clearCache('blockcms.tpl');
}
public function hookActionObjectCmsDeleteAfter()
{
$this->_clearCache('blockcms.tpl');
}
public function hookHeader($params)
{
$this->context->controller->addCSS(($this->_path).'blockcms.css', 'all');
}
public function hookLeftColumn()
{
return $this->displayBlockCMS(BlockCMSModel::LEFT_COLUMN);
}
public function hookRightColumn()
{
return $this->displayBlockCMS(BlockCMSModel::RIGHT_COLUMN);
}
public function hookFooter()
{
if (!($block_activation = Configuration::get('FOOTER_BLOCK_ACTIVATION')))
return;
if (!$this->isCached('blockcms.tpl', $this->getCacheId(BlockCMSModel::FOOTER)))
{
$display_poweredby = Configuration::get('FOOTER_POWEREDBY');
$this->smarty->assign(
array(
'block' => 0,
'contact_url' => 'contact',
'cmslinks' => BlockCMSModel::getCMSTitlesFooter(),
'display_stores_footer' => Configuration::get('PS_STORES_DISPLAY_FOOTER'),
'display_poweredby' => ((int)$display_poweredby === 1 || $display_poweredby === false),
'footer_text' => Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id),
'show_price_drop' => Configuration::get('FOOTER_PRICE-DROP'),
'show_new_products' => Configuration::get('FOOTER_NEW-PRODUCTS'),
'show_best_sales' => Configuration::get('FOOTER_BEST-SALES'),
'show_contact' => Configuration::get('FOOTER_CONTACT'),
'show_sitemap' => Configuration::get('FOOTER_SITEMAP')
)
);
}
return $this->display(__FILE__, 'blockcms.tpl', $this->getCacheId(BlockCMSModel::FOOTER));
}
protected function updatePositionsDnd()
{
if (Tools::getValue('cms_block_0'))
$positions = Tools::getValue('cms_block_0');
elseif (Tools::getValue('cms_block_1'))
$positions = Tools::getValue('cms_block_1');
else
$positions = array();
foreach ($positions as $position => $value)
{
$pos = explode('_', $value);
if (isset($pos[2]))
BlockCMSModel::updateCMSBlockPosition($pos[2], $position);
}
}
public function hookActionShopDataDuplication($params)
{
//get all cmd block to duplicate in new shop
$cms_blocks = Db::getInstance()->executeS('
SELECT * FROM `'._DB_PREFIX_.'cms_block` cb
JOIN `'._DB_PREFIX_.'cms_block_shop` cbf
ON (cb.`id_cms_block` = cbf.`id_cms_block` AND cbf.`id_shop` = '.(int)$params['old_id_shop'].') ');
if (count($cms_blocks))
{
foreach ($cms_blocks as $cms_block)
{
Db::getInstance()->execute('
INSERT IGNORE INTO '._DB_PREFIX_.'cms_block (`id_cms_block`, `id_cms_category`, `location`, `position`, `display_store`)
VALUES (NULL, '.(int)$cms_block['id_cms_category'].', '.(int)$cms_block['location'].', '.(int)$cms_block['position'].', '.(int)$cms_block['display_store'].');');
$id_block_cms = Db::getInstance()->Insert_ID();
Db::getInstance()->execute('INSERT IGNORE INTO '._DB_PREFIX_.'cms_block_shop (`id_cms_block`, `id_shop`) VALUES ('.(int)$id_block_cms.', '.(int)$params['new_id_shop'].');');
$langs = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'cms_block_lang` WHERE `id_cms_block` = '.(int)$cms_block['id_cms_block']);
foreach($langs as $lang)
Db::getInstance()->execute('
INSERT IGNORE INTO `'._DB_PREFIX_.'cms_block_lang` (`id_cms_block`, `id_lang`, `name`)
VALUES ('.(int)$id_block_cms.', '.(int)$lang['id_lang'].', \''.pSQL($lang['name']).'\');');
$pages = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'cms_block_page` WHERE `id_cms_block` = '.(int)$cms_block['id_cms_block']);
foreach($pages as $page)
Db::getInstance()->execute('
INSERT IGNORE INTO `'._DB_PREFIX_.'cms_block_page` (`id_cms_block_page`, `id_cms_block`, `id_cms`, `is_category`)
VALUES (NULL, '.(int)$id_block_cms.', '.(int)$page['id_cms'].', '.(int)$page['is_category'].');');
}
}
}
}

View File

@@ -1,108 +0,0 @@
{*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if $block == 1}
<!-- Block CMS module -->
{foreach from=$cms_titles key=cms_key item=cms_title}
<div id="informations_block_left_{$cms_key}" class="block informations_block_left">
<h4 class="title_block">
<a href="{$cms_title.category_link|escape:'html'}">{if !empty($cms_title.name)}{$cms_title.name}{else}{$cms_title.category_name}{/if}</a>
</h4>
<ul class="block_content">
{foreach from=$cms_title.categories item=cms_page}
{if isset($cms_page.link)}
<li class="bullet">
<b style="margin-left:2em;">
<a href="{$cms_page.link|escape:'html'}" title="{$cms_page.name|escape:html:'UTF-8'}">{$cms_page.name|escape:html:'UTF-8'}</a>
</b>
</li>
{/if}
{/foreach}
{foreach from=$cms_title.cms item=cms_page}
{if isset($cms_page.link)}
<li>
<a href="{$cms_page.link|escape:'html'}" title="{$cms_page.meta_title|escape:html:'UTF-8'}">{$cms_page.meta_title|escape:html:'UTF-8'}</a>
</li>
{/if}
{/foreach}
{if $cms_title.display_store}
<li>
<a href="{$link->getPageLink('stores')|escape:'html'}" title="{l s='Our stores' mod='blockcms'}">{l s='Our stores' mod='blockcms'}</a>
</li>
{/if}
</ul>
</div>
{/foreach}
<!-- /Block CMS module -->
{else}
<!-- MODULE Block footer -->
<div class="block_various_links" id="block_various_links_footer">
<h4 class="title_block">{l s='Information' mod='blockcms'}</h4>
<ul>
{if isset($show_price_drop) && $show_price_drop && !$PS_CATALOG_MODE}
<li class="first_item">
<a href="{$link->getPageLink('prices-drop')|escape:'html'}" title="{l s='Specials' mod='blockcms'}">{l s='Specials' mod='blockcms'}</a>
</li>
{/if}
{if isset($show_new_products) && $show_new_products}
<li class="item">
<a href="{$link->getPageLink('new-products')|escape:'html'}" title="{l s='New products' mod='blockcms'}">{l s='New products' mod='blockcms'}</a>
</li>
{/if}
{if isset($show_best_sales) && $show_best_sales && !$PS_CATALOG_MODE}
<li class="item">
<a href="{$link->getPageLink('best-sales')|escape:'html'}" title="{l s='Best sellers' mod='blockcms'}">{l s='Best sellers' mod='blockcms'}</a>
</li>
{/if}
{if isset($display_stores_footer) && $display_stores_footer}
<li class="item">
<a href="{$link->getPageLink('stores')|escape:'html'}" title="{l s='Our stores' mod='blockcms'}">{l s='Our stores' mod='blockcms'}</a>
</li>
{/if}
{if isset($show_contact) && $show_contact}
<li class="item">
<a href="{$link->getPageLink($contact_url, true)|escape:'html'}" title="{l s='Contact us' mod='blockcms'}">{l s='Contact us' mod='blockcms'}</a>
</li>
{/if}
{foreach from=$cmslinks item=cmslink}
{if $cmslink.meta_title != ''}
<li class="item">
<a href="{$cmslink.link|addslashes|escape:'html'}" title="{$cmslink.meta_title|escape:'html':'UTF-8'}">{$cmslink.meta_title|escape:'html':'UTF-8'}</a>
</li>
{/if}
{/foreach}
{if isset($show_sitemap) && $show_sitemap}
<li>
<a href="{$link->getPageLink('sitemap')|escape:'html'}" title="{l s='Sitemap' mod='blockcms'}">{l s='Sitemap' mod='blockcms'}</a>
</li>
{/if}
{if isset($display_poweredby) && $display_poweredby}
<li class="last_item">{l s='[1]Ecommerce software by %s[/1]' mod='blockcms' sprintf=['PrestaShop™'] tags=['<a class="_blank" href="http://www.prestashop.com">']}</li>
{/if}
</ul>
{$footer_text}
</div>
<!-- /MODULE Block footer -->
{/if}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

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

View File

@@ -1,9 +0,0 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_3($object)
{
return ($object->registerHook('actionObjectCmsUpdateAfter') && $object->registerHook('actionObjectCmsDeleteAfter'));
}

View File

@@ -1,9 +0,0 @@
<?php
if (!defined('_PS_VERSION_'))
exit;
function upgrade_module_1_4($object)
{
return ($object->registerHook('actionAdminStoresControllerUpdate_optionsAfter'));
}

View File

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

View File

@@ -1,222 +0,0 @@
{*
* 2007-2016 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-2016 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{extends file="helpers/form/form.tpl"}
{block name="label"}
{if $input.type == 'cms_blocks'}
{else}
{$smarty.block.parent}
{/if}
{/block}
{block name="legend"}
<h3>
{if isset($field.image)}<img src="{$field.image}" alt="{$field.title|escape:'html':'UTF-8'}" />{/if}
{if isset($field.icon)}<i class="{$field.icon}"></i>{/if}
{$field.title}
<span class="panel-heading-action">
{foreach from=$toolbar_btn item=btn key=k}
{if $k != 'modules-list' && $k != 'back'}
<a id="desc-{$table}-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}" class="list-toolbar-btn" {if isset($btn.href)}href="{$btn.href}"{/if} {if isset($btn.target) && $btn.target}target="_blank"{/if}{if isset($btn.js) && $btn.js}onclick="{$btn.js}"{/if}>
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s=$btn.desc}" data-html="true">
<i class="process-icon-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if} {if isset($btn.class)}{$btn.class}{/if}" ></i>
</span>
</a>
{/if}
{/foreach}
</span>
</h3>
{/block}
{block name="input"}
{if $input.type == 'select_category'}
{function name=render_select level=0}
{foreach $items as $item}
{if (isset($item['id_cms_category']))}
<option id="category_{$item['id_cms_category']}" value="{$item['id_cms_category']}"
{if (isset($fields_value['id_category']) && ($item['id_cms_category'] == $fields_value['id_category']))}
selected
{/if} >
{str_repeat('-', $level)|cat:$item['name']}
</option>
{if isset($item['sub_categories']) && count($item['sub_categories']) > 0}
{call name=render_select items=$item['sub_categories'] level=$level+1}
{/if}
{/if}
{/foreach}
{/function}
{if isset($input.options.query) && count($input.options.query) > 0}
{assign var=categories value=$input.options.query}
<select class="form-control fixed-width-xl" id="{$input.name}" name="{$input.name}">
{call render_select items=$categories}
</select>
{/if}
{else}
{$smarty.block.parent}
{/if}
{/block}
{block name="input_row"}
{if $input.type == 'cms_blocks'}
<div class="row">
<script type="text/javascript">
var come_from = '{$name_controller}';
var token = '{$token}';
var alternate = 1;
</script>
{assign var=cms_blocks_positions value=$input.values}
{if isset($cms_blocks_positions) && count($cms_blocks_positions) > 0}
{foreach $cms_blocks_positions as $key => $cms_blocks_position}
<div class="col-lg-6">
<div class="panel">
<div class="panel-heading">
{if $key == 0}
{l s='Left blocks' mod='blockcms'}
{else}
{l s='Right blocks' mod='blockcms'}
{/if}
</div>
<table class="table tableDnD cms" id="cms_block_{$key%2}">
<thead>
<tr class="nodrag nodrop">
<th>{l s='ID' mod='blockcms'}</th>
<th>{l s='Name of the block' mod='blockcms'}</th>
<th>{l s='Category name' mod='blockcms'}</th>
<th>{l s='Position' mod='blockcms'}</th>
<th></th>
</tr>
</thead>
<tbody>
{foreach $cms_blocks_position as $key => $cms_block}
<tr class="{if $key%2}alt_row{else}not_alt_row{/if} row_hover" id="tr_{$key%2}_{$cms_block['id_cms_block']}_{$cms_block['position']}">
<td>{$cms_block['id_cms_block']}</td>
<td>{$cms_block['block_name']}</td>
<td>{$cms_block['category_name']}</td>
<td class="center pointer dragHandle" id="td_{$key%2}_{$cms_block['id_cms_block']}">
<div class="dragGroup">
<div class="positions">
{$cms_block['position'] + 1}
</div>
</div>
</td>
<td>
<div class="btn-group-action">
<div class="btn-group pull-right">
<a class="btn btn-default" href="{$current}&amp;token={$token}&amp;editBlockCMS&amp;id_cms_block={(int)$cms_block['id_cms_block']}" title="{l s='Edit' mod='blockcms'}">
<i class="icon-edit"></i> {l s='Edit' mod='blockcms'}
</a>
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<i class="icon-caret-down"></i>&nbsp;
</button>
<ul class="dropdown-menu">
<li>
<a href="{$current}&amp;token={$token}&amp;deleteBlockCMS&amp;id_cms_block={(int)$cms_block['id_cms_block']}" title="{l s='Delete' mod='blockcms'}">
<i class="icon-trash"></i> {l s='Delete' mod='blockcms'}
</a>
</li>
</ul>
</div>
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{/foreach}
{/if}
</div>
{elseif $input.type == 'cms_pages'}
{assign var=cms value=$input.values}
{if isset($cms) && count($cms) > 0}
<div class="row">
<div class="col-lg-9 col-lg-offset-3">
<div class="panel">
<div class="panel-heading">
{$input.label}
</div>
<table class="table">
<thead>
<tr>
<th>
<input type="checkbox" name="checkme" id="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$input.name}', this.checked)" />
</th>
<th>{l s='ID' mod='blockcms'}</th>
<th>{l s='Name' mod='blockcms'}</th>
</tr>
</thead>
<tbody>
{foreach $cms as $key => $cms_category}
<tr {if $key%2}class="alt_row"{/if}>
<td>
{assign var=id_checkbox value=1|cat:'_'|cat:$cms_category['id_cms_category']}
<input type="checkbox" class="cmsBox" name="{$input.name}" id="{$id_checkbox}" value="{$id_checkbox}" {if isset($fields_value[$id_checkbox])}checked="checked"{/if} />
</td>
<td>
{$cms_category['id_cms_category']}
</td>
<td>
<label class="control-label" for="{$id_checkbox}">
{if $cms_category['level_depth'] > 0}
{str_repeat('- ', ($cms_category['level_depth'] - 1))}
{/if}
{$cms_category['name']|escape}
</label>
</td>
</tr>
{foreach $cms_category['cms_pages'] as $subkey => $cms_page}
<tr class="subitem{if ($subkey+$key-1)%2} alt_row{/if}">
<td>
{assign var=id_checkbox value=0|cat:'_'|cat:$cms_page['id_cms']}
<input type="checkbox" class="cmsBox" name="{$input.name}" id="{$id_checkbox}" value="{$id_checkbox}" {if isset($fields_value[$id_checkbox])}checked="checked"{/if} />
</td>
<td>
{$cms_page['id_cms']}
</td>
<td>
<label class="control-label" for="{$id_checkbox}">
{str_repeat('- ', $cms_category['level_depth'])|cat:$cms_page['meta_title']}
</label>
</td>
</tr>
{/foreach}
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
{else}
<p>{l s='No pages have been created.' mod='blockcms'}</p>
{/if}
{else}
{$smarty.block.parent}
{/if}
{/block}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,134 +0,0 @@
{*
* 2007-2017 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-2017 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{if $block == 1}
<!-- Block CMS module -->
{foreach from=$cms_titles key=cms_key item=cms_title}
<section id="informations_block_left_{$cms_key}" class="block informations_block_left">
<p class="title_block">
<a href="{$cms_title.category_link|escape:'html':'UTF-8'}">
{if !empty($cms_title.name)}{$cms_title.name}{else}{$cms_title.category_name}{/if}
</a>
</p>
<div class="block_content list-block">
<ul>
{foreach from=$cms_title.categories item=cms_page}
{if isset($cms_page.link)}
<li class="bullet">
<a href="{$cms_page.link|escape:'html':'UTF-8'}" title="{$cms_page.name|escape:'html':'UTF-8'}">
{$cms_page.name|escape:'html':'UTF-8'}
</a>
</li>
{/if}
{/foreach}
{foreach from=$cms_title.cms item=cms_page}
{if isset($cms_page.link)}
<li>
<a href="{$cms_page.link|escape:'html':'UTF-8'}" title="{$cms_page.meta_title|escape:'html':'UTF-8'}">
{$cms_page.meta_title|escape:'html':'UTF-8'}
</a>
</li>
{/if}
{/foreach}
{if $cms_title.display_store}
<li>
<a href="{$link->getPageLink('stores')|escape:'html':'UTF-8'}" title="{l s='Our stores' mod='blockcms'}">
{l s='Our stores' mod='blockcms'}
</a>
</li>
{/if}
</ul>
</div>
</section>
{/foreach}
<!-- /Block CMS module -->
{else}
<!-- Block CMS module footer -->
<section class="footer-block col-xs-12 col-sm-2" id="block_various_links_footer">
<h4>{l s='Information' mod='blockcms'}</h4>
<ul class="toggle-footer">
{if isset($show_price_drop) && $show_price_drop && !$PS_CATALOG_MODE}
<li class="item">
<a href="{$link->getPageLink('prices-drop')|escape:'html':'UTF-8'}" title="{l s='Specials' mod='blockcms'}">
{l s='Specials' mod='blockcms'}
</a>
</li>
{/if}
{if isset($show_new_products) && $show_new_products}
<li class="item">
<a href="{$link->getPageLink('new-products')|escape:'html':'UTF-8'}" title="{l s='New products' mod='blockcms'}">
{l s='New products' mod='blockcms'}
</a>
</li>
{/if}
{if isset($show_best_sales) && $show_best_sales && !$PS_CATALOG_MODE}
<li class="item">
<a href="{$link->getPageLink('best-sales')|escape:'html':'UTF-8'}" title="{l s='Top sellers' mod='blockcms'}">
{l s='Top sellers' mod='blockcms'}
</a>
</li>
{/if}
{if isset($display_stores_footer) && $display_stores_footer}
<li class="item">
<a href="{$link->getPageLink('stores')|escape:'html':'UTF-8'}" title="{l s='Our stores' mod='blockcms'}">
{l s='Our stores' mod='blockcms'}
</a>
</li>
{/if}
{if isset($show_contact) && $show_contact}
<li class="item">
<a href="{$link->getPageLink($contact_url, true)|escape:'html':'UTF-8'}" title="{l s='Contact us' mod='blockcms'}">
{l s='Contact us' mod='blockcms'}
</a>
</li>
{/if}
{foreach from=$cmslinks item=cmslink}
{if $cmslink.meta_title != ''}
<li class="item">
<a href="{$cmslink.link|escape:'html':'UTF-8'}" title="{$cmslink.meta_title|escape:'html':'UTF-8'}">
{$cmslink.meta_title|escape:'html':'UTF-8'}
</a>
</li>
{/if}
{/foreach}
{if isset($show_sitemap) && $show_sitemap}
<li>
<a href="{$link->getPageLink('sitemap')|escape:'html':'UTF-8'}" title="{l s='Sitemap' mod='blockcms'}">
{l s='Sitemap' mod='blockcms'}
</a>
</li>
{/if}
</ul>
{$footer_text}
</section>
{if $display_poweredby}
<section class="bottom-footer col-xs-12">
<div>
{l s='[1] %3$s %2$s - Ecommerce software by %1$s [/1]' mod='blockcms' sprintf=['PrestaShop™', 'Y'|date, '©'] tags=['<a class="_blank" href="http://www.prestashop.com">'] nocache}
</div>
</section>
{/if}
<!-- /Block CMS module footer -->
{/if}

View File

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

View File

@@ -1,25 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{blockcms}prestashop>blockcms_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Information';
$_MODULE['<{blockcms}prestashop>blockcms_ea4788705e6873b424c65e91c2846b19'] = 'Cancel';
$_MODULE['<{blockcms}prestashop>blockcms_ef61fb324d729c341ea8ab9901e23566'] = 'Add new';
$_MODULE['<{blockcms}prestashop>blockcms_c9cc8cce247e49bae79f15173ce97354'] = 'Save';
$_MODULE['<{blockcms}prestashop>blockcms_965be994da393e5aa15bd3a2444c6ccf'] = 'Footer\'s various links Configuration';
$_MODULE['<{blockcms}prestashop>blockcms_9aa03a5dca2e060a4ecbff0dd8616692'] = 'Save';
$_MODULE['<{blockcms}prestashop>blockcms_93cba07454f06a4a960172bbd6e2a435'] = 'Yes';
$_MODULE['<{blockcms}prestashop>blockcms_bafd7322c6e97d25b6299b5d6fe8920b'] = 'No';
$_MODULE['<{blockcms}prestashop>blockcms_87a2663d841b78f01c27c0edb4f50b76'] = 'Deletion successful';
$_MODULE['<{blockcms}prestashop>blockcms_34c869c542dee932ef8cd96d2f91cae6'] = 'Our stores';
$_MODULE['<{blockcms}prestashop>blockcms_3cb29f0ccc5fd220a97df89dafe46290'] = 'Best sellers';
$_MODULE['<{blockcms}prestashop>blockcms_e1da49db34b0bdfdddaba2ad6552f848'] = 'Sitemap';
$_MODULE['<{blockcms}prestashop>form_b718adec73e04ce3ec720dd11a06a308'] = 'ID';
$_MODULE['<{blockcms}prestashop>form_52f5e0bc3859bc5f5e25130b6c7e8881'] = 'Position';
$_MODULE['<{blockcms}prestashop>form_06df33001c1d7187fdd81ea1f5b277aa'] = 'Actions';
$_MODULE['<{blockcms}prestashop>form_08a38277b0309070706f6652eeae9a53'] = 'Down';
$_MODULE['<{blockcms}prestashop>form_258f49887ef8d14ac268c92b02503aaa'] = 'Up';
$_MODULE['<{blockcms}prestashop>form_7dce122004969d56ae2e0245cb754d35'] = 'Edit';
$_MODULE['<{blockcms}prestashop>form_f2a6c498fb90ee345d997f888fce3b18'] = 'Delete';
$_MODULE['<{blockcms}prestashop>form_49ee3087348e8d44e1feda1917443987'] = 'Name';

View File

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