Dodaj nowe obrazy i szablony do modułu AP Page Builder
8
.vscode/ftp-kr.sync.cache.json
vendored
@@ -4036,13 +4036,13 @@
|
||||
},
|
||||
"google-merchant_id-1.xml": {
|
||||
"type": "-",
|
||||
"size": 73985727,
|
||||
"size": 72910906,
|
||||
"lmtime": 0,
|
||||
"modified": true
|
||||
},
|
||||
"google-merchant_id-2.xml": {
|
||||
"type": "-",
|
||||
"size": 2954405,
|
||||
"size": 2932584,
|
||||
"lmtime": 0,
|
||||
"modified": true
|
||||
},
|
||||
@@ -4074,8 +4074,8 @@
|
||||
},
|
||||
"import-product.php": {
|
||||
"type": "-",
|
||||
"size": 23703,
|
||||
"lmtime": 1742503757666,
|
||||
"size": 23054,
|
||||
"lmtime": 1742810375717,
|
||||
"modified": false
|
||||
},
|
||||
"index.php": {
|
||||
|
||||
1173
classes/Dispatcher.php
Normal file
5
modules/appagebuilder/Readme.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Ap Page Builder
|
||||
|
||||
## About
|
||||
Construction site: provide a method of building effective site, high flexibility, to create multi header and profile for the home page, product page.
|
||||
The module will provide a full range of widgets with user friendly features for building websites for your shop as optimized for SEO, responsive design, multi header...
|
||||
30
modules/appagebuilder/apadminajax.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
include_once(dirname(__FILE__).'/appagebuilder.php');
|
||||
|
||||
$module = APPageBuilder::getInstance();
|
||||
|
||||
//DONGND:: get product link for demo multi product detail
|
||||
if (Tools::getValue('action') == 'get-list-shortcode') {
|
||||
$result = '';
|
||||
$result = $module->getListShortCodeForEditor();
|
||||
die($result);
|
||||
}
|
||||
237
modules/appagebuilder/apajax.php
Normal file
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__) . '/../../init.php');
|
||||
include_once(dirname(__FILE__) . '/appagebuilder.php');
|
||||
include_once(dirname(__FILE__) . '/classes/shortcodes.php');
|
||||
include_once(dirname(__FILE__) . '/classes/shortcodes/ApProductList.php');
|
||||
$module = APPageBuilder::getInstance();
|
||||
apPageHelper::setGlobalVariable(Context::getContext());
|
||||
|
||||
//DONGND:: get product link for demo multi product detail
|
||||
if (Tools::getValue('action') == 'get-product-link')
|
||||
{
|
||||
$result = '';
|
||||
|
||||
$sql = 'SELECT p.`id_product` FROM `' . _DB_PREFIX_ . 'product` p ' . Shop::addSqlAssociation('product', 'p') . '
|
||||
AND product_shop.`visibility` IN ("both", "catalog")
|
||||
AND product_shop.`active` = 1
|
||||
ORDER BY p.`id_product` ASC';
|
||||
$first_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
$result = Context::getContext()->link->getProductLink($first_product['id_product'], null, null, null, null, null, (int)Product::getDefaultAttribute((int)$first_product['id_product']));
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
|
||||
if (Tools::getValue('leoajax') == 1)
|
||||
{
|
||||
# process category
|
||||
$list_cat = Tools::getValue('cat_list');
|
||||
$product_list_image = Tools::getValue('product_list_image');
|
||||
$product_one_img = Tools::getValue('product_one_img');
|
||||
$leo_pro_cdown = Tools::getValue('pro_cdown');
|
||||
$leo_pro_color = Tools::getValue('pro_color');
|
||||
// $ap_extra = Tools::getValue('product_apextra');
|
||||
//add function wishlist compare
|
||||
$wishlist_compare = Tools::getValue('wishlist_compare');
|
||||
|
||||
$result = array();
|
||||
|
||||
// if ($ap_extra) {
|
||||
// $id_lang = Context::getContext()->language->id;
|
||||
// $id_shop = Context::getContext()->shop->id;
|
||||
// $sql = 'SELECT * FROM '._DB_PREFIX_.'appagebuilder_extrapro WHERE id_product IN('.pSQL($ap_extra).') AND id_lang="'.(int)$id_lang.'" AND id_shop="'.(int)$id_shop.'"';
|
||||
// $product_extras = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
//
|
||||
// if ($product_extras) {
|
||||
// foreach ($product_extras as $value) {
|
||||
// $result['pro_apextra'][$value['id_product']] = $value;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//get number product of compare + wishlist
|
||||
if ($wishlist_compare)
|
||||
{
|
||||
$wishlist_products = 0;
|
||||
if (Configuration::get('LEOFEATURE_ENABLE_PRODUCTWISHLIST') && isset(Context::getContext()->cookie->id_customer))
|
||||
{
|
||||
$current_user = (int)Context::getContext()->cookie->id_customer;
|
||||
$list_wishlist = Db::getInstance()->executeS("SELECT id_wishlist FROM `" . _DB_PREFIX_ . "leofeature_wishlist` WHERE id_customer = '" . (int)$current_user . "'");
|
||||
foreach ($list_wishlist as $list_wishlist_item)
|
||||
{
|
||||
$number_product_wishlist = Db::getInstance()->getValue("SELECT COUNT(id_wishlist_product) FROM `" . _DB_PREFIX_ . "leofeature_wishlist_product` WHERE id_wishlist = " . (int)$list_wishlist_item['id_wishlist']);
|
||||
$wishlist_products += $number_product_wishlist;
|
||||
}
|
||||
// $wishlist_products = Db::getInstance()->getValue("SELECT COUNT(id_wishlist_product) FROM `"._DB_PREFIX_."wishlist_product` WHERE id_wishlist = '$id_wishlist'");
|
||||
}
|
||||
|
||||
$compared_products = array();
|
||||
if (Configuration::get('LEOFEATURE_ENABLE_PRODUCTCOMPARE') && Configuration::get('LEOFEATURE_COMPARATOR_MAX_ITEM') > 0 && isset(Context::getContext()->cookie->id_compare))
|
||||
{
|
||||
$compared_products = Db::getInstance()->executeS('
|
||||
SELECT DISTINCT `id_product`
|
||||
FROM `' . _DB_PREFIX_ . 'leofeature_compare` c
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'leofeature_compare_product` cp ON (cp.`id_compare` = c.`id_compare`)
|
||||
WHERE cp.`id_compare` = ' . (int)(Context::getContext()->cookie->id_compare));
|
||||
}
|
||||
$result['wishlist_products'] = $wishlist_products;
|
||||
$result['compared_products'] = count($compared_products);
|
||||
}
|
||||
|
||||
if ($list_cat)
|
||||
{
|
||||
$list_cat = explode(',', $list_cat);
|
||||
$list_cat = array_filter($list_cat);
|
||||
$list_cat = array_unique($list_cat);
|
||||
$list_cat = array_map('intval', $list_cat); // fix sql injection
|
||||
$list_cat = implode(',', $list_cat);
|
||||
|
||||
$sql = 'SELECT COUNT(cp.`id_product`) AS total, cp.`id_category` FROM `' . _DB_PREFIX_ . 'product` p ' . Shop::addSqlAssociation('product', 'p') . '
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON p.`id_product` = cp.`id_product`
|
||||
WHERE cp.`id_category` IN (' . pSQL($list_cat) . ')
|
||||
AND product_shop.`visibility` IN ("both", "catalog")
|
||||
AND product_shop.`active` = 1
|
||||
GROUP BY cp.`id_category`';
|
||||
$cat = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if ($cat)
|
||||
{
|
||||
$result['cat'] = $cat;
|
||||
}
|
||||
}
|
||||
|
||||
if ($leo_pro_cdown)
|
||||
{
|
||||
$leo_pro_cdown = explode(',', $leo_pro_cdown);
|
||||
$leo_pro_cdown = array_unique($leo_pro_cdown);
|
||||
$leo_pro_cdown = implode(',', $leo_pro_cdown);
|
||||
$result['pro_cdown'] = $module->hookProductCdown($leo_pro_cdown);
|
||||
}
|
||||
|
||||
if ($leo_pro_color)
|
||||
{
|
||||
$leo_pro_color = explode(',', $leo_pro_color);
|
||||
$leo_pro_color = array_unique($leo_pro_color);
|
||||
$leo_pro_color = implode(',', $leo_pro_color);
|
||||
$result['pro_color'] = $module->hookProductColor($leo_pro_color);
|
||||
}
|
||||
|
||||
if ($product_list_image)
|
||||
{
|
||||
$product_list_image = explode(',', $product_list_image);
|
||||
$product_list_image = array_unique($product_list_image);
|
||||
$product_list_image = implode(',', $product_list_image);
|
||||
|
||||
# $leocustomajax = new Leocustomajax();
|
||||
$result['product_list_image'] = $module->hookProductMoreImg($product_list_image);
|
||||
}
|
||||
if ($product_one_img)
|
||||
{
|
||||
$product_one_img = explode(',', $product_one_img);
|
||||
$product_one_img = array_unique($product_one_img);
|
||||
$product_one_img = implode(',', $product_one_img);
|
||||
|
||||
$result['product_one_img'] = $module->hookProductOneImg($product_one_img);
|
||||
}
|
||||
|
||||
if ($result)
|
||||
{
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
}
|
||||
elseif (Tools::getValue('widget') == 'ApImageGallery')
|
||||
{
|
||||
|
||||
$show_number = Tools::getValue('show_number');
|
||||
$assign = Tools::getValue('assign', array());
|
||||
$assign = Tools::jsonDecode($assign, true);
|
||||
|
||||
$show_number_new = $show_number;
|
||||
$form_atts = $assign['formAtts'];
|
||||
|
||||
$limit = (int)$form_atts['limit'] + $show_number;
|
||||
$images = array();
|
||||
$link = new Link();
|
||||
$current_link = $link->getPageLink('', false, Context::getContext()->language->id);
|
||||
$path = _PS_ROOT_DIR_ . '/' . str_replace($current_link, '', isset($form_atts['path']) ? $form_atts['path'] : '');
|
||||
$arr_exten = array('jpg', 'jpge', 'gif', 'png');
|
||||
|
||||
|
||||
$count = 0;
|
||||
if ($path && is_dir($path))
|
||||
{
|
||||
if ($handle = scandir($path))
|
||||
{
|
||||
|
||||
if (($key = array_search('.', $handle)) !== false)
|
||||
{
|
||||
unset($handle[$key]);
|
||||
}
|
||||
if (($key = array_search('..', $handle)) !== false)
|
||||
{
|
||||
unset($handle[$key]);
|
||||
}
|
||||
|
||||
foreach ($handle as $entry)
|
||||
{
|
||||
if ($entry != '.' && $entry != '..' && is_file($path . '/' . $entry))
|
||||
{
|
||||
$ext = pathinfo($path . '/' . $entry, PATHINFO_EXTENSION);
|
||||
if (in_array($ext, $arr_exten))
|
||||
{
|
||||
$url = __PS_BASE_URI__ . '/' . str_replace($current_link, '', $form_atts['path']) . '/' . $entry;
|
||||
$url = str_replace('//', '/', $url);
|
||||
|
||||
if ($count >= $show_number)
|
||||
{
|
||||
$images[] = $url;
|
||||
$show_number_new++;
|
||||
}
|
||||
$count++;
|
||||
if ($count == $limit)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$total = count($handle);
|
||||
$total_nerver_show = (int)($total - $count);
|
||||
$c = (int)$form_atts['columns'];
|
||||
$assign['columns'] = $c > 0 ? $c : 4;
|
||||
|
||||
$result = array(
|
||||
'images' => array(),
|
||||
'show_number' => -1,
|
||||
'hasError' => 0,
|
||||
'errors' => array(),
|
||||
);
|
||||
|
||||
$result['images'] = $images;
|
||||
if ($total_nerver_show > 0)
|
||||
{
|
||||
$result['show_number'] = $show_number_new;
|
||||
}
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
else
|
||||
{
|
||||
$obj = new ApProductList();
|
||||
$result = $obj->ajaxProcessRender($module);
|
||||
die(Tools::jsonEncode($result));
|
||||
}
|
||||
3255
modules/appagebuilder/appagebuilder.php
Normal file
145
modules/appagebuilder/classes/ApPageBuilderDetailsModel.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/shortcodes.php');
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageSetting.php');
|
||||
|
||||
class ApPageBuilderDetailsModel extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $params;
|
||||
public $type;
|
||||
public $active;
|
||||
public $plist_key;
|
||||
public $class_detail;
|
||||
public $url_img_preview;
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'appagebuilder_details',
|
||||
'primary' => 'id_appagebuilder_details',
|
||||
'multilang' => false,
|
||||
'multishop' => true,
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'plist_key' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'type' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
||||
'params' => array('type' => self::TYPE_HTML),
|
||||
'class_detail' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'url_img_preview' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
)
|
||||
);
|
||||
|
||||
public function getAllProductProfileByShop()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
$where = ' WHERE id_shop='.(int)$id_shop;
|
||||
$sql = 'SELECT p.*, ps.*
|
||||
FROM '._DB_PREFIX_.'appagebuilder_details p
|
||||
INNER JOIN '._DB_PREFIX_.'appagebuilder_details_shop ps ON (ps.id_appagebuilder_details = p.id_appagebuilder_details)'
|
||||
.$where;
|
||||
return Db::getInstance()->executes($sql);
|
||||
}
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
|
||||
{
|
||||
// validate module
|
||||
unset($context);
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$res = parent::add($autodate, $null_values);
|
||||
$res &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'appagebuilder_details_shop` (`id_shop`, `id_appagebuilder_details`)
|
||||
VALUES('.(int)$id_shop.', '.(int)$this->id.')');
|
||||
if (Db::getInstance()->getValue('SELECT COUNT(p.`id_appagebuilder_details`) AS total FROM `'
|
||||
._DB_PREFIX_.'appagebuilder_details` p INNER JOIN `'
|
||||
._DB_PREFIX_.'appagebuilder_details_shop` ps ON(p.id_appagebuilder_details = ps.id_appagebuilder_details) WHERE id_shop='
|
||||
.(int)$id_shop) <= 1) {
|
||||
$this->deActiveAll();
|
||||
} else if ($this->active) {
|
||||
$this->deActiveAll();
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function toggleStatus()
|
||||
{
|
||||
$this->deActiveAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deActiveAll()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
$sql = 'UPDATE '._DB_PREFIX_.'appagebuilder_details_shop SET active=0 where id_shop='.(int)$id_shop;
|
||||
Db::getInstance()->execute($sql);
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop." AND ps.id_appagebuilder_details = '".(int)$this->id."'";
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_details_shop` ps set ps.active = 1 '.$where);
|
||||
}
|
||||
|
||||
public static function getActive()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
if (Tools::getIsset('plist_key') && Tools::getValue('plist_key')) {
|
||||
// validate module
|
||||
$where = " p.plist_key='".pSQL(Tools::getValue('plist_key'))."' and ps.id_shop=".(int)$id_shop;
|
||||
} else {
|
||||
// validate module
|
||||
$where = ' ps.active=1 and ps.id_shop='.(int)$id_shop;
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM '._DB_PREFIX_.'appagebuilder_details p
|
||||
INNER JOIN '._DB_PREFIX_.'appagebuilder_details_shop ps on(p.id_appagebuilder_details = ps.id_appagebuilder_details) WHERE '
|
||||
.pSQL($where);
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$result = parent::delete();
|
||||
|
||||
if ($result) {
|
||||
if (isset($this->def['multishop']) && $this->def['multishop'] == true) {
|
||||
# DELETE RECORD FORM TABLE _SHOP
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list)) {
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
}
|
||||
|
||||
$id_shop_list = array_map('intval', $id_shop_list);
|
||||
//DONGND:: fix sql
|
||||
$id_shop_list = implode(', ', $id_shop_list);
|
||||
|
||||
Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.
|
||||
(int)$this->id.' AND id_shop IN ('.pSQL($id_shop_list).')');
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
58
modules/appagebuilder/classes/ApPageBuilderHookModel.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageBuilderProfilesModel.php');
|
||||
|
||||
class ApPageBuilderHookModel
|
||||
{
|
||||
public $profile_data;
|
||||
public $profile_param;
|
||||
public $hook;
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->profile_data = ApPageBuilderProfilesModel::getActiveProfile('index');
|
||||
$this->profile_param = Tools::jsonDecode($this->profile_data['params'], true);
|
||||
$this->fullwidth_index_hook = $this->fullwidthIndexHook();
|
||||
$this->fullwidth_other_hook = $this->fullwidthOtherHook();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function fullwidthIndexHook()
|
||||
{
|
||||
return isset($this->profile_param['fullwidth_index_hook']) ? $this->profile_param['fullwidth_index_hook'] : ApPageSetting::getIndexHook(3);
|
||||
}
|
||||
|
||||
public function fullwidthOtherHook()
|
||||
{
|
||||
return isset($this->profile_param['fullwidth_other_hook']) ? $this->profile_param['fullwidth_other_hook'] : ApPageSetting::getOtherHook(3);
|
||||
}
|
||||
|
||||
public function fullwidthHook($hook_name, $page)
|
||||
{
|
||||
if ($page == 'index') {
|
||||
// validate module
|
||||
return isset($this->fullwidth_index_hook[$hook_name]) ? $this->fullwidth_index_hook[$hook_name] : 0;
|
||||
} else {
|
||||
# other page
|
||||
return isset($this->fullwidth_other_hook[$hook_name]) ? $this->fullwidth_other_hook[$hook_name] : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
404
modules/appagebuilder/classes/ApPageBuilderModel.php
Normal file
@@ -0,0 +1,404 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/shortcodes.php');
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageSetting.php');
|
||||
|
||||
class ApPageBuilderModel extends ObjectModel
|
||||
{
|
||||
public $hook_name;
|
||||
public $params;
|
||||
public $id_appagebuilder_positions;
|
||||
public $id_appagebuilder_shortcode;
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'appagebuilder',
|
||||
'primary' => 'id_appagebuilder',
|
||||
'multilang' => true,
|
||||
'multishop' => true,
|
||||
'fields' => array(
|
||||
'hook_name' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'id_appagebuilder_positions' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'params' => array('type' => self::TYPE_HTML, 'lang' => true),
|
||||
'id_appagebuilder_shortcode' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
)
|
||||
);
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
|
||||
{
|
||||
# validate module
|
||||
unset($context);
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
}
|
||||
|
||||
//DONGND:: get id by id shortcode
|
||||
public static function getIdByIdShortCode($id_shortcode)
|
||||
{
|
||||
if (!$id_shortcode) {
|
||||
return false;
|
||||
}
|
||||
$sql = 'SELECT id_appagebuilder FROM '._DB_PREFIX_.'appagebuilder WHERE id_appagebuilder_shortcode = ' . (int)$id_shortcode;
|
||||
$result = Db::getInstance()->getRow($sql);
|
||||
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $result['id_appagebuilder'];
|
||||
}
|
||||
|
||||
public function getIdbyHookName($hook_name, $position_id)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = (int)$context->shop->id;
|
||||
$sql = 'SELECT p.id_appagebuilder
|
||||
FROM '._DB_PREFIX_.'appagebuilder p
|
||||
LEFT JOIN '._DB_PREFIX_.'appagebuilder_shop ps ON (ps.id_appagebuilder = p.id_appagebuilder)
|
||||
WHERE ps.id_shop = '.(int)$id_shop.'
|
||||
AND hook_name=\''.pSql($hook_name).'\'
|
||||
AND p.id_appagebuilder_positions='.(int)$position_id.' ORDER BY p.id_appagebuilder';
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($result as $value) {
|
||||
$sql = 'DELETE FROM '._DB_PREFIX_.'appagebuilder_shop
|
||||
WHERE id_appagebuilder IN(SELECT id_appagebuilder
|
||||
FROM '._DB_PREFIX_.'appagebuilder
|
||||
WHERE hook_name=\''.pSql($hook_name).'\'
|
||||
AND id_appagebuilder_positions='.(int)$position_id.'
|
||||
AND id_appagebuilder != '.(int)$value['id_appagebuilder'].')';
|
||||
Db::getInstance()->execute($sql);
|
||||
|
||||
$sql = 'DELETE FROM '._DB_PREFIX_.'appagebuilder
|
||||
WHERE hook_name=\''.pSql($hook_name).'\'
|
||||
AND id_appagebuilder_positions='.(int)$position_id.'
|
||||
AND id_appagebuilder != '.(int)$value['id_appagebuilder'];
|
||||
Db::getInstance()->execute($sql);
|
||||
|
||||
return $value['id_appagebuilder'];
|
||||
}
|
||||
}
|
||||
|
||||
public function getIdbyHookNameAndProfile($hook_name, $profile, $id_lang)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = (int)$context->shop->id;
|
||||
|
||||
//$id_lang = (int)$id_lang;
|
||||
if (!$profile->header && !$profile->content && !$profile->footer && !$profile->product) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$arr = array($profile->header, $profile->content, $profile->footer, $profile->product);
|
||||
|
||||
$sql = 'SELECT p.id_appagebuilder, pl.params
|
||||
FROM '._DB_PREFIX_.'appagebuilder p
|
||||
LEFT JOIN '._DB_PREFIX_.'appagebuilder_shop ps ON (ps.id_appagebuilder = p.id_appagebuilder AND id_shop='.(int)$id_shop.')
|
||||
LEFT JOIN '._DB_PREFIX_.'appagebuilder_lang pl ON (p.id_appagebuilder = pl.id_appagebuilder AND pl.id_lang='.(int)$id_lang.')
|
||||
WHERE p.`hook_name`=\''.$hook_name.'\'
|
||||
AND ps.id_shop='.(int)$id_shop.'
|
||||
AND pl.id_lang='.(int)$id_lang.'
|
||||
AND p.id_appagebuilder_positions IN ('. pSQL(implode(',', array_map('intval', $arr))).')
|
||||
ORDER BY p.id_appagebuilder';
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* getListPositisionByType
|
||||
* @param type $type = {all, header, content, footer, product}
|
||||
* @return type
|
||||
*/
|
||||
public function getListPositisionByType($type = 'all', $id_shop = null)
|
||||
{
|
||||
$str = Tools::strtolower($type);
|
||||
$sql = 'SELECT p.* FROM `'._DB_PREFIX_.'appagebuilder_positions` p'
|
||||
.' INNER JOIN `'._DB_PREFIX_.'appagebuilder_positions_shop` ps ON (p.id_appagebuilder_positions = ps.id_appagebuilder_positions)';
|
||||
if ($type != 'all') {
|
||||
$sql .= ' WHERE p.position=\''.pSQL($str).'\' AND ps.id_shop='.(int)$id_shop;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS($sql, 1);
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$res = parent::add($autodate, $null_values);
|
||||
$res &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'appagebuilder_shop` (`id_shop`, `id_appagebuilder`)
|
||||
VALUES('.(int)$id_shop.', '.(int)$this->id.')');
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function save($null_values = false, $autodate = true)
|
||||
{
|
||||
# validate module
|
||||
unset($null_values);
|
||||
unset($autodate);
|
||||
$context = Context::getContext();
|
||||
$this->id_shop = $context->shop->id;
|
||||
return parent::save();
|
||||
}
|
||||
|
||||
public function parseData($hook_name, $data, $profile_param)
|
||||
{
|
||||
ApShortCodesBuilder::$is_front_office = 1;
|
||||
ApShortCodesBuilder::$is_gen_html = 1;
|
||||
ApShortCodesBuilder::$profile_param = $profile_param;
|
||||
$ap_helper = new ApShortCodesBuilder();
|
||||
ApShortCodesBuilder::$hook_name = $hook_name;
|
||||
$result = $ap_helper->parse($data);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all item by position include information: hooks postion and data
|
||||
* @param type $pos
|
||||
* @param type $id_position
|
||||
* @param type $id_profile
|
||||
* @param type $is_font
|
||||
* @param type $id_lang
|
||||
* @return type
|
||||
*/
|
||||
public function getAllItemsByPosition($pos, $id_position, $id_profile = 0, $is_font = 0, $id_lang = 0)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = (int)$context->shop->id;
|
||||
$id_position = (int)$id_position;
|
||||
$id_profile = (int)$id_profile;
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop.' AND pp.id_appagebuilder_positions='.(int)$id_position;
|
||||
if ($id_profile) {
|
||||
$where .= ' AND ppr.id_appagebuilder_profiles='.(int)$id_profile;
|
||||
}
|
||||
if ($id_lang) {
|
||||
$where .= ' AND pl.id_lang = '.(int)$id_lang;
|
||||
} else {
|
||||
// $id_lang = $context->language->id; // default in admin account
|
||||
$id_lang = (int)Configuration::get('PS_LANG_DEFAULT'); // default at frontend
|
||||
}
|
||||
$sql = 'SELECT p.*, pl.params, pl.id_lang
|
||||
FROM `'._DB_PREFIX_.'appagebuilder` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shop` ps ON (ps.id_appagebuilder = p.id_appagebuilder)
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_lang` pl ON (pl.id_appagebuilder = p.id_appagebuilder)
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_positions` pp ON (p.id_appagebuilder_positions=pp.id_appagebuilder_positions)
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_profiles` ppr ON (ppr.`'.bqSQL($pos).'`=pp.id_appagebuilder_positions)
|
||||
'.pSql($where).' ORDER BY p.id_appagebuilder';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
$id_langs = Language::getLanguages(true, false, true);
|
||||
# FIX - Only get language data valid
|
||||
foreach ($result as $key => $val) {
|
||||
if (isset($val['id_lang']) && !in_array($val['id_lang'], $id_langs)) {
|
||||
unset($result[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$data_lang = array();
|
||||
if ($is_font) {
|
||||
foreach ($result as $row) {
|
||||
$data_lang[$row['hook_name']] = $row['params'];
|
||||
}
|
||||
return $data_lang;
|
||||
}
|
||||
$ap_helper = new ApShortCodesBuilder();
|
||||
ApShortCodesBuilder::$is_front_office = $is_font;
|
||||
ApShortCodesBuilder::$is_gen_html = 1;
|
||||
foreach ($result as $row) {
|
||||
if (isset($data_lang[$row['id_appagebuilder']])) {
|
||||
$data_lang[$row['id_appagebuilder']]['params'][$row['id_lang']] = $row['params'];
|
||||
} else {
|
||||
$data_lang[$row['id_appagebuilder']] = array(
|
||||
'id' => $row['id_appagebuilder'],
|
||||
'hook_name' => $row['hook_name'],
|
||||
);
|
||||
$data_lang[$row['id_appagebuilder']]['params'][$row['id_lang']] = $row['params'];
|
||||
}
|
||||
}
|
||||
//$data_hook = array_flip(ApPageSetting::getHookHome());
|
||||
$hook_config = Configuration::get('APPAGEBUILDER_' . Tools::strtoupper($pos).'_HOOK');
|
||||
$hook_config = explode(',', $hook_config ? $hook_config : ApPageSetting::getHook($pos));
|
||||
$data_hook = array_flip($hook_config);
|
||||
foreach ($data_lang as $row) {
|
||||
//process params
|
||||
foreach ($row['params'] as $key => $value) {
|
||||
ApShortCodesBuilder::$lang_id = $key;
|
||||
if ($key == $id_lang) {
|
||||
ApShortCodesBuilder::$is_gen_html = 1;
|
||||
$row['content'] = $ap_helper->parse($value);
|
||||
} else {
|
||||
ApShortCodesBuilder::$is_gen_html = 0;
|
||||
$ap_helper->parse($value);
|
||||
}
|
||||
}
|
||||
$data_hook[$row['hook_name']] = $row;
|
||||
}
|
||||
return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all items - datas of all hooks by shop Id, lang Id for front-end or back-end
|
||||
* @param type $list_pos_id array
|
||||
*/
|
||||
public function getAllItemsByPositionId($list_pos_id)
|
||||
{
|
||||
if ($list_pos_id) {
|
||||
$sql = 'SELECT DISTINCT(id_appagebuilder) as id FROM `'._DB_PREFIX_.'appagebuilder` p
|
||||
WHERE id_appagebuilder_positions IN('. pSQL(implode(',', array_map('intval', $list_pos_id))).')';
|
||||
return Db::getInstance()->executes($sql);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all items - datas of all hooks by shop Id, lang Id for front-end or back-end
|
||||
* @param type $id_profiles
|
||||
* @param type $is_font (=0: for back-end; =1: for front-end)
|
||||
* @param type $id_lang
|
||||
* @return type
|
||||
*/
|
||||
public function getAllItems($profile, $is_font = 0, $id_lang = 0)
|
||||
{
|
||||
//print_r("Input: $id_profiles - $is_font - $id_lang"); 2-1-1
|
||||
$context = Context::getContext();
|
||||
// $id_profiles = (int)$profile['id_appagebuilder_profiles'];
|
||||
$id_shop = (int)$context->shop->id;
|
||||
$id_lang = $id_lang ? (int)$id_lang : (int)$context->language->id;
|
||||
if (!$profile['header'] && !$profile['content'] && !$profile['footer'] && !$profile['product']) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$arr = array($profile['header'], $profile['content'], $profile['footer'], $profile['product']);
|
||||
|
||||
$sql = 'SELECT p.*, pl.params, pl.id_lang
|
||||
FROM '._DB_PREFIX_.'appagebuilder p
|
||||
LEFT JOIN '._DB_PREFIX_.'appagebuilder_shop ps ON (ps.id_appagebuilder = p.id_appagebuilder AND id_shop='.(int)$id_shop.')
|
||||
LEFT JOIN '._DB_PREFIX_.'appagebuilder_lang pl ON (pl.id_appagebuilder = p.id_appagebuilder)
|
||||
WHERE
|
||||
pl.id_lang='.(int)$id_lang.'
|
||||
AND ps.id_shop='.(int)$id_shop.'
|
||||
AND p.id_appagebuilder_positions IN ('. pSQL(implode(',', array_map('intval', $arr))).')
|
||||
ORDER BY p.id_appagebuilder';
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
$data_lang = array();
|
||||
if ($is_font) {
|
||||
foreach ($result as $row) {
|
||||
$data_lang[$row['hook_name']] = $row['params'];
|
||||
}
|
||||
return $data_lang;
|
||||
}
|
||||
$ap_helper = new ApShortCodesBuilder();
|
||||
ApShortCodesBuilder::$is_front_office = $is_font;
|
||||
ApShortCodesBuilder::$is_gen_html = 1;
|
||||
foreach ($result as $row) {
|
||||
if (isset($data_lang[$row['id_appagebuilder']])) {
|
||||
$data_lang[$row['id_appagebuilder']]['params'][$row['id_lang']] = $row['params'];
|
||||
} else {
|
||||
$data_lang[$row['id_appagebuilder']] = array(
|
||||
'id' => $row['id_appagebuilder'],
|
||||
'hook_name' => $row['hook_name'],
|
||||
);
|
||||
$data_lang[$row['id_appagebuilder']]['params'][$row['id_lang']] = $row['params'];
|
||||
}
|
||||
}
|
||||
$data_hook = array_flip(ApPageSetting::getHookHome());
|
||||
foreach ($data_lang as $row) {
|
||||
//process params
|
||||
foreach ($row['params'] as $key => $value) {
|
||||
ApShortCodesBuilder::$lang_id = $key;
|
||||
if ($key == $id_lang) {
|
||||
ApShortCodesBuilder::$is_gen_html = 1;
|
||||
$row['content'] = $ap_helper->parse($value);
|
||||
} else {
|
||||
ApShortCodesBuilder::$is_gen_html = 0;
|
||||
$ap_helper->parse($value);
|
||||
}
|
||||
}
|
||||
$data_hook[$row['hook_name']] = $row;
|
||||
}
|
||||
|
||||
return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form);
|
||||
}
|
||||
|
||||
public function getAllStoreByShop()
|
||||
{
|
||||
return Store::getStores((int)Context::getContext()->language->id);
|
||||
// $context = Context::getContext();
|
||||
// $id_shop = (int)$context->shop->id;
|
||||
// $id_lang = (int)$context->language->id;
|
||||
// //$where = ' WHERE id_shop="'.$id_shop.'"';
|
||||
// $sql = '
|
||||
// SELECT a.*, cl.name country, st.name state
|
||||
// FROM '._DB_PREFIX_.'store a
|
||||
// LEFT JOIN '._DB_PREFIX_.'country_lang cl
|
||||
// ON (cl.id_country = a.id_country
|
||||
// AND cl.id_lang = '.(int)$id_lang.')
|
||||
// LEFT JOIN '._DB_PREFIX_.'state st
|
||||
// ON (st.id_state = a.id_state)
|
||||
// WHERE a.id_store IN (
|
||||
// SELECT sa.id_store
|
||||
// FROM '._DB_PREFIX_.'store_shop sa
|
||||
// WHERE sa.id_shop = '.(int)$id_shop.'
|
||||
// )';
|
||||
// return Db::getInstance()->executes($sql);
|
||||
}
|
||||
|
||||
public function findOtherProfileUsePosition($id_position, $id_profile)
|
||||
{
|
||||
$sql = 'SELECT * FROM '._DB_PREFIX_.'appagebuilder_profiles ap
|
||||
WHERE (ap.`header`='.(int)$id_position.' OR ap.`content`='.(int)$id_position.'
|
||||
OR ap.`footer`='.(int)$id_position.' OR ap.`product`='.(int)$id_position.')
|
||||
AND ap.`id_appagebuilder_profiles`<>'.(int)$id_profile;
|
||||
return Db::getInstance()->executes($sql);
|
||||
}
|
||||
|
||||
public function updateAppagebuilderLang($id, $id_lang, $params)
|
||||
{
|
||||
//can not use psql, because pramram is import function
|
||||
$data = array('params' => $params);
|
||||
Db::getInstance()->update('appagebuilder_lang', $data, 'id_appagebuilder='.(int)$id.' AND id_lang='.(int)$id_lang);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$result = parent::delete();
|
||||
|
||||
if ($result) {
|
||||
if (isset($this->def['multishop']) && $this->def['multishop'] == true) {
|
||||
# DELETE RECORD FORM TABLE _SHOP
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list)) {
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
}
|
||||
|
||||
$id_shop_list = array_map('intval', $id_shop_list);
|
||||
|
||||
Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.
|
||||
(int)$this->id.' AND id_shop IN ('. pSQL(implode(', ', $id_shop_list)).')');
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
149
modules/appagebuilder/classes/ApPageBuilderPositionsModel.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/Helper.php');
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/shortcodes.php');
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageSetting.php');
|
||||
|
||||
class ApPageBuilderPositionsModel extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $params;
|
||||
public $position;
|
||||
public $position_key;
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'appagebuilder_positions',
|
||||
'primary' => 'id_appagebuilder_positions',
|
||||
'multilang' => false,
|
||||
'multishop' => true,
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'position' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'position_key' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'params' => array('type' => self::TYPE_HTML)
|
||||
)
|
||||
);
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
|
||||
{
|
||||
// validate module
|
||||
unset($context);
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
// Shop::addTableAssociation($this->table, array('type' => 'shop')); // Delete with all table_shop, Insert all shop. Remove
|
||||
}
|
||||
|
||||
public static function getProfileUsingPosition($id)
|
||||
{
|
||||
$id = (int)$id;
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'appagebuilder_profiles` P
|
||||
WHERE
|
||||
P.`header`='.(int)$id.'
|
||||
OR P.`content`='.(int)$id.'
|
||||
OR P.`footer`='.(int)$id.'
|
||||
OR P.`product`='.(int)$id;
|
||||
return Db::getInstance()->executes($sql);
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$res = parent::add($autodate, $null_values);
|
||||
$res &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'appagebuilder_positions_shop` (`id_shop`, `id_appagebuilder_positions`)
|
||||
VALUES('.(int)$id_shop.', '.(int)$this->id.')');
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function addAuto($data)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'appagebuilder_positions` (name, position, position_key)
|
||||
VALUES("'.pSQL($data['name']).'", "'.pSQL($data['position']).'", "'.pSQL($data['position_key']).'")';
|
||||
Db::getInstance()->execute($sql);
|
||||
|
||||
$id = Db::getInstance()->Insert_ID();
|
||||
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'appagebuilder_positions_shop` (`id_shop`, `id_appagebuilder_positions`)
|
||||
VALUES('.(int)$id_shop.', '.(int)$id.')');
|
||||
return $id;
|
||||
}
|
||||
|
||||
public static function getAllPosition()
|
||||
{
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'appagebuilder_positions`';
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
public static function getPositionById($id)
|
||||
{
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'appagebuilder_positions` WHERE id_appagebuilder_positions='.(int)$id;
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
public static function updateName($id, $name)
|
||||
{
|
||||
$id = (int)$id;
|
||||
if ($id && $name) {
|
||||
$sql = 'UPDATE '._DB_PREFIX_.'appagebuilder_positions SET name=\''.pSQL($name).'\' WHERE id_appagebuilder_positions='.(int)$id;
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$result = parent::delete();
|
||||
|
||||
if ($result) {
|
||||
if (isset($this->def['multishop']) && $this->def['multishop'] == true) {
|
||||
# DELETE RECORD FORM TABLE _SHOP
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list)) {
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
}
|
||||
|
||||
$id_shop_list = array_map('intval', $id_shop_list);
|
||||
|
||||
Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.
|
||||
(int)$this->id.' AND id_shop IN ('. pSQL(implode(', ', $id_shop_list)).')');
|
||||
}
|
||||
|
||||
# DELETE DATA AT OTHER TABLE
|
||||
$sql = 'SELECT id_appagebuilder FROM '._DB_PREFIX_.'appagebuilder WHERE id_appagebuilder_positions = ' . (int)$this->id;
|
||||
$rows = Db::getInstance()->executes($sql);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$obj = new ApPageBuilderModel($row['id_appagebuilder']);
|
||||
$obj->delete();
|
||||
}
|
||||
|
||||
# Profile not use this position
|
||||
if (in_array($this->position, array('header', 'content', 'footer', 'product'))) {
|
||||
$sql = 'UPDATE '._DB_PREFIX_.'appagebuilder_profiles SET `'.bqSQL($this->position).'`=0 WHERE `'.bqSQL($this->position).'`='.(int)$this->id;
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
140
modules/appagebuilder/classes/ApPageBuilderProductsModel.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/shortcodes.php');
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageSetting.php');
|
||||
|
||||
class ApPageBuilderProductsModel extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $params;
|
||||
public $type;
|
||||
public $active;
|
||||
public $plist_key;
|
||||
public $class;
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'appagebuilder_products',
|
||||
'primary' => 'id_appagebuilder_products',
|
||||
'multilang' => false,
|
||||
'multishop' => true,
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'plist_key' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'type' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
||||
'params' => array('type' => self::TYPE_HTML),
|
||||
'class' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
)
|
||||
);
|
||||
|
||||
public function getAllProductProfileByShop()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
$where = ' WHERE id_shop='.(int)$id_shop;
|
||||
$sql = 'SELECT p.*, ps.*
|
||||
FROM '._DB_PREFIX_.'appagebuilder_products p
|
||||
INNER JOIN '._DB_PREFIX_.'appagebuilder_products_shop ps ON (ps.id_appagebuilder_products = p.id_appagebuilder_products)'
|
||||
.$where;
|
||||
return Db::getInstance()->executes($sql);
|
||||
}
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
|
||||
{
|
||||
// validate module
|
||||
unset($context);
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$res = parent::add($autodate, $null_values);
|
||||
$res &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'appagebuilder_products_shop` (`id_shop`, `id_appagebuilder_products`)
|
||||
VALUES('.(int)$id_shop.', '.(int)$this->id.')');
|
||||
if (Db::getInstance()->getValue('SELECT COUNT(p.`id_appagebuilder_products`) AS total FROM `'
|
||||
._DB_PREFIX_.'appagebuilder_products` p INNER JOIN `'
|
||||
._DB_PREFIX_.'appagebuilder_products_shop` ps ON(p.id_appagebuilder_products = ps.id_appagebuilder_products) WHERE id_shop='
|
||||
.(int)$id_shop) <= 1) {
|
||||
$this->deActiveAll();
|
||||
} else if ($this->active) {
|
||||
$this->deActiveAll();
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function toggleStatus()
|
||||
{
|
||||
$this->deActiveAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deActiveAll()
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
$sql = 'UPDATE '._DB_PREFIX_.'appagebuilder_products_shop SET active=0 where id_shop='.(int)$id_shop;
|
||||
Db::getInstance()->execute($sql);
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop." AND ps.id_appagebuilder_products = '".(int)$this->id."'";
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_products_shop` ps set ps.active = 1 '.$where);
|
||||
}
|
||||
|
||||
public static function getActive()
|
||||
{
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
if (Tools::getIsset('plist_key') && Tools::getValue('plist_key')) {
|
||||
// validate module
|
||||
$where = " p.plist_key='".pSQL(Tools::getValue('plist_key'))."' and ps.id_shop=".(int)$id_shop;
|
||||
} else {
|
||||
// validate module
|
||||
$where = ' ps.active=1 and ps.id_shop='.(int)$id_shop;
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM '._DB_PREFIX_.'appagebuilder_products p
|
||||
INNER JOIN '._DB_PREFIX_.'appagebuilder_products_shop ps on(p.id_appagebuilder_products = ps.id_appagebuilder_products) WHERE '.$where;
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$result = parent::delete();
|
||||
|
||||
if ($result) {
|
||||
if (isset($this->def['multishop']) && $this->def['multishop'] == true) {
|
||||
# DELETE RECORD FORM TABLE _SHOP
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list)) {
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
}
|
||||
|
||||
$id_shop_list = array_map('intval', $id_shop_list);
|
||||
|
||||
Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.
|
||||
(int)$this->id.' AND id_shop IN ('.pSQL(implode(', ', $id_shop_list)).')');
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
437
modules/appagebuilder/classes/ApPageBuilderProfilesModel.php
Normal file
@@ -0,0 +1,437 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/shortcodes.php');
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageSetting.php');
|
||||
|
||||
class ApPageBuilderProfilesModel extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $friendly_url;
|
||||
public $meta_title;
|
||||
public $meta_description;
|
||||
public $meta_keywords;
|
||||
public $group_box;
|
||||
public $params;
|
||||
public $page;
|
||||
public $profile_key;
|
||||
public $header;
|
||||
public $content;
|
||||
public $footer;
|
||||
public $product;
|
||||
public $active;
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'appagebuilder_profiles',
|
||||
'primary' => 'id_appagebuilder_profiles',
|
||||
'multilang' => true,
|
||||
'multishop' => true,
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'friendly_url' => array('type' => self::TYPE_STRING, 'size' => 255, 'lang' => true, 'validate' => 'isLinkRewrite'),
|
||||
'meta_title' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255, 'lang' => true),
|
||||
'meta_description' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255, 'lang' => true),
|
||||
'meta_keywords' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255, 'lang' => true),
|
||||
'group_box' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'page' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'profile_key' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
'header' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'content' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'footer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'params' => array('type' => self::TYPE_HTML)
|
||||
)
|
||||
);
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
|
||||
{
|
||||
// validate module
|
||||
unset($context);
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
$this->loadDataShop();
|
||||
}
|
||||
|
||||
public function loadDataShop()
|
||||
{
|
||||
if ($this->def['multishop'] == true) {
|
||||
$sql = 'SELECT * FROM ' ._DB_PREFIX_.$this->def['table'] . '_shop WHERE ' .$this->def['primary'] . ' =' .(int)$this->id;
|
||||
$this->data_shop = Db::getInstance()->getRow($sql);
|
||||
|
||||
if (isset($this->data_shop['active'])) {
|
||||
$this->active = $this->data_shop['active'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function toggleStatus()
|
||||
{
|
||||
$this->deActiveAll($this->page);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deActiveAll($page)
|
||||
{
|
||||
// validate module
|
||||
unset($page);
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
//$where = ' WHERE ps.id_shop='.$id_shop." AND ps.id_appagebuilder_profiles != '".(int)$this->id."'";
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop;
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_profiles_shop` ps set ps.active = 0 '.$where);
|
||||
$where = ' WHERE ps.id_shop='.$id_shop." AND ps.id_appagebuilder_profiles = '".(int)$this->id."'";
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_profiles_shop` ps set ps.active = 1 '.$where);
|
||||
}
|
||||
|
||||
public function getAllProfileByShop()
|
||||
{
|
||||
try {
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
$id_lang = $context->language->id;
|
||||
// $where = ' WHERE id_shop='.(int)$id_shop.' AND id_lang='.(int)$id_lang;
|
||||
$sql = 'SELECT p.*, ps.*,pl.friendly_url
|
||||
FROM '._DB_PREFIX_.'appagebuilder_profiles p
|
||||
INNER JOIN '._DB_PREFIX_.'appagebuilder_profiles_lang pl ON (p.id_appagebuilder_profiles = pl.id_appagebuilder_profiles)
|
||||
INNER JOIN '._DB_PREFIX_.'appagebuilder_profiles_shop ps ON (ps.id_appagebuilder_profiles = p.id_appagebuilder_profiles)
|
||||
WHERE id_shop='.(int)$id_shop.' AND id_lang='.(int)$id_lang;
|
||||
return Db::getInstance()->executes($sql);
|
||||
} catch (Exception $exc) {
|
||||
return array(); // OLD MODULE, NOT NEED SHOW DATA
|
||||
}
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$res = parent::add($autodate, $null_values);
|
||||
$res &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'appagebuilder_profiles_shop` (`id_shop`, `id_appagebuilder_profiles`)
|
||||
VALUES('.(int)$id_shop.', '.(int)$this->id.')');
|
||||
if (Db::getInstance()->getValue('SELECT COUNT(p.`id_appagebuilder_profiles`) AS total FROM `'._DB_PREFIX_.'appagebuilder_profiles` p
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_shop` ps ON(p.id_appagebuilder_profiles = ps.id_appagebuilder_profiles)
|
||||
WHERE id_shop='.(int)$id_shop) <= 1) {
|
||||
$this->deActiveAll($this->page);
|
||||
} else if ($this->active) {
|
||||
$this->deActiveAll($this->page);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function update($null_values = false)
|
||||
{
|
||||
// validate module
|
||||
unset($null_values);
|
||||
if ($this->active) {
|
||||
$this->deActiveAll($this->page);
|
||||
}
|
||||
|
||||
return parent::update();
|
||||
}
|
||||
|
||||
public function getProfilesInPage($id = 0)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop." AND p.page='".pSQL($this->page)."'";
|
||||
if ($id) {
|
||||
$where .= ' AND p.id_appagebuilder_profiles !='.(int)$id;
|
||||
}
|
||||
$inner_join = 'INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_shop` ps ON (ps.id_appagebuilder_profiles = p.id_appagebuilder_profiles)';
|
||||
$sql = 'SELECT p.* from `'._DB_PREFIX_.'appagebuilder_profiles` p '.$inner_join.$where;
|
||||
return Db::getInstance()->executes($sql);
|
||||
}
|
||||
|
||||
public static function getActiveProfile($page)
|
||||
{
|
||||
// validate module
|
||||
unset($page);
|
||||
|
||||
# Fix bug http://screencast.com/t/flCEjya6
|
||||
$updatePositions = Tools::getValue('action');
|
||||
$ajax = Tools::getValue('ajax');
|
||||
if ($updatePositions == 'updatePositions' && $ajax == '1') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$result = null;
|
||||
$is_use_co = Configuration::get('APPAGEBUILDER_COOKIE_PROFILE');
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
$id_profile = ApPageBuilderProfilesModel::getIdProfileFromRewrite();
|
||||
# SET PROFILE FOLLOW GROUP_CUSTOMER
|
||||
$current_group_id = Group::getCurrent()->id;
|
||||
if (isset($current_group_id) && $current_group_id == 3) {
|
||||
$customer = Context::getContext()->customer;
|
||||
$sql = 'SELECT id_group FROM `'._DB_PREFIX_.'customer_group` WHERE id_customer='.(int)$customer->id;
|
||||
$array_group_id = Db::getInstance()->executeS($sql);
|
||||
foreach ($array_group_id as $group_id) {
|
||||
if ($group_id !=1 && $group_id !=2 && $group_id !=3) {
|
||||
$current_group_id = $group_id['id_group'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$model = new ApPageBuilderProfilesModel();
|
||||
$list_profiles = $model->getAllProfileByShop();
|
||||
if ($list_profiles) {
|
||||
foreach ($list_profiles as $profile) {
|
||||
$group_boxs = $profile['group_box'];
|
||||
$aray_group_box = explode(',', $group_boxs);
|
||||
foreach ($aray_group_box as $group_box) {
|
||||
if (isset($current_group_id) && $current_group_id == $group_box) {
|
||||
$profile_current = $profile['id_appagebuilder_profiles'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($profile_current) && $profile_current != "") {
|
||||
$id_profile = $profile_current;
|
||||
}
|
||||
//check cookie
|
||||
if ($is_use_co) {
|
||||
if (!$id_profile && $context->cookie->ap_profile) {
|
||||
$id_profile = $context->cookie->ap_profile;
|
||||
} else {
|
||||
$context->cookie->ap_profile = $id_profile;
|
||||
}
|
||||
}
|
||||
|
||||
$id_lang = $context->language->id;
|
||||
$cache_id = 'ApPageBuilderProfilesModel::getActiveProfile_'.md5((int)$id_profile.(int)$id_lang.(int)$id_shop);
|
||||
if (!Cache::isStored($cache_id)) {
|
||||
if ($id_profile) {
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop.' AND p.id_appagebuilder_profiles='.(int)$id_profile;
|
||||
} else {
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop.' AND ps.active=1 ';
|
||||
}
|
||||
$inner_join = ' INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_lang` pl ON (pl.id_appagebuilder_profiles = p.id_appagebuilder_profiles) AND id_lang='.(int)$id_lang;
|
||||
$inner_join .= ' INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_shop` ps ON (ps.id_appagebuilder_profiles = p.id_appagebuilder_profiles)';
|
||||
$sql = 'SELECT p.*, pl.* from `'._DB_PREFIX_.'appagebuilder_profiles` p '.$inner_join.$where;
|
||||
$result = Db::getInstance()->getRow($sql);
|
||||
Cache::store($cache_id, $result);
|
||||
} else {
|
||||
$result = Cache::retrieve($cache_id);
|
||||
}
|
||||
foreach (array('header', 'content', 'footer', 'product') as $val) {
|
||||
$pos_key = 'ap_'.$val;
|
||||
if (Tools::getIsset($val)) {
|
||||
$result[$val] = Tools::getValue($val);
|
||||
|
||||
if (Tools::isSubmit('controller') && Tools::getValue('controller') === 'AdminNewsletterPro') {
|
||||
// Conflict with Newsletter Pro module
|
||||
} else {
|
||||
$context->cookie->{$pos_key} = $result[$val];
|
||||
}
|
||||
} else if ($is_use_co && $context->cookie->{$pos_key}) {
|
||||
$result[$val] = $context->cookie->{$pos_key};
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getProfile($id)
|
||||
{
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'appagebuilder_profiles` WHERE id_appagebuilder_profiles='.(int)$id;
|
||||
$object = Db::getInstance()->getRow($sql);
|
||||
return $object ? $object : null;
|
||||
}
|
||||
|
||||
public function duplicateProfile($id, $name, $profile_key, $id_shop)
|
||||
{
|
||||
$new_id = 0;
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'appagebuilder_profiles` WHERE id_appagebuilder_profiles='.(int)$id;
|
||||
$object_duplicated = Db::getInstance()->getRow($sql);
|
||||
if ($object_duplicated) {
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'appagebuilder_profiles`(name, profile_key, page) VALUES("'
|
||||
.pSQL($name).pSQL($object_duplicated['name']).'", "'.pSQL($profile_key).'", "index")';
|
||||
Db::getInstance()->execute($sql);
|
||||
$new_id = Db::getInstance()->Insert_ID();
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'appagebuilder_profiles_shop`(id_appagebuilder_profiles, id_shop, active) VALUES('
|
||||
.(int)$new_id.', '.(int)$id_shop.', 0)';
|
||||
Db::getInstance()->execute($sql);
|
||||
return $new_id;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function customDuplicateObject($message)
|
||||
{
|
||||
$object_duplicated = parent::duplicateObject();
|
||||
$object_duplicated->active = 0;
|
||||
$object_duplicated->name = $message.' '.$object_duplicated->name;
|
||||
return $object_duplicated;
|
||||
}
|
||||
|
||||
public function save($null_values = false, $autodate = true)
|
||||
{
|
||||
// validate module
|
||||
unset($null_values);
|
||||
unset($autodate);
|
||||
$context = Context::getContext();
|
||||
$this->id_shop = $context->shop->id;
|
||||
if ($this->active) {
|
||||
$this->deActiveAll($this->page);
|
||||
}
|
||||
return parent::save();
|
||||
}
|
||||
|
||||
public static function deleteById($id)
|
||||
{
|
||||
$id = (int)$id;
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'appagebuilder_profiles` WHERE id_appagebuilder_profiles='.(int)$id;
|
||||
$object_duplicated = Db::getInstance()->getRow($sql);
|
||||
if ($object_duplicated) {
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'appagebuilder_profiles` WHERE id_appagebuilder_profiles='.(int)$id;
|
||||
Db::getInstance()->execute($sql);
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'appagebuilder_profiles_lang` WHERE id_appagebuilder_profiles='.(int)$id;
|
||||
Db::getInstance()->execute($sql);
|
||||
$sql = 'DELETE FROM `'._DB_PREFIX_.'appagebuilder_profiles_shop` WHERE id_appagebuilder_profiles='.(int)$id;
|
||||
Db::getInstance()->execute($sql);
|
||||
return $object_duplicated;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPositionsForProfile($id_positions)
|
||||
{
|
||||
if ($id_positions) {
|
||||
$id_positions = implode(',', array_map('intval', $id_positions));
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'appagebuilder_positions` WHERE id_appagebuilder_positions IN('.pSQL($id_positions).')';
|
||||
return Db::getInstance()->executes($sql);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
public function delete($params = array())
|
||||
{
|
||||
$result = parent::delete();
|
||||
|
||||
if ($result) {
|
||||
if (isset($this->def['multishop']) && $this->def['multishop'] == true) {
|
||||
# DELETE RECORD FORM TABLE _SHOP
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list)) {
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
}
|
||||
|
||||
$id_shop_list = array_map('intval', $id_shop_list);
|
||||
|
||||
Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.
|
||||
(int)$this->id.' AND id_shop IN ('.pSQL(implode(', ', $id_shop_list)).')');
|
||||
|
||||
if (isset($params['import_sample']) && $params['import_sample'] == true) {
|
||||
$position = new ApPageBuilderPositionsModel((int)$this->header);
|
||||
$position->delete();
|
||||
$position = new ApPageBuilderPositionsModel((int)$this->content);
|
||||
$position->delete();
|
||||
$position = new ApPageBuilderPositionsModel((int)$this->footer);
|
||||
$position->delete();
|
||||
$position = new ApPageBuilderPositionsModel((int)$this->product);
|
||||
$position->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* $id_profile = ApPageBuilderProfilesModel::getIdProfileFromRewrite();
|
||||
*/
|
||||
public static function getIdProfileFromRewrite($linkRewrive = '')
|
||||
{
|
||||
static $id_appagebuilder_profiles = null;
|
||||
|
||||
if ($id_appagebuilder_profiles === null) {
|
||||
$context = Context::getContext();
|
||||
$id_shop = (int)$context->shop->id;
|
||||
$id_lang = (int)$context->language->id;
|
||||
|
||||
# ACCESS BY id_appagebuilder_profiles
|
||||
$id_temp = Tools::getIsset('id_appagebuilder_profiles') ? Tools::getValue('id_appagebuilder_profiles') : false;
|
||||
if ($id_temp !== false) {
|
||||
$id_appagebuilder_profiles = $id_temp;
|
||||
return $id_appagebuilder_profiles;
|
||||
}
|
||||
|
||||
# ACCESS BY friendly_url
|
||||
$linkRewrive = explode('/', $_SERVER['REQUEST_URI']);
|
||||
$linkRewrive = rtrim(end($linkRewrive), '.html');
|
||||
if (strpos($linkRewrive, '?')) {
|
||||
// REMOVE ? FROM URL
|
||||
$temp_str = explode("?", $linkRewrive);
|
||||
$linkRewrive = $temp_str[0];
|
||||
$linkRewrive = rtrim($linkRewrive, '.html');
|
||||
}
|
||||
if (!empty($linkRewrive)) {
|
||||
$sql = 'SELECT p.`id_appagebuilder_profiles` FROM `'._DB_PREFIX_.'appagebuilder_profiles` p';
|
||||
$sql .= ' INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_lang` pl ON(pl.id_appagebuilder_profiles = p.id_appagebuilder_profiles AND pl.friendly_url=\''.pSQL($linkRewrive).'\' AND id_lang='.(int)$id_lang.' ) ';
|
||||
$sql .= ' INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_shop` ps ON(ps.id_appagebuilder_profiles = p.id_appagebuilder_profiles AND ps.id_shop ='.(int)$id_shop.')';
|
||||
|
||||
$id_appagebuilder_profiles = Db::getInstance()->getValue($sql);
|
||||
return $id_appagebuilder_profiles;
|
||||
}
|
||||
|
||||
|
||||
|
||||
# ACESS BY active_profile
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop.' AND ps.active=1 ';
|
||||
|
||||
$inner_join = ' INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_lang` pl ON (pl.id_appagebuilder_profiles = p.id_appagebuilder_profiles) AND id_lang='.(int)$id_lang;
|
||||
$inner_join .= ' INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_shop` ps ON (ps.id_appagebuilder_profiles = p.id_appagebuilder_profiles)';
|
||||
$sql = 'SELECT p.id_appagebuilder_profiles, p.name, p.profile_key, pl.id_lang, ps.id_shop, ps.active from `'._DB_PREFIX_.'appagebuilder_profiles` p '.$inner_join.$where;
|
||||
|
||||
$active_profile = Db::getInstance()->getRow($sql);
|
||||
|
||||
if ($active_profile) {
|
||||
return $active_profile['id_appagebuilder_profiles'];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return $id_appagebuilder_profiles;
|
||||
}
|
||||
|
||||
public static function getAllProfileRewrite($id_profile = null)
|
||||
{
|
||||
if ($id_profile) {
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
|
||||
if ($id_profile) {
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop.' AND p.id_appagebuilder_profiles='.(int)$id_profile;
|
||||
}
|
||||
|
||||
$inner_join = ' INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_lang` pl ON (pl.id_appagebuilder_profiles = p.id_appagebuilder_profiles)';
|
||||
$inner_join .= ' INNER JOIN `'._DB_PREFIX_.'appagebuilder_profiles_shop` ps ON (ps.id_appagebuilder_profiles = p.id_appagebuilder_profiles)';
|
||||
$sql = 'SELECT p.id_appagebuilder_profiles, p.name, pl.id_lang, pl.friendly_url from `'._DB_PREFIX_.'appagebuilder_profiles` p '.$inner_join.$where;
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
|
||||
foreach ($result as $key => $value) {
|
||||
$result[$key]['iso_code'] = Language::getIsoById($result[$key]['id_lang']);
|
||||
}
|
||||
// validate module
|
||||
unset($value);
|
||||
|
||||
return $result;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
}
|
||||
276
modules/appagebuilder/classes/ApPageBuilderShortcodeModel.php
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageSetting.php');
|
||||
|
||||
class ApPageBuilderShortcodeModel extends ObjectModel
|
||||
{
|
||||
public $shortcode_key;
|
||||
// public $id_appagebuilder;
|
||||
public $shortcode_name;
|
||||
public $active = true;
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
public static $definition = array(
|
||||
'table' => 'appagebuilder_shortcode',
|
||||
'primary' => 'id_appagebuilder_shortcode',
|
||||
'multilang' => true,
|
||||
'multishop' => true,
|
||||
'fields' => array(
|
||||
'shortcode_key' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
|
||||
// 'id_appagebuilder' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
|
||||
'shortcode_name' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255, 'lang' => true, 'required' => true),
|
||||
|
||||
'active' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
||||
)
|
||||
);
|
||||
|
||||
public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
|
||||
{
|
||||
// validate module
|
||||
unset($context);
|
||||
parent::__construct($id, $id_lang, $id_shop);
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = false)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$res = parent::add($autodate, $null_values);
|
||||
|
||||
$res &= Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'appagebuilder_shortcode_shop` (`id_shop`, `id_appagebuilder_shortcode`, `active`)
|
||||
VALUES('.(int)$id_shop.', '.(int)$this->id.', '.(int)$this->active.')');
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function update($nullValues = false)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$res = parent::update($nullValues);
|
||||
|
||||
$res &= Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps set ps.active = '.(int)$this->active.' WHERE ps.id_shop='.(int)$id_shop.' AND ps.id_appagebuilder_shortcode = '.(int)$this->id);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$result = parent::delete();
|
||||
|
||||
if ($result) {
|
||||
if (isset($this->def['multishop']) && $this->def['multishop'] == true) {
|
||||
# DELETE RECORD FORM TABLE _SHOP
|
||||
$id_shop_list = Shop::getContextListShopID();
|
||||
if (count($this->id_shop_list)) {
|
||||
$id_shop_list = $this->id_shop_list;
|
||||
}
|
||||
|
||||
$id_shop_list = array_map('intval', $id_shop_list);
|
||||
|
||||
Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.
|
||||
(int)$this->id.' AND id_shop IN ('.pSQL(implode(', ', $id_shop_list)).')');
|
||||
}
|
||||
|
||||
//DONGND:: delete appagebuilder related shortcode
|
||||
$id_appagebuilder = ApPageBuilderModel::getIdByIdShortCode((int)$this->id);
|
||||
|
||||
if ($id_appagebuilder) {
|
||||
$obj = new ApPageBuilderModel($id_appagebuilder);
|
||||
$obj->delete();
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getShortCodeContent($id_appagebuilder = 0, $is_font = 0, $id_lang = 0)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = (int)$context->shop->id;
|
||||
$where = ' WHERE ps.id_shop='.(int)$id_shop.' AND p.id_appagebuilder='.(int)$id_appagebuilder;
|
||||
|
||||
if ($id_lang) {
|
||||
$where .= ' AND pl.id_lang = '.(int)$id_lang;
|
||||
} else {
|
||||
$id_lang = $context->language->id;
|
||||
}
|
||||
$sql = 'SELECT p.*, pl.params, pl.id_lang
|
||||
FROM `'._DB_PREFIX_.'appagebuilder` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shop` ps ON (ps.id_appagebuilder = p.id_appagebuilder)
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_lang` pl ON (pl.id_appagebuilder = p.id_appagebuilder)
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shortcode` pp ON (p.id_appagebuilder_shortcode = pp.id_appagebuilder_shortcode)
|
||||
|
||||
'.pSql($where).' ORDER BY p.id_appagebuilder';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($result);die();
|
||||
$id_langs = Language::getLanguages(true, false, true);
|
||||
# FIX - Only get language data valid
|
||||
foreach ($result as $key => $val) {
|
||||
if (isset($val['id_lang']) && !in_array($val['id_lang'], $id_langs)) {
|
||||
unset($result[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$data_lang = array();
|
||||
if ($is_font) {
|
||||
foreach ($result as $row) {
|
||||
$data_lang[$row['hook_name']] = $row['params'];
|
||||
}
|
||||
return $data_lang;
|
||||
}
|
||||
$ap_helper = new ApShortCodesBuilder();
|
||||
ApShortCodesBuilder::$is_front_office = $is_font;
|
||||
ApShortCodesBuilder::$is_gen_html = 1;
|
||||
//DONGND:: check gen for Apshortcode
|
||||
// ApShortCodesBuilder::$check_gen_Apshortcode = 1;
|
||||
foreach ($result as $row) {
|
||||
if (isset($data_lang[$row['id_appagebuilder']])) {
|
||||
$data_lang[$row['id_appagebuilder']]['params'][$row['id_lang']] = $row['params'];
|
||||
} else {
|
||||
$data_lang[$row['id_appagebuilder']] = array(
|
||||
'id' => $row['id_appagebuilder'],
|
||||
'hook_name' => $row['hook_name'],
|
||||
);
|
||||
$data_lang[$row['id_appagebuilder']]['params'][$row['id_lang']] = $row['params'];
|
||||
}
|
||||
}
|
||||
//$data_hook = array_flip(ApPageSetting::getHookHome());
|
||||
// $hook_config = Configuration::get('APPAGEBUILDER_' . Tools::strtoupper($pos).'_HOOK');
|
||||
// $hook_config = explode(',', $hook_config ? $hook_config : ApPageSetting::getHook($pos));
|
||||
// $data_hook = array_flip($hook_config);
|
||||
$data_hook = array();
|
||||
// echo '<pre>';
|
||||
// print_r($data_lang);die();
|
||||
foreach ($data_lang as $row) {
|
||||
//process params
|
||||
foreach ($row['params'] as $key => $value) {
|
||||
ApShortCodesBuilder::$lang_id = $key;
|
||||
if ($key == $id_lang) {
|
||||
ApShortCodesBuilder::$is_gen_html = 1;
|
||||
$row['content'] = $ap_helper->parse($value);
|
||||
} else {
|
||||
ApShortCodesBuilder::$is_gen_html = 0;
|
||||
$ap_helper->parse($value);
|
||||
}
|
||||
}
|
||||
$data_hook[$row['hook_name']] = $row;
|
||||
}
|
||||
|
||||
return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all items - datas of all hooks by shop Id, lang Id for front-end or back-end
|
||||
* @param type $id_profiles
|
||||
* @param type $is_font (=0: for back-end; =1: for front-end)
|
||||
* @param type $id_lang
|
||||
* @return type
|
||||
*/
|
||||
public static function getAllItems($id_appagebuilder, $is_font = 0, $id_lang = 0)
|
||||
{
|
||||
//print_r("Input: $id_profiles - $is_font - $id_lang"); 2-1-1
|
||||
$context = Context::getContext();
|
||||
// $id_profiles = (int)$profile['id_appagebuilder_profiles'];
|
||||
$id_shop = (int)$context->shop->id;
|
||||
$id_lang = $id_lang ? (int)$id_lang : (int)$context->language->id;
|
||||
|
||||
$sql = 'SELECT p.*, pl.params, pl.id_lang
|
||||
FROM '._DB_PREFIX_.'appagebuilder p
|
||||
LEFT JOIN '._DB_PREFIX_.'appagebuilder_shop ps ON (ps.id_appagebuilder = p.id_appagebuilder AND id_shop='.(int)$id_shop.')
|
||||
LEFT JOIN '._DB_PREFIX_.'appagebuilder_lang pl ON (pl.id_appagebuilder = p.id_appagebuilder)
|
||||
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shortcode` pp ON (p.id_appagebuilder_shortcode = pp.id_appagebuilder_shortcode)
|
||||
WHERE
|
||||
pl.id_lang='.(int)$id_lang.'
|
||||
AND ps.id_shop='.(int)$id_shop.'
|
||||
AND p.id_appagebuilder = '.(int)$id_appagebuilder.'
|
||||
ORDER BY p.id_appagebuilder';
|
||||
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
//echo '<pre>';print_r($result);die;
|
||||
$data_lang = array();
|
||||
if ($is_font) {
|
||||
foreach ($result as $row) {
|
||||
$data_lang[$row['hook_name']] = $row['params'];
|
||||
}
|
||||
return $data_lang;
|
||||
}
|
||||
$ap_helper = new ApShortCodesBuilder();
|
||||
ApShortCodesBuilder::$is_front_office = $is_font;
|
||||
ApShortCodesBuilder::$is_gen_html = 1;
|
||||
foreach ($result as $row) {
|
||||
if (isset($data_lang[$row['id_appagebuilder']])) {
|
||||
$data_lang[$row['id_appagebuilder']]['params'][$row['id_lang']] = $row['params'];
|
||||
} else {
|
||||
$data_lang[$row['id_appagebuilder']] = array(
|
||||
'id' => $row['id_appagebuilder'],
|
||||
'hook_name' => $row['hook_name'],
|
||||
);
|
||||
$data_lang[$row['id_appagebuilder']]['params'][$row['id_lang']] = $row['params'];
|
||||
}
|
||||
}
|
||||
$data_hook = array_flip(ApPageSetting::getHookHome());
|
||||
foreach ($data_lang as $row) {
|
||||
//process params
|
||||
foreach ($row['params'] as $key => $value) {
|
||||
ApShortCodesBuilder::$lang_id = $key;
|
||||
if ($key == $id_lang) {
|
||||
ApShortCodesBuilder::$is_gen_html = 1;
|
||||
$row['content'] = $ap_helper->parse($value);
|
||||
} else {
|
||||
ApShortCodesBuilder::$is_gen_html = 0;
|
||||
$ap_helper->parse($value);
|
||||
}
|
||||
}
|
||||
$data_hook[$row['hook_name']] = $row;
|
||||
}
|
||||
|
||||
return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form);
|
||||
}
|
||||
|
||||
public static function getShortCode($shortcode_key)
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
|
||||
$sql = 'SELECT p.*, pp.`id_appagebuilder` FROM `'._DB_PREFIX_.'appagebuilder_shortcode` p
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps on(p.`id_appagebuilder_shortcode` = ps.`id_appagebuilder_shortcode`)
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder` pp on(p.`id_appagebuilder_shortcode` = pp.`id_appagebuilder_shortcode`) WHERE
|
||||
p.`shortcode_key` = "'.pSQL($shortcode_key).'" AND ps.`active`= 1 AND ps.`id_shop` = '.(int)$id_shop;
|
||||
|
||||
return Db::getInstance()->getRow($sql);
|
||||
}
|
||||
|
||||
public static function getListShortCode()
|
||||
{
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
|
||||
$sql = 'SELECT p.*, ps.*, pl.* FROM `'._DB_PREFIX_.'appagebuilder_shortcode` p
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps on(p.`id_appagebuilder_shortcode` = ps.`id_appagebuilder_shortcode`)
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_lang` pl on(p.`id_appagebuilder_shortcode` = pl.`id_appagebuilder_shortcode`) WHERE
|
||||
ps.`id_shop` = '.(int)$id_shop.' AND pl.`id_lang` = '.(int)$id_lang;
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
}
|
||||
1407
modules/appagebuilder/classes/ApPageSetting.php
Normal file
421
modules/appagebuilder/classes/ApShortCodesBuilder.php
Normal file
@@ -0,0 +1,421 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!class_exists('ApShortCodeBase')) {
|
||||
|
||||
class ApShortCodesBuilder
|
||||
{
|
||||
public static $shortcode_tags = array();
|
||||
public static $lang_id = 0;
|
||||
public static $is_front_office = 1;
|
||||
public static $is_gen_html = 1;
|
||||
public static $data_form = array();
|
||||
public static $shortcode_lang;
|
||||
public static $hook_name;
|
||||
public static $profile_param;
|
||||
|
||||
public static function addShortcode($tag, $func)
|
||||
{
|
||||
self::$shortcode_tags[$tag] = $func;
|
||||
}
|
||||
|
||||
public static function removeShortcode($tag)
|
||||
{
|
||||
unset(self::$shortcode_tags[$tag]);
|
||||
}
|
||||
|
||||
public static function shortcodeExists($tag)
|
||||
{
|
||||
return array_key_exists($tag, self::$shortcode_tags);
|
||||
}
|
||||
|
||||
public static function doShortcode($content)
|
||||
{
|
||||
if (false === strpos($content, '[')) {
|
||||
return $content;
|
||||
}
|
||||
$pattern = self::getShortcodeRegex();
|
||||
return preg_replace_callback("/$pattern/s", array(new ApShortCodesBuilder, 'doShortcodeTag'), $content);
|
||||
}
|
||||
|
||||
public static function getShortcodeRegex()
|
||||
{
|
||||
$tagnames = array_keys(self::$shortcode_tags);
|
||||
$tagregexp = join('|', array_map('preg_quote', $tagnames));
|
||||
return '\\[(\\[?)'."($tagregexp)"
|
||||
.'(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)';
|
||||
/*
|
||||
return '\\[' // Opening bracket
|
||||
.'(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
|
||||
."($tagregexp)" // 2: Shortcode name
|
||||
.'(?![\\w-])' // Not followed by word character or hyphen
|
||||
.'(' // 3: Unroll the loop: Inside the opening shortcode tag
|
||||
.'[^\\]\\/]*' // Not a closing bracket or forward slash
|
||||
.'(?:'
|
||||
.'\\/(?!\\])' // A forward slash not followed by a closing bracket
|
||||
.'[^\\]\\/]*' // Not a closing bracket or forward slash
|
||||
.')*?'
|
||||
.')'
|
||||
.'(?:'
|
||||
.'(\\/)' // 4: Self closing tag ...
|
||||
.'\\]' // ... and closing bracket
|
||||
.'|'
|
||||
.'\\]' // Closing bracket
|
||||
.'(?:'
|
||||
.'(' // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags
|
||||
.'[^\\[]*+' // Not an opening bracket
|
||||
.'(?:'
|
||||
.'\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
|
||||
.'[^\\[]*+' // Not an opening bracket
|
||||
.')*+'
|
||||
.')'
|
||||
.'\\[\\/\\2\\]' // Closing shortcode tag
|
||||
.')?'
|
||||
.')'
|
||||
.'(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]]
|
||||
* */
|
||||
}
|
||||
|
||||
public static function doShortcodeTag($m)
|
||||
{
|
||||
$shortcode_tags = self::$shortcode_tags;
|
||||
// allow [[foo]] syntax for escaping a tag
|
||||
if ($m[1] == '[' && $m[6] == ']') {
|
||||
return Tools::substr($m[0], 1, -1);
|
||||
}
|
||||
$tag = $m[2];
|
||||
$attr = self::shortcodeParseAtts($m[3]);
|
||||
$function_call = self::$is_front_office ? 'fontContent' : 'adminContent';
|
||||
if (isset($m[5])) {
|
||||
// enclosing tag - extra parameter
|
||||
return $m[1].call_user_func(array($shortcode_tags[$tag], $function_call), $attr, $m[5], $tag, self::$is_gen_html).$m[6];
|
||||
} else {
|
||||
// self-closing tag
|
||||
return $m[1].call_user_func(array($shortcode_tags[$tag], $function_call), $attr, null, $tag, self::$is_gen_html).$m[6];
|
||||
}
|
||||
}
|
||||
|
||||
public static function shortcodeParseAtts($text)
|
||||
{
|
||||
$pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
|
||||
$text = preg_replace('/[\x{00a0}\x{200b}]+/u', ' ', $text);
|
||||
$atts = array();
|
||||
if (preg_match_all($pattern, $text, $match, PREG_SET_ORDER)) {
|
||||
foreach ($match as $m) {
|
||||
if (!empty($m[1])) {
|
||||
$atts[Tools::strtolower($m[1])] = stripcslashes($m[2]);
|
||||
} elseif (!empty($m[3])) {
|
||||
$atts[Tools::strtolower($m[3])] = stripcslashes($m[4]);
|
||||
} elseif (!empty($m[5])) {
|
||||
$atts[Tools::strtolower($m[5])] = stripcslashes($m[6]);
|
||||
} elseif (isset($m[7]) && Tools::strlen($m[7])) {
|
||||
$atts[] = stripcslashes($m[7]);
|
||||
} elseif (isset($m[8])) {
|
||||
$atts[] = stripcslashes($m[8]);
|
||||
} else {
|
||||
$atts = ltrim($text);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $atts;
|
||||
}
|
||||
|
||||
public static function stripShortcodes($content)
|
||||
{
|
||||
$shortcode_tags = self::$shortcode_tags;
|
||||
if (empty($shortcode_tags) || !is_array($shortcode_tags)) {
|
||||
return $content;
|
||||
}
|
||||
$pattern = self::getShortcodeRegex();
|
||||
return preg_replace_callback("/$pattern/s", array(self, 'stripShortcodeTag'), $content);
|
||||
}
|
||||
|
||||
public static function stripShortcodeTag($m)
|
||||
{
|
||||
// allow [[foo]] syntax for escaping a tag
|
||||
if ($m[1] == '[' && $m[6] == ']') {
|
||||
return Tools::substr($m[0], 1, -1);
|
||||
}
|
||||
return $m[1].$m[6];
|
||||
}
|
||||
|
||||
public static function setShortCodeLang($type)
|
||||
{
|
||||
if (!isset(AdminApPageBuilderHomeController::$shortcode_lang[$type])) {
|
||||
$fileName = $type;
|
||||
if (strpos($type, 'apSub') !== false) {
|
||||
$fileName = str_replace('Sub', '', $type);
|
||||
}
|
||||
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/classes/shortcodes/'.$fileName.'.php')) {
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/shortcodes/'.$fileName.'.php');
|
||||
}
|
||||
if ($fileName != $type) {
|
||||
$inputs = call_user_func(array(new $fileName, 'getConfigList'), 1);
|
||||
} else {
|
||||
$inputs = call_user_func(array(new $fileName, 'getConfigList'));
|
||||
}
|
||||
foreach ($inputs as $input) {
|
||||
if (isset($input['lang']) && $input['lang']) {
|
||||
if (self::$lang_id) {
|
||||
AdminApPageBuilderHomeController::$shortcode_lang[$type][$input['name']] = $input['name'].'_'.self::$lang_id;
|
||||
} else {
|
||||
foreach (AdminApPageBuilderHomeController::$language as $lang) {
|
||||
AdminApPageBuilderHomeController::$shortcode_lang[$type][$input['name'].'_'
|
||||
.$lang['iso_code']] = $input['name'].'_'.$lang['id_lang'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function converParamToAttr($params, $type, $theme_dir = '')
|
||||
{
|
||||
$attr = '';
|
||||
self::setShortCodeLang($type);
|
||||
|
||||
$lang_field = array();
|
||||
if (isset(AdminApPageBuilderHomeController::$shortcode_lang[$type])) {
|
||||
$lang_field = AdminApPageBuilderHomeController::$shortcode_lang[$type];
|
||||
}
|
||||
|
||||
//remove lang field first
|
||||
if ($lang_field) {
|
||||
foreach ($params as $key => $val) {
|
||||
if (false !== $arr_key = array_search($key, $lang_field)) {
|
||||
//do something
|
||||
$params[$arr_key] = $val;
|
||||
foreach ($params as $key => $val) {
|
||||
foreach (AdminApPageBuilderHomeController::$language as $lang) {
|
||||
unset($params[$arr_key.'_'.$lang['id_lang']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//DONGND:: fix data for ApBlockcarousel
|
||||
if ($type == 'ApBlockCarousel' && isset($params['total_slider']) && $params['total_slider'] != '')
|
||||
{
|
||||
$lang_field_special = array();
|
||||
|
||||
$list = explode('|', $params['total_slider']);
|
||||
|
||||
foreach ($list as $list_item)
|
||||
{
|
||||
$lang_field_special['tit_'.$list_item] = 'tit_'.$list_item.'_'.self::$lang_id;
|
||||
$lang_field_special['img_'.$list_item] = 'img_'.$list_item.'_'.self::$lang_id;
|
||||
$lang_field_special['link_'.$list_item] = 'link_'.$list_item.'_'.self::$lang_id;
|
||||
$lang_field_special['descript_'.$list_item] = 'descript_'.$list_item.'_'.self::$lang_id;
|
||||
};
|
||||
|
||||
if ($lang_field_special) {
|
||||
foreach ($params as $key => $val) {
|
||||
if (false !== $arr_key = array_search($key, $lang_field_special)) {
|
||||
//do something
|
||||
$params[$arr_key.'_'.self::$lang_id] = $val;
|
||||
|
||||
foreach ($params as $key => $val) {
|
||||
foreach (AdminApPageBuilderHomeController::$language as $lang) {
|
||||
if ($lang['id_lang'] != self::$lang_id)
|
||||
{
|
||||
unset($params[$arr_key.'_'.$lang['id_lang']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($params as $key => $val) {
|
||||
if ($key == 'override_folder' && $val) {
|
||||
//remove space
|
||||
$val = str_replace(' ', '', $val);
|
||||
//add new function override folder for widget
|
||||
self::processOverrideTpl($val, $type, $theme_dir);
|
||||
}
|
||||
$attr .= ($attr ? ' ' : '').$key.'="'.$val.'"';
|
||||
}
|
||||
return ($attr ? ' ' : '').$attr;
|
||||
}
|
||||
|
||||
|
||||
//DONGND:: clone function for Apshortcode
|
||||
public static function setShortCodeLang2($type)
|
||||
{
|
||||
if (!isset(AdminApPageBuilderShortcodeController::$shortcode_lang[$type])) {
|
||||
$fileName = $type;
|
||||
if (strpos($type, 'apSub') !== false) {
|
||||
$fileName = str_replace('Sub', '', $type);
|
||||
}
|
||||
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/classes/shortcodes/'.$fileName.'.php')) {
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/shortcodes/'.$fileName.'.php');
|
||||
}
|
||||
if ($fileName != $type) {
|
||||
$inputs = call_user_func(array(new $fileName, 'getConfigList'), 1);
|
||||
} else {
|
||||
$inputs = call_user_func(array(new $fileName, 'getConfigList'));
|
||||
}
|
||||
foreach ($inputs as $input) {
|
||||
if (isset($input['lang']) && $input['lang']) {
|
||||
if (self::$lang_id) {
|
||||
AdminApPageBuilderShortcodeController::$shortcode_lang[$type][$input['name']] = $input['name'].'_'.self::$lang_id;
|
||||
} else {
|
||||
foreach (AdminApPageBuilderShortcodeController::$language as $lang) {
|
||||
AdminApPageBuilderShortcodeController::$shortcode_lang[$type][$input['name'].'_'
|
||||
.$lang['iso_code']] = $input['name'].'_'.$lang['id_lang'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//DONGND:: clone function for Apshortcode
|
||||
public static function converParamToAttr2($params, $type, $theme_dir = '')
|
||||
{
|
||||
$attr = '';
|
||||
self::setShortCodeLang2($type);
|
||||
|
||||
$lang_field = array();
|
||||
if (isset(AdminApPageBuilderShortcodeController::$shortcode_lang[$type])) {
|
||||
$lang_field = AdminApPageBuilderShortcodeController::$shortcode_lang[$type];
|
||||
}
|
||||
|
||||
//remove lang field first
|
||||
if ($lang_field) {
|
||||
foreach ($params as $key => $val) {
|
||||
if (false !== $arr_key = array_search($key, $lang_field)) {
|
||||
//do something
|
||||
$params[$arr_key] = $val;
|
||||
foreach ($params as $key => $val) {
|
||||
foreach (AdminApPageBuilderShortcodeController::$language as $lang) {
|
||||
unset($params[$arr_key.'_'.$lang['id_lang']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//DONGND:: fix data for ApBlockcarousel
|
||||
if ($type == 'ApBlockCarousel' && isset($params['total_slider']) && $params['total_slider'] != '')
|
||||
{
|
||||
$lang_field_special = array();
|
||||
|
||||
$list = explode('|', $params['total_slider']);
|
||||
|
||||
foreach ($list as $list_item)
|
||||
{
|
||||
$lang_field_special['tit_'.$list_item] = 'tit_'.$list_item.'_'.self::$lang_id;
|
||||
$lang_field_special['img_'.$list_item] = 'img_'.$list_item.'_'.self::$lang_id;
|
||||
$lang_field_special['link_'.$list_item] = 'link_'.$list_item.'_'.self::$lang_id;
|
||||
$lang_field_special['descript_'.$list_item] = 'descript_'.$list_item.'_'.self::$lang_id;
|
||||
};
|
||||
|
||||
if ($lang_field_special) {
|
||||
foreach ($params as $key => $val) {
|
||||
if (false !== $arr_key = array_search($key, $lang_field_special)) {
|
||||
//do something
|
||||
$params[$arr_key.'_'.self::$lang_id] = $val;
|
||||
|
||||
foreach ($params as $key => $val) {
|
||||
foreach (AdminApPageBuilderHomeController::$language as $lang) {
|
||||
if ($lang['id_lang'] != self::$lang_id)
|
||||
{
|
||||
unset($params[$arr_key.'_'.$lang['id_lang']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($params as $key => $val) {
|
||||
if ($key == 'override_folder' && $val) {
|
||||
//remove space
|
||||
$val = str_replace(' ', '', $val);
|
||||
//add new function override folder for widget
|
||||
self::processOverrideTpl($val, $type, $theme_dir);
|
||||
}
|
||||
$attr .= ($attr ? ' ' : '').$key.'="'.$val.'"';
|
||||
}
|
||||
return ($attr ? ' ' : '').$attr;
|
||||
}
|
||||
|
||||
public static function processOverrideTpl($val, $type, $theme_dir)
|
||||
{
|
||||
if (file_exists($theme_dir.'modules/appagebuilder/views/templates/hook/'.$val.'/'.$type.'.tpl')) {
|
||||
return;
|
||||
}
|
||||
|
||||
//create overide folder
|
||||
if (!is_dir($theme_dir.'modules/appagebuilder/')) {
|
||||
// validate module
|
||||
mkdir($theme_dir.'modules/appagebuilder/', 0755, true);
|
||||
}
|
||||
if (!is_dir($theme_dir.'modules/appagebuilder/views/')) {
|
||||
// validate module
|
||||
mkdir($theme_dir.'modules/appagebuilder/views/', 0755, true);
|
||||
}
|
||||
if (!is_dir($theme_dir.'modules/appagebuilder/views/templates/')) {
|
||||
// validate module
|
||||
mkdir($theme_dir.'modules/appagebuilder/views/templates/', 0755, true);
|
||||
}
|
||||
if (!is_dir($theme_dir.'modules/appagebuilder/views/templates/hook/')) {
|
||||
// validate module
|
||||
mkdir($theme_dir.'modules/appagebuilder/views/templates/hook/', 0755, true);
|
||||
}
|
||||
if (!is_dir($theme_dir.'modules/appagebuilder/views/templates/hook/'.$val)) {
|
||||
// validate module
|
||||
mkdir($theme_dir.'modules/appagebuilder/views/templates/hook/'.$val, 0755, true);
|
||||
}
|
||||
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/views/templates/hook/'.$type.'.tpl')) {
|
||||
Tools::copy(_PS_MODULE_DIR_.'appagebuilder/views/templates/hook/'.$type.'.tpl', $theme_dir.'modules/appagebuilder/views/templates/hook/'.$val.'/'.$type.'.tpl');
|
||||
} else {
|
||||
$theme_dir_ori = _PS_THEME_DIR_;
|
||||
Tools::copy(_PS_MODULE_DIR_.'appagebuilder/views/templates/hook/ApGeneral.tpl', $theme_dir_ori.'modules/appagebuilder/views/templates/hook/'.$val.'/'.$type.'.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
public static function correctDeCodeData($data)
|
||||
{
|
||||
$function_name = 'base64_decode';
|
||||
//$functionName = 'b'.'a'.'s'.'e'.'6'.'4'.'_'.'decode';
|
||||
return call_user_func($function_name, $data);
|
||||
}
|
||||
|
||||
public static function correctEnCodeData($data)
|
||||
{
|
||||
$function_name = 'base64_encode';
|
||||
//$functionName = 'b'.'a'.'s'.'e'.'6'.'4'.'_'.'encode';
|
||||
return call_user_func($function_name, $data);
|
||||
}
|
||||
|
||||
public function parse($str)
|
||||
{
|
||||
return self::doShortcode($str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
36
modules/appagebuilder/classes/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
541
modules/appagebuilder/classes/shortcodes.php
Normal file
@@ -0,0 +1,541 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!class_exists('ApShortCodeBase')) {
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/Helper.php');
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/controllers/admin/AdminApPageBuilderShortcodes.php');
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApShortCodesBuilder.php');
|
||||
|
||||
abstract class ApShortCodeBase
|
||||
{
|
||||
/*
|
||||
* override it for each widget
|
||||
*/
|
||||
public $name = '';
|
||||
/**
|
||||
* override when using tinymcs
|
||||
*/
|
||||
public $tinymce = 0;
|
||||
public $module_name = 'appagebuilder';
|
||||
public $id_shop = 0;
|
||||
public $fields_form = array();
|
||||
public $types = array();
|
||||
public $config_list = array();
|
||||
public $str_search;
|
||||
public $str_relace;
|
||||
public $str_relace_html;
|
||||
public $str_relace_html_admin;
|
||||
public $theme_img_module;
|
||||
public $theme_dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->str_search = apPageHelper::getStrSearch();
|
||||
$this->str_relace = apPageHelper::getStrReplace();
|
||||
$this->str_relace_html = apPageHelper::getStrReplaceHtml();
|
||||
$this->str_relace_html_admin = apPageHelper::getStrReplaceHtmlAdmin();
|
||||
// Not run with multi_shop (ex block carousel cant get image in backend multi_shop)
|
||||
$this->theme_img_module = apPageHelper::getImgThemeUrl();
|
||||
$this->theme_dir = _PS_THEME_DIR_;
|
||||
}
|
||||
/*
|
||||
* if file is not exist in theme folder, will get it in module folder, this function only apply for font end
|
||||
*/
|
||||
|
||||
public function getDirOfFile($path_theme, $file, $path_module = '')
|
||||
{
|
||||
if (file_exists(_PS_THEME_DIR_.$path_theme.'/'.$file)) {
|
||||
// validate module
|
||||
return _PS_THEME_DIR_.$path_theme.'/'.$file;
|
||||
} else {
|
||||
if ($path_module) {
|
||||
return _PS_MODULE_DIR_.'appagebuilder/'.$path_module.$file;
|
||||
} else {
|
||||
return _PS_MODULE_DIR_.'appagebuilder/'.$path_theme.$file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get class name of product item by plistkey (using in widgets: ApProductList and ApProductCarousel)
|
||||
*/
|
||||
public function getProductClassByPListKey($plist = '')
|
||||
{
|
||||
// Against SQL injections
|
||||
// $plist = pSQL($plist ? $plist : '');
|
||||
$result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'appagebuilder_products WHERE plist_key="'.pSQL($plist).'" LIMIT 1');
|
||||
if ($result) {
|
||||
return $result[0]['class'];
|
||||
}
|
||||
return 'profile-default';
|
||||
}
|
||||
|
||||
/**
|
||||
* abstract method to return html widget form
|
||||
*/
|
||||
public function getInfo()
|
||||
{
|
||||
return array('key' => 'base', 'label' => 'Widget Base');
|
||||
}
|
||||
|
||||
public static function getUrlProfileEdit()
|
||||
{
|
||||
$id_profile = Tools::getIsset('id_appagebuilder_profiles') ? Tools::getValue('id_appagebuilder_profiles') : '';
|
||||
if (!$id_profile) {
|
||||
$profile = ApPageBuilderProfilesModel::getActiveProfile('index');
|
||||
$id_profile = $profile['id_appagebuilder_profiles'];
|
||||
}
|
||||
// $controller = 'AdminApPageBuilderHome';
|
||||
// $id_lang = Context::getContext()->language->id;
|
||||
// $params = array('token' => Tools::getAdminTokenLite($controller));
|
||||
//$url_profile_edit = $admin_dir.'/'.Dispatcher::getInstance()->createUrl($controller, $id_lang, $params, false);
|
||||
$url_profile_edit = Context::getContext()->link->getAdminLink('AdminApPageBuilderProfiles').
|
||||
'&id_appagebuilder_profiles='.$id_profile.'&updateappagebuilder_profiles';
|
||||
return $url_profile_edit;
|
||||
}
|
||||
|
||||
public static function getShortCodeInfos()
|
||||
{
|
||||
$shortcode_dir = _PS_MODULE_DIR_.'appagebuilder/classes/shortcodes/';
|
||||
$source_file = Tools::scandir($shortcode_dir);
|
||||
$short_code_list = array();
|
||||
$is_sub_tab = Tools::getValue('subTab');
|
||||
foreach ($source_file as $value) {
|
||||
$fileName = basename($value, '.php');
|
||||
if ($fileName == 'index' || $fileName == 'ApColumn' || $fileName == 'ApRow' || ($is_sub_tab && ($fileName == 'ApTabs' || $fileName == 'ApAccordions'))) {
|
||||
continue;
|
||||
}
|
||||
require_once($shortcode_dir.$value);
|
||||
$obj = new $fileName;
|
||||
$short_code_list[$fileName] = $obj->getInfo();
|
||||
}
|
||||
return $short_code_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* abstract method to return widget data
|
||||
*/
|
||||
public function renderContent($args, $data)
|
||||
{
|
||||
// validate module
|
||||
unset($args);
|
||||
unset($data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getTranslator()
|
||||
{
|
||||
static $translator;
|
||||
if (!$translator) {
|
||||
// $translator = Context::getContext()->controller->module->getTranslator(); // Run at Backend
|
||||
$translator = Context::getContext()->getTranslator(); // Run at Backend + Frontend. Test with ApGmap Widget
|
||||
}
|
||||
return $translator;
|
||||
}
|
||||
|
||||
protected function trans($id, array $parameters = array(), $domain = 'Modules.Appagebuilder.Admin', $locale = null)
|
||||
{
|
||||
return $this->getTranslator()->trans($id, $parameters, $domain, $locale);
|
||||
}
|
||||
|
||||
public function l($string, $specific = false)
|
||||
{
|
||||
if (Tools::getValue('type_shortcode')) {
|
||||
// FIX Translate in loading widget ajax
|
||||
return TranslateCore::getModuleTranslation($this->module_name, $string, ($specific) ? $specific : Tools::getValue('type_shortcode'));
|
||||
} else {
|
||||
return TranslateCore::getModuleTranslation($this->module_name, $string, ($specific) ? $specific : $this->module_name);
|
||||
}
|
||||
}
|
||||
|
||||
public function getInputValues($type, $value)
|
||||
{
|
||||
if ($type == 'switchYesNo') {
|
||||
return array(array('id' => $value.'_on', 'value' => 1, 'label' => $this->l('Yes')),
|
||||
array('id' => $value.'_off', 'value' => 0, 'label' => $this->l('No')));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asign value for each input of Data form
|
||||
*/
|
||||
public function getConfigFieldsValues($data = null)
|
||||
{
|
||||
$languages = Language::getLanguages(false);
|
||||
$fields_values = array();
|
||||
$obj = isset($data['params']) ? $data['params'] : array();
|
||||
foreach ($this->fields_form as $k => $f) {
|
||||
foreach ($f['form']['input'] as $j => $input) {
|
||||
if (isset($input['lang'])) {
|
||||
foreach ($languages as $lang) {
|
||||
$fields_values[$input['name']][$lang['id_lang']] = isset($obj[$input['name'].'_'
|
||||
.$lang['id_lang']]) ? $obj[$input['name'].'_'.$lang['id_lang']] : $input['default'];
|
||||
}
|
||||
} else if (isset($obj[trim($input['name'])])) {
|
||||
$value = $obj[trim($input['name'])];
|
||||
|
||||
if ($input['name'] == 'image' && $value) {
|
||||
// $thumb = __PS_BASE_URI__.'modules/'.$this->name.'/img/'.$value;
|
||||
$thumb = apPageHelper::getImgThemeUrl().$value;
|
||||
$this->fields_form[$k]['form']['input'][$j]['thumb'] = $thumb;
|
||||
}
|
||||
$fields_values[$input['name']] = $value;
|
||||
} else {
|
||||
$v = Tools::getValue($input['name'], Configuration::get($input['name']));
|
||||
$fields_values[$input['name']] = $v ? $v : $input['default'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($data['id_leowidgets'])) {
|
||||
$fields_values['id_leowidgets'] = $data['id_leowidgets'];
|
||||
}
|
||||
return $fields_values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return config value for each shortcode
|
||||
*/
|
||||
public function getConfigValue()
|
||||
{
|
||||
$config_val = array();
|
||||
//return addition config
|
||||
$a_config = $this->getAdditionConfig();
|
||||
if ($a_config) {
|
||||
$this->config_list = array_merge($this->config_list, $a_config);
|
||||
}
|
||||
foreach ($this->config_list as $config) {
|
||||
$config['lang'] = (isset($config['lang']) && $config['lang']) ? $config['lang'] : '';
|
||||
$config['name'] = (isset($config['name']) && $config['name']) ? $config['name'] : '';
|
||||
$config['default'] = (isset($config['default']) && $config['default']) ? $config['default'] : '';
|
||||
|
||||
if ($config['lang']) {
|
||||
foreach (Language::getLanguages(false) as $lang) {
|
||||
//$config_val[$config['name']] = Tools::getValue($config['name'], $config['default']);
|
||||
$config_val[$config['name']][$lang['id_lang']] = str_replace($this->str_search, $this->str_relace_html_admin, Tools::getValue($config['name'].'_'.$lang['id_lang'], $config['default']));
|
||||
}
|
||||
} else if (false !== strpos($config['name'], '[]')) {
|
||||
$get_val_name = str_replace('[]', '', $config['name']);
|
||||
$config_val[$config['name']] = explode(',', Tools::getValue($get_val_name, $config['default']));
|
||||
} else {
|
||||
$config_val[$config['name']] = str_replace($this->str_search, $this->str_relace_html_admin, Tools::getValue($config['name'], $config['default']));
|
||||
}
|
||||
}
|
||||
//$config_val[$config['name']] = Tools::getValue($config['name'], $config['default']);
|
||||
$config_val['override_folder'] = Tools::getValue('override_folder', '');
|
||||
return $config_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override in each shource code to return config list
|
||||
*/
|
||||
public function getConfigList()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return AdditionConfig list, when you use override of input in helper
|
||||
*/
|
||||
public function getAdditionConfig()
|
||||
{
|
||||
}
|
||||
|
||||
public function preparaAdminContent($atts, $tag_name = null)
|
||||
{
|
||||
if ($tag_name == null) {
|
||||
$tag_name = $this->name;
|
||||
}
|
||||
//need reprocess
|
||||
if (is_array($atts)) {
|
||||
$atts = array_diff($atts, array(''));
|
||||
if (!isset(ApShortCodesBuilder::$shortcode_lang[$tag_name])) {
|
||||
$inputs = $this->getConfigList();
|
||||
$lang_field = array();
|
||||
foreach ($inputs as $input) {
|
||||
if (isset($input['lang']) && $input['lang']) {
|
||||
$lang_field[] = $input['name'];
|
||||
}
|
||||
}
|
||||
ApShortCodesBuilder::$shortcode_lang[$tag_name] = $lang_field;
|
||||
} else {
|
||||
$lang_field = ApShortCodesBuilder::$shortcode_lang[$tag_name];
|
||||
}
|
||||
foreach ($atts as $key => $val) {
|
||||
if ($lang_field && in_array($key, $lang_field)) {
|
||||
$key .= '_'.ApShortCodesBuilder::$lang_id;
|
||||
}
|
||||
if (!isset(ApShortCodesBuilder::$data_form[$atts['form_id']][$key])) {
|
||||
//find language fields
|
||||
// if (strpos($key, '_array') !== false) {
|
||||
// $key = str_replace ('_array', '[]', $key);
|
||||
// }
|
||||
ApShortCodesBuilder::$data_form[$atts['form_id']][$key] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content for normal short code - from shource controller
|
||||
*/
|
||||
public function adminContent($atts, $content = null, $tag_name = null, $is_gen_html = null)
|
||||
{
|
||||
// validate module
|
||||
unset($tag_name);
|
||||
$this->preparaAdminContent($atts);
|
||||
if ($is_gen_html) {
|
||||
foreach ($atts as $key => $val) {
|
||||
if (strpos($key, 'content') !== false || strpos($key, 'link') !== false || strpos($key, 'url') !== false || strpos($key, 'alt') !== false || strpos($key, 'tit') !== false || strpos($key, 'name') !== false || strpos($key, 'desc') !== false || strpos($key, 'itemscustom') !== false) {
|
||||
$atts[$key] = str_replace($this->str_search, $this->str_relace_html, $val);
|
||||
}
|
||||
}
|
||||
$assign = array();
|
||||
$assign['apContent'] = ApShortCodesBuilder::doShortcode($content);
|
||||
if (isset($atts['content_html'])) {
|
||||
$atts['content_html'] = str_replace($this->str_search, $this->str_relace_html, $atts['content_html']);
|
||||
}
|
||||
$assign['formAtts'] = $atts;
|
||||
$w_info = $this->getInfo();
|
||||
$w_info['name'] = $this->name;
|
||||
$assign['apInfo'] = $w_info;
|
||||
if ($this->name == 'ApColumn') {
|
||||
$assign['colClass'] = $this->convertColWidthToClass($atts);
|
||||
$assign['widthList'] = ApPageSetting::returnWidthList();
|
||||
}
|
||||
//DONGND:: add parameter to create animation for group/column
|
||||
if ($this->name == 'ApRow' || $this->name == 'ApColumn') {
|
||||
$assign['listAnimation'] = ApPageSetting::getAnimationsColumnGroup();
|
||||
}
|
||||
|
||||
$controller = new AdminApPageBuilderShortcodesController();
|
||||
return $controller->adminContent($assign, $this->name.'.tpl');
|
||||
} else {
|
||||
ApShortCodesBuilder::doShortcode($content);
|
||||
}
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
return $assign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content for normal short code - from shource controller
|
||||
*/
|
||||
public function fontContent($atts, $content = null)
|
||||
{
|
||||
$is_active = $this->isWidgetActive(array('formAtts' => $atts));
|
||||
if (!$is_active) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$assign = array();
|
||||
$assign['apContent'] = ApShortCodesBuilder::doShortcode($content);
|
||||
foreach ($atts as $key => $val) {
|
||||
if (strpos($key, 'content') !== false || strpos($key, 'link') !== false || strpos($key, 'url') !== false || strpos($key, 'alt') !== false || strpos($key, 'tit') !== false || strpos($key, 'name') !== false || strpos($key, 'desc') !== false || strpos($key, 'itemscustom') !== false) {
|
||||
$atts[$key] = str_replace($this->str_search, $this->str_relace_html, $val);
|
||||
if (strpos($atts[$key], '_AP_IMG_DIR') !== false) {
|
||||
// validate module
|
||||
$atts[$key] = str_replace('_AP_IMG_DIR/', $this->theme_img_module, $atts[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($atts['class'])) {
|
||||
$atts['class'] = '';
|
||||
}
|
||||
if (isset($atts['specific_type']) && $atts['specific_type']) {
|
||||
$current_page = apPageHelper::getPageName();
|
||||
|
||||
//$current_hook = ApShortCodesBuilder::$hook_name;
|
||||
if ($atts['specific_type'] == 'all') {
|
||||
$ex_page = explode(',', isset($atts['controller_pages']) ? $atts['controller_pages'] : '');
|
||||
$ex_page = array_map('trim', $ex_page);
|
||||
if (in_array($current_page, $ex_page)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
# Front modules controller fc=module module=... controller=...
|
||||
$current_page = Tools::getValue('fc').'-'.Tools::getValue('module').'-'.Tools::getValue('controller');
|
||||
if (in_array($current_page, $ex_page)) {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
if ($current_page != $atts['specific_type']) {
|
||||
return '';
|
||||
}
|
||||
if ($current_page == 'category' || $current_page == 'product' || $current_page == 'cms') {
|
||||
$ids = explode(',', $atts['controller_id']);
|
||||
$ids = array_map('trim', $ids);
|
||||
if ($atts['controller_id'] != '' && !ApPageSetting::getControllerId($current_page, $ids)) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->name == 'ApColumn') {
|
||||
$atts['class'] = $this->convertColWidthToClass($atts). ' ' .$atts['class'];
|
||||
}
|
||||
$atts['class'] .= ' '.$this->name;
|
||||
$atts['class'] = trim($atts['class']);
|
||||
$atts['rtl'] = Context::getContext()->language->is_rtl;
|
||||
$assign['formAtts'] = $atts;
|
||||
$assign['homeSize'] = Image::getSize(ImageType::getFormattedName('home'));
|
||||
$assign['mediumSize'] = Image::getSize(ImageType::getFormattedName('medium'));
|
||||
$module = APPageBuilder::getInstance();
|
||||
|
||||
# FIX 1.7 GLOBAL VARIABLE
|
||||
$assign['img_manu_dir'] = _THEME_MANU_DIR_;
|
||||
|
||||
$assign['comparator_max_item'] = (int)Configuration::get('PS_COMPARATOR_MAX_ITEM');
|
||||
$assign['compared_products'] = array();
|
||||
$assign['tpl_dir'] = _PS_THEME_DIR_;
|
||||
$assign['PS_CATALOG_MODE'] = (int)Configuration::get('PS_CATALOG_MODE');
|
||||
$assign['priceDisplay'] = ProductCore::getTaxCalculationMethod(Context::getContext()->cookie->id_customer);
|
||||
$assign['PS_STOCK_MANAGEMENT'] = Configuration::get('PS_STOCK_MANAGEMENT');
|
||||
$assign['page_name'] = apPageHelper::getPageName();
|
||||
$assign['leo_helper'] = apPageHelper::getInstance();
|
||||
isset($assign['formAtts']['override_folder']) ? true : $assign['formAtts']['override_folder'] = '';
|
||||
|
||||
$assign = $this->prepareFontContent($assign, $module);
|
||||
return $module->fontContent($assign, $this->name.'.tpl');
|
||||
}
|
||||
|
||||
public function isWidgetActive($assign)
|
||||
{
|
||||
$flag = true;
|
||||
|
||||
if (isset($assign['formAtts']['active']) && $assign['formAtts']['active'] == 0) {
|
||||
$flag = false;
|
||||
}
|
||||
|
||||
return $flag;
|
||||
}
|
||||
|
||||
public function convertColWidthToClass($atts)
|
||||
{
|
||||
$class = '';
|
||||
// 1.7 Update Module
|
||||
if (!array_key_exists('xl', $atts)) {
|
||||
$class .= 'col-xl-12';
|
||||
}
|
||||
foreach ($atts as $key => $val) {
|
||||
if ($key == 'xl' || $key == 'lg' || $key == 'md' || $key == 'sm' || $key == 'xs' || $key == 'sp') {
|
||||
$class .= ' col-'.$key.'-'.$val;
|
||||
}
|
||||
}
|
||||
return $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return config form
|
||||
*/
|
||||
public function renderForm()
|
||||
{
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = (isset($this->table) && $this->table) ? $this->table : '';
|
||||
$helper->name_controller = 'form_'.$this->name;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$default_lang = $lang->id;
|
||||
$this->fields_form = array();
|
||||
$helper->identifier = (isset($this->identifier) && $this->identifier) ? $this->identifier : '';
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
foreach (Language::getLanguages(false) as $lang) {
|
||||
$helper->languages[] = array(
|
||||
'id_lang' => $lang['id_lang'],
|
||||
'iso_code' => $lang['iso_code'],
|
||||
'name' => $lang['name'],
|
||||
'is_default' => ($default_lang == $lang['id_lang'] ? 1 : 0)
|
||||
);
|
||||
}
|
||||
$helper->default_form_language = $default_lang;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ?
|
||||
Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->config_list = $this->getConfigList();
|
||||
//add code for override tpl folder
|
||||
if ($this->name != 'ApRow' && $this->name != 'ApColumn' && $this->name != 'ApModule') {
|
||||
$this->config_list[count($this->config_list)] = array(
|
||||
'type' => 'text',
|
||||
'name' => 'override_folder',
|
||||
'label' => $this->l('Override Folder', 'shortcodes'),
|
||||
'desc' => $this->l('[Developer Only] System will auto create folder, you can put tpl of this shortcode to the folder. You can use this function to show 2 different layout', 'shortcodes'),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
);
|
||||
}
|
||||
|
||||
$w_info = $this->getInfo();
|
||||
$title_widget = array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="modal-widget-title">'.$w_info['label'].'</div>',
|
||||
);
|
||||
array_unshift($this->config_list, $title_widget);
|
||||
$helper->submit_action = $this->name;
|
||||
$field_value = $this->getConfigValue();
|
||||
$this->addConfigList($field_value);
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'input' => $this->config_list,
|
||||
'name' => $this->name,
|
||||
'class' => $this->name,
|
||||
'tinymce' => $this->tinymce
|
||||
),
|
||||
);
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $field_value,
|
||||
'widthList' => ApPageSetting::returnWidthList(),
|
||||
);
|
||||
|
||||
$this->helper = $helper;
|
||||
if (method_exists($this, $method_name = 'endRenderForm')) {
|
||||
$this->$method_name();
|
||||
}
|
||||
|
||||
return $this->helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget can override this method and add more config at here
|
||||
*/
|
||||
public function addConfigList($field_value)
|
||||
{
|
||||
// validate module
|
||||
unset($field_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget can override this method and add more config at here
|
||||
*/
|
||||
public function displayModuleExceptionList()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function ajaxProcessRender($module)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
221
modules/appagebuilder/classes/shortcodes/ApAccordions.php
Normal file
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApAccordions extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApAccordions';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Accordions'),
|
||||
'position' => 5, 'desc' => $this->l('You can put widget in accordions'),
|
||||
'icon_class' => 'icon icon-align-justify',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList($sub_tab = 0)
|
||||
{
|
||||
if (Tools::getIsset('subTab') || $sub_tab) {
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'values' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'id',
|
||||
'label' => $this->l('ID Accordion'),
|
||||
'values' => ''
|
||||
)
|
||||
);
|
||||
$this->name = 'ApSubAccordion';
|
||||
} else {
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => '',
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'select',
|
||||
// 'label' => $this->l('Accordion Type'),
|
||||
// 'name' => 'accordion_type',
|
||||
// 'options' => array(
|
||||
// 'query' => array(
|
||||
// array(
|
||||
// 'id' => 'vertical',
|
||||
// 'name' => $this->l('Vertical'),
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'horizontal',
|
||||
// 'name' => $this->l('Horizontal'),
|
||||
// )
|
||||
// ),
|
||||
// 'id' => 'id',
|
||||
// 'name' => 'name'
|
||||
// ),
|
||||
// ),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Showing Type'),
|
||||
'name' => 'active_type',
|
||||
'class' => 'form-action',
|
||||
'default' => 'hideall',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'set',
|
||||
'name' => $this->l('Set active'),
|
||||
),
|
||||
array(
|
||||
'id' => 'showall',
|
||||
'name' => $this->l('Show all'),
|
||||
),
|
||||
array(
|
||||
'id' => 'hideall',
|
||||
'name' => $this->l('Hide all'),
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'active_accordion',
|
||||
'label' => $this->l('Active Accordion'),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'active_type_sub active_type-set',
|
||||
),
|
||||
);
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
/**
|
||||
* overide in tabs module
|
||||
*/
|
||||
public function adminContent($atts, $content = null, $tag_name = null, $is_gen_html = null)
|
||||
{
|
||||
$this->preparaAdminContent($atts, $tag_name);
|
||||
if ($is_gen_html) {
|
||||
$assign = array();
|
||||
$w_info = $this->getInfo();
|
||||
$w_info['name'] = $this->name;
|
||||
if ($tag_name == 'ApAccordion') {
|
||||
$assign['isSubTab'] = 1;
|
||||
$w_info['name'] = 'ApAccordion';
|
||||
} else {
|
||||
preg_match_all('/ parent_id="([^\"]+)"{0,1}/i', $content, $matches, PREG_OFFSET_CAPTURE);
|
||||
if (isset($matches['1']['0']['0'])) {
|
||||
$atts['id'] = $matches['1']['0']['0'];
|
||||
}
|
||||
}
|
||||
$assign['formAtts'] = $atts;
|
||||
$assign['apInfo'] = $w_info;
|
||||
$assign['apContent'] = ApShortCodesBuilder::doShortcode($content);
|
||||
$controller = new AdminApPageBuilderShortcodesController();
|
||||
return $controller->adminContent($assign, $this->name.'.tpl');
|
||||
} else {
|
||||
ApShortCodesBuilder::doShortcode($content);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* overide in tabs module
|
||||
*/
|
||||
public function fontContent($atts, $content = null, $tag_name = null, $is_gen_html = null)
|
||||
{
|
||||
$is_active = $this->isWidgetActive(array('formAtts' => $atts));
|
||||
if (!$is_active) {
|
||||
return '';
|
||||
}
|
||||
|
||||
foreach ($atts as $key => $val) {
|
||||
if (strpos($key, 'content') !== false || strpos($key, 'link') !== false || strpos($key, 'url') !== false || strpos($key, 'alt') !== false || strpos($key, 'tit') !== false || strpos($key, 'name') !== false || strpos($key, 'desc') !== false || strpos($key, 'itemscustom') !== false) {
|
||||
$atts[$key] = str_replace($this->str_search, $this->str_relace_html, $val);
|
||||
if (strpos($atts[$key], '_AP_IMG_DIR') !== false) {
|
||||
// validate module
|
||||
$atts[$key] = str_replace('_AP_IMG_DIR/', $this->theme_img_module, $atts[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// validate module
|
||||
unset($is_gen_html);
|
||||
$assign = $w_info = array();
|
||||
$w_info['name'] = $this->name;
|
||||
if ($tag_name == 'ApAccordion') {
|
||||
$assign['isSubTab'] = 1;
|
||||
$w_info['name'] = 'ApAccordion';
|
||||
} else {
|
||||
//DONGND:: check correct wrapper ApAccordion
|
||||
$assign['isWrapper'] = 1;
|
||||
preg_match_all('/ parent_id="([^\"]+)"{0,1}/i', $content, $matches, PREG_OFFSET_CAPTURE);
|
||||
if (isset($matches['1']['0']['0'])) {
|
||||
$atts['id'] = $matches['1']['0']['0'];
|
||||
}
|
||||
|
||||
if (!isset($atts['active_accordion'])) {
|
||||
$active_tab = 0;
|
||||
// validate module
|
||||
unset($active_tab);
|
||||
} else {
|
||||
# SET ACTIVE
|
||||
if (isset($atts['title']) && !empty($atts['title'])) {
|
||||
$atts['active_accordion'] = $atts['active_accordion'] + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$content = ApShortCodesBuilder::doShortcode($content);
|
||||
$assign['apContent'] = $content;
|
||||
$assign['formAtts'] = $atts;
|
||||
$module = APPageBuilder::getInstance();
|
||||
return $module->fontContent($assign, $this->name.'.tpl');
|
||||
}
|
||||
}
|
||||
99
modules/appagebuilder/classes/shortcodes/ApAlert.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApAlert extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApAlert';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Alert'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Alert Message box'),
|
||||
'icon_class' => 'icon-info-sign',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$types = array(
|
||||
array(
|
||||
'value' => 'alert-success',
|
||||
'text' => $this->l('Alert Success')
|
||||
),
|
||||
array(
|
||||
'value' => 'alert-info',
|
||||
'text' => $this->l('Alert Info')
|
||||
),
|
||||
array(
|
||||
'value' => 'alert-warning',
|
||||
'text' => $this->l('Alert Warning')
|
||||
),
|
||||
array(
|
||||
'value' => 'alert-danger',
|
||||
'text' => $this->l('Alert Danger')
|
||||
)
|
||||
);
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'lang' => true,
|
||||
'label' => $this->l('Content'),
|
||||
'name' => 'content_html',
|
||||
'cols' => 40,
|
||||
'rows' => 10,
|
||||
'value' => true,
|
||||
'lang' => true,
|
||||
'default' => '',
|
||||
'autoload_rte' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Alert Type'),
|
||||
'name' => 'alert_type',
|
||||
'options' => array('query' => $types,
|
||||
'id' => 'value',
|
||||
'name' => 'text'),
|
||||
'default' => '1',
|
||||
'desc' => $this->l('Select a alert style')
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
}
|
||||
1010
modules/appagebuilder/classes/shortcodes/ApBlockCarousel.php
Normal file
473
modules/appagebuilder/classes/shortcodes/ApBlockLink.php
Normal file
@@ -0,0 +1,473 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApBlockLink extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApBlockLink';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Block Link'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Create List Block Links'),
|
||||
'icon_class' => 'icon icon-list',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$types = array(
|
||||
array(
|
||||
'value' => 'link-url',
|
||||
'text' => $this->l('URL')
|
||||
),
|
||||
array(
|
||||
'value' => 'link-category',
|
||||
'text' => $this->l('Category')
|
||||
),
|
||||
array(
|
||||
'value' => 'link-product',
|
||||
'text' => $this->l('Product')
|
||||
),
|
||||
array(
|
||||
'value' => 'link-manufacture',
|
||||
'text' => $this->l('Manufacture')
|
||||
),
|
||||
array(
|
||||
'value' => 'link-supplier',
|
||||
'text' => $this->l('Supplier')
|
||||
),
|
||||
array(
|
||||
'value' => 'link-cms',
|
||||
'text' => $this->l('CMS')
|
||||
),
|
||||
array(
|
||||
'value' => 'link-page',
|
||||
'text' => $this->l('Page Controller')
|
||||
),
|
||||
);
|
||||
|
||||
$target = array(
|
||||
array(
|
||||
'value' => '_blank',
|
||||
'text' => $this->l('Blank ( New Tab)')
|
||||
),
|
||||
array(
|
||||
'value' => '_self',
|
||||
'text' => $this->l('Self ( Same Tab)')
|
||||
),
|
||||
array(
|
||||
'value' => '_parent',
|
||||
'text' => $this->l('Parent')
|
||||
),
|
||||
array(
|
||||
'value' => '_top',
|
||||
'text' => $this->l('Top')
|
||||
),
|
||||
);
|
||||
$accordion_type = array(
|
||||
array(
|
||||
'value' => 'full',
|
||||
'text' => $this->l('Always Full')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion',
|
||||
'text' => $this->l('Always Accordion')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion_small_screen',
|
||||
'text' => $this->l('Accordion at small screen')
|
||||
),
|
||||
);
|
||||
$page_controller = array();
|
||||
foreach (Meta::getPages() as $page) {
|
||||
if (strpos($page, 'module') === false) {
|
||||
$array_tmp = array();
|
||||
$array_tmp['link'] = $page;
|
||||
$array_tmp['name'] = $page;
|
||||
array_push($page_controller, $array_tmp);
|
||||
}
|
||||
}
|
||||
# $sqlFilter : NOT SHOW ROOT CATEOGRY, ONLY SHOW FROM HOME
|
||||
$list_categories = Category::getAllCategoriesName(null, Context::getContext()->language->id, true, null, true, ' AND c.id_parent != 0 ');
|
||||
$languages = Language::getLanguages(true, Context::getContext()->shop->id);
|
||||
|
||||
$languages = Language::getLanguages();
|
||||
$list_id_lang = array();
|
||||
foreach ($languages as $languages_val) {
|
||||
array_push($list_id_lang, $languages_val['id_lang']);
|
||||
}
|
||||
|
||||
// Get value with keys special
|
||||
$languages = Language::getLanguages(false);
|
||||
$config_val = array();
|
||||
|
||||
$list_field = Tools::getValue('list_field');
|
||||
$list_field = array_filter(explode(',', $list_field));
|
||||
foreach ($list_field as $field) {
|
||||
$key = $field;
|
||||
$config_val[$key] = str_replace($this->str_search, $this->str_relace_html_admin, Tools::getValue($key));
|
||||
}
|
||||
|
||||
$list_field_lang = Tools::getValue('list_field_lang');
|
||||
$list_field_lang = array_filter(explode(',', $list_field_lang));
|
||||
foreach ($languages as $lang) {
|
||||
foreach ($list_field_lang as $field) {
|
||||
$key = $field.'_'.$lang['id_lang'];
|
||||
$config_val[$key] = str_replace($this->str_search, $this->str_relace_html_admin, Tools::getValue($key));
|
||||
}
|
||||
}
|
||||
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<script>var listData = '.Tools::jsonEncode($config_val).';</script>',
|
||||
'form_group_class' => 'hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<script>
|
||||
var totalLanguage = "'.count($languages).'";
|
||||
var list_id_lang = \''.Tools::jsonEncode($list_id_lang).'\';
|
||||
var remove_button_text = "'.$this->l('Remove Link').'";
|
||||
var duplicate_button_text = "'.$this->l('Duplicate Link').'";
|
||||
</script>',
|
||||
'form_group_class' => 'hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'total_link',
|
||||
'default' => '0',
|
||||
'form_group_class' => 'hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'list_id_link',
|
||||
'default' => '',
|
||||
'form_group_class' => 'hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'list_field',
|
||||
'default' => '',
|
||||
'form_group_class' => 'hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'list_field_lang',
|
||||
'default' => '',
|
||||
'form_group_class' => 'hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'blockLink',
|
||||
'name' => 'title',
|
||||
'lang' => 'true',
|
||||
'label' => $this->l('Title'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Widget Title'),
|
||||
'hint' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Widget Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Accordion Type'),
|
||||
'name' => 'accordion_type',
|
||||
'options' => array(
|
||||
'query' => $accordion_type,
|
||||
'id' => 'value',
|
||||
'name' => 'text' ),
|
||||
'default' => 'full',
|
||||
'hint' => $this->l('Select a Accordion Type'),
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<button type="button" class="add-new-link btn btn-default">
|
||||
<i class="process-icon-new"></i> '.$this->l('Add new link').'</button>',
|
||||
'form_group_class' => 'frm-add-new-link',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Title'),
|
||||
'name' => 'link_title',
|
||||
'lang' => true,
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Target Type'),
|
||||
'name' => 'target_type',
|
||||
'options' => array(
|
||||
'query' => $target,
|
||||
'id' => 'value',
|
||||
'name' => 'text' ),
|
||||
'default' => '_self',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Link Type'),
|
||||
'name' => 'link_type',
|
||||
'options' => array(
|
||||
'query' => $types,
|
||||
'id' => 'value',
|
||||
'name' => 'text' ),
|
||||
'default' => 'link-url',
|
||||
'class' => 'form-action tmp',
|
||||
'hint' => $this->l('Select a link type'),
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('URL'),
|
||||
'name' => 'link_url',
|
||||
'lang' => true,
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'link_type_sub link_type-link-url parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('CMS'),
|
||||
'name' => 'cmspage_id',
|
||||
'options' => array('query' => CMS::listCms(Context::getContext()->language->id, false, true),
|
||||
'id' => 'id_cms',
|
||||
'name' => 'meta_title'),
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'link_type_sub link_type-link-cms parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Categories'),
|
||||
'name' => 'category_id',
|
||||
'options' => array('query' => $list_categories,
|
||||
'id' => 'id_category',
|
||||
'name' => 'name'),
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'link_type_sub link_type-link-category parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Product ID'),
|
||||
'name' => 'product_id',
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'link_type_sub link_type-link-product parent-tmp hidden',
|
||||
'hint' => $this->l('Enter a product id'),
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Manufacture'),
|
||||
'name' => 'manufacture_id',
|
||||
'options' => array('query' => Manufacturer::getManufacturers(false, Context::getContext()->language->id, true),
|
||||
'id' => 'id_manufacturer',
|
||||
'name' => 'name'),
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'link_type_sub link_type-link-manufacture parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Supplier'),
|
||||
'name' => 'supplier_id',
|
||||
'options' => array('query' => Supplier::getSuppliers(false, Context::getContext()->language->id, true),
|
||||
'id' => 'id_supplier',
|
||||
'name' => 'name'),
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'link_type_sub link_type-link-supplier parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Page'),
|
||||
'name' => 'page_id',
|
||||
'options' => array('query' => $page_controller,
|
||||
'id' => 'link',
|
||||
'name' => 'name'),
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'link_type_sub link_type-link-page parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Parameter of page'),
|
||||
'name' => 'page_param',
|
||||
'default' => '',
|
||||
'hint' => $this->l('Param on URL. Example var=100&var2=110&var3=120'),
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'link_type_sub link_type-link-page parent-tmp hidden',
|
||||
),
|
||||
);
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function getConfigValue()
|
||||
{
|
||||
$config_val = parent::getConfigValue();
|
||||
$config_val['target_type'] = '_self';
|
||||
return $config_val;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
$this->helper->module = new $this->module_name();
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
unset($module);
|
||||
$formAtts = $assign['formAtts'];
|
||||
$formAtts['links'] = array();
|
||||
|
||||
if (!isset($formAtts['list_id_link'])) {
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show this Blocklink. Please remove it and create new Blocklink in Appbuilder Profile.';
|
||||
return $assign;
|
||||
}
|
||||
$id_forms = $formAtts['list_id_link'];
|
||||
$id_forms = array_filter(explode(',', $id_forms));
|
||||
|
||||
foreach ($id_forms as $id_form) {
|
||||
$index = '_'.$id_form;
|
||||
$indexlang = $index.'_'.Context::getContext()->language->id;
|
||||
$link = array();
|
||||
switch ($formAtts['link_type'.$index]) {
|
||||
case 'link-url':
|
||||
if (isset($formAtts['link_title'.$indexlang]) && $formAtts['link_title'.$indexlang]) {
|
||||
$link['title'] = (isset($formAtts['link_title'.$indexlang]) && $formAtts['link_title'.$indexlang]) ? $formAtts['link_title'.$indexlang] : $formAtts['link_url'.$indexlang];
|
||||
$link['link'] = isset($formAtts['link_url'.$indexlang]) ? $formAtts['link_url'.$indexlang] : '';
|
||||
$link['target_type'] = isset($formAtts['target_type'.$index]) ? $formAtts['target_type'.$index] : '_self';
|
||||
$formAtts['links'][] = $link;
|
||||
}
|
||||
break;
|
||||
case 'link-category':
|
||||
$category = new Category((int)$formAtts['category_id'.$index], Context::getContext()->language->id, Context::getContext()->shop->id);
|
||||
$link['title'] = (isset($formAtts['link_title'.$indexlang]) && $formAtts['link_title'.$indexlang]) ? $formAtts['link_title'.$indexlang] : $category->name;
|
||||
$link['link'] = Context::getContext()->link->getCategoryLink($category);
|
||||
$link['target_type'] = isset($formAtts['target_type'.$index]) ? $formAtts['target_type'.$index] : '_self';
|
||||
$formAtts['links'][] = $link;
|
||||
break;
|
||||
case 'link-product':
|
||||
$product_id = isset($formAtts['product_id'.$index]) ? (int)$formAtts['product_id'.$index] : 0;
|
||||
$product = new Product($product_id, true, Context::getContext()->language->id, Context::getContext()->shop->id);
|
||||
$link['title'] = (isset($formAtts['link_title'.$indexlang]) && $formAtts['link_title'.$indexlang]) ? $formAtts['link_title'.$indexlang] : $product->name;
|
||||
if ((int)$product->id > 0) {
|
||||
$link['link'] = Context::getContext()->link->getProductLink($product);
|
||||
} else {
|
||||
$link['link'] = '';
|
||||
}
|
||||
$link['target_type'] = isset($formAtts['target_type'.$index]) ? $formAtts['target_type'.$index] : '_self';
|
||||
$formAtts['links'][] = $link;
|
||||
break;
|
||||
case 'link-manufacture':
|
||||
$manufacture = new Manufacturer($assign['formAtts']['manufacture_id'], Context::getContext()->language->id);
|
||||
$link['title'] = (isset($formAtts['link_title'.$indexlang]) && $formAtts['link_title'.$indexlang]) ? $formAtts['link_title'.$indexlang] : $manufacture->name;
|
||||
$link['link'] = Context::getContext()->link->getManufacturerLink((int)$manufacture->id, $manufacture->link_rewrite, Context::getContext()->language->id);
|
||||
$link['target_type'] = isset($formAtts['target_type'.$index]) ? $formAtts['target_type'.$index] : '_self';
|
||||
$formAtts['links'][] = $link;
|
||||
break;
|
||||
case 'link-supplier':
|
||||
$supplier = new Supplier($assign['formAtts']['supplier_id'], Context::getContext()->language->id);
|
||||
$link['title'] = (isset($formAtts['link_title'.$indexlang]) && $formAtts['link_title'.$indexlang]) ? $formAtts['link_title'.$indexlang] : $supplier->name;
|
||||
$link['link'] = Context::getContext()->link->getSupplierLink((int)$supplier->id, $supplier->link_rewrite, Context::getContext()->language->id);
|
||||
$link['target_type'] = isset($formAtts['target_type'.$index]) ? $formAtts['target_type'.$index] : '_self';
|
||||
$formAtts['links'][] = $link;
|
||||
break;
|
||||
case 'link-cms':
|
||||
$cms = new CMS((int)$formAtts['cmspage_id'.$index], Context::getContext()->language->id, Context::getContext()->shop->id);
|
||||
$link['title'] = (isset($formAtts['link_title'.$indexlang]) && $formAtts['link_title'.$indexlang]) ? $formAtts['link_title'.$indexlang] : $cms->meta_title;
|
||||
$link['link'] = Context::getContext()->link->getCMSLink($cms, $cms->link_rewrite, (bool)Configuration::get('PS_SSL_ENABLED'));
|
||||
$link['target_type'] = isset($formAtts['target_type'.$index]) ? $formAtts['target_type'.$index] : '_self';
|
||||
$formAtts['links'][] = $link;
|
||||
break;
|
||||
case 'link-page':
|
||||
$param = isset($formAtts['page_param'.$index]) ? $formAtts['page_param'.$index] : '';
|
||||
// $front_link = $this->getFronTLink($formAtts['page_id'.$index]);
|
||||
// if ($front_link != false) {
|
||||
// $formAtts['page_id'.$index] = $front_link;
|
||||
// }
|
||||
$link['link'] = Context::getContext()->link->getPageLink($formAtts['page_id'.$index], null, Context::getContext()->language->id, $param);
|
||||
$link['title'] = (isset($formAtts['link_title'.$indexlang]) && $formAtts['link_title'.$indexlang]) ? $formAtts['link_title'.$indexlang] : Tools::ucfirst($formAtts['page_id'.$index]);
|
||||
$link['target_type'] = isset($formAtts['target_type'.$index]) ? $formAtts['target_type'.$index] : '_self';
|
||||
$formAtts['links'][] = $link;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$assign['formAtts']['links'] = $formAtts['links'];
|
||||
return $assign;
|
||||
}
|
||||
|
||||
public function getFronTLink($controller_param)
|
||||
{
|
||||
$controllers = Dispatcher::getControllers(array(_PS_FRONT_CONTROLLER_DIR_, _PS_OVERRIDE_DIR_.'controllers/front/'));
|
||||
$controllers['index'] = 'IndexController';
|
||||
if (isset($controllers['auth'])) {
|
||||
$controllers['authentication'] = $controllers['auth'];
|
||||
}
|
||||
if (isset($controllers['contact'])) {
|
||||
$controllers['contactform'] = $controllers['contact'];
|
||||
}
|
||||
if (!isset($controllers[Tools::strtolower($controller_param)])) {
|
||||
return false;
|
||||
}
|
||||
$controller_class = $controllers[Tools::strtolower($controller_param)];
|
||||
$controller_obj = Controller::getController($controller_class);
|
||||
return $controller_obj->php_self;
|
||||
}
|
||||
}
|
||||
1158
modules/appagebuilder/classes/shortcodes/ApBlog.php
Normal file
250
modules/appagebuilder/classes/shortcodes/ApButton.php
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApButton extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApButton';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Buttons'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Custom color, size and create a link for button'),
|
||||
'icon_class' => 'icon-edit',
|
||||
'tag' => 'content control');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'name',
|
||||
'label' => $this->l('Name'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => 'Button'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Use Outline Button'),
|
||||
'class' => 'form-action',
|
||||
'name' => 'use_outline_button',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'no', 'name' => $this->l('No')),
|
||||
array('id' => 'yes', 'name' => $this->l('Yes')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Button Type'),
|
||||
'name' => 'button_type',
|
||||
'options' => array('query' => $this->getDataButtonType(),
|
||||
'id' => 'value',
|
||||
'name' => 'text'),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'use_outline_button_sub use_outline_button-no',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Button Type'),
|
||||
'name' => 'outline_button_type',
|
||||
'options' => array('query' => $this->getDataOutlineButtonType(),
|
||||
'id' => 'value',
|
||||
'name' => 'text'),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'use_outline_button_sub use_outline_button-yes',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Button Size'),
|
||||
'name' => 'button_size',
|
||||
'options' => array('query' => $this->getDataSize(),
|
||||
'id' => 'value',
|
||||
'name' => 'text'),
|
||||
'default' => 'btn-lg',
|
||||
'desc' => $this->l('Select a button size')
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Is Block'),
|
||||
'name' => 'is_block',
|
||||
'desc' => $this->l('If is block, will display width is full 100%'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<hr/>'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => $this->l('You can add code in ').'<a href="'.self::getUrlProfileEdit().'" target="_blank">here</a>'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'url',
|
||||
'label' => $this->l('Url'),
|
||||
'desc' => $this->l('Exmaple: http://prestashop.com'),
|
||||
'lang' => 'true',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Open new window'),
|
||||
'name' => 'is_blank',
|
||||
'desc' => $this->l('If is Yes, will open new tab with url when click'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0'
|
||||
),
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
|
||||
if ($assign['formAtts']['use_outline_button'] == 'yes') {
|
||||
$assign['formAtts']['button_type'] = $assign['formAtts']['outline_button_type'];
|
||||
}
|
||||
return $assign;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function getDataButtonType()
|
||||
{
|
||||
$data = array(
|
||||
array(
|
||||
'value' => 'btn-primary',
|
||||
'text' => $this->l('Button Primary')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-secondary',
|
||||
'text' => $this->l('Button Secondary')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-success',
|
||||
'text' => $this->l('Button Success')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-info',
|
||||
'text' => $this->l('Button Info')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-warning',
|
||||
'text' => $this->l('Button Warning')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-danger',
|
||||
'text' => $this->l('Button Danger')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-link',
|
||||
'text' => $this->l('Button Link')
|
||||
)
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function getDataOutlineButtonType()
|
||||
{
|
||||
$data = array(
|
||||
array(
|
||||
'value' => 'btn-outline-primary',
|
||||
'text' => $this->l('Button Outline Primary')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-outline-secondary',
|
||||
'text' => $this->l('Button Outline Secondary')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-outline-success',
|
||||
'text' => $this->l('Button Outline Success')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-outline-info',
|
||||
'text' => $this->l('Button Outline Info')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-outline-warning',
|
||||
'text' => $this->l('Button Outline Warning')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-outline-danger',
|
||||
'text' => $this->l('Button Outline Danger')
|
||||
),
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function getDataSize()
|
||||
{
|
||||
$data = array(
|
||||
array(
|
||||
'value' => 'btn-lg',
|
||||
'text' => $this->l('Size Large')
|
||||
),
|
||||
array(
|
||||
'value' => 'btn-sm',
|
||||
'text' => $this->l('Size Small')
|
||||
),
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
314
modules/appagebuilder/classes/shortcodes/ApCategoryImage.php
Normal file
@@ -0,0 +1,314 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApCategoryImage extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApCategoryImage';
|
||||
public $for_module = 'manage';
|
||||
public $module_name = 'appagebuilder';
|
||||
public $level = 4;
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Images of categories'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Choosing images for categories'),
|
||||
'icon_class' => 'icon-picture',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$root = Category::getRootCategory();
|
||||
$selected_cat = array();
|
||||
$selected_cates = '';
|
||||
$selected_images = '';
|
||||
// $image_list = $this->getImages();
|
||||
$image_list = array();
|
||||
if (Tools::getIsset('categorybox')) {
|
||||
$category_box = Tools::getValue('categorybox');
|
||||
$selected_cat = explode(',', $category_box);
|
||||
}
|
||||
if (Tools::getIsset('category_img')) {
|
||||
$selected_images = str_replace($this->str_search, $this->str_relace_html, Tools::getValue('category_img'));
|
||||
}
|
||||
if (Tools::getIsset('selected_cates')) {
|
||||
$selected_cates = Tools::getValue('selected_cates');
|
||||
}
|
||||
$tree = new HelperTreeCategories('categorybox', 'All Categories');
|
||||
// fix tree category with ps version 1.6.1 or newer
|
||||
if (version_compare(_PS_VERSION_, '1.6.1', '>=')) {
|
||||
$tree->setRootCategory($root->id)->setUseCheckBox(true)->setFullTree(true)->setSelectedCategories($selected_cat)->setInputName('categorybox');
|
||||
} else {
|
||||
$tree->setRootCategory($root->id)->setUseCheckBox(true)->setSelectedCategories($selected_cat)->setInputName('categorybox');
|
||||
}
|
||||
$orderby = array(
|
||||
array(
|
||||
'order' => 'position',
|
||||
'name' => $this->l('Position')
|
||||
),
|
||||
array(
|
||||
'order' => 'depth',
|
||||
'name' => $this->l('Depth')
|
||||
),
|
||||
array(
|
||||
'order' => 'name',
|
||||
'name' => $this->l('Name')
|
||||
)
|
||||
);
|
||||
$showicons = array(
|
||||
array(
|
||||
'show' => '1',
|
||||
'name' => $this->l('Yes')
|
||||
),
|
||||
array(
|
||||
'show' => '2',
|
||||
'name' => $this->l('Level 1 categories')
|
||||
),
|
||||
array(
|
||||
'show' => '0',
|
||||
'name' => $this->l('No')
|
||||
)
|
||||
);
|
||||
$path_image = apPageHelper::getImgThemeUrl('icon');
|
||||
Context::getContext()->smarty->assign('path_image', $path_image);
|
||||
$href = Context::getContext()->link->getAdminLink('AdminApPageBuilderImages').'&ajax=1&action=manageimage&imgDir=icon';
|
||||
$tree_html = $tree->render();
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'img_cat',
|
||||
'name' => 'img_cat',
|
||||
'imageList' => $image_list,
|
||||
'selected_images' => $selected_images,
|
||||
'selected_cates' => $selected_cates,
|
||||
'lang' => true,
|
||||
'tree' => $tree_html,
|
||||
'href_image' => $href,
|
||||
'path_image' => $path_image,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Depth'),
|
||||
'name' => 'cate_depth',
|
||||
'default' => '1',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Order By:'),
|
||||
'name' => 'orderby',
|
||||
'default' => 'position',
|
||||
'options' => array(
|
||||
'query' => $orderby,
|
||||
'id' => 'order',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Show icons:'),
|
||||
'name' => 'showicons',
|
||||
'default' => '1',
|
||||
'options' => array(
|
||||
'query' => $showicons,
|
||||
'id' => 'show',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Limit'),
|
||||
'name' => 'limit',
|
||||
'default' => '5',
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'id_root',
|
||||
'default' => '2',
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'id_lang',
|
||||
'default' => '1',
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
$this->helper->module = new $this->module_name();
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
$form_atts = $assign['formAtts'];
|
||||
$images = array();
|
||||
if (isset($form_atts['category_img']) && $form_atts['category_img']) {
|
||||
$selected_images = str_replace($this->str_search, $this->str_relace_html, $form_atts['category_img']);
|
||||
$images = Tools::jsonDecode($selected_images, true);
|
||||
}
|
||||
$sql_filter = '';
|
||||
$sql_sort = '';
|
||||
if (isset($form_atts['orderby']) && $form_atts['orderby']) {
|
||||
if ($form_atts['orderby'] == 'depth') {
|
||||
$sql_sort = ' ORDER BY c.`level_depth` ASC';
|
||||
}
|
||||
if ($form_atts['orderby'] == 'position') {
|
||||
$sql_sort = ' ORDER BY c.`level_depth` ASC, category_shop.`position` ASC';
|
||||
}
|
||||
if ($form_atts['orderby'] == 'name') {
|
||||
$sql_sort = ' ORDER BY c.`level_depth` ASC, cl.`name` ASC';
|
||||
}
|
||||
}
|
||||
$catids = (isset($form_atts['categorybox']) && $form_atts['categorybox']) ? ($form_atts['categorybox']) : '';
|
||||
$catids = explode(',', $catids);
|
||||
$result = array();
|
||||
$this->level = (int)$form_atts['cate_depth'];
|
||||
$limit = (isset($form_atts['limit']) && $form_atts['limit']) ? ((int)$form_atts['limit']) : 0;
|
||||
$limit++;
|
||||
foreach ($catids as $cate_id) {
|
||||
if ($cate_id && Validate::isInt($cate_id)) {
|
||||
$result_cate = $this->getNestedCategories($cate_id, 1, $images, $limit);
|
||||
if ($result_cate) {
|
||||
$result[] = $result_cate;
|
||||
}
|
||||
}
|
||||
}
|
||||
$assign['categories'] = $result;
|
||||
$assign['random'] = 'categories-image-'.ApPageSetting::getRandomNumber();
|
||||
$assign['type'] = 'category_image';
|
||||
// validate module
|
||||
unset($sql_filter);
|
||||
unset($sql_sort);
|
||||
return $assign;
|
||||
}
|
||||
|
||||
public function getImages()
|
||||
{
|
||||
$oimages = array();
|
||||
|
||||
$img_theme_dir = apPageHelper::getImgThemeDir();
|
||||
$icon_theme_dir = apPageHelper::getImgThemeDir('icon');
|
||||
$icon_theme_url = apPageHelper::getImgThemeUrl('icon');
|
||||
|
||||
if (!file_exists($img_theme_dir)) {
|
||||
mkdir($img_theme_dir, 0755, true);
|
||||
}
|
||||
if (!file_exists($icon_theme_dir)) {
|
||||
mkdir($icon_theme_dir, 0755, true);
|
||||
}
|
||||
|
||||
if (is_dir($img_theme_dir) && is_dir($icon_theme_dir)) {
|
||||
$images = glob($icon_theme_dir.'*.*');
|
||||
$exts = array('jpg', 'gif', 'png');
|
||||
foreach ($images as $key => $image) {
|
||||
$ext = Tools::substr($image, Tools::strlen($image) - 3, Tools::strlen($image));
|
||||
if (in_array(Tools::strtolower($ext), $exts)) {
|
||||
$aimage = array();
|
||||
$aimage['path'] = $icon_theme_url.basename($image);
|
||||
$aimage['name'] = basename($image);
|
||||
$oimages[] = $aimage;
|
||||
}
|
||||
// validate module
|
||||
unset($key);
|
||||
}
|
||||
}
|
||||
return $oimages;
|
||||
}
|
||||
|
||||
public function getNestedCategories($parent, $level, $images, $limit)
|
||||
{
|
||||
$buff = array();
|
||||
if ($level <= $this->level) {
|
||||
$lang = Context::getContext()->language->id;
|
||||
$current = array();
|
||||
$child = array();
|
||||
// $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https://' : 'http://';
|
||||
$image_path = apPageHelper::getImgThemeUrl('icon');
|
||||
$sql = '
|
||||
SELECT c.*, cl.*
|
||||
FROM `'._DB_PREFIX_.'category` c'.Shop::addSqlAssociation('category', 'c').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').'
|
||||
WHERE c.id_parent='.(int)$parent.' AND `id_lang` = '.(int)$lang.'
|
||||
AND c.`active` = 1
|
||||
ORDER BY c.`level_depth` ASC, category_shop.`position` ASC';
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
$current_category = Db::getInstance()->executeS('SELECT c.*, cl.*
|
||||
FROM `'._DB_PREFIX_.'category` c'.Shop::addSqlAssociation('category', 'c').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Shop::addSqlRestrictionOnLang('cl').'
|
||||
WHERE c.id_category='.(int)$parent.' AND `id_lang` = '.(int)$lang.'
|
||||
AND c.`active` = 1');
|
||||
if ($current_category) {
|
||||
if (array_key_exists($current_category[0]['id_category'], $images)) {
|
||||
$current_category[0]['image'] = $image_path.$images[$current_category[0]['id_category']];
|
||||
}
|
||||
if ($result) {
|
||||
foreach ($result as &$row) {
|
||||
if ($row && isset($row['id_category'])) {
|
||||
$child = $this->getNestedCategories($row['id_category'], $level + 1, $images, $limit);
|
||||
if ($child) {
|
||||
foreach ($child as $item) {
|
||||
if (array_key_exists($item['id_category'], $images)) {
|
||||
$item['image'] = $image_path.$images[$item['id_category']];
|
||||
}
|
||||
$current[$row['id_category']] = $item;
|
||||
}
|
||||
}
|
||||
$buff[$row['id_parent']] = $current_category[0];
|
||||
if ($current) {
|
||||
$buff[$row['id_parent']]['children'] = &$current;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// validate module
|
||||
$buff[$parent] = $current_category[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $buff;
|
||||
}
|
||||
}
|
||||
279
modules/appagebuilder/classes/shortcodes/ApColumn.php
Normal file
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApColumn extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApColumn';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Column'), 'position' => 2, 'desc' => $this->l('A column can have one or more widget'),
|
||||
'tag' => 'content structure');
|
||||
}
|
||||
|
||||
public function getAdditionConfig()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'xl',
|
||||
'default' => '12'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'lg',
|
||||
'default' => '12'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'md',
|
||||
'default' => '12'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'sm',
|
||||
'default' => '12'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'xs',
|
||||
'default' => '12'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'sp',
|
||||
'default' => '12'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'tabConfig',
|
||||
'name' => 'tabConfig',
|
||||
'values' => array(
|
||||
'aprow_general' => $this->l('General'),
|
||||
'aprow_style' => $this->l('Width'),
|
||||
// 'aprow_animation' => $this->l('Animation'),
|
||||
'aprow_exceptions' => $this->l('Exceptions'))
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'id',
|
||||
'label' => $this->l('ID'),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'desc' => $this->l('Use for css and javascript'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'ApColumnclass',
|
||||
'name' => 'class',
|
||||
'leolabel' => $this->l('CSS Class'),
|
||||
'values' => '',
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_general',
|
||||
),
|
||||
array(
|
||||
'type' => 'column_width',
|
||||
'name' => 'width',
|
||||
'values' => '',
|
||||
'columnGrids' => ApPageSetting::getColumnGrid(),
|
||||
'form_group_class' => 'aprow_style',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Specific Controller'),
|
||||
'name' => 'specific_type',
|
||||
'class' => 'form-action',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'all',
|
||||
'name' => $this->l('Show on all Page Controller'),
|
||||
),
|
||||
array(
|
||||
'id' => 'index',
|
||||
'name' => $this->l('Show on only Index'),
|
||||
),
|
||||
array(
|
||||
'id' => 'category',
|
||||
'name' => $this->l('Show on only Category'),
|
||||
),
|
||||
array(
|
||||
'id' => 'product',
|
||||
'name' => $this->l('Show on only Product'),
|
||||
),
|
||||
array(
|
||||
'id' => 'cms',
|
||||
'name' => $this->l('Show on only CMS'),
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'aprow_exceptions',
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'reloadControler',
|
||||
'label' => $this->l('AJAX Reload Controller'),
|
||||
'name' => 'reloadControler',
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_exceptions specific_type_sub specific_type-all',
|
||||
'hint' => 'If website have new a Controller, click to generate Controller again.',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Controller ID'),
|
||||
'name' => 'controller_id',
|
||||
'desc' => $this->l('Example: 1,2,3'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_exceptions specific_type_sub specific_type-category specific_type-product specific_type-cms',
|
||||
),
|
||||
array(
|
||||
'type' => 'apExceptions',
|
||||
'name' => 'controller_pages',
|
||||
'form_group_class' => 'aprow_exceptions specific_type_sub specific_type-all',
|
||||
),
|
||||
);
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
$this->helper->module = new $this->module_name();
|
||||
$this->helper->tpl_vars['exception_list'] = $this->displayModuleExceptionList();
|
||||
}
|
||||
|
||||
public function displayModuleExceptionList()
|
||||
{
|
||||
$controllers = array();
|
||||
$controllers_modules = array();
|
||||
$controllers_modules['admin'] = array();
|
||||
$controllers_modules['front'] = array();
|
||||
|
||||
if (Tools::getValue('reloadControllerException')) {
|
||||
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
|
||||
$controllers_modules = array(
|
||||
'admin' => Dispatcher::getModuleControllers('admin'),
|
||||
'front' => Dispatcher::getModuleControllers('front'),
|
||||
);
|
||||
|
||||
Configuration::updateValue('AP_CACHE_FRONT_CONTROLLER_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers)));
|
||||
Configuration::updateValue('AP_CACHE_FRONT_MODULE_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers_modules['admin'])));
|
||||
Configuration::updateValue('AP_CACHE_ADMIN_MODULE_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers_modules['front'])));
|
||||
} else {
|
||||
if (Configuration::get('AP_CACHE_FRONT_CONTROLLER_EXCEPTION') === false) {
|
||||
# First Time : write to config
|
||||
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
|
||||
Configuration::updateValue('AP_CACHE_FRONT_CONTROLLER_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers)));
|
||||
} else {
|
||||
# Second Time : read from config
|
||||
$controllers = Tools::jsonDecode(apPageHelper::correctDeCodeData(Configuration::get('AP_CACHE_FRONT_CONTROLLER_EXCEPTION')), true);
|
||||
}
|
||||
|
||||
if (Configuration::get('AP_CACHE_FRONT_MODULE_EXCEPTION') === false) {
|
||||
# First Time : write to config
|
||||
$controllers_modules['admin'] = Dispatcher::getModuleControllers('admin');
|
||||
Configuration::updateValue('AP_CACHE_FRONT_MODULE_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers_modules['admin'])));
|
||||
} else {
|
||||
# Second Time : read from config
|
||||
$controllers_modules['admin'] = Tools::jsonDecode(apPageHelper::correctDeCodeData(Configuration::get('AP_CACHE_FRONT_MODULE_EXCEPTION')), true);
|
||||
}
|
||||
|
||||
if (Configuration::get('AP_CACHE_ADMIN_MODULE_EXCEPTION') === false) {
|
||||
# First Time : write to config
|
||||
$controllers_modules['front'] = Dispatcher::getModuleControllers('front');
|
||||
Configuration::updateValue('AP_CACHE_ADMIN_MODULE_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers_modules['front'])));
|
||||
} else {
|
||||
# Second Time : read from config
|
||||
$controllers_modules['front'] = Tools::jsonDecode(apPageHelper::correctDeCodeData(Configuration::get('AP_CACHE_ADMIN_MODULE_EXCEPTION')), true);
|
||||
}
|
||||
}
|
||||
|
||||
$controller = Tools::getValue('controller_pages');
|
||||
$arr_controllers = explode(',', $controller);
|
||||
$arr_controllers = array_map('trim', $arr_controllers);
|
||||
|
||||
$modules_controllers_type = array('front' => $this->l('Front modules controller'), 'admin' => $this->l('Admin modules controller'));
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'_core_' => $this->l('________________________________________ CORE ________________________________________'),
|
||||
'controller' => $controller,
|
||||
'arr_controllers' => $arr_controllers,
|
||||
'controllers' => $controllers,
|
||||
'modules_controllers_type' => $modules_controllers_type,
|
||||
'controllers_modules' => $controllers_modules,
|
||||
));
|
||||
$content = Context::getContext()->smarty->fetch(apPageHelper::getShortcodeTemplatePath('ApColumn.tpl'));
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
if (!isset($assign['formAtts']['animation']) || $assign['formAtts']['animation'] == 'none') {
|
||||
$assign['formAtts']['animation'] = 'none';
|
||||
$assign['formAtts']['animation_delay'] = '';
|
||||
} elseif ($assign['formAtts']['animation'] != 'none') {
|
||||
// validate module
|
||||
//DONGND:: add more config for animation
|
||||
if ((int)$assign['formAtts']['animation_delay'] >= 0) {
|
||||
$assign['formAtts']['animation_delay'] .= 's';
|
||||
} else {
|
||||
$assign['formAtts']['animation_delay'] = '1s';
|
||||
}
|
||||
if (isset($assign['formAtts']['animation_duration']) && (int)$assign['formAtts']['animation_duration'] >= 0) {
|
||||
$assign['formAtts']['animation_duration'] .= 's';
|
||||
} else {
|
||||
$assign['formAtts']['animation_duration'] = '1s';
|
||||
}
|
||||
if (isset($assign['formAtts']['animation_iteration_count']) && (int)$assign['formAtts']['animation_iteration_count'] > 0) {
|
||||
$assign['formAtts']['animation_iteration_count'] = (int)$assign['formAtts']['animation_iteration_count'];
|
||||
} else {
|
||||
$assign['formAtts']['animation_iteration_count'] = 1;
|
||||
}
|
||||
};
|
||||
$assign['formAtts']['class'] = str_replace('.', '-', $assign['formAtts']['class']);
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
200
modules/appagebuilder/classes/shortcodes/ApCountdown.php
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApCountdown extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApCountdown';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array(
|
||||
'label' => $this->l('Countdown'),
|
||||
'position' => 3,
|
||||
'desc' => $this->l('Show a __________________'),
|
||||
'icon_class' => 'icon-picture', 'tag' => 'content slider'
|
||||
);
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$html_content = "
|
||||
|
||||
<style rel='stylesheet' type='text/css'>
|
||||
.ui-datepicker.ui-widget-content{
|
||||
border: 1px solid #aaaaaa/*{borderColorContent}*/;
|
||||
background: #ffffff/*{bgColorContent}*/;
|
||||
color: #222222/*{fcContent}*/;
|
||||
}
|
||||
.ui-slider.ui-widget-content{
|
||||
border: 1px solid #aaaaaa/*{borderColorContent}*/;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script>
|
||||
$('.datepicker').datetimepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
// Define a custom regional settings in order to use PrestaShop translation tools
|
||||
currentText: 'Now',
|
||||
closeText: 'Done',
|
||||
ampm: false,
|
||||
amNames: ['AM', 'A'],
|
||||
pmNames: ['PM', 'P'],
|
||||
timeFormat: 'hh:mm:ss tt',
|
||||
timeSuffix: '',
|
||||
timeOnlyTitle: 'Choose Time',
|
||||
timeText: 'Time',
|
||||
hourText: 'Hour',
|
||||
minuteText: 'Minute'
|
||||
});
|
||||
</script>
|
||||
|
||||
";
|
||||
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => 'container'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Time From'),
|
||||
'name' => 'time_from',
|
||||
'class' => 'datepicker',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Time To'),
|
||||
'name' => 'time_to',
|
||||
'default' => '',
|
||||
'class' => 'datepicker',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Open new tab'),
|
||||
'desc' => $this->l('Open new tab when click to link in slider'),
|
||||
'name' => 'new_tab',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'link_label',
|
||||
'label' => $this->l('Link Label'),
|
||||
'lang' => 'true',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'link',
|
||||
'label' => $this->l('Link'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
'class' => 'item-add-slide ignore-lang',
|
||||
'form_group_class' => 'apfullslider-row link-slide',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => $html_content,
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Widget Description'),
|
||||
'name' => 'description',
|
||||
'cols' => 40,
|
||||
'rows' => 10,
|
||||
'value' => true,
|
||||
'lang' => true,
|
||||
'default' => '',
|
||||
'class' => 'item-add-slide ignore-lang',
|
||||
'form_group_class' => 'apfullslider-row description-slide',
|
||||
),
|
||||
);
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function getListGroup($list)
|
||||
{
|
||||
|
||||
$result = array();
|
||||
foreach ($list as $item) {
|
||||
$status = ' ('.($item['active'] ? $this->l('Active') : $this->l('Deactive')).')';
|
||||
$result[] = array('id' => $item['id_leoslideshow_groups'], 'name' => $item['title'].$status);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
|
||||
$productCdown = Configuration::get('APPAGEBUILDER_LOAD_COUNT');
|
||||
if (!$productCdown) {
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show Countdown Widget via Appagebuilder. Please enable AJAX Show Count Down Product.';
|
||||
return $assign;
|
||||
}
|
||||
|
||||
$from = strtotime($assign['formAtts']['time_from']);
|
||||
$now = time();
|
||||
$end = strtotime($assign['formAtts']['time_to']);
|
||||
|
||||
if (($from <= $now) && ($now < $end)) {
|
||||
$start = true;
|
||||
} else {
|
||||
$start = false;
|
||||
}
|
||||
|
||||
if ($start) {
|
||||
# RUNNING
|
||||
$assign['formAtts']['time_to'] = str_replace('-', '/', $assign['formAtts']['time_to']);
|
||||
$assign['formAtts']['active'] = 1;
|
||||
} else {
|
||||
$assign['formAtts']['active'] = 0;
|
||||
}
|
||||
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
126
modules/appagebuilder/classes/shortcodes/ApFacebook.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApFacebook extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApFacebook';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Facebook'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('You can config Facebook Like box'),
|
||||
'icon_class' => 'icon-facebook-sign',
|
||||
'tag' => 'social');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$soption = ApPageSetting::returnYesNo();
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Page URL'),
|
||||
'name' => 'page_url',
|
||||
'class' => 'ap_facebook',
|
||||
'default' => 'https://www.facebook.com/prestashop',
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'switch',
|
||||
// 'label' => $this->l('Is Border'),
|
||||
// 'name' => 'border',
|
||||
// 'values' => $soption,
|
||||
// 'default' => '1',
|
||||
// ),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Color'),
|
||||
'name' => 'target',
|
||||
'options' => array('query' => array(
|
||||
array('id' => 'dark', 'name' => $this->l('Dark')),
|
||||
array('id' => 'light', 'name' => $this->l('Light')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'default' => '_self',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Width'),
|
||||
'name' => 'width',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Height'),
|
||||
'name' => 'height',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Stream'),
|
||||
'name' => 'show_stream',
|
||||
'values' => $soption,
|
||||
'default' => '0',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Faces'),
|
||||
'name' => 'show_faces',
|
||||
'values' => $soption,
|
||||
'default' => '1',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Header'),
|
||||
'name' => 'show_header',
|
||||
'values' => $soption,
|
||||
'default' => '0',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Border'),
|
||||
'name' => 'show_border',
|
||||
'values' => $soption,
|
||||
'default' => '0',
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
}
|
||||
173
modules/appagebuilder/classes/shortcodes/ApFontAwesome.php
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApFontAwesome extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApFontAwesome';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Font Awesome'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Add a font Awesome'),
|
||||
'icon_class' => 'icon icon-font',
|
||||
'tag' => 'content control');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$rotate = array(
|
||||
array(
|
||||
'value' => 'normal',
|
||||
'text' => $this->l('Normal')
|
||||
),
|
||||
array(
|
||||
'value' => 'icon-rotate-90',
|
||||
'text' => $this->l('Rotate Left')
|
||||
),
|
||||
array(
|
||||
'value' => 'icon-rotate-180',
|
||||
'text' => $this->l('Rotate Inverser')
|
||||
),
|
||||
array(
|
||||
'value' => 'icon-rotate-270',
|
||||
'text' => $this->l('Rotate Right')
|
||||
),
|
||||
array(
|
||||
'value' => 'icon-flip-horizontal',
|
||||
'text' => $this->l('Flip Horizontal')
|
||||
),
|
||||
array(
|
||||
'value' => 'icon-flip-vertical',
|
||||
'text' => $this->l('Flip Vertical')
|
||||
),
|
||||
);
|
||||
$sizes = array(
|
||||
array(
|
||||
'value' => 'size-default',
|
||||
'text' => $this->l('Size Default')
|
||||
),
|
||||
array(
|
||||
'value' => 'icon-large',
|
||||
'text' => $this->l('Size Large')
|
||||
),
|
||||
array(
|
||||
'value' => 'icon-2x',
|
||||
'text' => $this->l('Size 2x')
|
||||
),
|
||||
array(
|
||||
'value' => 'icon-3x',
|
||||
'text' => $this->l('Size 3x')
|
||||
),
|
||||
array(
|
||||
'value' => 'icon-4x',
|
||||
'text' => $this->l('Size 4x')
|
||||
)
|
||||
);
|
||||
$default_font = Tools::getIsset('font_name') ? Tools::getValue('font_name') : 'icon-font';
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<input type="text" name="font_name" id="font_name" value="'.$default_font.
|
||||
'"/><div class="box-list-font-awesome">'.$this->renderListFont($default_font).'</div>'
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<hr/><div class="preview-widget"><i class="icon '.$default_font.
|
||||
'" data-default="'.$default_font.'"></i></div>'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Font Rotate'),
|
||||
'name' => 'font_type',
|
||||
'options' => array('query' => $rotate,
|
||||
'id' => 'value',
|
||||
'name' => 'text'),
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Font Size'),
|
||||
'name' => 'font_size',
|
||||
'options' => array('query' => $sizes,
|
||||
'id' => 'value',
|
||||
'name' => 'text'),
|
||||
'default' => 'size-default',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Is Spin'),
|
||||
'name' => 'is_spin',
|
||||
'options' => array('query' => array(
|
||||
array('value' => '', 'text' => $this->l('No spin')),
|
||||
array('value' => 'icon-spin', 'text' => $this->l('Spin')),
|
||||
),
|
||||
'id' => 'value',
|
||||
'name' => 'text'),
|
||||
'default' => 'btn-lg',
|
||||
),
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function renderListFont($default = 'icon-font')
|
||||
{
|
||||
$list = ApPageSetting::listFontAwesome();
|
||||
$result = '';
|
||||
foreach ($list as $item) {
|
||||
$cls = '';
|
||||
if ($default === $item['value']) {
|
||||
$cls = 'selected';
|
||||
}
|
||||
$result .= '<li class="'.$cls.'"><i class="icon '.$item['value'].'" data-default="'.$item['value'].'"></i>';
|
||||
}
|
||||
return "<ul class='list-font-awesome'>$result</ul>";
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
$assign['formAtts']['font_name'] = str_replace('icon', 'fa', $assign['formAtts']['font_name']);
|
||||
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
258
modules/appagebuilder/classes/shortcodes/ApFullSlider.php
Normal file
@@ -0,0 +1,258 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApFullSlider extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApFullSlider';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Full Slider'), 'position' => 6,
|
||||
'desc' => $this->l('You can create Inner slideshow'), 'icon_class' => 'icon icon-chevron-right',
|
||||
'tag' => 'content slider');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$href = Context::getContext()->link->getAdminLink('AdminApPageBuilderImages').'&ajax=1&action=manageimage&imgDir=images';
|
||||
$ad = __PS_BASE_URI__.basename(_PS_ADMIN_DIR_);
|
||||
$iso_tiny_mce = Context::getContext()->language->iso_code;
|
||||
$iso_tiny_mce = (file_exists(_PS_JS_DIR_.'tiny_mce/langs/'.$iso_tiny_mce.'.js') ? $iso_tiny_mce : 'en');
|
||||
$list_slider = '<button type="button" id="btn-add-slider" class="btn btn-default">
|
||||
<i class="icon-plus-sign-alt"></i> '.$this->l('Add slider').'</button><hr/>';
|
||||
$list_slider_button = '<div id="frm-slider" class="hide">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12 ">
|
||||
<button type="button" class="btn btn-primary btn-save-fullslider"
|
||||
data-error="'.$this->l('Please enter the title and description').'">'.$this->l('Save').'</button>
|
||||
<button type="button" class="btn btn-default btn-reset-fullslider">'.$this->l('Reset').'</button>
|
||||
<button type="button" class="btn btn-default btn-cancel-fullslider">'.$this->l('Cancel').'</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var ad = "'.$ad.'";
|
||||
var iso = "'.$iso_tiny_mce.'";
|
||||
</script>
|
||||
<hr/>
|
||||
</div>';
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => 'container'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Width slider'),
|
||||
'desc' => $this->l('Example: 100%, 1170px'),
|
||||
'name' => 'width',
|
||||
'default' => '100%'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Height slider'),
|
||||
'name' => 'height',
|
||||
'default' => '400px',
|
||||
'desc' => $this->l('Example: 100%, 400px'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Interval'),
|
||||
'name' => 'interval',
|
||||
'default' => 2000,
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Display title in slider'),
|
||||
'name' => 'display_title',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Display indicators in slider'),
|
||||
'name' => 'display_indicators',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Open new tab'),
|
||||
'desc' => $this->l('Open new tab when click to link in slider'),
|
||||
'name' => 'is_open',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">'.$this->l('Next step: Add content for sliders').'</div>'
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => $list_slider
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Image'),
|
||||
'type' => 'selectImg',
|
||||
'href' => $href,
|
||||
'name' => 'temp_image',
|
||||
'lang' => true,
|
||||
'class' => 'item-add-slide ignore-lang',
|
||||
'form_group_class' => 'apfullslider-row select-img',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
'class' => 'item-add-slide ignore-lang',
|
||||
'form_group_class' => 'apfullslider-row title-slide',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_link',
|
||||
'label' => $this->l('Link'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
'class' => 'item-add-slide ignore-lang',
|
||||
'form_group_class' => 'apfullslider-row link-slide',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Description'),
|
||||
'name' => 'temp_descript',
|
||||
'cols' => 40,
|
||||
'rows' => 10,
|
||||
'value' => true,
|
||||
'lang' => true,
|
||||
'default' => '',
|
||||
'class' => 'item-add-slide ignore-lang',
|
||||
'form_group_class' => 'apfullslider-row description-slide',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => $list_slider_button
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'total_slider',
|
||||
'default' => ''
|
||||
),
|
||||
);
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
$this->helper->module = new $this->module_name();
|
||||
}
|
||||
|
||||
public function addConfigList($values)
|
||||
{
|
||||
// Get value with keys special
|
||||
$config_val = array();
|
||||
$total = isset($values['total_slider']) ? $values['total_slider'] : '';
|
||||
$arr = explode('|', $total);
|
||||
$inputs = array('tit', 'img', 'link', 'descript');
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($arr as $i) {
|
||||
foreach ($inputs as $config) {
|
||||
foreach ($languages as $lang) {
|
||||
$config_val[$config][$i][$lang['id_lang']] = str_replace($this->str_search, $this->str_relace_html_admin, Tools::getValue($config.'_'.$i.'_'.$lang['id_lang'], ''));
|
||||
// print_r($config_val);
|
||||
// echo '====';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'lang' => $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')),
|
||||
'default_lang' => $lang->id,
|
||||
'arr' => $arr,
|
||||
'languages' => $languages,
|
||||
'config_val' => $config_val,
|
||||
'path' => $this->theme_img_module,
|
||||
));
|
||||
$list_slider = Context::getContext()->smarty->fetch(apPageHelper::getShortcodeTemplatePath('ApFullSlider.tpl'));
|
||||
$input = array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => $list_slider
|
||||
);
|
||||
$this->config_list[] = $input;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
$total_slider = isset($assign['formAtts']['total_slider']) ? $assign['formAtts']['total_slider'] : '';
|
||||
$list = explode('|', $total_slider);
|
||||
$sliders = array();
|
||||
$lang = Language::getLanguage(Context::getContext()->language->id);
|
||||
$lang_default = $lang['id_lang'];
|
||||
foreach ($list as $item) {
|
||||
if ($item) {
|
||||
$temp = $item.'_'.$lang_default;
|
||||
$slider = array();
|
||||
$slider['id'] = $item;
|
||||
$slider['title'] = isset($assign['formAtts']['tit_'.$temp]) ? $assign['formAtts']['tit_'.$temp] : '';
|
||||
$slider['link'] = isset($assign['formAtts']['link_'.$temp]) ? $assign['formAtts']['link_'.$temp] : '';
|
||||
if (isset($assign['formAtts']['img_'.$temp]) && $assign['formAtts']['img_'.$temp]) {
|
||||
// validate module
|
||||
$slider['img'] = $this->theme_img_module.$assign['formAtts']['img_'.$temp];
|
||||
} else {
|
||||
// validate module
|
||||
$slider['img'] = '';
|
||||
}
|
||||
|
||||
$desc = isset($assign['formAtts']['descript_'.$temp]) ? $assign['formAtts']['descript_'.$temp] : '';
|
||||
$slider['descript'] = str_replace($this->str_search, $this->str_relace_html, $desc);
|
||||
//$slider['descript'] = $assign['formAtts']['descript_'.$temp];
|
||||
$sliders[] = $slider;
|
||||
}
|
||||
}
|
||||
$assign['formAtts']['is_open'] = isset($assign['formAtts']['is_open']) ? $assign['formAtts']['is_open'] : 0;
|
||||
$assign['formAtts']['slides'] = $sliders;
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
115
modules/appagebuilder/classes/shortcodes/ApGenCode.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApGenCode extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApGenCode';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Generate Code'),
|
||||
'position' => 8,
|
||||
'desc' => $this->l('Generate Code for tpl file. This function for web developer'),
|
||||
'icon_class' => 'icon-edit',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'value' => 'abcd',
|
||||
'name' => 'id_gencode',
|
||||
'default' => uniqid('id_gencode_').'_'.time(),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'content_html',
|
||||
'class' => 'ap_html_raw raw-'.time(),
|
||||
'rows' => '10',
|
||||
'label' => $this->l('Code'),
|
||||
'values' => '',
|
||||
'default' => '',
|
||||
'desc' => $this->l('Typing code for file tpl.'),
|
||||
),
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
$this->generateFile($assign, $module);
|
||||
|
||||
$file_name = $assign['formAtts']['id_gencode'].'.tpl';
|
||||
$profile_data = $module->getProfileData();
|
||||
$profile_folder = $profile_data['profile_key'];
|
||||
$file_url = apPageHelper::getConfigDir('theme_profiles').$profile_folder.'/'.$file_name;
|
||||
// check file tồn tại
|
||||
if (file_exists($file_url)) {
|
||||
$assign['formAtts']['tpl_file'] = $file_url;
|
||||
} else {
|
||||
$title = $assign['formAtts']['title'];
|
||||
$assign['formAtts']['error_file'] = '1';
|
||||
$assign['formAtts']['error_message'] = "ERROR!!! Generate Code
|
||||
'$title'. Physical file does not exist "._THEME_NAME_.'/'.$profile_folder.'/'.$file_name;
|
||||
}
|
||||
return $assign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create code file in profile folder
|
||||
*/
|
||||
public function generateFile($assign, $module = null)
|
||||
{
|
||||
$folder_profiles = apPageHelper::getConfigDir('theme_profiles');
|
||||
if (!is_dir($folder_profiles)) {
|
||||
mkdir($folder_profiles, 0755, true);
|
||||
}
|
||||
|
||||
$file = $assign['formAtts']['id_gencode'].'.tpl';
|
||||
$profile_data = $module->getProfileData();
|
||||
$folder = $folder_profiles.$profile_data['profile_key'];
|
||||
$value = isset($assign['formAtts']['content_html']) ? $assign['formAtts']['content_html'] : '';
|
||||
|
||||
if (!is_dir($folder)) {
|
||||
mkdir($folder, 0755, true);
|
||||
}
|
||||
|
||||
ApPageSetting::writeFile($folder, $file, $value);
|
||||
}
|
||||
}
|
||||
289
modules/appagebuilder/classes/shortcodes/ApGmap.php
Normal file
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApGmap extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApGmap';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Google Map'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Create a Google Map'),
|
||||
'icon_class' => 'icon-map-marker',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$iselect = Tools::getValue('display_store');
|
||||
|
||||
if ($iselect === false) {
|
||||
$script_update_select = '<script>$("#display_store").removeAttr("checked");</script>';
|
||||
} elseif ($iselect == 1) {
|
||||
$script_update_select = '<script>$("#display_store").attr("checked", "checked");</script>';
|
||||
}
|
||||
// Get all store of shop
|
||||
$base_model = new ApPageBuilderModel();
|
||||
$data_list = $base_model->getAllStoreByShop();
|
||||
// Options for switch elements
|
||||
$zoom_option = array();
|
||||
for ($i = 1; $i <= 20; $i++) {
|
||||
$zoom_option[] = array('id' => $i, 'value' => $i);
|
||||
}
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Google Key'),
|
||||
'name' => 'gkey',
|
||||
'desc' => $this->l('Example: AIzaSyCWJmaoDNR_l3GVkP6uRnMzsGG5iuuU_AM'),
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Zoom'),
|
||||
'name' => 'zoom',
|
||||
'default' => '11',
|
||||
'options' => array(
|
||||
'query' => $zoom_option,
|
||||
'id' => 'id',
|
||||
'name' => 'value'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Width'),
|
||||
'name' => 'width',
|
||||
'desc' => $this->l('Example: 100%, 100px'),
|
||||
'default' => '100%',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Height'),
|
||||
'name' => 'height',
|
||||
'desc' => $this->l('Example: 100%, 100px'),
|
||||
'default' => '300px',
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'display',
|
||||
'label' => $this->l('Select display store on map'),
|
||||
'class' => 'checkbox-group',
|
||||
// 'desc' => $this->l('Uncheck is display all stores'),
|
||||
'values' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'store',
|
||||
'name' => $this->l('Select store'),
|
||||
'val' => '1'
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">'.$this->l('Uncheck to Display all stores').'</div>'.$script_update_select,
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('List stores'),
|
||||
'desc' => $this->l('Can select multi store'),
|
||||
'name' => 'store[]',
|
||||
'multiple' => true,
|
||||
'options' => array(
|
||||
'query' => $data_list,
|
||||
'id' => 'id_store',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'aprow_exceptions',
|
||||
'default' => 'all',
|
||||
'form_group_class' => 'display_store',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Store Menu'),
|
||||
'name' => 'is_display_list',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Enable Gmap at Our_Stores page'),
|
||||
'name' => 'stores',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Enable Gmap at Sitemap page'),
|
||||
'name' => 'sitemap',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0'
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
// Get all store of shop
|
||||
$base_model = new ApPageBuilderModel();
|
||||
$data_list = $base_model->getAllStoreByShop();
|
||||
$form_atts = $assign['formAtts'];
|
||||
$not_all = (isset($form_atts['display_store']) && $form_atts['display_store']);
|
||||
$store_ids = explode(',', (isset($form_atts['store']) && $form_atts['store']) ? $form_atts['store'] : '');
|
||||
$assign['hasListStore'] = (isset($form_atts['is_display_list']) && $form_atts['is_display_list']) ? 'is_display_list' : '';
|
||||
$markers = array();
|
||||
if ($not_all) {
|
||||
foreach ($store_ids as $id) {
|
||||
foreach ($data_list as $store) {
|
||||
if ($id == $store['id_store']) {
|
||||
$markers[] = $store;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$markers = $data_list;
|
||||
}
|
||||
foreach ($markers as &$marker) {
|
||||
$address = $this->processStoreAddress($marker);
|
||||
$marker['other'] = $this->renderStoreWorkingHours($marker);
|
||||
$marker['address'] = $address;
|
||||
$marker['has_store_picture'] = file_exists(_PS_STORE_IMG_DIR_.(int)$marker['id_store'].'.jpg');
|
||||
}
|
||||
|
||||
$assign['marker_center'] = Tools::jsonEncode($this->getMarkerCenter($markers));
|
||||
$assign['marker_list'] = Tools::jsonEncode($markers);
|
||||
|
||||
$assign['apGMap'] = Tools::jsonEncode(array(
|
||||
'translation_5' => $this->l('Click to to larger Map'),
|
||||
'logo_store' => Configuration::get('PS_STORES_ICON'),
|
||||
'img_store_dir' => _THEME_STORE_DIR_,
|
||||
'img_ps_dir' => _PS_IMG_,
|
||||
));
|
||||
|
||||
return $assign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get formatted string address
|
||||
*/
|
||||
protected function processStoreAddress($store)
|
||||
{
|
||||
$ignore_field = array(
|
||||
'firstname',
|
||||
'lastname'
|
||||
);
|
||||
$out_datas = array();
|
||||
$address_datas = AddressFormat::getOrderedAddressFields($store['id_country'], false, true);
|
||||
$state = (isset($store['id_state'])) ? new State($store['id_state']) : null;
|
||||
foreach ($address_datas as $data_line) {
|
||||
$data_fields = explode(' ', $data_line);
|
||||
$addr_out = array();
|
||||
$data_fields_mod = false;
|
||||
foreach ($data_fields as $field_item) {
|
||||
$field_item = trim($field_item);
|
||||
if (!in_array($field_item, $ignore_field) && !empty($store[$field_item])) {
|
||||
$addr_out[] = ($field_item == 'city' && $state && isset($state->iso_code) && Tools::strlen($state->iso_code)) ?
|
||||
$store[$field_item].', '.$state->iso_code : $store[$field_item];
|
||||
$data_fields_mod = true;
|
||||
}
|
||||
}
|
||||
if ($data_fields_mod) {
|
||||
$out_datas[] = implode(' ', $addr_out);
|
||||
}
|
||||
}
|
||||
$out = implode('<br />', $out_datas);
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function renderStoreWorkingHours($store)
|
||||
{
|
||||
$days = array();
|
||||
$days[1] = 'Monday';
|
||||
$days[2] = 'Tuesday';
|
||||
$days[3] = 'Wednesday';
|
||||
$days[4] = 'Thursday';
|
||||
$days[5] = 'Friday';
|
||||
$days[6] = 'Saturday';
|
||||
$days[7] = 'Sunday';
|
||||
|
||||
$hours_temp = $store['hours'];
|
||||
$hours_temp = Tools::jsonDecode($hours_temp);
|
||||
$hours = array();
|
||||
//DONGND:: fix when stores do not have the data of open time
|
||||
if (count($hours_temp) > 0) {
|
||||
foreach ($hours_temp as $h) {
|
||||
$hours[] = implode(' | ', $h);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($hours)) {
|
||||
$result = '';
|
||||
for ($i = 1; $i < 8; $i++) {
|
||||
if (isset($hours[(int)$i - 1])) {
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'days' => $days,
|
||||
'hours' => $hours,
|
||||
'i' => $i,
|
||||
));
|
||||
|
||||
$file_name = _PS_MODULE_DIR_.'appagebuilder/views/templates/front/shortcodes/ApGmap.tpl';
|
||||
$result .= Context::getContext()->smarty->fetch($file_name);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getMarkerCenter($markers)
|
||||
{
|
||||
//'default lat/long = 21.010904,105.787736 is location of LeoTheme
|
||||
$lat = 21.010904;
|
||||
$long = 105.787736;
|
||||
return (is_array($markers) && count($markers) > 0) ? $markers[0] : array('latitude' => $lat, 'longitude' => $long);
|
||||
}
|
||||
}
|
||||
97
modules/appagebuilder/classes/shortcodes/ApHtml.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApHtml extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApHtml';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Html'), 'position' => 3, 'desc' => $this->l('You can put html'),
|
||||
'icon_class' => 'icon-html5', 'tag' => 'content structure');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$accordion_type = array(
|
||||
array(
|
||||
'value' => 'full',
|
||||
'text' => $this->l('Always Full')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion',
|
||||
'text' => $this->l('Always Accordion')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion_small_screen',
|
||||
'text' => $this->l('Accordion at small screen')
|
||||
),
|
||||
);
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'autoload_rte' => false,
|
||||
'values' => '',
|
||||
'class' => 'sub_title',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Accordion Type'),
|
||||
'name' => 'accordion_type',
|
||||
'options' => array(
|
||||
'query' => $accordion_type,
|
||||
'id' => 'value',
|
||||
'name' => 'text' ),
|
||||
'default' => 'full',
|
||||
'hint' => $this->l('Select a Accordion Type'),
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'content_html',
|
||||
'class' => 'ap_html',
|
||||
'rows' => '50',
|
||||
'lang' => true,
|
||||
'label' => $this->l('Html'),
|
||||
'values' => '',
|
||||
'autoload_rte' => true,
|
||||
'default' => "<div>\n</div>"
|
||||
),
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
}
|
||||
180
modules/appagebuilder/classes/shortcodes/ApImage.php
Normal file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApImage extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApImage';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Image'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Single Image'),
|
||||
'icon_class' => 'icon-image',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
Context::getContext()->smarty->assign('path_image', apPageHelper::getImgThemeUrl());
|
||||
$href = Context::getContext()->link->getAdminLink('AdminApPageBuilderImages').'&ajax=1&action=manageimage&imgDir=images';
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Animations'),
|
||||
'name' => 'animation',
|
||||
'class' => 'animation-select',
|
||||
'options' => array(
|
||||
'optiongroup' => array(
|
||||
'label' => 'name',
|
||||
'query' => ApPageSetting::getAnimations(),
|
||||
),
|
||||
'options' => array(
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
'query' => 'query',
|
||||
),
|
||||
),
|
||||
'form_group_class' => 'apimage_animation',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div id="animationSandbox">Prestashop.com</div>',
|
||||
'form_group_class' => 'apimage_animation animate_sub',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Delay'),
|
||||
'name' => 'animation_delay',
|
||||
'default' => '0.5',
|
||||
'suffix' => 's',
|
||||
'class' => 'fixed-width-xs',
|
||||
'form_group_class' => 'apimage_animation animate_sub',
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Image'),
|
||||
'type' => 'selectImg',
|
||||
'href' => $href,
|
||||
'name' => 'image',
|
||||
'lang' => true,
|
||||
'show_image' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'alt',
|
||||
'label' => $this->l('Alt'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'url',
|
||||
'label' => $this->l('Link to'),
|
||||
'lang' => true,
|
||||
'desc' => 'Example: http://prestashop.com',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Open new tab'),
|
||||
'name' => 'is_open',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'width',
|
||||
'label' => $this->l('Image size width'),
|
||||
'desc' => $this->l('Example: auto, 100%, 100px'),
|
||||
'default' => '100%'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'height',
|
||||
'label' => $this->l('Image size height'),
|
||||
'desc' => $this->l('Example: auto, 100%, 100px'),
|
||||
'default' => 'auto'
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Description'),
|
||||
'name' => 'description',
|
||||
'cols' => 40,
|
||||
'rows' => 10,
|
||||
'value' => true,
|
||||
'lang' => true,
|
||||
'default' => '',
|
||||
'autoload_rte' => true,
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
$this->helper->module = new $this->module_name();
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
$assign['path'] = apPageHelper::getImgThemeUrl();
|
||||
|
||||
if (!isset($assign['formAtts']['animation']) || $assign['formAtts']['animation'] == 'none') {
|
||||
$assign['formAtts']['animation'] = 'none';
|
||||
$assign['formAtts']['animation_delay'] = '';
|
||||
} elseif ($assign['formAtts']['animation'] != 'none' && (int)$assign['formAtts']['animation_delay'] > 0) {
|
||||
// validate module
|
||||
$assign['formAtts']['animation_delay'] .= 's';
|
||||
} elseif ($assign['formAtts']['animation'] != 'none' && (int)$assign['formAtts']['animation_delay'] <= 0) {
|
||||
// Default delay
|
||||
$assign['formAtts']['animation_delay'] = '1s';
|
||||
}
|
||||
if (isset($assign['formAtts']['image'])) {
|
||||
$assign['formAtts']['image'] = trim($assign['formAtts']['image']);
|
||||
}
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
421
modules/appagebuilder/classes/shortcodes/ApImage360.php
Normal file
@@ -0,0 +1,421 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApImage360 extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApImage360';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Image 360'), 'position' => 20, 'desc' => $this->l('Adds multiple 360 images, rotating display objects'),
|
||||
'icon_class' => 'icon-image', 'tag' => 'content structure');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$href = Context::getContext()->link->getAdminLink('AdminApPageBuilderImages').'&ajax=1&action=manageimage&imgDir=images&widget=ApImage360';
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'switch',
|
||||
// 'label' => $this->l('Magnifier enable'),
|
||||
// 'name' => 'magnify',
|
||||
// 'is_bool' => true,
|
||||
// 'values' => ApPageSetting::returnYesNo(),
|
||||
// 'default' => 1,
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'name' => 'magnifier_width',
|
||||
// 'label' => $this->trans("Magnifier's width"),
|
||||
// 'default' => '80%',
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'select',
|
||||
// 'label' => $this->trans("Magnifier's shape"),
|
||||
// 'name' => 'magnifier_shape',
|
||||
// 'options' => array(
|
||||
// 'query' => array(
|
||||
// array('id' => 'inner', 'name' => $this->l('Inner')),
|
||||
// array('id' => 'circle', 'name' => $this->l('Circle')),
|
||||
// array('id' => 'square', 'name' => $this->l('Square')),
|
||||
// ),
|
||||
// 'id' => 'id',
|
||||
// 'name' => 'name'
|
||||
// ),
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'switch',
|
||||
// 'label' => $this->l('Fullscreen enable'),
|
||||
// 'name' => 'fullscreen',
|
||||
// 'is_bool' => true,
|
||||
// 'values' => ApPageSetting::returnYesNo(),
|
||||
// 'default' => 1,
|
||||
// ),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Spin'),
|
||||
'name' => 'spin',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'drag', 'name' => $this->l('Drag')),
|
||||
array('id' => 'hover', 'name' => $this->l('Hover')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'desc' => $this->l('Method for spinning the image'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'speed',
|
||||
'label' => $this->l('Speed'),
|
||||
// 'lang' => 'true',
|
||||
'default' => '50',
|
||||
'desc' => $this->l('Mouse drag distance in pixels to next image (1 - 100). Ex 50'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'mousewheel_step',
|
||||
'label' => $this->l('Mousewheel Step'),
|
||||
// 'lang' => 'true',
|
||||
'default' => '1',
|
||||
'desc' => $this->l('Number of image to spin on mousewheel'),
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Smoothing'),
|
||||
'name' => 'smoothing',
|
||||
'is_bool' => true,
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 1,
|
||||
'desc' => $this->l('Smoothly stop the image spinning'),
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Initialization'),
|
||||
'name' => 'initialize_on',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'hover', 'name' => $this->l('hover')),
|
||||
array('id' => 'click', 'name' => $this->l('click')),
|
||||
array('id' => 'load', 'name' => $this->l('load')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'load',
|
||||
'desc' => $this->l('Start automatic spin on page load, click or hover'),
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Autospin duration'),
|
||||
'name' => 'autospin',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'once', 'name' => $this->l('Once')),
|
||||
array('id' => 'twice', 'name' => $this->l('Twice')),
|
||||
array('id' => 'infinite', 'name' => $this->l('Infinite')),
|
||||
array('id' => 'off', 'name' => $this->l('Off')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
// 'desc' => $this->l('Method for spinning the image'),
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Autospin start'),
|
||||
'name' => 'autospin_start',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'load', 'name' => $this->l('load')),
|
||||
array('id' => 'hover', 'name' => $this->l('hover')),
|
||||
array('id' => 'click', 'name' => $this->l('click')),
|
||||
array('id' => 'load,hover', 'name' => $this->l('load,hover')),
|
||||
array('id' => 'load,click', 'name' => $this->l('load,click')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'desc' => $this->l('Start automatic spin on page load, click or hover'),
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Autospin stops'),
|
||||
'name' => 'autospin_stop',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'hover', 'name' => $this->l('hover')),
|
||||
array('id' => 'click', 'name' => $this->l('click')),
|
||||
array('id' => 'never', 'name' => $this->l('never')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'desc' => $this->l('Start automatic spin on page load, click or hover'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'autospin_speed',
|
||||
'label' => $this->l('Autospin Time'),
|
||||
// 'lang' => 'true',
|
||||
'default' => '2000',
|
||||
'desc' => $this->l('Value is milisecond. Ex 2000 (2s)'),
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Autospin direction'),
|
||||
'name' => 'autospin_direction',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'clockwise', 'name' => $this->l('Clockwise')),
|
||||
array('id' => 'anticlockwise', 'name' => $this->l('Anticlockwise')),
|
||||
array('id' => 'alternate-clockwise', 'name' => $this->l('Alternate Clockwise')),
|
||||
array('id' => 'alternate-anticlockwise', 'name' => $this->l('Alternate Anticlockwise')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'desc' => $this->l('Method for spinning the image'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'start_column',
|
||||
'label' => $this->l('Start Column'),
|
||||
'default' => '1',
|
||||
'desc' => $this->l('Column from which to start spin. auto means to start from the middle'),
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'name' => 'start_row',
|
||||
// 'label' => $this->l('Start Row'),
|
||||
// 'default' => 'auto',
|
||||
// 'desc' => $this->l('Row from which to start spin. auto means to start from the middle'),
|
||||
// ),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Loop Column'),
|
||||
'name' => 'loop_column',
|
||||
'is_bool' => true,
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 1,
|
||||
'desc' => $this->l('Continue spin after the last image on X-axis'),
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'switch',
|
||||
// 'label' => $this->l('Loop Row'),
|
||||
// 'name' => 'loop_row',
|
||||
// 'is_bool' => true,
|
||||
// 'values' => ApPageSetting::returnYesNo(),
|
||||
// 'default' => 1,
|
||||
// 'desc' => $this->l('Continue spin after the last image on Y-axis'),
|
||||
// ),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Reverse rotation on X-axis'),
|
||||
'name' => 'reverse_column',
|
||||
'is_bool' => true,
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 0,
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'switch',
|
||||
// 'label' => $this->l('Reverse rotation on Y-axis'),
|
||||
// 'name' => 'reverse_row',
|
||||
// 'is_bool' => true,
|
||||
// 'values' => ApPageSetting::returnYesNo(),
|
||||
// 'default' => 1,
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'name' => 'column_increment',
|
||||
// 'label' => $this->l('Column increment'),
|
||||
// 'default' => '1',
|
||||
// 'desc' => $this->l('Load only every second (2) or third (3) column so that spins load faster'),
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'name' => 'row_increment',
|
||||
// 'label' => $this->l('Row increment'),
|
||||
// 'default' => '1',
|
||||
// 'desc' => $this->l('Load only every second (2) or third (3) row so that spins load faster'),
|
||||
// ),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'message',
|
||||
'label' => $this->l('Message under image'),
|
||||
'default' => 'Drag image to spin',
|
||||
'lang' => true,
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'name' => 'message_loading',
|
||||
// 'label' => $this->l('Message Loading'),
|
||||
// 'default' => 'Text displayed while images are loading.',
|
||||
// 'lang' => true,
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'name' => 'message_loading_fullscreen',
|
||||
// 'label' => $this->l('Message Fullscren Loading'),
|
||||
// 'default' => 'Loading...',
|
||||
// 'lang' => true,
|
||||
// ),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show hint message'),
|
||||
'name' => 'hint',
|
||||
'is_bool' => true,
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 1,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'message_desktop_hint',
|
||||
'label' => $this->l('Message Desktop Hint'),
|
||||
'default' => 'Drag to spin',
|
||||
'lang' => true,
|
||||
'desc' => $this->l('Text of the hint on Desktop'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'message_mobile_hint',
|
||||
'label' => $this->l('Message Mobile Hint'),
|
||||
'default' => 'Swipe to spin',
|
||||
'lang' => true,
|
||||
'desc' => $this->l('Text of the hint on iOS/Android devices'),
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Slider'),
|
||||
'name' => 'show_slider',
|
||||
'is_bool' => true,
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => false,
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'total_slider',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Image'),
|
||||
'type' => 'selectImg',
|
||||
'href' => $href,
|
||||
'name' => 'image_360',
|
||||
'lang' => false,
|
||||
'class' => 'item-add-slide ignore-lang',
|
||||
'form_group_class' => 'apfullslider-row select-img',
|
||||
'show_image' => false,
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
$this->helper->module = new $this->module_name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget can override this method and add more config at here
|
||||
*/
|
||||
public function addConfigList($values)
|
||||
{
|
||||
// Get value with keys special
|
||||
$config_val = array();
|
||||
$total = isset($values['total_slider']) ? $values['total_slider'] : '';
|
||||
|
||||
$arr = explode('|', $total);
|
||||
$inputs = array('image360');
|
||||
// $languages = Language::getLanguages(false);
|
||||
foreach ($arr as $i) {
|
||||
foreach ($inputs as $config) {
|
||||
$config_val[$config][$i] = str_replace($this->str_search, $this->str_relace_html_admin, Tools::getValue($config.'_'.$i, ''));
|
||||
}
|
||||
}
|
||||
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'arr' => $arr,
|
||||
'config_val' => $config_val,
|
||||
'image_folder' => apPageHelper::getImgThemeUrl(),
|
||||
));
|
||||
$list_slider = Context::getContext()->smarty->fetch(apPageHelper::getShortcodeTemplatePath('ApImage360.tpl'));
|
||||
$input = array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => $list_slider
|
||||
);
|
||||
$this->config_list[] = $input;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
|
||||
if (!Configuration::get('APPAGEBUILDER_LOAD_IMAGE360')) {
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Please enable Image360 library in Appagebuilder Configuration.';
|
||||
return $assign;
|
||||
}
|
||||
|
||||
$total_slider = isset($assign['formAtts']['total_slider']) ? $assign['formAtts']['total_slider'] : '';
|
||||
$list = explode('|', $total_slider);
|
||||
|
||||
|
||||
$image_list = array();
|
||||
$image_path = apPageHelper::getImgThemeUrl();
|
||||
|
||||
foreach ($list as $item) {
|
||||
if (isset($assign['formAtts']['image360_'.$item])) {
|
||||
$image_list[] = $assign['formAtts']['image360_'.$item];
|
||||
}
|
||||
}
|
||||
|
||||
$assign['formAtts']['image_path'] = $image_path;
|
||||
$assign['formAtts']['columns'] = count($list);
|
||||
$assign['formAtts']['row'] = 1;
|
||||
$assign['formAtts']['image_list'] = $image_list;
|
||||
|
||||
// IMAGE DEFAULT
|
||||
$min_key = min(array_keys($image_list));
|
||||
$assign['formAtts']['image_default'] = $image_list[$min_key];
|
||||
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
236
modules/appagebuilder/classes/shortcodes/ApImageGallery.php
Normal file
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApImageGallery extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApImageGallery';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Image Gallery'),
|
||||
'position' => 7,
|
||||
'desc' => $this->l('Create Images Mini Gallery From A Folder'),
|
||||
'icon_class' => 'icon-th',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
private function addCustomJS()
|
||||
{
|
||||
return Context::getContext()->smarty->fetch(apPageHelper::getShortcodeTemplatePath($this->name.'.tpl'));
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$path_info = 'Example: themes/'._THEME_NAME_.'/assets/img/modules/appagebuilder/images/yourFolderImage';
|
||||
$path = 'themes/'._THEME_NAME_.'/assets/img/modules/appagebuilder/images/';
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'path',
|
||||
'label' => $this->l('Path'),
|
||||
'desc' => $this->trans($path_info),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => $path,
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<input class="btn btn-primary btn-create-folder" type="button" value="'.$this->l('AJAX Create Folder').'" name="create_folder">' . $this->addCustomJS(),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Limit'),
|
||||
'name' => 'limit',
|
||||
'default' => '12',
|
||||
'desc' => $this->l('Enter a number')
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Columns'),
|
||||
'name' => 'columns',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '1', 'name' => $this->l('1 Column')),
|
||||
array('id' => '2', 'name' => $this->l('2 Columns')),
|
||||
array('id' => '3', 'name' => $this->l('3 Columns')),
|
||||
array('id' => '4', 'name' => $this->l('4 Columns')),
|
||||
array('id' => '5', 'name' => $this->l('5 Columns')),
|
||||
array('id' => '6', 'name' => $this->l('6 Columns')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'default' => '4',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Load more'),
|
||||
'name' => 'load_more',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '0', 'name' => $this->l('No')),
|
||||
array('id' => '1', 'name' => $this->l('Yes')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'default' => '0',
|
||||
'desc' => $this->l('Show button load more image. Auto hide the button if all images is showed'),
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
$form_atts = $assign['formAtts'];
|
||||
$form_atts['path'] = ltrim($form_atts['path'], '/');
|
||||
$form_atts['path'] = rtrim($form_atts['path'], '/');
|
||||
|
||||
$limit = (int)$form_atts['limit'];
|
||||
$images = array();
|
||||
$link = new Link();
|
||||
$current_link = $link->getPageLink('', false, Context::getContext()->language->id);
|
||||
$path = _PS_ROOT_DIR_.'/'.str_replace($current_link, '', isset($form_atts['path']) ? $form_atts['path'] : '');
|
||||
$arr_exten = array('jpg', 'jpge', 'gif', 'png');
|
||||
|
||||
$count = 0;
|
||||
if ($path && is_dir($path)) {
|
||||
if ($handle = scandir($path)) {
|
||||
|
||||
if (($key = array_search('.', $handle)) !== false) {
|
||||
unset($handle[$key]);
|
||||
}
|
||||
if (($key = array_search('..', $handle)) !== false) {
|
||||
unset($handle[$key]);
|
||||
}
|
||||
|
||||
foreach ($handle as $entry) {
|
||||
if ($entry != '.' && $entry != '..' && is_file($path.'/'.$entry)) {
|
||||
$ext = Tools::strtolower(pathinfo($path.'/'.$entry, PATHINFO_EXTENSION));
|
||||
if (in_array($ext, $arr_exten)) {
|
||||
# FIX 1.7
|
||||
$images[] = __PS_BASE_URI__.str_replace($current_link, '', $form_atts['path']).'/'.$entry;
|
||||
$count++;
|
||||
if ($count == $limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$total = count($handle);
|
||||
$total_nerver_show = (int)( $total - $count );
|
||||
|
||||
if( isset($form_atts['load_more']) && (int) $form_atts['load_more'] == 1 && $total_nerver_show)
|
||||
{
|
||||
# SHOW BUTTON SHOW_MORE
|
||||
$assign['show_number'] = $count;
|
||||
$assign['show_more_btn'] = 1;
|
||||
}
|
||||
|
||||
|
||||
$c = (int)$form_atts['columns'];
|
||||
$assign['columns'] = $c > 0 ? $c : 4;
|
||||
$assign['images'] = $images;
|
||||
if( isset($assign['tpl_dir'])) {
|
||||
unset($assign['tpl_dir']);
|
||||
}
|
||||
$assign['assign'] = Tools::jsonEncode($assign);
|
||||
|
||||
return $assign;
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX : create folder image follow user type url
|
||||
*/
|
||||
public function ajaxCallBackCreateDir()
|
||||
{
|
||||
$path = Tools::getValue('path');
|
||||
|
||||
// $domain = strpos($url, _PS_BASE_URL_.__PS_BASE_URI__ );
|
||||
// if ($domain === false)
|
||||
// {
|
||||
// # CHECK NOT SAME DOMAIN
|
||||
// # http://localhost/prestashop/ps_1700_RC03_local != http://prestashop/ps_1700_RC03_local
|
||||
// die(Tools::jsonEncode(array(
|
||||
// 'hasError' => true,
|
||||
// 'error' => $this->l('Domain is incorrect. Please type this at first: '),
|
||||
// 'img_dir' => _PS_BASE_URL_.__PS_BASE_URI__,
|
||||
// )));
|
||||
// }
|
||||
|
||||
$img_dir = str_replace(_PS_BASE_URL_.__PS_BASE_URI__, '', $path);
|
||||
$img_dir = _PS_ROOT_DIR_.'/'.$img_dir;
|
||||
$img_dir = str_replace('\\', '/', $img_dir);
|
||||
$img_dir = str_replace('//', '/', $img_dir);
|
||||
|
||||
if (file_exists($img_dir)) {
|
||||
# CHECK FOLDER EXIST
|
||||
die(Tools::jsonEncode(array(
|
||||
'hasError' => true,
|
||||
'error' => $this->l('Folder is exist'),
|
||||
'img_dir' => $img_dir,
|
||||
)));
|
||||
}
|
||||
|
||||
try {
|
||||
$result = mkdir($img_dir, 0755, true);
|
||||
if ($result) {
|
||||
die(Tools::jsonEncode(array(
|
||||
'success' => true,
|
||||
'information' => $this->l('Create folder successful'),
|
||||
'img_dir' => $img_dir,
|
||||
)));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
die(Tools::jsonEncode(array(
|
||||
'hasError' => true,
|
||||
'error' => $this->l('Can NOT create folder'),
|
||||
'img_dir' => $img_dir,
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApImageGalleryProduct extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApImageGalleryProduct';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Image Gallery Product'),
|
||||
'position' => 7,
|
||||
'desc' => $this->l('Create Images Mini Gallery From Product'),
|
||||
'icon_class' => 'icon-th',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$source = array(
|
||||
array(
|
||||
'value' => 'ip_pcategories',
|
||||
'name' => $this->l('Category')
|
||||
),
|
||||
array(
|
||||
'value' => 'ip_pproductids',
|
||||
'name' => $this->l('Product Ids')
|
||||
)
|
||||
);
|
||||
$pimagetypes = $this->getImageTypes();
|
||||
$selected_categories = array();
|
||||
if (Tools::getIsset('categorybox')) {
|
||||
$category_box = Tools::getValue('categorybox');
|
||||
$category_box = explode(',', $category_box);
|
||||
$selected_categories = $category_box;
|
||||
}
|
||||
$id_root_category = Context::getContext()->shop->getCategory();
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Source'),
|
||||
'name' => 'ip_source',
|
||||
'class' => 'group form-action',
|
||||
'default' => '',
|
||||
'options' => array(
|
||||
'query' => $source,
|
||||
'id' => 'value',
|
||||
'name' => 'name'
|
||||
),
|
||||
'desc' => 'Select source type'
|
||||
),
|
||||
array(
|
||||
'type' => 'categories',
|
||||
'label' => $this->l('Select Category'),
|
||||
'name' => 'categorybox',
|
||||
'tree' => array(
|
||||
'root_category' => $id_root_category,
|
||||
'use_search' => false,
|
||||
'id' => 'categorybox',
|
||||
'use_checkbox' => true,
|
||||
'selected_categories' => $selected_categories,
|
||||
),
|
||||
'form_group_class' => 'ip_source_sub ip_source-ip_pcategories'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Product Ids'),
|
||||
'form_group_class' => 'ip_source_sub ip_source-ip_pproductids',
|
||||
'name' => 'ip_pproductids',
|
||||
'default' => '',
|
||||
'desc' => $this->l('Enter Product Ids with format id1,id2,...')
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Small image'),
|
||||
'name' => 'smallimage',
|
||||
'class' => 'group',
|
||||
'id' => 'psmallimagetypes',
|
||||
'default' => '',
|
||||
'options' => array(
|
||||
'query' => $pimagetypes,
|
||||
'id' => 'name',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Thick image'),
|
||||
'name' => 'thickimage',
|
||||
'id' => 'pthickimagetypes',
|
||||
'default' => ApPageSetting::getDefaultNameImage('thickbox'),
|
||||
'options' => array(
|
||||
'query' => $pimagetypes,
|
||||
'id' => 'name',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Limit'),
|
||||
'name' => 'limit',
|
||||
'default' => '12',
|
||||
'desc' => $this->l('Enter a number')
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Columns'),
|
||||
'name' => 'columns',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '1', 'name' => $this->l('1 Column')),
|
||||
array('id' => '2', 'name' => $this->l('2 Columns')),
|
||||
array('id' => '3', 'name' => $this->l('3 Columns')),
|
||||
array('id' => '4', 'name' => $this->l('4 Columns')),
|
||||
array('id' => '5', 'name' => $this->l('5 Columns')),
|
||||
array('id' => '6', 'name' => $this->l('6 Columns')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'default' => '4',
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
$form_atts = $assign['formAtts'];
|
||||
$limit = (int)$form_atts['limit'];
|
||||
$images = array();
|
||||
$smallimage = ($form_atts['smallimage']) ? ($form_atts['smallimage']) : ApPageSetting::getDefaultNameImage('small');
|
||||
$thickimage = ($form_atts['thickimage']) ? ($form_atts['thickimage']) : ApPageSetting::getDefaultNameImage('thickbox');
|
||||
switch ($form_atts['ip_source']) {
|
||||
case 'ip_pproductids':
|
||||
if (empty($form_atts['ip_pproductids'])) {
|
||||
return false;
|
||||
}
|
||||
$pproductids = $form_atts['ip_pproductids'];
|
||||
if ($pproductids) {
|
||||
$images = $this->getImagesByProductId($pproductids, 0, $limit, (int)Context::getContext()->language->id);
|
||||
}
|
||||
break;
|
||||
case 'ip_pcategories':
|
||||
$catids = (isset($form_atts['categorybox']) && $form_atts['categorybox']) ? ($form_atts['categorybox']) : array();
|
||||
if ($catids) {
|
||||
$images = $this->getImagesByCategory($catids, 0, $limit, (int)Context::getContext()->language->id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
$c = (int)$form_atts['columns'];
|
||||
$assign['columns'] = $c > 0 ? $c : 4;
|
||||
$assign['thickimage'] = $thickimage;
|
||||
$assign['smallimage'] = $smallimage;
|
||||
$assign['images'] = $images;
|
||||
return $assign;
|
||||
}
|
||||
|
||||
public function getImagesByProductId($productids, $start, $limit, $id_lang)
|
||||
{
|
||||
$sql = 'SELECT DISTINCT(i.`id_image`), pl.`link_rewrite`
|
||||
FROM
|
||||
`'._DB_PREFIX_.'image` i
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON(i.`id_image` = il.`id_image`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON(
|
||||
i.`id_product` = pl.`id_product`)';
|
||||
$sql .= ' WHERE i.`id_product` IN ('.$productids.')
|
||||
AND il.`id_lang` ='.(int)$id_lang.
|
||||
' AND pl.`id_lang` ='.(int)$id_lang.
|
||||
' AND i.cover = 1
|
||||
ORDER BY
|
||||
i.`position` ASC'.($limit > 0 ? ' LIMIT '.(int)$start.','.(int)$limit : '');
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
return $results;
|
||||
}
|
||||
|
||||
public static function getImagesByCategory($categories, $start, $limit, $id_lang, Context $context = null)
|
||||
{
|
||||
if (!$context) {
|
||||
$context = Context::getContext();
|
||||
}
|
||||
$front = true;
|
||||
if (!in_array($context->controller->controller_type, array('front', 'modulefront'))) {
|
||||
$front = false;
|
||||
}
|
||||
$sql_groups = '';
|
||||
if (Group::isFeatureActive()) {
|
||||
$groups = FrontController::getCurrentCustomerGroups();
|
||||
$sql_groups = 'AND cg.`id_group` '.(count($groups) ? 'IN ('.pSQL(implode(',', $groups)).')' : '= 1');
|
||||
}
|
||||
$sql = 'SELECT i.`id_image`, pl.`link_rewrite`
|
||||
FROM
|
||||
`'._DB_PREFIX_.'image` i
|
||||
INNER JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)
|
||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (i.`id_product` = pl.`id_product`)
|
||||
INNER JOIN `'._DB_PREFIX_.'image_shop` ish ON (i.`id_image` = ish.`id_image`)';
|
||||
$sql .= 'WHERE i.`id_product` IN (
|
||||
SELECT cp.`id_product`
|
||||
FROM `'._DB_PREFIX_.'category_product` cp
|
||||
'.(Group::isFeatureActive() ? 'INNER JOIN `'._DB_PREFIX_.'category_group` cg ON cp.`id_category` = cg.`id_category`' : '').'
|
||||
INNER JOIN `'._DB_PREFIX_.'category` c ON cp.`id_category` = c.`id_category`
|
||||
INNER JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product`
|
||||
'.Shop::addSqlAssociation('product', 'p', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.Shop::addSqlRestrictionOnLang('pl').')
|
||||
WHERE c.`active` = 1
|
||||
AND product_shop.`active` = 1
|
||||
'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '')
|
||||
.pSQL($sql_groups).' AND cp.id_category in ('.pSQL($categories).') AND pl.id_lang ='.(int)$id_lang.')
|
||||
AND il.`id_lang` ='.$id_lang.
|
||||
' AND pl.id_lang = '.(int)$id_lang.
|
||||
' AND pl.id_shop = '.(int)$context->shop->id.
|
||||
' AND ish.id_shop = '.(int)$context->shop->id.
|
||||
' AND ish.cover = 1
|
||||
ORDER BY i.`position` ASC'.((int)$limit > 0 ? ' LIMIT '.(int)$start.','.(int)$limit : '');
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
}
|
||||
|
||||
public function getImageTypes()
|
||||
{
|
||||
$pimagetypes = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT tp.id_image_type,tp.name
|
||||
FROM '._DB_PREFIX_.'image_type tp
|
||||
WHERE tp.products = 1
|
||||
ORDER BY tp.name ASC');
|
||||
return $pimagetypes;
|
||||
}
|
||||
}
|
||||
516
modules/appagebuilder/classes/shortcodes/ApImageHotspot.php
Normal file
@@ -0,0 +1,516 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApImageHotspot extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApImageHotspot';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public $inputs_lang = array('temp_title', 'temp_image', 'temp_description');
|
||||
public $inputs = array('temp_top', 'temp_left', 'temp_hpcolor', 'temp_location', 'temp_textalign', 'temp_trigger', 'temp_opacity', 'temp_width', 'temp_margin', 'temp_padding', 'temp_textcolor', 'temp_backcolor', 'temp_class', 'temp_imagealign');
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Image Hotspot'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Display tooltip in your image when user hover over points'),
|
||||
'icon_class' => 'icon-image',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
Context::getContext()->smarty->assign('path_image', apPageHelper::getImgThemeUrl());
|
||||
$href = Context::getContext()->link->getAdminLink('AdminApPageBuilderImages').'&ajax=1&action=manageimage&imgDir=images';
|
||||
$ad = __PS_BASE_URI__.basename(_PS_ADMIN_DIR_);
|
||||
$iso_tiny_mce = Context::getContext()->language->iso_code;
|
||||
$iso_tiny_mce = (file_exists(_PS_JS_DIR_.'tiny_mce/langs/'.$iso_tiny_mce.'.js') ? $iso_tiny_mce : 'en');
|
||||
$list_slider = '<button type="button" id="btn-add-hotpot" class="btn btn-default btn-add-level2">
|
||||
<i class="icon-plus-sign-alt"></i> '.$this->l('Add Hotspot').'</button><hr/>';
|
||||
$list_slider_button = '<div id="frm-level2" class="row-level2 frm-level2">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12 ">
|
||||
<button type="button" class="btn btn-primary btn-save-level2"
|
||||
data-error="'.$this->l('Please enter the title').'">'.$this->l('Save').'</button>
|
||||
<button type="button" class="btn btn-default btn-reset-level2">'.$this->l('Reset').'</button>
|
||||
<button type="button" class="btn btn-default btn-cancel-level2">'.$this->l('Cancel').'</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var ad = "'.$ad.'";
|
||||
var iso = "'.$iso_tiny_mce.'";
|
||||
</script>
|
||||
<hr/>
|
||||
</div>';
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Image'),
|
||||
'type' => 'selectImg',
|
||||
'href' => $href,
|
||||
'name' => 'image',
|
||||
'lang' => true,
|
||||
'show_image' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'alt',
|
||||
'label' => $this->l('Alt'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'url',
|
||||
'label' => $this->l('Link to'),
|
||||
'lang' => true,
|
||||
'desc' => 'Example: http://prestashop.com',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Open new tab'),
|
||||
'name' => 'is_open',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'width',
|
||||
'label' => $this->l('Image size width'),
|
||||
'desc' => $this->l('Example: auto, 100%, 100px'),
|
||||
'default' => '100%'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'height',
|
||||
'label' => $this->l('Image size height'),
|
||||
'desc' => $this->l('Example: auto, 100%, 100px'),
|
||||
'default' => 'auto'
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => $list_slider
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_title js-multilang',
|
||||
'form_group_class' => 'row-level2 row2-title',
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Image'),
|
||||
'type' => 'selectImg',
|
||||
'href' => $href,
|
||||
'name' => 'temp_image',
|
||||
'lang' => true,
|
||||
'class' => 'input-level2 temp_image js-multilang',
|
||||
'form_group_class' => 'row-level2 row2-image',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Image Align'),
|
||||
'name' => 'temp_imagealign',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'left',
|
||||
'name' => $this->l('Left'),
|
||||
),
|
||||
array(
|
||||
'id' => 'right',
|
||||
'name' => $this->l('Right'),
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'left',
|
||||
'class' => 'input-level2 temp_imagealign',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Description'),
|
||||
'name' => 'temp_description',
|
||||
'cols' => 40,
|
||||
'rows' => 10,
|
||||
'value' => true,
|
||||
'lang' => true,
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_description js-multilang',
|
||||
'form_group_class' => 'row-level2 row2-description',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_top',
|
||||
'label' => $this->l('Hotpot Top'),
|
||||
'lang' => false,
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_top',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_left',
|
||||
'label' => $this->l('Hotpot Left'),
|
||||
'lang' => false,
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_left',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'name' => 'temp_hpcolor',
|
||||
'label' => $this->l('Hotpot Color'),
|
||||
'lang' => false,
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_hpcolor',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Location'),
|
||||
'name' => 'temp_location',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'top',
|
||||
'name' => $this->l('top'),
|
||||
),
|
||||
array(
|
||||
'id' => 'right',
|
||||
'name' => $this->l('right'),
|
||||
),
|
||||
array(
|
||||
'id' => 'bottom',
|
||||
'name' => $this->l('bottom'),
|
||||
),
|
||||
array(
|
||||
'id' => 'left',
|
||||
'name' => $this->l('left'),
|
||||
),
|
||||
array(
|
||||
'id' => 'top-left',
|
||||
'name' => $this->l('top-left'),
|
||||
),
|
||||
array(
|
||||
'id' => 'top-right',
|
||||
'name' => $this->l('top-right'),
|
||||
),
|
||||
array(
|
||||
'id' => 'right-top',
|
||||
'name' => $this->l('right-top'),
|
||||
),
|
||||
array(
|
||||
'id' => 'right-bottom',
|
||||
'name' => $this->l('right-bottom'),
|
||||
),
|
||||
array(
|
||||
'id' => 'bottom-left',
|
||||
'name' => $this->l('bottom-left'),
|
||||
),
|
||||
array(
|
||||
'id' => 'bottom-right',
|
||||
'name' => $this->l('bottom-right'),
|
||||
),
|
||||
array(
|
||||
'id' => 'left-top',
|
||||
'name' => $this->l('left-top'),
|
||||
),
|
||||
array(
|
||||
'id' => 'left-bottom',
|
||||
'name' => $this->l('left-bottom'),
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'none',
|
||||
'class' => 'input-level2 temp_location',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Text Align'),
|
||||
'name' => 'temp_textalign',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'left',
|
||||
'name' => $this->l('Left'),
|
||||
),
|
||||
array(
|
||||
'id' => 'top',
|
||||
'name' => $this->l('Top'),
|
||||
),
|
||||
array(
|
||||
'id' => 'right',
|
||||
'name' => $this->l('Right'),
|
||||
),
|
||||
array(
|
||||
'id' => 'center',
|
||||
'name' => $this->l('Center'),
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'left',
|
||||
'class' => 'input-level2 temp_textalign',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Mouse event'),
|
||||
'name' => 'temp_trigger',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'hover',
|
||||
'name' => $this->l('hover'),
|
||||
),
|
||||
array(
|
||||
'id' => 'hoverable',
|
||||
'name' => $this->l('hoverable'),
|
||||
),
|
||||
array(
|
||||
'id' => 'click',
|
||||
'name' => $this->l('click'),
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'hover',
|
||||
'class' => 'input-level2 temp_trigger',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_opacity',
|
||||
'label' => $this->l('Opacity'),
|
||||
'lang' => false,
|
||||
'default' => '0.6',
|
||||
'class' => 'input-level2 temp_opacity',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_class',
|
||||
'label' => $this->l('Class'),
|
||||
'lang' => false,
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_class',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_width',
|
||||
'label' => $this->l('Width'),
|
||||
'lang' => false,
|
||||
'default' => '200px',
|
||||
'class' => 'input-level2 temp_width',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_margin',
|
||||
'label' => $this->l('Margin'),
|
||||
'lang' => false,
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_margin',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_padding',
|
||||
'label' => $this->l('Padding'),
|
||||
'lang' => false,
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_padding',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'name' => 'temp_textcolor',
|
||||
'label' => $this->l('Text Color'),
|
||||
'lang' => false,
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_textcolor',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'name' => 'temp_backcolor',
|
||||
'label' => $this->l('Backgroud Color'),
|
||||
'lang' => false,
|
||||
'default' => '',
|
||||
'class' => 'input-level2 temp_backcolor',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<script type="text/javascript" src="'.__PS_BASE_URI__.apPageHelper::getJsDir().'colorpicker/js/leo.jquery.colorpicker.js"></script>',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => $list_slider_button
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'total_slider',
|
||||
'default' => ''
|
||||
),
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function addConfigList($values)
|
||||
{
|
||||
// Get value with keys special
|
||||
$config_val = array();
|
||||
$total = isset($values['total_slider']) ? $values['total_slider'] : '';
|
||||
$arr = explode('|', $total);
|
||||
|
||||
$inputs_lang = $this->inputs_lang;
|
||||
$inputs = $this->inputs;
|
||||
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($arr as $i) {
|
||||
foreach ($inputs_lang as $config) {
|
||||
foreach ($languages as $lang) {
|
||||
$config_val[$config][$i][$lang['id_lang']] = str_replace($this->str_search, $this->str_relace_html_admin, Tools::getValue($config.'_'.$i.'_'.$lang['id_lang'], ''));
|
||||
}
|
||||
}
|
||||
foreach ($inputs as $config) {
|
||||
$config_val[$config][$i] = str_replace($this->str_search, $this->str_relace_html_admin, Tools::getValue($config.'_'.$i, ''));
|
||||
}
|
||||
}
|
||||
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'lang' => $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')),
|
||||
'default_lang' => $lang->id,
|
||||
'arr' => $arr,
|
||||
'languages' => $languages,
|
||||
'config_val' => $config_val,
|
||||
'path' => apPageHelper::getImgThemeUrl(),
|
||||
'inputs_lang' => $this->inputs_lang,
|
||||
'inputs' => $this->inputs,
|
||||
));
|
||||
$list_slider = Context::getContext()->smarty->fetch(apPageHelper::getShortcodeTemplatePath('ApImageHotspot.tpl'));
|
||||
|
||||
$input = array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => $list_slider,
|
||||
);
|
||||
// Append new input type html
|
||||
$this->config_list[] = $input;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
$this->helper->module = new $this->module_name();
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
if (!Configuration::get('APPAGEBUILDER_LOAD_IMAGEHOTPOT')) {
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Please enable Image Hotpot library in Appagebuilder Configuration.';
|
||||
return $assign;
|
||||
}
|
||||
$assign['path'] = apPageHelper::getImgThemeUrl();
|
||||
$total_slider = isset($assign['formAtts']['total_slider']) ? $assign['formAtts']['total_slider'] : '';
|
||||
$list = explode('|', $total_slider);
|
||||
$list_items = array();
|
||||
$lang = Language::getLanguage(Context::getContext()->language->id);
|
||||
$id_lang = $lang['id_lang'];
|
||||
|
||||
$inputs_lang = $this->inputs_lang;
|
||||
$inputs = $this->inputs;
|
||||
|
||||
foreach ($list as $number) {
|
||||
if ($number) {
|
||||
$item = array();
|
||||
$item['id'] = $number;
|
||||
|
||||
foreach ($inputs_lang as $key) {
|
||||
# MULTI-LANG
|
||||
$name = $key.'_'.$number.'_'.$id_lang;
|
||||
$item[$key] = isset($assign['formAtts'][$name]) ? $assign['formAtts'][$name] : '';
|
||||
|
||||
// Description
|
||||
if ($key == 'temp_description' && isset($assign['formAtts'][$name]) && $assign['formAtts'][$name]) {
|
||||
$item[$key] = str_replace($this->str_search, $this->str_relace_html, $assign['formAtts'][$name]);
|
||||
}
|
||||
|
||||
// Image
|
||||
if ($key == 'temp_image' && isset($assign['formAtts'][$name]) && $assign['formAtts'][$name]) {
|
||||
$item[$key] = apPageHelper::getImgThemeUrl() . $assign['formAtts'][$name];
|
||||
} else if ($key == 'temp_image') {
|
||||
$item[$key] = '';
|
||||
}
|
||||
}
|
||||
foreach ($inputs as $key) {
|
||||
# SINGLE-LANG
|
||||
$name = $key.'_'.$number;
|
||||
$item[$key] = isset($assign['formAtts'][$name]) ? $assign['formAtts'][$name] : '';
|
||||
}
|
||||
|
||||
$list_items[] = $item;
|
||||
}
|
||||
}
|
||||
$assign['formAtts']['items'] = $list_items;
|
||||
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
559
modules/appagebuilder/classes/shortcodes/ApInstagram.php
Normal file
@@ -0,0 +1,559 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApInstagram extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApInstagram';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Instagram'),
|
||||
'position' => 6,
|
||||
'desc' => $this->l('You can config Instagram box'),
|
||||
'icon_class' => 'icon-instagram',
|
||||
'tag' => 'social');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$accordion_type = array(
|
||||
array(
|
||||
'value' => 'full',
|
||||
'text' => $this->l('Always Full')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion',
|
||||
'text' => $this->l('Always Accordion')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion_small_screen',
|
||||
'text' => $this->l('Accordion at small screen')
|
||||
),
|
||||
);
|
||||
// $soption = ApPageSetting::returnYesNo();
|
||||
// $get = array(
|
||||
// array(
|
||||
// 'id' => 'popular',
|
||||
// 'label' => $this->l('Popular')
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'tagged',
|
||||
// 'label' => $this->l('Tagged'),
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'location',
|
||||
// 'label' => $this->l('Location')
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'user',
|
||||
// 'label' => $this->l('User')
|
||||
// ),
|
||||
// );
|
||||
$sort = array(
|
||||
array(
|
||||
'id' => 'none',
|
||||
'label' => $this->l('None')
|
||||
),
|
||||
array(
|
||||
'id' => 'most-recent',
|
||||
'label' => $this->l('Newest to oldest.'),
|
||||
),
|
||||
array(
|
||||
'id' => 'least-recent',
|
||||
'label' => $this->l('Oldest to newest.')
|
||||
),
|
||||
array(
|
||||
'id' => 'most-liked',
|
||||
'label' => $this->l('Highest # of likes to lowest.')
|
||||
),
|
||||
array(
|
||||
'id' => 'least-liked',
|
||||
'label' => $this->l('Lowest # likes to highest.')
|
||||
),
|
||||
array(
|
||||
'id' => 'most-commented',
|
||||
'label' => $this->l('Highest # of comments to lowest.')
|
||||
),
|
||||
array(
|
||||
'id' => 'least-commented',
|
||||
'label' => $this->l('Lowest # of comments to highest.')
|
||||
),
|
||||
array(
|
||||
'id' => 'random',
|
||||
'label' => $this->l('Random order.')
|
||||
),
|
||||
);
|
||||
$resolution = array(
|
||||
array(
|
||||
'id' => 'thumbnail',
|
||||
'label' => $this->l('thumbnail - 150x150')
|
||||
),
|
||||
array(
|
||||
'id' => 'low_resolution',
|
||||
'label' => $this->l('low_resolution - 306x306'),
|
||||
),
|
||||
array(
|
||||
'id' => 'standard_resolution',
|
||||
'label' => $this->l('standard_resolution - 612x612')
|
||||
)
|
||||
);
|
||||
// $display_type = array(
|
||||
// array(
|
||||
// 'id' => 'list',
|
||||
// 'label' => $this->l('Display as List')
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'carousel',
|
||||
// 'label' => $this->l('Display as Boostrap Carousel'),
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'owl-carousel',
|
||||
// 'label' => $this->l('Display as Owl Carousel')
|
||||
// )
|
||||
// );
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'desc' => $this->l('The script was get from http://instafeedjs.com/'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Accordion Type'),
|
||||
'name' => 'accordion_type',
|
||||
'options' => array(
|
||||
'query' => $accordion_type,
|
||||
'id' => 'value',
|
||||
'name' => 'text' ),
|
||||
'default' => 'full',
|
||||
'hint' => $this->l('Select a Accordion Type'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Client ID'),
|
||||
'name' => 'client_id',
|
||||
'class' => 'ap_instagram',
|
||||
'desc' => $this->l('Your API client id from Instagram. Required.'),
|
||||
'default' => '3e4a239f6a704208ba131d140a751098',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Access Token'),
|
||||
'name' => 'access_token',
|
||||
'class' => 'ap_instagram',
|
||||
// 'desc' => $this->l('A valid oAuth token. Required to use get: "user".'),
|
||||
'default' => '3953969014.3e4a239.993032cd15cc463cabd9eea3ce9d1639',
|
||||
),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'label' => $this->l('Target'),
|
||||
// 'name' => 'target',
|
||||
// 'class' => 'ap_instagram',
|
||||
// 'desc' => $this->l('The ID of a DOM element you want to add the images to.'),
|
||||
// 'default' => '',
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'textarea',
|
||||
// 'label' => $this->l('Template'),
|
||||
// 'name' => 'template',
|
||||
// 'class' => 'ap_instagram',
|
||||
// 'desc' => $this->l('(Developer Only) Custom HTML template to use for images.'),
|
||||
// 'default' => '',
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'select',
|
||||
// 'label' => $this->l('Get'),
|
||||
// 'name' => 'get',
|
||||
// 'class' => 'ap_instagram',
|
||||
// 'options' => array(
|
||||
// 'query' => $get,
|
||||
// 'id' => 'id',
|
||||
// 'name' => 'label'
|
||||
// ),
|
||||
// 'desc' => $this->l('Customize what Instafeed fetches'),
|
||||
// 'default' => 'user',
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'label' => $this->l('Tag Name'),
|
||||
// 'name' => 'tag_name',
|
||||
// 'desc' => $this->l('Name of the tag to get. Use with get: "tagged".'),
|
||||
// 'default' => '',
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'text',
|
||||
// 'label' => $this->l('Location ID'),
|
||||
// 'name' => 'location_id',
|
||||
// 'desc' => $this->l('(number) Unique id of a location to get. Use with get: "location".'),
|
||||
// 'default' => '',
|
||||
// ),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('User ID'),
|
||||
'name' => 'user_id',
|
||||
'desc' => $this->l('User ID of Instagram Account. Type Number'),
|
||||
'default' => '3953969014',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Sort By'),
|
||||
'name' => 'sort_by',
|
||||
'class' => 'ap_instagram',
|
||||
'options' => array(
|
||||
'query' => $sort,
|
||||
'id' => 'id',
|
||||
'name' => 'label'
|
||||
),
|
||||
'desc' => $this->l('Sort the images in a set order. Available options are'),
|
||||
'default' => 'none',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Links'),
|
||||
'desc' => $this->l('Wrap the images with a link to the photo on Instagram. Set empty to use link of Instagram Image'),
|
||||
'name' => 'links',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Limit'),
|
||||
'desc' => $this->l('Number of Images want to get. Max is 20 images, this is rule of Instagram.'),
|
||||
'name' => 'limit',
|
||||
'default' => '20',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Resolution'),
|
||||
'name' => 'resolution',
|
||||
'class' => 'ap_instagram',
|
||||
'options' => array(
|
||||
'query' => $resolution,
|
||||
'id' => 'id',
|
||||
'name' => 'label'
|
||||
),
|
||||
'desc' => $this->l('Size of the images to show.'),
|
||||
'default' => 'thumbnail',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Profile Link'),
|
||||
'desc' => $this->l('Create link in footer link to profile'),
|
||||
'name' => 'profile_link',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space" style="color:red">'.$this->l('Template Type').'</div>',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Carousel Type'),
|
||||
'class' => 'form-action',
|
||||
'name' => 'carousel_type',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'list', 'name' => $this->l('Normal List')),
|
||||
array('id' => 'owlcarousel', 'name' => $this->l('Owl Carousel')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'list'
|
||||
),
|
||||
//Owl Carousel begin
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space" style="font-size:13px">'.$this->l('Items per Row').'</div>',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'items',
|
||||
'label' => $this->l('Items'),
|
||||
'desc' => $this->l('Typing number of items. Default'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
'default' => '5',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemsdesktop',
|
||||
'label' => $this->l('Items_Desktop'),
|
||||
'desc' => $this->l('Typing number of items ( with Screen < 1200 )'),
|
||||
'default' => '4',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemsdesktopsmall',
|
||||
'label' => $this->l('Items_Desktop_Small'),
|
||||
'desc' => $this->l('Typing number of items ( with Screen < 992 )'),
|
||||
'default' => '3',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemstablet',
|
||||
'label' => $this->l('Items_Tablet'),
|
||||
'desc' => $this->l('Typing number of items ( with Screen < 768 )'),
|
||||
'default' => '2',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemsmobile',
|
||||
'label' => $this->l('Items_Mobile'),
|
||||
'desc' => $this->l('Typing number of items ( with Screen < 576 )'),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemscustom',
|
||||
'label' => $this->l('Items_Custom'),
|
||||
'desc' => $this->l('(Advance User) Example: [[0, 2], [576, 3], [768, 4], [992, 5], [1200, 6]]. The format is [x,y] whereby x=browser width and y=number of slides displayed'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itempercolumn',
|
||||
'label' => $this->l('Items per Column'),
|
||||
'desc' => $this->l('Number of item per one column. Same with number of line for one page'),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space" style="font-size:13px">'.$this->l('Effect').'</div>',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Autoplay'),
|
||||
'name' => 'autoplay',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Yes - scroll per page. No - scroll per item. This affect next/prev buttons and mouse/touch dragging.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Stop on Hover'),
|
||||
'name' => 'stoponhover',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Stop autoplay on mouse hover'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Responsive'),
|
||||
'name' => 'responsive',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('You can use Owl Carousel on desktop-only websites too! Just change that to "false" to disable resposive capabilities'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Navigation'),
|
||||
'name' => 'navigation',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Display "next" and "prev" buttons.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Auto Height'),
|
||||
'name' => 'autoHeight',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Add height to owl-wrapper-outer so you can use diffrent heights on slides. Use it only for one item per page setting.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Mouse Drag'),
|
||||
'name' => 'mouseDrag',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('On DeskTop - Turn off/on mouse events.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Touch Drag'),
|
||||
'name' => 'touchdrag',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('On Mobile - Turn off/on touch events.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space" style="font-size:13px">'.$this->l('Lazy Load: This function is only work when have one item per column').'</div>',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Lazy Load'),
|
||||
'name' => 'lazyload',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'desc' => $this->l('Delays loading of images. Images outside of viewport will not be loaded before user scrolls to them. Great for mobile devices to speed up page loadings'),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Lazy Follow'),
|
||||
'name' => 'lazyfollow',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('When pagination used, it skips loading the images from pages that got skipped. It only loads the images that get displayed in viewport. If set to false, all images get loaded when pagination used. It is a sub setting of the lazy load function.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Lazy Effect'),
|
||||
'name' => 'lazyeffect',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'fade', 'name' => $this->l('fade')),
|
||||
array('id' => 'false', 'name' => $this->l('No')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'desc' => $this->l('Default is fadeIn on 400ms speed. Use false to remove that effect.'),
|
||||
'default' => 'fade',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Pagination Enable'),
|
||||
'name' => 'pagination',
|
||||
'is_bool' => true,
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'desc' => $this->l('Show Pagination below owl-carousel.'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Pagination Numbers'),
|
||||
'name' => 'paginationnumbers',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Show numbers inside Pagination'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space" style="font-size:13px">'.$this->l('NEXT PAGE').'</div>',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Scroll per Page'),
|
||||
'name' => 'scrollPerPage',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Yes - scroll per Page. No - scroll per Item. This affect next/prev buttons and mouse/touch dragging.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Scroll Page Speed'),
|
||||
'name' => 'paginationspeed',
|
||||
'desc' => $this->l('Time to next page. Ex 800 ( Milliseconds )'),
|
||||
'default' => '800',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Scroll Item Speed'),
|
||||
'name' => 'slidespeed',
|
||||
'desc' => $this->l('Time to next item. Ex 200 (Milliseconds)'),
|
||||
'default' => '200',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
//Owl Carousel end
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
|
||||
if (!Configuration::get('APPAGEBUILDER_LOAD_INSTAFEED')) {
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show Instagram. Please enable Instafeed library in Appagebuilder Configuration.';
|
||||
return $assign;
|
||||
} elseif (isset($assign['formAtts']['carousel_type']) && $assign['formAtts']['carousel_type'] == 'owlcarousel') {
|
||||
if (!Configuration::get('APPAGEBUILDER_LOAD_OWL')) {
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show Instagram. Please enable Owl Carousel library in Appagebuilder Configuration.';
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
|
||||
$assign['formAtts']['get'] = 'user';
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,950 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApManuFacturersCarousel extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApManuFacturersCarousel';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Manufacturers carousel'), 'position' => 6,
|
||||
'desc' => $this->l('Show manufacturers in Carousel'), 'icon_class' => 'icon icon-chevron-right',
|
||||
'tag' => 'content slider');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
//get all manufacture
|
||||
$manufacturers = Manufacturer::getManufacturers(false, 0, true, false, false, false, true);
|
||||
// get image type
|
||||
$imagetype = ImageType::getImagesTypes('manufacturers');
|
||||
$iselect = Tools::getValue('value_by_manufacture');
|
||||
if ($iselect === '0') {
|
||||
$script_update_select = '<script>$("#value_by_manufacture").attr("checked", "checked");</script>';
|
||||
} else {
|
||||
$script_update_select = '<script>$("#value_by_manufacture").removeAttr("checked");</script>';
|
||||
}
|
||||
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">'.
|
||||
$this->l('Step 1: Use latest manufacturers or select Manufacturers').'</div>'.$script_update_select,
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'value_by',
|
||||
'label' => $this->l('Select manufacturers'),
|
||||
'class' => 'checkbox-group',
|
||||
'desc' => $this->l('Unchecked to show latest manufacturers'),
|
||||
'values' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'manufacture',
|
||||
'name' => $this->l('Select Manufacturers'),
|
||||
'val' => '0'
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Manufacture'),
|
||||
'name' => 'manuselect[]',
|
||||
'multiple' => true,
|
||||
'options' => array(
|
||||
'query' => $manufacturers,
|
||||
'id' => 'id_manufacturer',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'all',
|
||||
'form_group_class' => 'value_by_manufacture',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">'.$this->l('Step 2: Select image type').'</div>',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Image:'),
|
||||
'desc' => $this->l('Select image type for manufacture.'),
|
||||
'name' => 'imagetype',
|
||||
'default' => ApPageSetting::getDefaultNameImage('small'),
|
||||
'options' => array(
|
||||
'query' => $imagetype,
|
||||
'id' => 'name',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">'.$this->l('Step 3: Product Order And Limit').'</div>',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Order Way'),
|
||||
'class' => 'form-action',
|
||||
'name' => 'order_way',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'asc', 'name' => $this->l('Asc')),
|
||||
array('id' => 'desc', 'name' => $this->l('Desc')),
|
||||
array('id' => 'random', 'name' => $this->l('Random'))),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'all',
|
||||
'form_group_class' => 'value_by_manufacture',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Order By'),
|
||||
'name' => 'order_by',
|
||||
'options' => array(
|
||||
'query' => ApPageSetting::getOrderByManu(),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'order_type_sub order_type-asc order_type-desc',
|
||||
'default' => 'all',
|
||||
'form_group_class' => 'value_by_manufacture',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'manu_limit',
|
||||
'label' => $this->l('Limit'),
|
||||
'default' => '10',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">'.$this->l('Step 3: Carousel Setting').'</div>',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Carousel Type'),
|
||||
'class' => 'form-action',
|
||||
'name' => 'carousel_type',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'boostrap', 'name' => $this->l('Bootstrap')),
|
||||
array('id' => 'owlcarousel', 'name' => $this->l('Owl Carousel')),
|
||||
array('id' => 'slickcarousel', 'name' => $this->l('Slick Carousel')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'boostrap'
|
||||
),
|
||||
//Owl Carousel begin
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space" style="font-size:13px">'.$this->l('Items per Row').'</div>',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'items',
|
||||
'label' => $this->l('Items'),
|
||||
'desc' => $this->l('Typing number of items. Default'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
'default' => '5',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemsdesktop',
|
||||
'label' => $this->l('Items_Desktop'),
|
||||
'desc' => $this->l('Typing number of items ( with Screen < 1200 )'),
|
||||
'default' => '4',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemsdesktopsmall',
|
||||
'label' => $this->l('Items_Desktop_Small'),
|
||||
'desc' => $this->l('Typing number of items ( with Screen < 992 )'),
|
||||
'default' => '3',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemstablet',
|
||||
'label' => $this->l('Items_Tablet'),
|
||||
'desc' => $this->l('Typing number of items ( with Screen < 768 )'),
|
||||
'default' => '2',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemsmobile',
|
||||
'label' => $this->l('Items_Mobile'),
|
||||
'desc' => $this->l('Typing number of items ( with Screen < 576 )'),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itemscustom',
|
||||
'label' => $this->l('Items_Custom'),
|
||||
'desc' => $this->l('(Advance User) Example: [[0, 2], [576, 3], [768, 4], [992, 5], [1200, 6]]. The format is [x,y] whereby x=browser width and y=number of slides displayed'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'itempercolumn',
|
||||
'label' => $this->l('Items per Column'),
|
||||
'desc' => $this->l('Number of item per one column. Same with number of line for one page'),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space" style="font-size:13px">'.$this->l('Effect').'</div>',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Autoplay'),
|
||||
'name' => 'autoplay',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Yes - scroll per page. No - scroll per item. This affect next/prev buttons and mouse/touch dragging.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Stop on Hover'),
|
||||
'name' => 'stoponhover',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Stop autoplay on mouse hover'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Responsive'),
|
||||
'name' => 'responsive',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('You can use Owl Carousel on desktop-only websites too! Just change that to "false" to disable resposive capabilities'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Navigation'),
|
||||
'name' => 'navigation',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Display "next" and "prev" buttons.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Auto Height'),
|
||||
'name' => 'autoHeight',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Add height to owl-wrapper-outer so you can use diffrent heights on slides. Use it only for one item per page setting.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Mouse Drag'),
|
||||
'name' => 'mouseDrag',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('On DeskTop - Turn off/on mouse events.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Touch Drag'),
|
||||
'name' => 'touchdrag',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('On Mobile - Turn off/on touch events.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space" style="font-size:13px">'.$this->l('Lazy Load: This function is only work when have one item per column').'</div>',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Lazy Load'),
|
||||
'name' => 'lazyload',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'desc' => $this->l('Delays loading of images. Images outside of viewport will not be loaded before user scrolls to them. Great for mobile devices to speed up page loadings'),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Lazy Follow'),
|
||||
'name' => 'lazyfollow',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('When pagination used, it skips loading the images from pages that got skipped. It only loads the images that get displayed in viewport. If set to false, all images get loaded when pagination used. It is a sub setting of the lazy load function.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Lazy Effect'),
|
||||
'name' => 'lazyeffect',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'fade', 'name' => $this->l('fade')),
|
||||
array('id' => 'false', 'name' => $this->l('No')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'desc' => $this->l('Default is fadeIn on 400ms speed. Use false to remove that effect.'),
|
||||
'default' => 'fade',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Pagination Enable'),
|
||||
'name' => 'pagination',
|
||||
'is_bool' => true,
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'desc' => $this->l('Show Pagination below owl-carousel.'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Pagination Numbers'),
|
||||
'name' => 'paginationnumbers',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Show numbers inside Pagination'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space" style="font-size:13px">'.$this->l('NEXT PAGE').'</div>',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Scroll per Page'),
|
||||
'name' => 'scrollPerPage',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('Yes - scroll per Page. No - scroll per Item. This affect next/prev buttons and mouse/touch dragging.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '0',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Scroll Page Speed'),
|
||||
'name' => 'paginationspeed',
|
||||
'desc' => $this->l('Time to next page. Ex 800 ( Milliseconds )'),
|
||||
'default' => '800',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Scroll Item Speed'),
|
||||
'name' => 'slidespeed',
|
||||
'desc' => $this->l('Time to next item. Ex 200 (Milliseconds)'),
|
||||
'default' => '200',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-owlcarousel',
|
||||
),
|
||||
//Owl Carousel end
|
||||
//boostrap carousel begin
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'nbitemsperpage',
|
||||
'label' => $this->l('Number of Item per Page'),
|
||||
'desc' => $this->l('How many product you want to display in a Page. divisible by Item per Line (Desktop, Table, mobile)(default:12)'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-boostrap carousel_type-desc',
|
||||
'default' => '12',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="space">'.$this->l('Items per Row').'</div>',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-boostrap',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Items_Desktop ( >= 1200 )'),
|
||||
'name' => 'nbitemsperline_desktop',
|
||||
'default' => '',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '', 'name' => $this->l('Default')),
|
||||
array('id' => '1', 'name' => $this->l('1 item')),
|
||||
array('id' => '2', 'name' => $this->l('2 items')),
|
||||
array('id' => '3', 'name' => $this->l('3 items')),
|
||||
array('id' => '4', 'name' => $this->l('4 items')),
|
||||
array('id' => '5', 'name' => $this->l('5 items')),
|
||||
array('id' => '6', 'name' => $this->l('6 items')),
|
||||
array('id' => '12', 'name' => $this->l('12 items')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'desc' => $this->l('How many product you want to display in a row of page. Default 4'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-boostrap carousel_type-desc',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Items_SmallDesktop ( >= 992 )'),
|
||||
'name' => 'nbitemsperline_smalldesktop',
|
||||
'default' => '',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '', 'name' => $this->l('Default')),
|
||||
array('id' => '1', 'name' => $this->l('1 item')),
|
||||
array('id' => '2', 'name' => $this->l('2 items')),
|
||||
array('id' => '3', 'name' => $this->l('3 items')),
|
||||
array('id' => '4', 'name' => $this->l('4 items')),
|
||||
array('id' => '5', 'name' => $this->l('5 items')),
|
||||
array('id' => '6', 'name' => $this->l('6 items')),
|
||||
array('id' => '12', 'name' => $this->l('12 items')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'desc' => $this->l('How many product you want to display in a row of page. Default 3'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-boostrap carousel_type-desc',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Items_Tablet ( >= 768 )'),
|
||||
'name' => 'nbitemsperline_tablet',
|
||||
'default' => '',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '', 'name' => $this->l('Default')),
|
||||
array('id' => '1', 'name' => $this->l('1 item')),
|
||||
array('id' => '2', 'name' => $this->l('2 items')),
|
||||
array('id' => '3', 'name' => $this->l('3 items')),
|
||||
array('id' => '4', 'name' => $this->l('4 items')),
|
||||
array('id' => '5', 'name' => $this->l('5 items')),
|
||||
array('id' => '6', 'name' => $this->l('6 items')),
|
||||
array('id' => '12', 'name' => $this->l('12 items')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'desc' => $this->l('How many product you want to display in a row of page. Default 3'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-boostrap carousel_type-desc',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Items_SmallDevices ( >= 576 )'),
|
||||
'name' => 'nbitemsperline_smalldevices',
|
||||
'default' => '',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '', 'name' => $this->l('Default')),
|
||||
array('id' => '1', 'name' => $this->l('1 item')),
|
||||
array('id' => '2', 'name' => $this->l('2 items')),
|
||||
array('id' => '3', 'name' => $this->l('3 items')),
|
||||
array('id' => '4', 'name' => $this->l('4 items')),
|
||||
array('id' => '5', 'name' => $this->l('5 items')),
|
||||
array('id' => '6', 'name' => $this->l('6 items')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'desc' => $this->l('How many product you want to display in a row of page. Default 2'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-boostrap carousel_type-desc',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Items_ExtraSmallDevices ( >= 480 )'),
|
||||
'name' => 'nbitemsperline_extrasmalldevices',
|
||||
'default' => '',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '', 'name' => $this->l('Default')),
|
||||
array('id' => '1', 'name' => $this->l('1 item')),
|
||||
array('id' => '2', 'name' => $this->l('2 items')),
|
||||
array('id' => '3', 'name' => $this->l('3 items')),
|
||||
array('id' => '4', 'name' => $this->l('4 items')),
|
||||
array('id' => '5', 'name' => $this->l('5 items')),
|
||||
array('id' => '6', 'name' => $this->l('6 items')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'desc' => $this->l('How many product you want to display in a row of page. Default 1'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-boostrap carousel_type-desc',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Items_Smartphone ( < 480 )'),
|
||||
'name' => 'nbitemsperline_smartphone',
|
||||
'default' => '',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '', 'name' => $this->l('Default')),
|
||||
array('id' => '1', 'name' => $this->l('1 item')),
|
||||
array('id' => '2', 'name' => $this->l('2 items')),
|
||||
array('id' => '3', 'name' => $this->l('3 items')),
|
||||
array('id' => '4', 'name' => $this->l('4 items')),
|
||||
array('id' => '5', 'name' => $this->l('5 items')),
|
||||
array('id' => '6', 'name' => $this->l('6 items')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'desc' => $this->l('How many product you want to display in a row of page. Default 1'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-boostrap carousel_type-desc',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'interval',
|
||||
'label' => $this->l('interval'),
|
||||
'desc' => $this->l('The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.'),
|
||||
'default' => '5000',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-boostrap carousel_type-desc',
|
||||
),
|
||||
|
||||
//Slick carousel start
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Vertical'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
'name' => 'slick_vertical',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => '0', 'name' => $this->l('No')),
|
||||
array('id' => '1', 'name' => $this->l('Yes')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'slick_autoplay',
|
||||
'label' => $this->l('Auto play'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
'desc' => $this->l(''),
|
||||
'options' => array('query' => array(
|
||||
array('id' => '1', 'name' => $this->l('Yes')),
|
||||
array('id' => '0', 'name' => $this->l('No')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name')
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'slick_pauseonhover',
|
||||
'label' => $this->l('Pause on Hover'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
'desc' => $this->l(''),
|
||||
'options' => array('query' => array(
|
||||
array('id' => '1', 'name' => $this->l('Yes')),
|
||||
array('id' => '0', 'name' => $this->l('No')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name')
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'slick_loopinfinite',
|
||||
'label' => $this->l('Loop Infinite'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
'desc' => $this->l(''),
|
||||
'default' => '0',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '0', 'name' => $this->l('No')),
|
||||
array('id' => '1', 'name' => $this->l('Yes')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'slick_arrows',
|
||||
'label' => $this->l('Prev/Next Arrows'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
'desc' => $this->l(''),
|
||||
'options' => array('query' => array(
|
||||
array('id' => '1', 'name' => $this->l('Yes')),
|
||||
array('id' => '0', 'name' => $this->l('No')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name')
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'slick_dot',
|
||||
'label' => $this->l('Show dot indicators'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
'desc' => $this->l(''),
|
||||
'default' => '0',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '0', 'name' => $this->l('No')),
|
||||
array('id' => '1', 'name' => $this->l('Yes')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name')
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'slick_centermode',
|
||||
// 'class' => 'form-action',
|
||||
'label' => $this->l('Center mode'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
'desc' => $this->l(''),
|
||||
'default' => '0',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '0', 'name' => $this->l('No')),
|
||||
array('id' => '1', 'name' => $this->l('Yes')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'slick_centerpadding',
|
||||
'label' => $this->l('Center padding'),
|
||||
'desc' => $this->l('Only for center mode. Unit is px (pixel). Default: 60(px)'),
|
||||
'default' => '60',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'slick_row',
|
||||
'label' => $this->l('Num Row'),
|
||||
'desc' => $this->l('Show number row display. Ex 1 or 1,2,3,4 '),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'slick_slidestoshow',
|
||||
'label' => $this->l('Slides To Show'),
|
||||
'desc' => $this->l('Show number row display. Ex 1 or 1,2,3,4 '),
|
||||
'default' => '5',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'slick_slidestoscroll',
|
||||
'label' => $this->l('Slides To Scroll'),
|
||||
'desc' => $this->l('Show number row display. Ex 1 or 1,2,3,4 '),
|
||||
'default' => '1',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'slick_items_custom',
|
||||
'label' => $this->l('Display for other screen'),
|
||||
'desc' => $this->l('(Advance User) Example: [[1200, 6],[992, 5],[768, 4], [576, 3],[480, 2]]. The format is [x,y] whereby x=browser width and y=number of slides displayed'),
|
||||
'default' => '[[1200, 6],[992, 5],[768, 4], [576, 3],[480, 2]]',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
),
|
||||
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'slick_custom_status',
|
||||
// 'class' => 'form-action',
|
||||
'label' => $this->l('Enable custom js slick'),
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
'desc' => $this->l('Only for developers and advanced users. Goto http://kenwheeler.github.io/slick/ for option'),
|
||||
'options' => array('query' => array(
|
||||
array('id' => '0', 'name' => $this->l('No')),
|
||||
array('id' => '1', 'name' => $this->l('Yes')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'),
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'slick_custom',
|
||||
'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
'label' => $this->l('Custom js Slick'),
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '{
|
||||
dots: true,
|
||||
infinite: false,
|
||||
speed: 300,
|
||||
slidesToShow: 4,
|
||||
slidesToScroll: 4,
|
||||
responsive: [
|
||||
{
|
||||
breakpoint: 1024,
|
||||
settings: {
|
||||
slidesToShow: 3,
|
||||
slidesToScroll: 3,
|
||||
infinite: true,
|
||||
dots: true
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 600,
|
||||
settings: {
|
||||
slidesToShow: 2,
|
||||
slidesToScroll: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 480,
|
||||
settings: {
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}',
|
||||
// 'form_group_class' => 'carousel_type_sub carousel_type-slickcarousel',
|
||||
),
|
||||
|
||||
//Slick carousel end
|
||||
|
||||
|
||||
);
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
// KEEP OLD DATA
|
||||
if (Tools::getIsset('nbitemsperline') && Tools::getValue('nbitemsperline')) {
|
||||
$this->helper->tpl_vars['fields_value']['nbitemsperline_desktop'] = Tools::getValue('nbitemsperline');
|
||||
$this->helper->tpl_vars['fields_value']['nbitemsperline_smalldesktop'] = Tools::getValue('nbitemsperline');
|
||||
$this->helper->tpl_vars['fields_value']['nbitemsperline_tablet'] = Tools::getValue('nbitemsperline');
|
||||
}
|
||||
|
||||
if (Tools::getIsset('nbitemsperlinetablet') && Tools::getValue('nbitemsperlinetablet')) {
|
||||
$this->helper->tpl_vars['fields_value']['nbitemsperline_smalldevices'] = Tools::getValue('nbitemsperlinetablet');
|
||||
}
|
||||
|
||||
if (Tools::getIsset('nbitemsperlinemobile') && Tools::getValue('nbitemsperlinemobile')) {
|
||||
$this->helper->tpl_vars['fields_value']['nbitemsperline_extrasmalldevices'] = Tools::getValue('nbitemsperlinemobile');
|
||||
$this->helper->tpl_vars['fields_value']['nbitemsperline_smartphone'] = Tools::getValue('nbitemsperlinemobile');
|
||||
}
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
if (isset($assign['formAtts']['carousel_type']) && $assign['formAtts']['carousel_type'] == 'owlcarousel') {
|
||||
if (!Configuration::get('APPAGEBUILDER_LOAD_OWL')) {
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show ManuFacturer Carousel. Please enable Owl Carousel library in Appagebuilder Configuration.';
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
if (isset($assign['formAtts']['value_by_manufacture']) && $assign['formAtts']['value_by_manufacture'] == '0') {
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoProcessData.php');
|
||||
$assign['manuselect'] = LeoProcessData::getManufacturersSelect($assign['formAtts']);
|
||||
} else {
|
||||
// validate module
|
||||
$assign['manuselect'] = Manufacturer::getManufacturers(false, 0, true, 1, (int)$assign['formAtts']['manu_limit'], false, true);
|
||||
}
|
||||
$assign['manufacturers'] = $assign['manuselect'];
|
||||
$assign['image_type'] = ($assign['formAtts']['imagetype']) ? ($assign['formAtts']['imagetype']) : ApPageSetting::getDefaultNameImage('small');
|
||||
$assign['carouselName'] = 'carousel-'.ApPageSetting::getRandomNumber();
|
||||
if ($assign['formAtts']['carousel_type'] == 'boostrap') {
|
||||
if (isset($assign['formAtts']['nbitemsperline']) && $assign['formAtts']['nbitemsperline']) {
|
||||
$assign['formAtts']['nbitemsperline_desktop'] = $assign['formAtts']['nbitemsperline'];
|
||||
$assign['formAtts']['nbitemsperline_smalldesktop'] = $assign['formAtts']['nbitemsperline'];
|
||||
$assign['formAtts']['nbitemsperline_tablet'] = $assign['formAtts']['nbitemsperline'];
|
||||
}
|
||||
if (isset($assign['formAtts']['nbitemsperlinetablet']) && $assign['formAtts']['nbitemsperlinetablet']) {
|
||||
$assign['formAtts']['nbitemsperline_smalldevices'] = $assign['formAtts']['nbitemsperlinetablet'];
|
||||
}
|
||||
if (isset($assign['formAtts']['nbitemsperlinemobile']) && $assign['formAtts']['nbitemsperlinemobile']) {
|
||||
$assign['formAtts']['nbitemsperline_extrasmalldevices'] = $assign['formAtts']['nbitemsperlinemobile'];
|
||||
$assign['formAtts']['nbitemsperline_smartphone'] = $assign['formAtts']['nbitemsperlinemobile'];
|
||||
}
|
||||
|
||||
$assign['formAtts']['nbitemsperline_desktop'] = isset($assign['formAtts']['nbitemsperline_desktop']) && $assign['formAtts']['nbitemsperline_desktop'] ? (int)$assign['formAtts']['nbitemsperline_desktop'] : 4;
|
||||
$assign['formAtts']['nbitemsperline_smalldesktop'] = isset($assign['formAtts']['nbitemsperline_smalldesktop']) && $assign['formAtts']['nbitemsperline_smalldesktop'] ? (int)$assign['formAtts']['nbitemsperline_smalldesktop'] : 4;
|
||||
$assign['formAtts']['nbitemsperline_tablet'] = isset($assign['formAtts']['nbitemsperline_tablet']) && $assign['formAtts']['nbitemsperline_tablet'] ? (int)$assign['formAtts']['nbitemsperline_tablet'] : 3;
|
||||
$assign['formAtts']['nbitemsperline_smalldevices'] = isset($assign['formAtts']['nbitemsperline_smalldevices']) && $assign['formAtts']['nbitemsperline_smalldevices'] ? (int)$assign['formAtts']['nbitemsperline_smalldevices'] : 2;
|
||||
$assign['formAtts']['nbitemsperline_extrasmalldevices'] = isset($assign['formAtts']['nbitemsperline_extrasmalldevices']) && $assign['formAtts']['nbitemsperline_extrasmalldevices'] ? (int)$assign['formAtts']['nbitemsperline_extrasmalldevices'] : 1;
|
||||
$assign['formAtts']['nbitemsperline_smartphone'] = isset($assign['formAtts']['nbitemsperline_smartphone']) && $assign['formAtts']['nbitemsperline_smartphone'] ? (int)$assign['formAtts']['nbitemsperline_smartphone'] : 1;
|
||||
|
||||
$assign['tabname'] = 'carousel-'.ApPageSetting::getRandomNumber();
|
||||
$assign['itemsperpage'] = (int)$assign['formAtts']['nbitemsperpage'];
|
||||
$assign['nbItemsPerLine'] = (int)$assign['formAtts']['nbitemsperline_desktop'];
|
||||
|
||||
$assign['scolumn'] = '';
|
||||
|
||||
if ($assign['formAtts']['nbitemsperline_desktop'] == '5') {
|
||||
$assign['scolumn'] .= ' col-xl-2-4';
|
||||
} else {
|
||||
$assign['scolumn'] .= ' col-xl-' .str_replace('.', '-', ''.(int)(12 / $assign['formAtts']['nbitemsperline_desktop']));
|
||||
}
|
||||
|
||||
if ($assign['formAtts']['nbitemsperline_smalldesktop'] == '5') {
|
||||
$assign['scolumn'] .= ' col-lg-2-4';
|
||||
} else {
|
||||
$assign['scolumn'] .= ' col-lg-' .str_replace('.', '-', ''.(int)(12 / $assign['formAtts']['nbitemsperline_smalldesktop']));
|
||||
}
|
||||
|
||||
if ($assign['formAtts']['nbitemsperline_tablet'] == '5') {
|
||||
$assign['scolumn'] .= ' col-md-2-4';
|
||||
} else {
|
||||
$assign['scolumn'] .= ' col-md-' .str_replace('.', '-', ''.(int)(12 / $assign['formAtts']['nbitemsperline_tablet']));
|
||||
}
|
||||
|
||||
if ($assign['formAtts']['nbitemsperline_smalldevices'] == '5') {
|
||||
$assign['scolumn'] .= ' col-sm-2-4';
|
||||
} else {
|
||||
$assign['scolumn'] .= ' col-sm-' .str_replace('.', '-', ''.(int)(12 / $assign['formAtts']['nbitemsperline_smalldevices']));
|
||||
}
|
||||
|
||||
if ($assign['formAtts']['nbitemsperline_extrasmalldevices'] == '5') {
|
||||
$assign['scolumn'] .= ' col-xs-2-4';
|
||||
} else {
|
||||
$assign['scolumn'] .= ' col-xs-' .str_replace('.', '-', ''.(int)(12 / $assign['formAtts']['nbitemsperline_extrasmalldevices']));
|
||||
}
|
||||
|
||||
if ($assign['formAtts']['nbitemsperline_smartphone'] == '5') {
|
||||
$assign['scolumn'] .= ' col-sp-2-4';
|
||||
} else {
|
||||
$assign['scolumn'] .= ' col-sp-' .str_replace('.', '-', ''.(int)(12 / $assign['formAtts']['nbitemsperline_smartphone']));
|
||||
}
|
||||
}
|
||||
//DONGND:: create data for owl carousel with item custom
|
||||
if ($assign['formAtts']['carousel_type'] == 'owlcarousel') {
|
||||
//DONGND:: build data for fake item loading
|
||||
$assign['formAtts']['number_fake_item'] = $assign['formAtts']['items'];
|
||||
$array_fake_item = array();
|
||||
$array_fake_item['m'] = $assign['formAtts']['itemsmobile'];
|
||||
$array_fake_item['sm'] = $assign['formAtts']['itemstablet'];
|
||||
$array_fake_item['md'] = $assign['formAtts']['itemsdesktopsmall'];
|
||||
$array_fake_item['lg'] = $assign['formAtts']['itemsdesktop'];
|
||||
$array_fake_item['xl'] = $assign['formAtts']['items'];
|
||||
$assign['formAtts']['array_fake_item'] = $array_fake_item;
|
||||
|
||||
if (isset($assign['formAtts']['itemscustom']) && $assign['formAtts']['itemscustom'] != '') {
|
||||
$array_item_custom = Tools::jsonDecode($assign['formAtts']['itemscustom']);
|
||||
$array_item_custom_tmp = array();
|
||||
$array_number_item = array();
|
||||
foreach ($array_item_custom as $array_item_custom_val) {
|
||||
$size_window = $array_item_custom_val[0];
|
||||
$number_item = $array_item_custom_val[1];
|
||||
if (0 <= $size_window && $size_window < 576) {
|
||||
$array_item_custom_tmp['m'] = $number_item;
|
||||
} else if (576 <= $size_window && $size_window < 768) {
|
||||
$array_item_custom_tmp['sm'] = $number_item;
|
||||
} else if (768 <= $size_window && $size_window < 992) {
|
||||
$array_item_custom_tmp['md'] = $number_item;
|
||||
} else if (992 <= $size_window && $size_window < 1200) {
|
||||
$array_item_custom_tmp['lg'] = $number_item;
|
||||
} else if ($size_window >= 1200) {
|
||||
$array_item_custom_tmp['xl'] = $number_item;
|
||||
}
|
||||
$array_item_custom_tmp[$size_window] = $number_item;
|
||||
$array_number_item[] = $number_item;
|
||||
};
|
||||
$assign['formAtts']['array_fake_item'] = array_merge($array_fake_item, $array_item_custom_tmp);
|
||||
|
||||
if (max($array_number_item) > $assign['formAtts']['items']) {
|
||||
$assign['formAtts']['number_fake_item'] = max($array_number_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($assign['formAtts']['carousel_type'] == 'slickcarousel') {
|
||||
if (isset($assign['formAtts']['slick_items_custom'])) {
|
||||
$assign['formAtts']['slick_items_custom'] = str_replace($this->str_search, $this->str_relace, $assign['formAtts']['slick_items_custom']);
|
||||
}
|
||||
if (isset($assign['formAtts']['slick_custom'])) {
|
||||
$str_relace = array('&', '\"', '\'', '', '', '', '[', ']');
|
||||
$assign['formAtts']['slick_custom'] = str_replace($this->str_search, $str_relace, $assign['formAtts']['slick_custom']);
|
||||
}
|
||||
if (isset($assign['formAtts']['slick_items_custom'])) {
|
||||
$assign['formAtts']['slick_items_custom'] = Tools::jsonDecode($assign['formAtts']['slick_items_custom']);
|
||||
}
|
||||
|
||||
//DONGND:: build data for fake item loading
|
||||
$assign['formAtts']['number_fake_item'] = $assign['formAtts']['slick_slidestoshow']*$assign['formAtts']['slick_row'];
|
||||
|
||||
if (isset($assign['formAtts']['slick_items_custom']) && $assign['formAtts']['slick_items_custom'] != '') {
|
||||
$array_item_custom = $assign['formAtts']['slick_items_custom'];
|
||||
$array_item_custom_tmp = array();
|
||||
$array_number_item = array();
|
||||
foreach ($array_item_custom as $array_item_custom_val) {
|
||||
$size_window = $array_item_custom_val[0];
|
||||
$number_item = $array_item_custom_val[1];
|
||||
if (0 <= $size_window && $size_window < 576) {
|
||||
$array_item_custom_tmp['m'] = $number_item;
|
||||
} else if (576 <= $size_window && $size_window < 768) {
|
||||
$array_item_custom_tmp['sm'] = $number_item;
|
||||
} else if (768 <= $size_window && $size_window < 992) {
|
||||
$array_item_custom_tmp['md'] = $number_item;
|
||||
} else if (992 <= $size_window && $size_window < 1200) {
|
||||
$array_item_custom_tmp['lg'] = $number_item;
|
||||
} else if ($size_window >= 1200) {
|
||||
$array_item_custom_tmp['xl'] = $assign['formAtts']['slick_slidestoshow'];
|
||||
}
|
||||
$number_item = $number_item*$assign['formAtts']['slick_row'];
|
||||
$array_item_custom_tmp[$size_window] = $number_item;
|
||||
$array_number_item[] = $number_item;
|
||||
};
|
||||
$assign['formAtts']['array_fake_item'] = $array_item_custom_tmp;
|
||||
|
||||
if (max($array_number_item) > $assign['formAtts']['slick_slidestoshow']) {
|
||||
$assign['formAtts']['number_fake_item'] = max($array_number_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
147
modules/appagebuilder/classes/shortcodes/ApMegamenu.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApMegamenu extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApMegamenu';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Megamenu Module'), 'position' => 3, 'desc' => $this->l('You can get group from leobootstrapmenu module'),
|
||||
'icon_class' => 'icon icon-chevron-right', 'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
if (Module::isInstalled('leobootstrapmenu') && Module::isEnabled('leobootstrapmenu')) {
|
||||
include_once(_PS_MODULE_DIR_.'leobootstrapmenu/leobootstrapmenu.php');
|
||||
$module = new Leobootstrapmenu();
|
||||
$list = $module->getGroups();
|
||||
// $controller = 'AdminModules';
|
||||
// $id_lang = Context::getContext()->language->id;
|
||||
// $params = array('token' => Tools::getAdminTokenLite($controller),
|
||||
// 'configure' => 'Leobootstrapmenu',
|
||||
// 'tab_module' => 'front_office_features',
|
||||
// 'module_name' => 'Leobootstrapmenu');
|
||||
//$url = dirname($_SERVER['PHP_SELF']).'/'.Dispatcher::getInstance()->createUrl($controller, $id_lang, $params, false);
|
||||
$url = Context::getContext()->link->getAdminLink('AdminLeoBootstrapMenuModule');
|
||||
if ($list && count($list) > 0) {
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Select a group for megamenu'),
|
||||
'name' => 'megamenu_group',
|
||||
'options' => array(
|
||||
'query' => $this->getListGroup($list),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'value_by_categories',
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class=""><a class="" href="'.$url.'" target="_blank">'.
|
||||
$this->l('Go to page configuration megamenu').'</a></div>'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// Go to page setting of the module LeoSlideShow
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-warning">'.
|
||||
$this->l('There is no group in Leobootstrapmenu Module.').
|
||||
'</div><br/><div><center><a class="btn btn-primary" href="'.$url.'" target="_blank">'.
|
||||
$this->l(' CREATE GROUP ').'</a></center></div>'
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-warning">'.
|
||||
$this->l('"Leobootstrapmenu" Module must be installed and enabled before using.').
|
||||
'</div><br/><h4><center>You can take this module at leo-theme or apollo-theme</center></h4>'
|
||||
)
|
||||
);
|
||||
}
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function getListGroup($list)
|
||||
{
|
||||
$result = array();
|
||||
foreach ($list as $item) {
|
||||
$status = ' (ID: '.$item['id_btmegamenu_group'].' - '.($item['active'] ? $this->l('Active') : $this->l('Deactive')).')';
|
||||
$result[] = array('id' => $item['randkey'], 'name' => $item['title'].$status);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
if (Module::isInstalled('leobootstrapmenu') && Module::isEnabled('leobootstrapmenu')) {
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
$assign['formAtts']['isEnabled'] = true;
|
||||
include_once(_PS_MODULE_DIR_.'leobootstrapmenu/leobootstrapmenu.php');
|
||||
$module = new Leobootstrapmenu();
|
||||
$link_array = explode(',', $assign['formAtts']['megamenu_group']);
|
||||
if ($link_array && !is_numeric($link_array['0'])) {
|
||||
$randkey_group = '';
|
||||
foreach ($link_array as $val) {
|
||||
// validate module
|
||||
$randkey_group .= ($randkey_group == '') ? "'".pSQL($val)."'" : ",'".pSQL($val)."'";
|
||||
}
|
||||
|
||||
$where = ' WHERE randkey IN ('.$randkey_group.') AND id_shop = ' . (int)$id_shop;
|
||||
$sql = 'SELECT id_btmegamenu_group FROM `'._DB_PREFIX_.'btmegamenu_group` '.$where;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
if (is_array($result) && empty($result)) {
|
||||
$assign['formAtts']['isEnabled'] = false;
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show LeoBootstrapMenu via Appagebuilder. Please check that The Group of LeoBootstrapMenu is exist.';
|
||||
return $assign;
|
||||
}
|
||||
|
||||
$where = '';
|
||||
foreach ($result as $blog) {
|
||||
// validate module
|
||||
$where .= ($where == '') ? $blog['id_btmegamenu_group'] : ','.$blog['id_btmegamenu_group'];
|
||||
}
|
||||
$assign['formAtts']['megamenu_group'] = $where;
|
||||
}
|
||||
$form_id = explode("_", $assign['formAtts']['form_id']);
|
||||
$assign['content_megamenu'] = $module->processHookCallBack($assign['formAtts']['megamenu_group'], $form_id[1]);
|
||||
} else {
|
||||
// validate module
|
||||
$assign['formAtts']['isEnabled'] = false;
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show LeoBootstrapMenu via Appagebuilder. Please enable LeoBootstrapMenu module.';
|
||||
}
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
241
modules/appagebuilder/classes/shortcodes/ApModule.php
Normal file
@@ -0,0 +1,241 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
|
||||
|
||||
class ApModule extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApModule';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Module'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Custom moule'),
|
||||
'icon_class' => 'icon-copy',
|
||||
'tag' => 'module');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
if (Tools::getIsset('edit')) {
|
||||
$name_module = Tools::getValue('name_module');
|
||||
} else {
|
||||
$name_module = Tools::getValue('type_shortcode');
|
||||
}
|
||||
if (!$name_module) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$module_WidgetInterface = false;
|
||||
# GET HOOK
|
||||
if (($module_instance = Module::getInstanceByName($name_module))) {
|
||||
if ($module_instance instanceof WidgetInterface) {
|
||||
# module has method function renderWidget()
|
||||
$module_WidgetInterface = true;
|
||||
$hooks = ApPageSetting::getOverrideHook();
|
||||
$arr = array(
|
||||
array(
|
||||
'id' => '',
|
||||
'name' => $this->l('--------- Select a Hook ---------')
|
||||
)
|
||||
);
|
||||
foreach ($hooks as $hook) {
|
||||
$arr[] = array(
|
||||
'id' => $hook,
|
||||
'name' => $hook,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# GET HOOK
|
||||
if ($module_WidgetInterface == false) {
|
||||
// Get list hook by id (this source code was coped from AdminApPageBuilderShortcodesController)
|
||||
$hook_assign = array('rightcolumn', 'leftcolumn', 'home', 'top', 'footer');
|
||||
$module_instance = ModuleCore::getInstanceByName($name_module);
|
||||
$hooks = array();
|
||||
$result = array();
|
||||
foreach ($hook_assign as $hook) {
|
||||
$retro_hook_name = Hook::getRetroHookName($hook);
|
||||
if (is_callable(array($module_instance, 'hook'.$hook)) || is_callable(array($module_instance, 'hook'.$retro_hook_name))) {
|
||||
$hooks[] = $retro_hook_name;
|
||||
}
|
||||
}
|
||||
if ($hooks) {
|
||||
$randkey_hook = '';
|
||||
foreach ($hooks as $val) {
|
||||
// validate module
|
||||
$randkey_hook .= ($randkey_hook == '') ? "'".pSQL($val)."'" : ",'".pSQL($val)."'";
|
||||
}
|
||||
|
||||
$result = Db::getInstance()->ExecuteS('
|
||||
SELECT `id_hook`, `name` FROM `'._DB_PREFIX_.'hook`
|
||||
WHERE `name` IN ('.$randkey_hook.')');
|
||||
}
|
||||
$arr = array(array('id' => '', 'name' => $this->l('--------- Select a Hook ---------')));
|
||||
$len = count($result);
|
||||
if ($result && $len > 0) {
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$arr[] = array('id' => $result[$i]['name'], 'name' => $result[$i]['name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">Module name: <b>"'.$name_module
|
||||
.'"</b><input type="hidden" id="select-hook-error" value="'.$this->l('Please select a hook').'"/>
|
||||
<input type="hidden" id="name-module" name="name_module" value="'.$name_module.'"/>
|
||||
</div>',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'id' => 'select-hook',
|
||||
'label' => $this->l('Select hook of module (*)'),
|
||||
'name' => 'hook',
|
||||
'options' => array('query' => $arr,
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Remove display'),
|
||||
'desc' => $this->l('This module will remove in this hook'),
|
||||
'name' => 'is_display',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-danger">'.$this->l('Please consider using this function.
|
||||
This function is only for advance user,
|
||||
It will load other module and display in column of Appagebuilder.
|
||||
With some module have ID in wrapper DIV, your site will have Javascript Conflicts.
|
||||
We will not support this error.').'</div>',
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
$form_attr = $assign['formAtts'];
|
||||
$context = Context::getContext();
|
||||
if (isset($form_attr['hook']) && isset($form_attr['name_module']) && Module::isEnabled($form_attr['name_module'])) {
|
||||
$assign['apContent'] = $this->execModuleHook($form_attr['hook'], array(), $form_attr['name_module'], false, $context->shop->id);
|
||||
}
|
||||
return $assign;
|
||||
}
|
||||
|
||||
public static function execModuleHook($hook_name = null, $hook_args = array(), $module_name = null, $use_push = false, $id_shop = null)
|
||||
{
|
||||
static $disable_non_native_modules = null;
|
||||
if ($disable_non_native_modules === null) {
|
||||
$disable_non_native_modules = (bool)Configuration::get('PS_DISABLE_NON_NATIVE_MODULE');
|
||||
}
|
||||
// Check arguments validity
|
||||
if (!Validate::isModuleName($module_name) || !Validate::isHookName($hook_name)) {
|
||||
return '';
|
||||
}
|
||||
//throw new PrestaShopException('Invalid module name or hook name');
|
||||
// If no modules associated to hook_name or recompatible hook name, we stop the function
|
||||
if (!Hook::getHookModuleExecList($hook_name)) {
|
||||
return '';
|
||||
}
|
||||
// Check if hook exists
|
||||
if (!$id_hook = Hook::getIdByName($hook_name)) {
|
||||
return false;
|
||||
}
|
||||
// Store list of executed hooks on this page
|
||||
Hook::$executed_hooks[$id_hook] = $hook_name;
|
||||
$context = Context::getContext();
|
||||
if (!isset($hook_args['cookie']) || !$hook_args['cookie']) {
|
||||
$hook_args['cookie'] = $context->cookie;
|
||||
}
|
||||
if (!isset($hook_args['cart']) || !$hook_args['cart']) {
|
||||
$hook_args['cart'] = $context->cart;
|
||||
}
|
||||
$retro_hook_name = Hook::getRetroHookName($hook_name);
|
||||
// Look on modules list
|
||||
$altern = 0;
|
||||
$output = '';
|
||||
if ($disable_non_native_modules && !isset(Hook::$native_module)) {
|
||||
Hook::$native_module = Module::getNativeModuleList();
|
||||
}
|
||||
$different_shop = false;
|
||||
if ($id_shop !== null && Validate::isUnsignedId($id_shop) && $id_shop != $context->shop->getContextShopID()) {
|
||||
$old_context = $context->shop->getContext();
|
||||
$old_shop = clone $context->shop;
|
||||
$shop = new Shop((int)$id_shop);
|
||||
if (Validate::isLoadedObject($shop)) {
|
||||
$context->shop = $shop;
|
||||
$context->shop->setContext(Shop::CONTEXT_SHOP, $shop->id);
|
||||
$different_shop = true;
|
||||
}
|
||||
}
|
||||
// Check errors
|
||||
if ((bool)$disable_non_native_modules && Hook::$native_module && count(Hook::$native_module) && !in_array($module_name, self::$native_module)) {
|
||||
return;
|
||||
}
|
||||
if (!($module_instance = Module::getInstanceByName($module_name))) {
|
||||
return;
|
||||
}
|
||||
if ($use_push && !$module_instance->allow_push) {
|
||||
return;
|
||||
}
|
||||
// Check which / if method is callable
|
||||
$hook_callable = is_callable(array($module_instance, 'hook'.$hook_name));
|
||||
$hook_retro_callable = is_callable(array($module_instance, 'hook'.$retro_hook_name));
|
||||
if (($hook_callable || $hook_retro_callable)) {
|
||||
$hook_args['altern'] = ++$altern;
|
||||
if ($use_push && isset($module_instance->push_filename) && file_exists($module_instance->push_filename)) {
|
||||
Tools::waitUntilFileIsModified($module_instance->push_filename, $module_instance->push_time_limit);
|
||||
}
|
||||
if ($hook_callable) {
|
||||
// Call hook method
|
||||
$display = $module_instance->{'hook'.$hook_name}($hook_args);
|
||||
} elseif ($hook_retro_callable) {
|
||||
$display = $module_instance->{'hook'.$retro_hook_name}($hook_args);
|
||||
}
|
||||
$output .= $display;
|
||||
} elseif (Hook::isDisplayHookName($hook_name)) {
|
||||
if ($module_instance instanceof WidgetInterface) {
|
||||
$display = Hook::coreRenderWidget($module_instance, $hook_name, $hook_args);
|
||||
|
||||
$output .= $display;
|
||||
}
|
||||
}
|
||||
|
||||
if ($different_shop) {
|
||||
$context->shop = $old_shop;
|
||||
$context->shop->setContext($old_context, $shop->id);
|
||||
}
|
||||
return $output; // Return html string
|
||||
}
|
||||
}
|
||||
1168
modules/appagebuilder/classes/shortcodes/ApProductCarousel.php
Normal file
527
modules/appagebuilder/classes/shortcodes/ApProductList.php
Normal file
@@ -0,0 +1,527 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
use PrestaShop\PrestaShop\Adapter\Image\ImageRetriever;
|
||||
use PrestaShop\PrestaShop\Adapter\Product\PriceFormatter;
|
||||
use PrestaShop\PrestaShop\Core\Product\ProductListingPresenter;
|
||||
use PrestaShop\PrestaShop\Adapter\Product\ProductColorsRetriever;
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageBuilderProductsModel.php');
|
||||
|
||||
class ApProductList extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApProductList';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Product List'),
|
||||
'position' => 7,
|
||||
'desc' => $this->l('Create Product List'),
|
||||
'icon_class' => 'icon icon-th',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getAdditionConfig()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'value_by_categories',
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'value_by_product_type',
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'value_by_manufacture',
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'value_by_supplier',
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'value_by_product_id',
|
||||
'default' => '0'
|
||||
),
|
||||
array(
|
||||
'type' => '',
|
||||
'name' => 'value_by_tags',
|
||||
'default' => '0'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$selected_categories = array();
|
||||
if (Tools::getIsset('categorybox')) {
|
||||
$category_box = Tools::getValue('categorybox');
|
||||
$selected_categories = explode(',', $category_box);
|
||||
}
|
||||
//get all manufacture
|
||||
$manufacturers = Manufacturer::getManufacturers(false, 0, true, false, false, false, true);
|
||||
$suppliers = Supplier::getSuppliers();
|
||||
// $product_active = ApPageBuilderProductsModel::getActive();
|
||||
// $product_class = $product_active['class'];
|
||||
$profile = new ApPageBuilderProductsModel();
|
||||
$profile_list = $profile->getAllProductProfileByShop();
|
||||
array_unshift($profile_list, array('plist_key' => 'default', 'name' => $this->l('Use Default')));
|
||||
$id_root_category = Context::getContext()->shop->getCategory();
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'), 'lang' => 'true',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">'.$this->l('Step 1: Product Filter').'</div>',
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'value_by',
|
||||
'label' => $this->l('Select By'),
|
||||
'class' => 'checkbox-group',
|
||||
'desc' => $this->l('Select Product Condition'),
|
||||
'values' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'categories',
|
||||
'name' => $this->l('Categories'),
|
||||
'val' => '1'
|
||||
),
|
||||
array(
|
||||
'id' => 'product_type',
|
||||
'name' => $this->l('Product Type'),
|
||||
'val' => '1'
|
||||
),
|
||||
array(
|
||||
'id' => 'manufacture',
|
||||
'name' => $this->l('Manufacture'),
|
||||
'val' => '1'
|
||||
),
|
||||
array(
|
||||
'id' => 'supplier',
|
||||
'name' => $this->l('Supplier'),
|
||||
'val' => '1'
|
||||
),
|
||||
array(
|
||||
'id' => 'product_id',
|
||||
'name' => $this->l('Product Ids'),
|
||||
'val' => '1'
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'categories',
|
||||
'label' => $this->l('Select Category'),
|
||||
'name' => 'categorybox',
|
||||
'desc' => $this->l('You can select one or more, if not select we will not search by category'),
|
||||
'tree' => array(
|
||||
'root_category' => $id_root_category,
|
||||
'use_search' => false,
|
||||
'id' => 'categorybox',
|
||||
'use_checkbox' => true,
|
||||
'selected_categories' => $selected_categories,
|
||||
),
|
||||
'form_group_class' => 'value_by_categories',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Product of Category'),
|
||||
'name' => 'category_type',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'all', 'name' => $this->l('Get All Product of Category')),
|
||||
array('id' => 'default', 'name' => $this->l('Get Product if category is default category of product'))),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'value_by_categories',
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="sperator"></div>',
|
||||
'form_group_class' => 'value_by_categories',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Product Type'),
|
||||
'name' => 'product_type',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'all',
|
||||
'name' => $this->l('All Product'),
|
||||
),
|
||||
array(
|
||||
'id' => 'new_product',
|
||||
'name' => $this->l('New Product'),
|
||||
),
|
||||
array(
|
||||
'id' => 'best_sellers',
|
||||
'name' => $this->l('Best sellers'),
|
||||
),
|
||||
array(
|
||||
'id' => 'price_drop',
|
||||
'name' => $this->l('Special'),
|
||||
),
|
||||
array(
|
||||
'id' => 'home_featured',
|
||||
'name' => $this->l('Home Featured'),
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'value_by_product_type',
|
||||
'default' => 'all',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="sperator"></div>',
|
||||
'form_group_class' => 'value_by_product_type',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Manufacture'),
|
||||
'name' => 'manufacture[]',
|
||||
'multiple' => true,
|
||||
'options' => array(
|
||||
'query' => $manufacturers,
|
||||
'id' => 'id_manufacturer',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'aprow_exceptions',
|
||||
'default' => 'all',
|
||||
'form_group_class' => 'value_by_manufacture',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="sperator"></div>',
|
||||
'form_group_class' => 'value_by_manufacture',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Supplier'),
|
||||
'name' => 'supplier[]',
|
||||
'multiple' => true,
|
||||
'options' => array(
|
||||
'query' => $suppliers,
|
||||
'id' => 'id_supplier',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'value_by_supplier',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="sperator"></div>',
|
||||
'form_group_class' => 'value_by_supplier',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'product_id',
|
||||
'label' => $this->l('Product Ids'),
|
||||
'desc' => $this->l('Show product follow product id. Ex 1 or 1,2,3,4 '),
|
||||
'default' => '',
|
||||
'form_group_class' => 'value_by_product_id',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="sperator"></div>',
|
||||
'form_group_class' => 'value_by_product_id',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">'.$this->l('Step 2: Product Order And Limit').'</div>',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Order Way'),
|
||||
'class' => 'form-action',
|
||||
'name' => 'order_way',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array('id' => 'asc', 'name' => $this->l('Asc')),
|
||||
array('id' => 'desc', 'name' => $this->l('Desc')),
|
||||
array('id' => 'random', 'name' => $this->l('Random'))), // remove to increase speed
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Order By'),
|
||||
'name' => 'order_by',
|
||||
'options' => array(
|
||||
'query' => ApPageSetting::getOrderBy(),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'order_type_sub order_type-asc order_type-desc',
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Columns'),
|
||||
'name' => 'columns',
|
||||
'options' => array('query' => array(
|
||||
array('id' => '1', 'name' => $this->l('1 Column')),
|
||||
array('id' => '2', 'name' => $this->l('2 Columns')),
|
||||
array('id' => '3', 'name' => $this->l('3 Columns')),
|
||||
array('id' => '4', 'name' => $this->l('4 Columns')),
|
||||
array('id' => '5', 'name' => $this->l('5 Columns')),
|
||||
array('id' => '6', 'name' => $this->l('6 Columns')),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => '4',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'nb_products',
|
||||
'label' => $this->l('Limit'),
|
||||
'default' => '10',
|
||||
),
|
||||
//boostrap carousel end
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-info">'.$this->l('Step 3: Product Template').'</div>',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Product Template'),
|
||||
'name' => 'profile',
|
||||
'options' => array(
|
||||
'query' => $profile_list,
|
||||
'id' => 'plist_key',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Use Animation For Product Item'),
|
||||
'name' => 'use_animation',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1'
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Use Show More button'),
|
||||
'name' => 'use_showmore',
|
||||
'desc' => $this->l('Show button to load more product or hidden this function'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => '1'
|
||||
),
|
||||
);
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
$form_atts = $assign['formAtts'];
|
||||
$n = (int)isset($form_atts['nb_products']) ? $form_atts['nb_products'] : '10';
|
||||
$p = (int)Tools::getIsset('p') ? Tools::getValue('p') : '1';
|
||||
$form_atts['page_number'] = $p; // current page
|
||||
$form_atts['get_total'] = true; // sql param
|
||||
$module = APPageBuilder::getInstance();
|
||||
$total = $module->getProductsFont($form_atts);
|
||||
$total = (is_array($total) && count($total) > 0) ? count($total) : 0;
|
||||
$form_atts['total_page'] = $total_page = ceil(($total / $n));
|
||||
$is_more = $p < $total_page ? 'more' : '';
|
||||
|
||||
$products = array();
|
||||
if ($p <= $total_page) {
|
||||
$form_atts['get_total'] = false;
|
||||
$products = $module->getProductsFont($form_atts);
|
||||
$products = $this->loadProductDetail($products, $module);
|
||||
}
|
||||
|
||||
$assign['scolumn'] = $form_atts['columns'];
|
||||
$assign['products'] = $products;
|
||||
$assign['is_more'] = $is_more;
|
||||
$assign['p'] = $p + 1;
|
||||
|
||||
$assign['productClassWidget'] = $this->getProductClassByPListKey($assign['formAtts']['profile']);
|
||||
|
||||
if (isset($assign['formAtts']['profile']) && $assign['formAtts']['profile'] != 'default' && file_exists(apPageHelper::getConfigDir('theme_profiles').$assign['formAtts']['profile'] . '.tpl')) {
|
||||
$assign['product_item_path'] = apPageHelper::getConfigDir('theme_profiles') . $assign['formAtts']['profile'].'.tpl';
|
||||
} else {
|
||||
// Default load file in theme
|
||||
$assign['product_item_path'] = 'catalog/_partials/miniatures/product.tpl';
|
||||
}
|
||||
|
||||
# DATA FOR AJAX
|
||||
$apPConfig = $form_atts;
|
||||
// FIX : special charactor http://screencast.com/t/cEqFoIL5K
|
||||
unset($apPConfig['title']);
|
||||
$apPConfig['product_item_path'] = $assign['product_item_path'];
|
||||
|
||||
$assign['apPConfig'] = call_user_func('base64'.'_encode', Tools::jsonEncode($apPConfig));
|
||||
return $assign;
|
||||
}
|
||||
|
||||
public function ajaxProcessRender($module)
|
||||
{
|
||||
$assign = array();
|
||||
$params = array();
|
||||
$input = Tools::jsonDecode(call_user_func('base64'.'_decode', Tools::getValue('config')));
|
||||
$use_animation = Tools::getValue('use_animation');
|
||||
$n = (int)isset($input->nb_products) ? $input->nb_products : '10';
|
||||
$p = (int)Tools::getIsset('p') ? Tools::getValue('p') : '1';
|
||||
$params['value_by_categories'] = isset($input->value_by_categories) ? $input->value_by_categories : '0';
|
||||
$params['value_by_product_type'] = isset($input->value_by_product_type) ? $input->value_by_product_type : '0';
|
||||
$params['value_by_manufacture'] = isset($input->value_by_manufacture) ? $input->value_by_manufacture : '0';
|
||||
$params['value_by_supplier'] = isset($input->value_by_supplier) ? $input->value_by_supplier : '0';
|
||||
$params['categorybox'] = isset($input->categorybox) ? $input->categorybox : '';
|
||||
$params['category_type'] = isset($input->category_type) ? $input->category_type : '';
|
||||
$params['product_type'] = isset($input->product_type) ? $input->product_type : '';
|
||||
$params['manufacture'] = isset($input->manufacture) ? $input->manufacture : '';
|
||||
$params['supplier'] = isset($input->supplier) ? $input->supplier : '';
|
||||
$params['nb_products'] = $n;
|
||||
$params['page_number'] = $p;
|
||||
$params['order_by'] = isset($input->order_by) ? $input->order_by : '';
|
||||
$params['order_way'] = isset($input->order_way) ? $input->order_way : '';
|
||||
$params['get_total'] = true;
|
||||
$params['override_folder'] = isset($input->override_folder) ? $input->override_folder : '';
|
||||
$assign['product_item_path'] = $input->product_item_path;
|
||||
$total_page = $input->total_page;
|
||||
|
||||
|
||||
$is_more = ($p < $total_page) ? 'more' : '';
|
||||
$products = array();
|
||||
if ($p <= $total_page) {
|
||||
$params['get_total'] = false;
|
||||
$products = $module->getProductsFont($params);
|
||||
$products = $this->loadProductDetail($products, $module);
|
||||
}
|
||||
$assign['profile'] = (isset($input->profile) && $input->profile != 'default') ? $input->profile : '';
|
||||
$assign['products'] = $products;
|
||||
$assign['apAjax'] = 1;
|
||||
$assign['scolumn'] = $input->columns;
|
||||
$assign['formAtts']['use_animation'] = $use_animation;
|
||||
|
||||
$theme_name = _THEME_NAME_;
|
||||
$tpl_name = 'ApProductList.tpl';
|
||||
if (isset($params['override_folder']) && file_exists(_PS_ALL_THEMES_DIR_.$theme_name.'/modules/appagebuilder/views/templates/hook/'.$params['override_folder'].'/'.$tpl_name)) {
|
||||
// overide_folder
|
||||
$tpl_file = _PS_ALL_THEMES_DIR_.$theme_name.'/modules/appagebuilder/views/templates/hook/'.$params['override_folder'].'/'.$tpl_name;
|
||||
// } elseif (file_exists(_PS_ALL_THEMES_DIR_.$theme_name.'/modules/appagebuilder/views/templates/hook/'.$hook_name.'/'.$tpl_name) || file_exists(dirname(__FILE__).'/views/templates/hook/'.$hook_name.'/'.$tpl_name)) {
|
||||
// $tpl_file = 'views/templates/hook/'.$hook_name.'/'.$tpl_name;
|
||||
} elseif (file_exists(_PS_ALL_THEMES_DIR_.$theme_name.'/modules/appagebuilder/views/templates/hook/'.$tpl_name) || file_exists(dirname(__FILE__).'/views/templates/hook/'.$tpl_name)) {
|
||||
// theme folder
|
||||
$tpl_file = _PS_ALL_THEMES_DIR_.$theme_name.'/modules/appagebuilder/views/templates/hook/'.$tpl_name;
|
||||
} else {
|
||||
// module folder
|
||||
$tpl_file = _PS_MODULE_DIR_.'appagebuilder/views/templates/hook/'.$tpl_name;
|
||||
}
|
||||
|
||||
$imageRetriever = new ImageRetriever(Context::getContext()->link);
|
||||
$urls['no_picture_image'] = $imageRetriever->getNoPictureImage(Context::getContext()->language);
|
||||
Context::getContext()->smarty->assign('urls', $urls);
|
||||
|
||||
foreach ($assign as $key => $ass) {
|
||||
Context::getContext()->smarty->assign(array($key => $ass));
|
||||
}
|
||||
$html = Context::getContext()->smarty->fetch($tpl_file);
|
||||
|
||||
return array('html' => $html, 'is_more' => $is_more);
|
||||
}
|
||||
|
||||
public function loadProductDetail($products, $module)
|
||||
{
|
||||
# 1.7
|
||||
$assembler = new ProductAssembler(Context::getContext());
|
||||
$presenterFactory = new ProductPresenterFactory(Context::getContext());
|
||||
$presentationSettings = $presenterFactory->getPresentationSettings();
|
||||
$presenter = new ProductListingPresenter(
|
||||
new ImageRetriever(
|
||||
Context::getContext()->link
|
||||
),
|
||||
Context::getContext()->link,
|
||||
new PriceFormatter(),
|
||||
new ProductColorsRetriever(),
|
||||
Context::getContext()->getTranslator()
|
||||
);
|
||||
|
||||
$products_for_template = array();
|
||||
foreach ($products as $rawProduct)
|
||||
{
|
||||
$product_temp = $presenter->present(
|
||||
$presentationSettings,
|
||||
$assembler->assembleProduct($rawProduct),
|
||||
Context::getContext()->language
|
||||
);
|
||||
|
||||
# FIX 1.7.5.0
|
||||
if(is_object($product_temp) && method_exists($product_temp, 'jsonSerialize'))
|
||||
{
|
||||
$product_temp = $product_temp->jsonSerialize();
|
||||
}
|
||||
|
||||
# ADD SHORTCODE TO PRODUCT DESCRIPTION AND PRODUCT SHORT DESCRIPTION
|
||||
$product_temp['description'] = $module->buildShortCode($product_temp['description']);
|
||||
$product_temp['description_short'] = $module->buildShortCode($product_temp['description_short']);
|
||||
$products_for_template[] = $product_temp;
|
||||
}
|
||||
return $products_for_template;
|
||||
}
|
||||
}
|
||||
170
modules/appagebuilder/classes/shortcodes/ApProductTag.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApProductTag extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApProductTag';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array(
|
||||
'label' => $this->l('Product Tags'),
|
||||
'position' => 4,
|
||||
'desc' => $this->l('Show Product Tags at Frontend'),
|
||||
'icon_class' => 'icon icon-tags',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$accordion_type = array(
|
||||
array(
|
||||
'value' => 'full',
|
||||
'text' => $this->l('Always Full')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion',
|
||||
'text' => $this->l('Always Accordion')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion_small_screen',
|
||||
'text' => $this->l('Accordion at small screen')
|
||||
),
|
||||
);
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'autoload_rte' => false,
|
||||
'values' => '',
|
||||
'class' => 'sub_title',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Accordion Type'),
|
||||
'name' => 'accordion_type',
|
||||
'options' => array(
|
||||
'query' => $accordion_type,
|
||||
'id' => 'value',
|
||||
'name' => 'text'
|
||||
),
|
||||
'default' => 'full',
|
||||
'hint' => $this->l('Select a Accordion Type'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'displayed_tags',
|
||||
'label' => $this->l('Displayed tags'),
|
||||
'desc' => $this->l('Set the number of tags you would like to see displayed in this block. (default: 10)'),
|
||||
'lang' => 'false',
|
||||
'default' => '10'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'tag_levels',
|
||||
'label' => $this->l('Tag levels'),
|
||||
'desc' => $this->l('Set the number of different tag levels you would like to use. (default: 3) '),
|
||||
'lang' => 'false',
|
||||
'default' => '10'
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Random display'),
|
||||
'name' => 'random_display',
|
||||
'class' => 'fixed-width-xs',
|
||||
'desc' => $this->l('If enabled, displays tags randomly. By default, random display is disabled and the most used tags are displayed first.'),
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled')
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled')
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
|
||||
$id_lang = (int) Context::getContext()->language->id;
|
||||
$displayed_tags = isset($assign['formAtts']['displayed_tags']) ? (int)$assign['formAtts']['displayed_tags'] : 10;
|
||||
$tag_levels = isset($assign['formAtts']['tag_levels']) ? (int)$assign['formAtts']['tag_levels'] : 10;
|
||||
$random_display = isset($assign['formAtts']['random_display']) ? (int)$assign['formAtts']['random_display'] : 0;
|
||||
|
||||
$tags = Tag::getMainTags($id_lang, $displayed_tags);
|
||||
|
||||
$max = -1;
|
||||
$min = -1;
|
||||
foreach ($tags as $tag) {
|
||||
if ($tag['times'] > $max) {
|
||||
$max = $tag['times'];
|
||||
}
|
||||
if ($tag['times'] < $min || $min == -1) {
|
||||
$min = $tag['times'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($min == $max) {
|
||||
$coef = $max;
|
||||
} else {
|
||||
$coef = ($tag_levels - 1) / ($max - $min);
|
||||
}
|
||||
|
||||
if (!count($tags)) {
|
||||
return $assign;
|
||||
}
|
||||
if ($random_display) {
|
||||
shuffle($tags);
|
||||
}
|
||||
foreach ($tags as &$tag) {
|
||||
$tag['class'] = 'tag_level'.(int)(($tag['times'] - $min) * $coef + 1);
|
||||
}
|
||||
|
||||
$assign['formAtts']['tags'] = $tags;
|
||||
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
120
modules/appagebuilder/classes/shortcodes/ApQuicklogin.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApQuicklogin extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApQuicklogin';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Quicklogin Module'), 'position' => 3, 'desc' => $this->l('You set quick login or social login form from leoquicklogin module'),
|
||||
'icon_class' => 'icon icon-chevron-right', 'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
if (Module::isInstalled('leoquicklogin') && Module::isEnabled('leoquicklogin')) {
|
||||
include_once(_PS_MODULE_DIR_.'leoquicklogin/leoquicklogin.php');
|
||||
$module = new Leoquicklogin();
|
||||
$select_list_type = array();
|
||||
|
||||
foreach ($module->list_type as $key => $value) {
|
||||
$select_list_type[] = array('id' => $key, 'name' => $value);
|
||||
}
|
||||
|
||||
$select_list_layout = array();
|
||||
|
||||
foreach ($module->list_layout as $key => $value) {
|
||||
$select_list_layout[] = array('id' => $key, 'name' => $value);
|
||||
}
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Select type'),
|
||||
'name' => 'quicklogin_type',
|
||||
'options' => array(
|
||||
'query' => $select_list_type,
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Select layout'),
|
||||
'name' => 'quicklogin_layout',
|
||||
'options' => array(
|
||||
'query' => $select_list_layout,
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Show Social Login'),
|
||||
'name' => 'quicklogin_sociallogin',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'enable',
|
||||
'name' => $this->l('Yes'),
|
||||
),
|
||||
array(
|
||||
'id' => 'disable',
|
||||
'name' => $this->l('No'),
|
||||
)),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-warning">'.
|
||||
$this->l('"Leoquicklogin module" Module must be installed and enabled before using.').
|
||||
'</div><br/><h4><center>You can take this module at leo-theme or apollo-theme</center></h4>'
|
||||
)
|
||||
);
|
||||
}
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
if (Module::isInstalled('leoquicklogin') && Module::isEnabled('leoquicklogin')) {
|
||||
$assign['formAtts']['isEnabled'] = true;
|
||||
include_once(_PS_MODULE_DIR_.'leoquicklogin/leoquicklogin.php');
|
||||
$module = new Leoquicklogin();
|
||||
|
||||
$assign['content_quicklogin'] = $module->processHookCallBack($assign['formAtts']['quicklogin_type'], $assign['formAtts']['quicklogin_layout'], $assign['formAtts']['quicklogin_sociallogin']);
|
||||
} else {
|
||||
// validate module
|
||||
$assign['formAtts']['isEnabled'] = false;
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show Leoquicklogin via Appagebuilder. Please enable Leoquicklogin module.';
|
||||
}
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
70
modules/appagebuilder/classes/shortcodes/ApRawHtml.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApRawHtml extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApRawHtml';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Raw Html'), 'position' => 3, 'desc' => $this->l('You can put raw html'),
|
||||
'icon_class' => 'icon-html5', 'tag' => 'content structure');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'content_html',
|
||||
'class' => 'ap_html_raw raw-'.time(),
|
||||
'rows' => '50',
|
||||
'lang' => true,
|
||||
'label' => $this->l('Raw html'),
|
||||
'values' => '',
|
||||
'default' => "<div>\n</div>"
|
||||
),
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
}
|
||||
774
modules/appagebuilder/classes/shortcodes/ApRow.php
Normal file
@@ -0,0 +1,774 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageBuilderHookModel.php');
|
||||
|
||||
class ApRow extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApRow';
|
||||
public $for_module = 'manage';
|
||||
public $show_upload = '1';
|
||||
public $atribute = array('el_class' => '');
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Row'), 'position' => 1,
|
||||
'desc' => $this->l('Each row can have one or more Column'),
|
||||
'tag' => 'content structure');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'tabConfig',
|
||||
'name' => 'tabConfig',
|
||||
'values' => array(
|
||||
'aprow_general' => $this->l('General'),
|
||||
'aprow_style' => $this->l('Style'),
|
||||
'aprow_background' => $this->l('Background'),
|
||||
// 'aprow_animation' => $this->l('Animation'),
|
||||
'aprow_exceptions' => $this->l('Exceptions'))
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'id',
|
||||
'label' => $this->l('ID'),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'desc' => $this->l('Use for css and javascript'),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'container',
|
||||
'label' => $this->l('Class container'),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'desc' => $this->getDescriptionContainerInput(),
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'ApRowclass',
|
||||
'name' => 'class',
|
||||
'leolabel' => 'CSS Class',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => 'row'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'min_height',
|
||||
'label' => $this->l('Minimum height'),
|
||||
'desc' => $this->l('You can use pixels : 10px or percents : 10%.'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_style',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Margin Top'),
|
||||
'name' => 'margin_top',
|
||||
'desc' => $this->l('You can use pixels :10px or percents : 10%.'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_style',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Margin Bottom'),
|
||||
'name' => 'margin_bottom',
|
||||
'desc' => $this->l('You can use pixels :10px or percents : 10%.'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_style',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Padding Top'),
|
||||
'name' => 'padding_top',
|
||||
'desc' => $this->l('You can use pixels :10px or percents : 10%.'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_style',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Padding Bottom'),
|
||||
'name' => 'padding_bottom',
|
||||
'desc' => $this->l('You can use pixels : 10px or percents : 10%.'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_style',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Background Config'),
|
||||
'name' => 'bg_config',
|
||||
'default' => 'boxed',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'fullwidth',
|
||||
'name' => $this->l('Full width'),
|
||||
),
|
||||
array(
|
||||
'id' => 'boxed',
|
||||
'name' => $this->l('Boxed'),
|
||||
),
|
||||
array(
|
||||
'id' => 'none',
|
||||
'name' => $this->l('None'),
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'aprow_background',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Background Type'),
|
||||
'name' => 'bg_type',
|
||||
'class' => 'form-action',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'normal',
|
||||
'name' => $this->l('Normal'),
|
||||
),
|
||||
array(
|
||||
'id' => 'fixed',
|
||||
'name' => $this->l('Fixed'),
|
||||
),
|
||||
array(
|
||||
'id' => 'parallax',
|
||||
'name' => $this->l('Parallax'),
|
||||
),
|
||||
array(
|
||||
'id' => 'mouseparallax',
|
||||
'name' => $this->l('Mouse Parallax'),
|
||||
),
|
||||
// array(
|
||||
// 'id' => 'video_youtube',
|
||||
// 'name' => $this->l('Video Youtube'),
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'video_vimeo',
|
||||
// 'name' => $this->l('Vimeo video'),
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => 'video_html5',
|
||||
// 'name' => $this->l('HTML5'),
|
||||
// )
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'aprow_background',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Background size'),
|
||||
'name' => 'bg_size',
|
||||
'desc' => $this->l('Set CSS value for the background size. (Ex: contain, cover, 50% 100%, 100px 200px,..)'),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-normal bg_type-fixed bg_type-parallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'label' => $this->l('Background color'),
|
||||
'name' => 'bg_color',
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-normal bg_type-fixed bg_type-parallax bg_type-mouseparallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<script type="text/javascript" src="'.__PS_BASE_URI__.apPageHelper::getJsDir().'colorpicker/js/leo.jquery.colorpicker.js"></script>',
|
||||
),
|
||||
array(
|
||||
'type' => 'bg_img',
|
||||
'label' => $this->l('Background image'),
|
||||
'name' => 'bg_img',
|
||||
'img_link' => _THEME_IMG_DIR_.'modules/'.$this->module_name.'/images/',
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-normal bg_type-fixed bg_type-parallax bg_type-mouseparallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Background position'),
|
||||
'name' => 'bg_position',
|
||||
'desc' => $this->l('Set CSS value for the background image position. (Ex: center top, right bottom, 50% 50%, 100px 200px,..)'),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-normal bg_type-fixed bg_type-parallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Background repeat'),
|
||||
'name' => 'bg_repeat',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'no-repeat',
|
||||
'name' => $this->l('No repeat'),
|
||||
),
|
||||
array(
|
||||
'id' => 'repeat',
|
||||
'name' => $this->l('Repeat All'),
|
||||
),
|
||||
array(
|
||||
'id' => 'repeat-x',
|
||||
'name' => $this->l('repeat horizontally only'),
|
||||
),
|
||||
array(
|
||||
'id' => 'repeat-y',
|
||||
'name' => $this->l('repeat vertically only'),
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-normal bg_type-fixed bg_type-parallax bg_type-mouseparallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Parallax speed'),
|
||||
'name' => 'parallax_speed',
|
||||
'default' => '0.1',
|
||||
'desc' => $this->l('Set the background speed, this is relative to the natural scroll speed (Ex: 0, 0.5, 1, 2).'),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-parallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Parallax axis'),
|
||||
'desc' => $this->l('Select axis effect for this background.'),
|
||||
'name' => 'parallax_axis',
|
||||
'desc' => $this->l('Select axis effect for this background.'),
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'both',
|
||||
'name' => $this->l('Both'),
|
||||
),
|
||||
array(
|
||||
'id' => 'axis-x',
|
||||
'name' => $this->l('Axis X (horizontally)'),
|
||||
),
|
||||
array(
|
||||
'id' => 'axis-y',
|
||||
'name' => $this->l('Axis Y (vertically)'),
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-mouseparallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Parallax strength'),
|
||||
'name' => 'parallax_strength',
|
||||
'default' => '0.5',
|
||||
'desc' => $this->l('Set the background strength, this is relative to the natural mouse speed (Ex: 0, 0.5, 1, 2).'),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-mouseparallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Parallax rid'),
|
||||
'name' => 'parallax_rid',
|
||||
'default' => '0.5',
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-mouseparallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Parallax horizontal offsets'),
|
||||
'name' => 'parallax_hoffsets',
|
||||
'default' => '0.1',
|
||||
'desc' => $this->l('Set the global alignment horizontal offset'),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-parallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Parallax vertical speed'),
|
||||
'name' => 'parallax_voffsets',
|
||||
'default' => '0.1',
|
||||
'desc' => $this->l('Set the global alignment vertical offset'),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-parallax',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Video background'),
|
||||
'name' => 'video_link',
|
||||
'default' => '',
|
||||
'desc' => $this->l('Put video youtube link or vimeo'),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-video_html5',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Video ID'),
|
||||
'name' => 'video_id',
|
||||
'default' => '',
|
||||
'desc' => $this->l('Put video ID of youtube link or vimeo'),
|
||||
'form_group_class' => 'aprow_background bg_type_sub bg_type-video_youtube bg_type-video_vimeo',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Specific Controller'),
|
||||
'name' => 'specific_type',
|
||||
'class' => 'form-action',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'all',
|
||||
'name' => $this->l('Show on all Page Controller'),
|
||||
),
|
||||
array(
|
||||
'id' => 'index',
|
||||
'name' => $this->l('Show on only Index'),
|
||||
),
|
||||
array(
|
||||
'id' => 'category',
|
||||
'name' => $this->l('Show on only Category'),
|
||||
),
|
||||
array(
|
||||
'id' => 'product',
|
||||
'name' => $this->l('Show on only Product'),
|
||||
),
|
||||
array(
|
||||
'id' => 'cms',
|
||||
'name' => $this->l('Show on only CMS'),
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'aprow_exceptions',
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'reloadControler',
|
||||
'label' => $this->l('AJAX Reload Controller'),
|
||||
'name' => 'reloadControler',
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_exceptions specific_type_sub specific_type-all',
|
||||
'hint' => 'If website have new a Controller, click to generate Controller again.',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Controller ID'),
|
||||
'name' => 'controller_id',
|
||||
'desc' => $this->l('Example: 1,2,3'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'aprow_exceptions specific_type_sub specific_type-category specific_type-product specific_type-cms',
|
||||
),
|
||||
array(
|
||||
'type' => 'apExceptions',
|
||||
'name' => 'controller_pages',
|
||||
'form_group_class' => 'aprow_exceptions specific_type_sub specific_type-all',
|
||||
),
|
||||
);
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
// $display_module_exception = '';
|
||||
//
|
||||
// if (Tools::getValue('reloadControllerException')) {
|
||||
// # ReLoad : write to config
|
||||
// $display_module_exception = $this->displayModuleExceptionList();
|
||||
//
|
||||
// $ap_cache_controller_exception = apPageHelper::correctEnCodeData($display_module_exception);
|
||||
// Configuration::updateValue('AP_CACHE_CONTROLLER_EXCEPTION', $ap_cache_controller_exception);
|
||||
// } else {
|
||||
//
|
||||
// $display_module_exception = Configuration::get('AP_CACHE_CONTROLLER_EXCEPTION');
|
||||
// if ($display_module_exception === false)
|
||||
// {
|
||||
// # First Time : write to config
|
||||
// $display_module_exception = $this->displayModuleExceptionList();
|
||||
//
|
||||
// $ap_cache_controller_exception = apPageHelper::correctEnCodeData($display_module_exception);
|
||||
// Configuration::updateValue('AP_CACHE_CONTROLLER_EXCEPTION', $ap_cache_controller_exception);
|
||||
// } else {
|
||||
// # Second Time : read from config
|
||||
// $display_module_exception = apPageHelper::correctDeCodeData($display_module_exception);
|
||||
// }
|
||||
// }
|
||||
// $this->helper->tpl_vars['exception_list'] = $display_module_exception;
|
||||
$this->helper->module = new $this->module_name();
|
||||
$this->helper->tpl_vars['link'] = Context::getContext()->link;
|
||||
$this->helper->tpl_vars['exception_list'] = $this->displayModuleExceptionList();
|
||||
}
|
||||
|
||||
public function displayModuleExceptionList()
|
||||
{
|
||||
$controllers = array();
|
||||
$controllers_modules = array();
|
||||
$controllers_modules['admin'] = array();
|
||||
$controllers_modules['front'] = array();
|
||||
|
||||
if (Tools::getValue('reloadControllerException')) {
|
||||
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
|
||||
$controllers_modules = array(
|
||||
'admin' => Dispatcher::getModuleControllers('admin'),
|
||||
'front' => Dispatcher::getModuleControllers('front'),
|
||||
);
|
||||
|
||||
Configuration::updateValue('AP_CACHE_FRONT_CONTROLLER_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers)));
|
||||
Configuration::updateValue('AP_CACHE_FRONT_MODULE_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers_modules['admin'])));
|
||||
Configuration::updateValue('AP_CACHE_ADMIN_MODULE_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers_modules['front'])));
|
||||
} else {
|
||||
if (Configuration::get('AP_CACHE_FRONT_CONTROLLER_EXCEPTION') === false) {
|
||||
# First Time : write to config
|
||||
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
|
||||
Configuration::updateValue('AP_CACHE_FRONT_CONTROLLER_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers)));
|
||||
} else {
|
||||
# Second Time : read from config
|
||||
$controllers = Tools::jsonDecode(apPageHelper::correctDeCodeData(Configuration::get('AP_CACHE_FRONT_CONTROLLER_EXCEPTION')), true);
|
||||
}
|
||||
|
||||
if (Configuration::get('AP_CACHE_FRONT_MODULE_EXCEPTION') === false) {
|
||||
# First Time : write to config
|
||||
$controllers_modules['admin'] = Dispatcher::getModuleControllers('admin');
|
||||
Configuration::updateValue('AP_CACHE_FRONT_MODULE_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers_modules['admin'])));
|
||||
} else {
|
||||
# Second Time : read from config
|
||||
$controllers_modules['admin'] = Tools::jsonDecode(apPageHelper::correctDeCodeData(Configuration::get('AP_CACHE_FRONT_MODULE_EXCEPTION')), true);
|
||||
}
|
||||
|
||||
if (Configuration::get('AP_CACHE_ADMIN_MODULE_EXCEPTION') === false) {
|
||||
# First Time : write to config
|
||||
$controllers_modules['front'] = Dispatcher::getModuleControllers('front');
|
||||
Configuration::updateValue('AP_CACHE_ADMIN_MODULE_EXCEPTION', apPageHelper::correctEnCodeData(Tools::jsonEncode($controllers_modules['front'])));
|
||||
} else {
|
||||
# Second Time : read from config
|
||||
$controllers_modules['front'] = Tools::jsonDecode(apPageHelper::correctDeCodeData(Configuration::get('AP_CACHE_ADMIN_MODULE_EXCEPTION')), true);
|
||||
}
|
||||
}
|
||||
|
||||
$controller = Tools::getValue('controller_pages');
|
||||
$arr_controllers = explode(',', $controller);
|
||||
$arr_controllers = array_map('trim', $arr_controllers);
|
||||
|
||||
$modules_controllers_type = array('front' => $this->l('Front modules controller'), 'admin' => $this->l('Admin modules controller'));
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'_core_' => $this->l('________________________________________ CORE ________________________________________'),
|
||||
'controller' => $controller,
|
||||
'arr_controllers' => $arr_controllers,
|
||||
'controllers' => $controllers,
|
||||
'modules_controllers_type' => $modules_controllers_type,
|
||||
'controllers_modules' => $controllers_modules,
|
||||
));
|
||||
$content = Context::getContext()->smarty->fetch(apPageHelper::getShortcodeTemplatePath('ApRow.tpl'));
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
// validate module
|
||||
unset($module);
|
||||
$form_atts = $assign['formAtts'];
|
||||
|
||||
//process back-ground
|
||||
$form_atts['bg_class'] = '';
|
||||
$form_atts['bg_data'] = '';
|
||||
$form_atts['parallax'] = '';
|
||||
$form_atts['bg_video'] = '';
|
||||
|
||||
//1. set class
|
||||
if (isset($form_atts['bg_config']) && $form_atts['bg_config'] != 'none') {
|
||||
$form_atts['bg_class'] = 'has-bg';
|
||||
//video
|
||||
if (isset($form_atts['bg_type']) && ($form_atts['bg_type'] == 'video_youtube' || $form_atts['bg_type'] == 'video_youtube' || $form_atts['bg_type'] == 'video_youtube')) {
|
||||
// validate module
|
||||
$form_atts['bg_video'] = $this->getBgStyleVideo($form_atts);
|
||||
} else {
|
||||
if ($form_atts['bg_config'] == 'boxed') {
|
||||
// validate module
|
||||
$form_atts['bg_class'] .= ' bg-boxed';
|
||||
} else {
|
||||
if (isset($form_atts['container']) && $form_atts['container']) {
|
||||
// validate module
|
||||
$form_atts['bg_class'] .= ' bg-fullwidth-container';
|
||||
} else {
|
||||
$form_atts['id'] = (isset($form_atts['id']) && $form_atts['id'] != '') ? $form_atts['id'] : $form_atts['form_id'];
|
||||
$form_atts['bg_class'] .= ' bg-fullwidth';
|
||||
}
|
||||
}
|
||||
if (isset($form_atts['bg_color']) && $form_atts['bg_color']) {
|
||||
// validate module
|
||||
$form_atts['bg_data'] .= ' '.$form_atts['bg_color'];
|
||||
}
|
||||
if (isset($form_atts['bg_img']) && $form_atts['bg_img']) {
|
||||
if (strpos($form_atts['bg_img'], '/') == false) {
|
||||
// validate module
|
||||
$form_atts['bg_img'] = _THEME_IMG_DIR_.'modules/'.$this->module_name.'/images/'.$form_atts['bg_img'];
|
||||
}
|
||||
$form_atts['bg_data'] .= ' url('.$form_atts['bg_img'].')';
|
||||
}
|
||||
if (isset($form_atts['bg_type']) && $form_atts['bg_type'] == 'fixed') {
|
||||
// validate module
|
||||
$form_atts['bg_data'] .= ' fixed';
|
||||
}
|
||||
if ($form_atts['bg_repeat']) {
|
||||
// validate module
|
||||
$form_atts['bg_data'] .= ' '.$form_atts['bg_repeat'];
|
||||
}
|
||||
if (isset($form_atts['bg_position']) && $form_atts['bg_position']) {
|
||||
// validate module
|
||||
$form_atts['bg_data'] .= ' '.$form_atts['bg_position'];
|
||||
}
|
||||
if (isset($form_atts['bg_size']) && $form_atts['bg_size']) {
|
||||
if (!empty($form_atts['bg_data'])) {
|
||||
$form_atts['bg_data'] .= '; ';
|
||||
}
|
||||
|
||||
$form_atts['bg_data'] .= 'background-size: '.$form_atts['bg_size'];
|
||||
}
|
||||
//config for background style - stela - stela
|
||||
if (isset($form_atts['bg_type']) && $form_atts['bg_type'] == 'parallax') {
|
||||
$form_atts['bg_class'] .= ' bg-parallax';
|
||||
$hoffset = (isset($form_atts['parallax_hoffsets']) && $form_atts['parallax_hoffsets']) ? $form_atts['parallax_hoffsets'] : '40';
|
||||
$voffset = (isset($form_atts['parallax_voffsets']) && $form_atts['parallax_voffsets']) ? $form_atts['parallax_voffsets'] : '150';
|
||||
$bratio = (isset($form_atts['parallax_speed']) && $form_atts['parallax_speed']) ? $form_atts['parallax_speed'] : '0.5';
|
||||
|
||||
$form_atts['id'] = (isset($form_atts['id']) && $form_atts['id'] != '') ? $form_atts['id'] : $form_atts['form_id'];
|
||||
|
||||
$form_atts['parallax'] = 'data-stellar-horizontal-offset="'
|
||||
.$hoffset.'" data-stellar-vertical-offset="'.$voffset.'" data-stellar-background-ratio="'.$bratio.'"';
|
||||
}
|
||||
|
||||
if (isset($form_atts['bg_type']) && $form_atts['bg_type'] == 'mouseparallax') {
|
||||
$strength = (isset($form_atts['parallax_strength']) && $form_atts['parallax_strength']) ? $form_atts['parallax_strength'] : '40';
|
||||
$axis = (isset($form_atts['parallax_axis']) && $form_atts['parallax_axis']) ? $form_atts['parallax_axis'] : 'both';
|
||||
$rid = (isset($form_atts['parallax_rid']) && $form_atts['parallax_rid']) ? $form_atts['parallax_rid'] : '0.5';
|
||||
|
||||
$form_atts['id'] = $form_atts['form_id'];
|
||||
|
||||
$form_atts['parallax'] = 'data-mouse-parallax-strength="'.$strength.'" data-mouse-parallax-axis="'.$axis.'" data-mouse-parallax-rid="'.$rid.'"';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($form_atts['bg_img']) && isset($form_atts['img_link'])) {
|
||||
if ($form_atts['bg_img'] == '' && $form_atts['img_link'] != '') {
|
||||
// validate module
|
||||
$form_atts['bg_img'] = $form_atts['img_link'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($form_atts['animation']) || $form_atts['animation'] == 'none') {
|
||||
$form_atts['animation'] = 'none';
|
||||
$form_atts['animation_delay'] = '';
|
||||
} elseif ($form_atts['animation'] != 'none') {
|
||||
// validate module
|
||||
//DONGND:: add more config for animation
|
||||
if ((int)$form_atts['animation_delay'] >= 0) {
|
||||
$form_atts['animation_delay'] .= 's';
|
||||
} else {
|
||||
$form_atts['animation_delay'] = '1s';
|
||||
}
|
||||
|
||||
if (isset($form_atts['animation_duration']) && (int)$form_atts['animation_duration'] >= 0) {
|
||||
$form_atts['animation_duration'] .= 's';
|
||||
} else {
|
||||
$form_atts['animation_duration'] = '1s';
|
||||
}
|
||||
|
||||
if (isset($form_atts['animation_iteration_count']) && (int)$form_atts['animation_iteration_count'] > 0) {
|
||||
$form_atts['animation_iteration_count'] = (int)$form_atts['animation_iteration_count'];
|
||||
} else {
|
||||
$form_atts['animation_iteration_count'] = 1;
|
||||
}
|
||||
};
|
||||
|
||||
# set style
|
||||
$assign['formAtts'] = $form_atts;
|
||||
$form_atts['css_style'] = $this->showCSSStyle($assign);
|
||||
$assign['formAtts']['css_style'] = $this->showCSSStyle($assign);
|
||||
$this->checkFullwidth($assign);
|
||||
|
||||
return $assign;
|
||||
}
|
||||
|
||||
public function checkFullwidth(&$assign)
|
||||
{
|
||||
$page_name = apPageHelper::getPageName();
|
||||
$hook_name = ApShortCodesBuilder::$hook_name;
|
||||
|
||||
$hook_model = new ApPageBuilderHookModel();
|
||||
$hook_model->create();
|
||||
if ($page_name == 'index') {
|
||||
$hooks = $hook_model->fullwidth_index_hook;
|
||||
} else {
|
||||
$hooks = $hook_model->fullwidth_other_hook;
|
||||
}
|
||||
|
||||
if (isset($hooks[$hook_name]) && $hooks[$hook_name] == ApPageSetting::HOOK_FULWIDTH_INDEXPAGE) {
|
||||
// validate module
|
||||
$assign['formAtts']['container_remove'] = '0';
|
||||
} else {
|
||||
# remove container class - BEGIN
|
||||
if (isset($assign['formAtts']['container'])) {
|
||||
$str_search = array('/\bcontainer\b/');
|
||||
$str_replace = array('');
|
||||
$str_subject = $assign['formAtts']['container'];
|
||||
|
||||
$assign['formAtts']['container'] = preg_replace($str_search, $str_replace, $str_subject);
|
||||
$assign['formAtts']['container_remove'] = '1';
|
||||
}
|
||||
# remove container class - END
|
||||
}
|
||||
}
|
||||
|
||||
public function getHookLayout()
|
||||
{
|
||||
$hook_name = Tools::getValue('hook_name');
|
||||
|
||||
$hook_model = new ApPageBuilderHookModel();
|
||||
$hook_model->create();
|
||||
|
||||
return $hook_model->fullwidthHook($hook_name, 'index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Live
|
||||
* not follow in database
|
||||
*/
|
||||
public function getRowLayOut($hook_layout)
|
||||
{
|
||||
$row_layout = ApPageSetting::ROW_BOXED;
|
||||
if ($hook_layout == ApPageSetting::HOOK_FULWIDTH_INDEXPAGE) {
|
||||
$row_container = Tools::getValue('container');
|
||||
if (!preg_match('/\bcontainer\b/', $row_container)) {
|
||||
// validate module
|
||||
$row_layout = ApPageSetting::ROW_FULWIDTH_INDEXPAGE;
|
||||
}
|
||||
}
|
||||
|
||||
return $row_layout;
|
||||
}
|
||||
|
||||
public function getDescriptionContainerInput()
|
||||
{
|
||||
$hook_layout = $this->getHookLayout();
|
||||
$row_layout = $this->getRowLayOut($hook_layout);
|
||||
|
||||
$id_profile = Tools::getValue('id_appagebuilder_profiles');
|
||||
$url_profile_edit = Context::getContext()->link->getAdminLink('AdminApPageBuilderProfiles').
|
||||
'&id_appagebuilder_profiles='.$id_profile.'&updateappagebuilder_profiles';
|
||||
$link = '<a href="'.$url_profile_edit.'" target="blank">edit profile</a>';
|
||||
|
||||
$hook_name = Tools::getValue('hook_name');
|
||||
|
||||
$row_layout_text = 'Boxed';
|
||||
if ($row_layout) {
|
||||
// validate module
|
||||
$row_layout_text = 'Fullwidth';
|
||||
}
|
||||
|
||||
$row_contain_class = 0;
|
||||
$row_container = Tools::getValue('container');
|
||||
if (preg_match('/\bcontainer\b/', $row_container)) {
|
||||
// validate module
|
||||
$row_contain_class = 1;
|
||||
}
|
||||
if ($row_layout) {
|
||||
# fullwidth
|
||||
$desc = 'Now Layout of Row is <strong>'.$row_layout_text.'</strong>, to change to Boxed :';
|
||||
$desc .= '<br />';
|
||||
$desc .= '- Typing "container" to above textbox.';
|
||||
} else {
|
||||
# boxed
|
||||
$desc = 'Now Layout of Row is <strong>'.$row_layout_text.'</strong>, to change to Fullwidth :';
|
||||
if ($row_contain_class) {
|
||||
$desc .= '<br />';
|
||||
$desc .= '- Removing "container" above textbox.';
|
||||
}
|
||||
if ($hook_layout == ApPageSetting::HOOK_BOXED) {
|
||||
$desc .= '<br />';
|
||||
$desc .= '- Going to '.$link.' check option "'.$hook_name.'" hook of "Fullwidth Homepage"';
|
||||
}
|
||||
}
|
||||
return $desc;
|
||||
}
|
||||
|
||||
public function showCSSStyle($assign)
|
||||
{
|
||||
$form_atts = $assign['formAtts'];
|
||||
$style = 'style="';
|
||||
if (isset($form_atts['bg_config']) && $form_atts['bg_config'] == 'boxed' && isset($form_atts['bg_data']) && $form_atts['bg_data']) {
|
||||
$style .= 'background:'.$form_atts['bg_data'].';';
|
||||
}
|
||||
if (isset($form_atts['min_height']) && $form_atts['min_height']) {
|
||||
$style .= 'min-height: '.$form_atts['min_height'].';';
|
||||
}
|
||||
if (isset($form_atts['margin_top']) && $form_atts['margin_top']) {
|
||||
$style .= 'margin-top: '.$form_atts['margin_top'].';';
|
||||
}
|
||||
if (isset($form_atts['margin_bottom']) && $form_atts['margin_bottom']) {
|
||||
$style .= 'margin-bottom: '.$form_atts['margin_bottom'].';';
|
||||
}
|
||||
if (isset($form_atts['padding_top']) && $form_atts['padding_top']) {
|
||||
$style .= 'padding-top: '.$form_atts['padding_top'].';';
|
||||
}
|
||||
if (isset($form_atts['padding_bottom']) && $form_atts['padding_bottom']) {
|
||||
$style .= 'padding-bottom: '.$form_atts['padding_bottom'].';';
|
||||
}
|
||||
$style .= '"';
|
||||
return $style;
|
||||
}
|
||||
|
||||
public function getPageName()
|
||||
{
|
||||
// Are we in a payment module
|
||||
$module_name = '';
|
||||
if (Validate::isModuleName(Tools::getValue('module'))) {
|
||||
$module_name = Tools::getValue('module');
|
||||
}
|
||||
|
||||
if (!empty($this->page_name)) {
|
||||
$page_name = $this->page_name;
|
||||
} elseif (!empty($this->php_self)) {
|
||||
$page_name = $this->php_self;
|
||||
} elseif (Tools::getValue('fc') == 'module' && $module_name != '' && (Module::getInstanceByName($module_name) instanceof PaymentModule)) {
|
||||
$page_name = 'module-payment-submit';
|
||||
} elseif (preg_match('#^'.preg_quote(Context::getContext()->shop->physical_uri, '#').'modules/([a-zA-Z0-9_-]+?)/(.*)$#', $_SERVER['REQUEST_URI'], $m)) {
|
||||
// @retrocompatibility Are we in a module ?
|
||||
$page_name = 'module-'.$m[1].'-'.str_replace(array('.php', '/'), array('', '-'), $m[2]);
|
||||
} else {
|
||||
$page_name = Dispatcher::getInstance()->getController();
|
||||
$page_name = (preg_match('/^[0-9]/', $page_name) ? 'page_'.$page_name : $page_name);
|
||||
}
|
||||
|
||||
return $page_name;
|
||||
}
|
||||
}
|
||||
141
modules/appagebuilder/classes/shortcodes/ApSlideShow.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApSlideShow extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApSlideShow';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Slide show Module'), 'position' => 3, 'desc' => $this->l('You can get group from leoslideshow module'),
|
||||
'icon_class' => 'icon icon-chevron-right', 'tag' => 'content slider');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
if (Module::isInstalled('leoslideshow') && Module::isEnabled('leoslideshow')) {
|
||||
include_once(_PS_MODULE_DIR_.'leoslideshow/leoslideshow.php');
|
||||
$module = new LeoSlideshow();
|
||||
$list = $module->getAllSlides();
|
||||
$controller = 'AdminModules';
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
$params = array('token' => Tools::getAdminTokenLite($controller),
|
||||
'configure' => 'leoslideshow',
|
||||
'tab_module' => 'front_office_features',
|
||||
'module_name' => 'leoslideshow');
|
||||
$url = dirname($_SERVER['PHP_SELF']).'/'.Dispatcher::getInstance()->createUrl($controller, $id_lang, $params, false);
|
||||
if ($list && count($list) > 0) {
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Select a group for slideshow'),
|
||||
'name' => 'slideshow_group',
|
||||
'options' => array(
|
||||
'query' => $this->getListGroup($list),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'value_by_categories',
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class=""><a class="" href="'.$url.'" target="_blank">'.
|
||||
$this->l('Go to page configuration Slider').'</a></div>'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// Go to page setting of the module LeoSlideShow
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-warning">'.
|
||||
$this->l('There is no group slide in LeoSlideshow Module.').
|
||||
'</div><br/><div><center><a class="btn btn-primary" href="'.$url.'" target="_blank">'.
|
||||
$this->l(' CREATE GROUP SLIDER').'</a></center></div>'
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-warning">'.
|
||||
$this->l('"LeoSlideshow" Module must be installed and enabled before using.').
|
||||
'</div><br/><h4><center>You can take this module at leo-theme or apollo-theme</center></h4>'
|
||||
)
|
||||
);
|
||||
}
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function getListGroup($list)
|
||||
{
|
||||
$result = array();
|
||||
foreach ($list as $item) {
|
||||
$status = ' ('.($item['active'] ? $this->l('Active') : $this->l('Deactive')).')';
|
||||
$result[] = array('id' => $item['randkey'], 'name' => $item['title'].$status);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
if (Module::isInstalled('leoslideshow') && Module::isEnabled('leoslideshow')) {
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
$assign['formAtts']['isEnabled'] = true;
|
||||
include_once(_PS_MODULE_DIR_.'leoslideshow/leoslideshow.php');
|
||||
$module = new LeoSlideshow();
|
||||
$link_array = explode(',', $assign['formAtts']['slideshow_group']);
|
||||
if ($link_array && !is_numeric($link_array['0'])) {
|
||||
$randkey_group = '';
|
||||
foreach ($link_array as $val) {
|
||||
// validate module
|
||||
$randkey_group .= ($randkey_group == '') ? "'".pSQL($val)."'" : ",'".pSQL($val)."'";
|
||||
}
|
||||
$where = ' WHERE randkey IN ('.$randkey_group.') AND id_shop = ' . (int)$id_shop;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_leoslideshow_groups FROM `'._DB_PREFIX_.'leoslideshow_groups` '.$where);
|
||||
$where = '';
|
||||
|
||||
if (is_array($result) && !empty($result)) {
|
||||
foreach ($result as $slide) {
|
||||
// validate module
|
||||
$where .= ($where == '') ? $slide['id_leoslideshow_groups'] : ','.$slide['id_leoslideshow_groups'];
|
||||
}
|
||||
$assign['formAtts']['slideshow_group'] = $where;
|
||||
$assign['content_slider'] = $module->processHookCallBack($assign['formAtts']['slideshow_group']);
|
||||
} else {
|
||||
$assign['formAtts']['isEnabled'] = false;
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show LeoSlideShow via Appagebuilder. Please check that The Group of LeoSlideShow is exist.';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$assign['formAtts']['isEnabled'] = false;
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show LeoSlideShow via Appagebuilder. Please enable LeoSlideShow module.';
|
||||
}
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
138
modules/appagebuilder/classes/shortcodes/ApSliderLayer.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApSliderLayer extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApSliderLayer';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Slider Layer Module'), 'position' => 3, 'desc' => $this->l('You can group from leosliderlayer module to display'),
|
||||
'icon_class' => 'icon icon-chevron-right', 'tag' => 'content slider');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
if (Module::isInstalled('leosliderlayer') && Module::isEnabled('leosliderlayer')) {
|
||||
include_once(_PS_MODULE_DIR_.'leosliderlayer/leosliderlayer.php');
|
||||
$module = new LeoSliderLayer();
|
||||
$list = $module->getAllSlides();
|
||||
$controller = 'AdminModules';
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
$params = array('token' => Tools::getAdminTokenLite($controller),
|
||||
'configure' => 'leosliderlayer',
|
||||
'tab_module' => 'front_office_features',
|
||||
'module_name' => 'leosliderlayer');
|
||||
$url = dirname($_SERVER['PHP_SELF']).'/'.Dispatcher::getInstance()->createUrl($controller, $id_lang, $params, false);
|
||||
if ($list && count($list) > 0) {
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Select a group for slider layer'),
|
||||
'name' => 'slideshow_group',
|
||||
'options' => array(
|
||||
'query' => $this->getListGroup($list),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'value_by_categories',
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class=""><a class="" href="'.$url.'" target="_blank">'.
|
||||
$this->l('Go to page configuration Slider').'</a></div>'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// Go to page setting of the module LeoSlideShow
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-warning">'.
|
||||
$this->l('There is no group slide in Leosliderlayer Module.').
|
||||
'</div><br/><div><center><a class="btn btn-primary" href="'.$url.'" target="_blank">'.
|
||||
$this->l(' CREATE GROUP SLIDER').'</a></center></div>'
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<div class="alert alert-warning">'.
|
||||
$this->l('"Leosliderlayer" Module must be installed and enabled before using.').
|
||||
'</div><br/><h4><center>You can take this module at leo-theme or apollo-theme</center></h4>'
|
||||
)
|
||||
);
|
||||
}
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
public function getListGroup($list)
|
||||
{
|
||||
$result = array();
|
||||
foreach ($list as $item) {
|
||||
$status = ' ('.($item['active'] ? $this->l('Active') : $this->l('Deactive')).')';
|
||||
$result[] = array('id' => $item['id_leosliderlayer_groups'], 'name' => $item['title'].$status);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function prepareFontContent($assign, $module = null)
|
||||
{
|
||||
if (Module::isInstalled('leosliderlayer') && Module::isEnabled('leosliderlayer')) {
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
$assign['formAtts']['isEnabled'] = true;
|
||||
include_once(_PS_MODULE_DIR_.'leosliderlayer/leosliderlayer.php');
|
||||
$module = new LeoSliderLayer();
|
||||
//print_r($assign['slideshow_group']['slideshow_group']);
|
||||
$link_array = explode(',', $assign['formAtts']['slideshow_group']);
|
||||
if ($link_array && !is_numeric($link_array['0'])) {
|
||||
$randkey_title = '';
|
||||
foreach ($link_array as $val) {
|
||||
// validate module
|
||||
$randkey_title .= ($randkey_title == '') ? "'".pSQL($val)."'" : ",'".pSQL($val)."'";
|
||||
}
|
||||
|
||||
$where = ' WHERE title IN ('.$randkey_title.') AND id_shop = ' . (int)$id_shop;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_leoslideshow_groups FROM `'._DB_PREFIX_.'leoslideshow_groups` '.pSQL($where));
|
||||
$where = '';
|
||||
foreach ($result as $blog) {
|
||||
// validate module
|
||||
$where .= ($where == '') ? $blog['id_leoslideshow_groups'] : ','.$blog['id_leoslideshow_groups'];
|
||||
}
|
||||
$assign['formAtts']['slideshow_group'] = $where;
|
||||
}
|
||||
$assign['content_slider'] = $module->processHookCallBack($assign['formAtts']['slideshow_group']);
|
||||
//$module->processHookCallBack();
|
||||
} else {
|
||||
// validate module
|
||||
$assign['formAtts']['isEnabled'] = false;
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Can not show LeoSliderLayer via Appagebuilder. Please enable LeoSliderLayer module.';
|
||||
}
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
389
modules/appagebuilder/classes/shortcodes/ApTabs.php
Normal file
@@ -0,0 +1,389 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApTabs extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApTabs';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Tabs'), 'position' => 4,
|
||||
'desc' => $this->l('You can put widget in tab'),
|
||||
'icon_class' => 'icon-html5', 'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList($sub_tab = 0)
|
||||
{
|
||||
Context::getContext()->smarty->assign('path_image', apPageHelper::getImgThemeUrl());
|
||||
$href = Context::getContext()->link->getAdminLink('AdminApPageBuilderImages').'&ajax=1&action=manageimage&imgDir=images';
|
||||
if (Tools::getIsset('subTab') || $sub_tab) {
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'values' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'id',
|
||||
'label' => $this->l('ID Tab'),
|
||||
'values' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'css_class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'values' => '',
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Image'),
|
||||
'type' => 'selectImg',
|
||||
'href' => $href,
|
||||
'name' => 'image',
|
||||
'lang' => false,
|
||||
'show_image' => true,
|
||||
),
|
||||
);
|
||||
$this->name = 'ap_sub_tabs';
|
||||
} else {
|
||||
$input = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'lang' => 'true',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Select Type'),
|
||||
'name' => 'tab_type',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'tabs-top',
|
||||
'name' => $this->l('Tabs Top'),
|
||||
),
|
||||
array(
|
||||
'id' => 'tabs-below',
|
||||
'name' => $this->l('Tabs below'),
|
||||
),
|
||||
array(
|
||||
'id' => 'tabs-left',
|
||||
'name' => $this->l('Tabs Left'),
|
||||
),
|
||||
array(
|
||||
'id' => 'tabs-right',
|
||||
'name' => $this->l('Tabs Right'),
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'active_tab',
|
||||
'label' => $this->l('Active Tab'),
|
||||
'default' => '1',
|
||||
'desc' => $this->l('Input position(number) to show tab. If Blank, all tab default is inactive.'),
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Use Fade effect'),
|
||||
'name' => 'fade_effect',
|
||||
'is_bool' => true,
|
||||
'desc' => $this->l('To make tabs fade in.'),
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
)
|
||||
);
|
||||
}
|
||||
return $input;
|
||||
}
|
||||
|
||||
public function endRenderForm()
|
||||
{
|
||||
$this->helper->module = new $this->module_name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overide in tabs module
|
||||
* @param type $atts
|
||||
* @param type $content
|
||||
* @param type $tag_name
|
||||
* @param type $is_gen_html
|
||||
* @return type
|
||||
*/
|
||||
public function adminContent($atts, $content = null, $tag_name = null, $is_gen_html = null)
|
||||
{
|
||||
$this->preparaAdminContent($atts, $tag_name);
|
||||
if ($is_gen_html) {
|
||||
$assign = array();
|
||||
$assign['formAtts'] = $atts;
|
||||
$w_info = $this->getInfo();
|
||||
$w_info['name'] = $this->name;
|
||||
$assign['apInfo'] = $w_info;
|
||||
if ($tag_name == 'ApTab') {
|
||||
$assign['tabID'] = $atts['id'];
|
||||
$assign['isSubTab'] = 1;
|
||||
$w_info['name'] = 'ApTab';
|
||||
} else {
|
||||
preg_match_all('/ApTab form_id="([^\"]+)" id\=\"([^\"]+)\" css_class\=\"([^\"]+){0,1}\" title\=\"([^\"]+)\"{0,1}/i', $content, $matches, PREG_OFFSET_CAPTURE);
|
||||
$sub_tab_content = array();
|
||||
$len = count($matches[0]);
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$title = $matches[4][$i][0];
|
||||
$title = str_replace($this->str_search, $this->str_relace_html, $title);
|
||||
$form_id = $matches[1][$i][0];
|
||||
$sub_tab_content[$form_id] = array(
|
||||
'form_id' => $form_id,
|
||||
'id' => $matches[2][$i][0],
|
||||
'css_class' => $matches[3][$i][0],
|
||||
'title' => $title,
|
||||
);
|
||||
}
|
||||
// validate module
|
||||
$pattern = '/ApTab form_id="([^\"]+)" id\=\"([^\"]+)\" css_class\=\"([^\"]+){0,1}\" ';
|
||||
$pattern .= 'override_folder\=\"([^\"]+){0,1}\" title\=\"([^\"]+)\"{0,1}/i';
|
||||
preg_match_all($pattern, $content, $matches2, PREG_OFFSET_CAPTURE);
|
||||
$sub_tab_content2 = array();
|
||||
$len2 = count($matches2[0]);
|
||||
for ($i = 0; $i < $len2; $i++) {
|
||||
$title2 = $matches2[5][$i][0];
|
||||
$title2 = str_replace($this->str_search, $this->str_relace_html, $title2);
|
||||
$form_id2 = $matches2[1][$i][0];
|
||||
$sub_tab_content2[$form_id2] = array(
|
||||
'form_id' => $form_id2,
|
||||
'id' => $matches2[2][$i][0],
|
||||
'css_class' => $matches2[3][$i][0],
|
||||
'title' => $title2,
|
||||
);
|
||||
}
|
||||
|
||||
$pattern = '/ApTab form_id="([^\"]+)" id\=\"([^\"]+)\" css_class\=\"([^\"]+){0,1}\" image\=\"([^\"]+){0,1}\" override_folder\=\"([^\"]+){0,1}\" title\=\"([^\"]+){0,1}\" sub_title\=\"([^\"]+){0,1}/i';
|
||||
preg_match_all($pattern, $content, $matches3, PREG_OFFSET_CAPTURE);
|
||||
$sub_tab_content3 = array();
|
||||
$len3 = count($matches3[0]);
|
||||
for ($i = 0; $i < $len3; $i++) {
|
||||
$title3 = $matches3[6][$i][0];
|
||||
$title3 = str_replace($this->str_search, $this->str_relace_html, $title3);
|
||||
$sub_title = isset($matches3[7][$i][0]) ? $matches3[7][$i][0] : '';
|
||||
$sub_title = str_replace($this->str_search, $this->str_relace_html, $sub_title);
|
||||
|
||||
$form_id3 = $matches3[1][$i][0];
|
||||
$sub_tab_content3[$form_id3] = array(
|
||||
'form_id' => $form_id3,
|
||||
'id' => $matches3[2][$i][0],
|
||||
'css_class' => $matches3[3][$i][0],
|
||||
'title' => $title3,
|
||||
'sub_title' => $sub_title,
|
||||
);
|
||||
}
|
||||
$assign['subTabContent'] = array_merge($sub_tab_content, $sub_tab_content2, $sub_tab_content3);
|
||||
}
|
||||
$assign['apContent'] = ApShortCodesBuilder::doShortcode($content);
|
||||
$controller = new AdminApPageBuilderShortcodesController();
|
||||
return $controller->adminContent($assign, $this->name.'.tpl');
|
||||
} else {
|
||||
ApShortCodesBuilder::doShortcode($content);
|
||||
}
|
||||
//preg_match_all( '/ap_tab id="([^\"]+)"(\id\=\"([^\"]+)\"){0,1}/i', $content, $matches, PREG_OFFSET_CAPTURE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Overide in tabs module
|
||||
* @param type $atts
|
||||
* @param type $content
|
||||
* @param type $tag_name
|
||||
* @param type $is_gen_html
|
||||
* @return type
|
||||
*/
|
||||
public function fontContent($atts, $content = null, $tag_name = null, $is_gen_html = null)
|
||||
{
|
||||
$is_active = $this->isWidgetActive(array('formAtts' => $atts));
|
||||
if (!$is_active) {
|
||||
return '';
|
||||
}
|
||||
|
||||
foreach ($atts as $key => $val) {
|
||||
if (strpos($key, 'content') !== false || strpos($key, 'link') !== false || strpos($key, 'url') !== false || strpos($key, 'alt') !== false || strpos($key, 'tit') !== false || strpos($key, 'name') !== false || strpos($key, 'desc') !== false || strpos($key, 'itemscustom') !== false) {
|
||||
$atts[$key] = str_replace($this->str_search, $this->str_relace_html, $val);
|
||||
if (strpos($atts[$key], '_AP_IMG_DIR') !== false) {
|
||||
// validate module
|
||||
$atts[$key] = str_replace('_AP_IMG_DIR/', $this->theme_img_module, $atts[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// validate module
|
||||
unset($is_gen_html);
|
||||
$assign = array();
|
||||
|
||||
if ($tag_name == 'ApTabs') {
|
||||
// ApTabs
|
||||
$assign['tab_name'] = 'ApTabs';
|
||||
preg_match_all('/ApTab form_id="([^\"]+)" id\=\"([^\"]+)\" css_class\=\"([^\"]+){0,1}\" image\=\"([^\"]+)\" title\=\"([^\"]+)\"{0,1}/i', $content, $matches, PREG_OFFSET_CAPTURE);
|
||||
$sub_tab_content = array();
|
||||
$len = count($matches[0]);
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$title = $matches[4][$i][0];
|
||||
$title = str_replace($this->str_search, $this->str_relace_html, $title);
|
||||
$sub_tab_content[] = array(
|
||||
'form_id' => $matches[1][$i][0],
|
||||
'id' => $matches[2][$i][0],
|
||||
'css_class' => $matches[3][$i][0],
|
||||
'title' => $title,
|
||||
);
|
||||
}
|
||||
$pattern = '/ApTab form_id="([^\"]+)" id\=\"([^\"]+)\" css_class\=\"([^\"]+){0,1}\" override_folder\=\"([^\"]+){0,1}\" title\=\"([^\"]+)\"{0,1}/i';
|
||||
preg_match_all($pattern, $content, $matches2, PREG_OFFSET_CAPTURE);
|
||||
$sub_tab_content2 = array();
|
||||
$len2 = count($matches2[0]);
|
||||
for ($i = 0; $i < $len2; $i++) {
|
||||
$title2 = $matches2[5][$i][0];
|
||||
$title2 = str_replace($this->str_search, $this->str_relace_html, $title2);
|
||||
$form_id2 = $matches2[1][$i][0];
|
||||
$sub_tab_content2[$form_id2] = array(
|
||||
'form_id' => $form_id2,
|
||||
'id' => $matches2[2][$i][0],
|
||||
'css_class' => $matches2[3][$i][0],
|
||||
'title' => $title2,
|
||||
);
|
||||
}
|
||||
|
||||
$pattern = '/ApTab form_id="([^\"]+)" id\=\"([^\"]+)\" css_class\=\"([^\"]+){0,1}\" image\=\"([^\"]+){0,1}\" override_folder\=\"([^\"]+){0,1}\" title\=\"([^\"]+){0,1}\" sub_title\=\"([^\"]+){0,1}/i';
|
||||
preg_match_all($pattern, $content, $matches3, PREG_OFFSET_CAPTURE);
|
||||
$sub_tab_content3 = array();
|
||||
$len3 = count($matches3[0]);
|
||||
for ($i = 0; $i < $len3; $i++) {
|
||||
$title3 = $matches3[6][$i][0];
|
||||
$title3 = str_replace($this->str_search, $this->str_relace_html, $title3);
|
||||
$sub_title = isset($matches3[7][$i][0]) ? $matches3[7][$i][0] : '';
|
||||
$sub_title = str_replace($this->str_search, $this->str_relace_html, $sub_title);
|
||||
|
||||
$form_id3 = $matches3[1][$i][0];
|
||||
$sub_tab_content3[$form_id3] = array(
|
||||
'form_id' => $form_id3,
|
||||
'id' => $matches3[2][$i][0],
|
||||
'css_class' => $matches3[3][$i][0],
|
||||
'title' => $title3,
|
||||
'image' => $matches3[4][$i][0],
|
||||
'sub_title' => $sub_title,
|
||||
);
|
||||
}
|
||||
if (isset($atts['active_tab']) && $atts['active_tab'] != '') {
|
||||
$tab_count = substr_count($content, '[ApTab');
|
||||
$tab_active = (int)$atts['active_tab'];
|
||||
|
||||
if (($tab_active <= $tab_count) && ($tab_active >= 1)) {
|
||||
# ACTIVE TAB
|
||||
$atts['active_tab'] = $tab_active - 1;
|
||||
} elseif ($tab_active > $tab_count) {
|
||||
# ACTIVE LAST TAB
|
||||
$atts['active_tab'] = $tab_count - 1;
|
||||
} else {
|
||||
# ACTIVE FIRST TAB
|
||||
$atts['active_tab'] = 0;
|
||||
}
|
||||
} else {
|
||||
# BLANK
|
||||
$atts['active_tab'] = -1;
|
||||
}
|
||||
$assign['subTabContent'] = array_merge($sub_tab_content, $sub_tab_content2, $sub_tab_content3);
|
||||
$atts['id'] = 'tab_'.ApPageSetting::getRandomNumber();
|
||||
$atts['class'] = ((isset($atts['class']) && $atts['class']) ? $atts['class'].' ' : '').(isset($atts['tab_type']) ? $atts['tab_type'] : '');
|
||||
|
||||
$assign['formAtts'] = $atts;
|
||||
$module = APPageBuilder::getInstance();
|
||||
$assign['path'] = apPageHelper::getImgThemeUrl();
|
||||
$assign['apContent'] = ApShortCodesBuilder::doShortcode($content);
|
||||
return $module->fontContent($assign, $this->name.'.tpl');
|
||||
} else {
|
||||
// ApTab
|
||||
$assign['tabID'] = $atts['id'];
|
||||
$assign['tab_name'] = 'ApTab';
|
||||
$assign['isSubTab'] = 1;
|
||||
|
||||
$assign['formAtts'] = $atts;
|
||||
$module = APPageBuilder::getInstance();
|
||||
$assign['path'] = apPageHelper::getImgThemeUrl();
|
||||
$assign['apContent'] = ApShortCodesBuilder::doShortcode($content);
|
||||
return $module->fontContent($assign, $this->name.'.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Override
|
||||
* Fixed css_class is empty -> cant set to $apHomeBuilder.process (json) in javascript
|
||||
*/
|
||||
public function preparaAdminContent($atts, $tag_name = null)
|
||||
{
|
||||
if ($tag_name == null) {
|
||||
$tag_name = $this->name;
|
||||
}
|
||||
if (is_array($atts)) {
|
||||
if (!isset(ApShortCodesBuilder::$shortcode_lang[$tag_name])) {
|
||||
$inputs = $this->getConfigList();
|
||||
$lang_field = array();
|
||||
foreach ($inputs as $input) {
|
||||
if (isset($input['lang']) && $input['lang']) {
|
||||
$lang_field[] = $input['name'];
|
||||
}
|
||||
}
|
||||
ApShortCodesBuilder::$shortcode_lang[$tag_name] = $lang_field;
|
||||
} else {
|
||||
$lang_field = ApShortCodesBuilder::$shortcode_lang[$tag_name];
|
||||
}
|
||||
foreach ($atts as $key => $val) {
|
||||
if ($lang_field && in_array($key, $lang_field)) {
|
||||
$key .= '_'.ApShortCodesBuilder::$lang_id;
|
||||
}
|
||||
if (!isset(ApShortCodesBuilder::$data_form[$atts['form_id']][$key])) {
|
||||
ApShortCodesBuilder::$data_form[$atts['form_id']][$key] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
194
modules/appagebuilder/classes/shortcodes/ApTwitter.php
Normal file
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApTwitter extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApTwitter';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Twitter'),
|
||||
'position' => 6,
|
||||
'desc' => $this->l('You can config for display Twitter box'),
|
||||
'icon_class' => 'icon-twitter-sign',
|
||||
'tag' => 'social');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$accordion_type = array(
|
||||
array(
|
||||
'value' => 'full',
|
||||
'text' => $this->l('Always Full')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion',
|
||||
'text' => $this->l('Always Accordion')
|
||||
),
|
||||
array(
|
||||
'value' => 'accordion_small_screen',
|
||||
'text' => $this->l('Accordion at small screen')
|
||||
),
|
||||
);
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Accordion Type'),
|
||||
'name' => 'accordion_type',
|
||||
'options' => array(
|
||||
'query' => $accordion_type,
|
||||
'id' => 'value',
|
||||
'name' => 'text' ),
|
||||
'default' => 'full',
|
||||
'hint' => $this->l('Select a Accordion Type'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Twitter'),
|
||||
'name' => 'twidget_id',
|
||||
'default' => '578806287158251521',
|
||||
'desc' => $this->l('Please go to the page https://twitter.com/settings/widgets/new, then create a widget, and get data-widget-id to input in this param.'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Count'),
|
||||
'name' => 'count',
|
||||
'default' => 2,
|
||||
'desc' => $this->l('If the param is empty or equal 0, the widget will show scrollbar when more items. Or you can input number from 1-20. Default NULL.'),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('User'),
|
||||
'name' => 'username',
|
||||
'default' => 'prestashop',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '<script type="text/javascript" src="'.__PS_BASE_URI__.apPageHelper::getJsDir().'colorpicker/js/leo.jquery.colorpicker.js"></script>',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'label' => $this->l('Border Color'),
|
||||
'name' => 'border_color',
|
||||
'default' => '#000',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'label' => $this->l('Link Color'),
|
||||
'name' => 'link_color',
|
||||
'default' => '#000',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'label' => $this->l('Text Color'),
|
||||
'name' => 'text_color',
|
||||
'default' => '#000',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'label' => $this->l('Name Color'),
|
||||
'name' => 'name_color',
|
||||
'default' => '#000',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'label' => $this->l('Nick name Color'),
|
||||
'name' => 'mail_color',
|
||||
'default' => '#000',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Width'),
|
||||
'name' => 'width',
|
||||
'default' => 180,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Height'),
|
||||
'name' => 'height',
|
||||
'default' => 200,
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show background'),
|
||||
'name' => 'transparent',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 0,
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Replies'),
|
||||
'name' => 'show_replies',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 0,
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Header'),
|
||||
'name' => 'show_header',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 0,
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Footer'),
|
||||
'name' => 'show_footer',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 0,
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Border'),
|
||||
'name' => 'show_border',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 0,
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Scrollbar'),
|
||||
'name' => 'show_scrollbar',
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'desc' => $this->l('If the param is empty or equal 0, the widget will show scrollbar when more items. Or you can input number from 1-20. Default NULL.'),
|
||||
'hint' => $this->l('Twitter not Show Scrollbar if you set a number of Tweets is specified. Please not set value for input Count.'),
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
}
|
||||
84
modules/appagebuilder/classes/shortcodes/ApVideo.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApVideo extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApVideo';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Video'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Embed video box'),
|
||||
'icon_class' => 'icon-facetime-video',
|
||||
'tag' => 'social');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'title',
|
||||
'label' => $this->l('Title'),
|
||||
'desc' => $this->l('Auto hide if leave it blank'),
|
||||
'lang' => 'true',
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => ''
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'sub_title',
|
||||
'label' => $this->l('Sub Title'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Code'),
|
||||
'name' => 'content_html',
|
||||
'cols' => 40,
|
||||
'rows' => 10,
|
||||
'value' => true,
|
||||
'default' => '',
|
||||
'desc' => $this->l('Example embed video: "<div class="embed-responsive"><iframe src="https://www.youtube.com/embed/iZoR21juRzs" frameborder="0" allowfullscreen></iframe></div>"'),
|
||||
'autoload_rte' => false,
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Align'),
|
||||
'name' => 'align',
|
||||
'options' => array('query' => array(
|
||||
array('id' => 'left', 'name' => $this->l('Left')),
|
||||
array('id' => 'center', 'name' => $this->l('Center')),
|
||||
array('id' => 'right', 'name' => $this->l('Right'))
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'default' => 'center',
|
||||
)
|
||||
);
|
||||
return $inputs;
|
||||
}
|
||||
}
|
||||
36
modules/appagebuilder/classes/shortcodes/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
12
modules/appagebuilder/config.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>appagebuilder</name>
|
||||
<displayName><![CDATA[Apollo Page Builder]]></displayName>
|
||||
<version><![CDATA[2.2.0]]></version>
|
||||
<description><![CDATA[Apollo Page Builder build content for your site.]]></description>
|
||||
<author><![CDATA[ApolloTheme]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
12
modules/appagebuilder/config_pl.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>appagebuilder</name>
|
||||
<displayName><![CDATA[Apollo Page Builder]]></displayName>
|
||||
<version><![CDATA[2.2.0]]></version>
|
||||
<description><![CDATA[Apollo Page Builder build content for your site.]]></description>
|
||||
<author><![CDATA[ApolloTheme]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class AdminApPageBuilderController extends ModuleAdminControllerCore
|
||||
{
|
||||
public static $shortcode_lang;
|
||||
public static $lang_id;
|
||||
public static $language;
|
||||
public $error_text = '';
|
||||
public $theme_name;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$url = 'index.php?controller=adminmodules&configure=appagebuilder&token='.Tools::getAdminTokenLite('AdminModules')
|
||||
.'&tab_module=Home&module_name=appagebuilder';
|
||||
Tools::redirectAdmin($url);
|
||||
$this->bootstrap = true;
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'configuration';
|
||||
$this->theme_name = _THEME_NAME_;
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,601 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageBuilderDetailsModel.php');
|
||||
|
||||
class AdminApPageBuilderDetailsController extends ModuleAdminControllerCore
|
||||
{
|
||||
private $theme_name = '';
|
||||
public $module_name = 'appagebuilder';
|
||||
public $tpl_save = '';
|
||||
public $file_content = array();
|
||||
public $explicit_select;
|
||||
public $order_by;
|
||||
public $order_way;
|
||||
public $profile_css_folder;
|
||||
public $module_path;
|
||||
// public $module_path_resource;
|
||||
public $str_search = array();
|
||||
public $str_relace = array();
|
||||
public $theme_dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'appagebuilder_details';
|
||||
$this->className = 'ApPageBuilderDetailsModel';
|
||||
$this->lang = false;
|
||||
$this->explicit_select = true;
|
||||
$this->allow_export = true;
|
||||
$this->context = Context::getContext();
|
||||
$this->_join = '
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_details_shop` ps ON (ps.`id_appagebuilder_details` = a.`id_appagebuilder_details`)';
|
||||
$this->_select .= ' ps.active as active, ';
|
||||
|
||||
$this->order_by = 'id_appagebuilder_details';
|
||||
$this->order_way = 'DESC';
|
||||
parent::__construct();
|
||||
$this->fields_list = array(
|
||||
'id_appagebuilder_details' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 50,
|
||||
'class' => 'fixed-width-xs'
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'width' => 140,
|
||||
'type' => 'text',
|
||||
'filter_key' => 'a!name'
|
||||
),
|
||||
'plist_key' => array(
|
||||
'title' => $this->l('Product List Key'),
|
||||
'filter_key' => 'a!plist_key',
|
||||
'type' => 'text',
|
||||
'width' => 140,
|
||||
),
|
||||
'class_detail' => array(
|
||||
'title' => $this->l('Class'),
|
||||
'width' => 140,
|
||||
'type' => 'text',
|
||||
'filter_key' => 'a!class_detail',
|
||||
'orderby' => false
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Is Default'),
|
||||
'active' => 'status',
|
||||
'filter_key' => 'ps!active',
|
||||
'align' => 'text-center',
|
||||
'type' => 'bool',
|
||||
'class' => 'fixed-width-sm',
|
||||
'orderby' => false
|
||||
),
|
||||
);
|
||||
$this->bulk_actions = array(
|
||||
'delete' => array(
|
||||
'text' => $this->l('Delete selected'),
|
||||
'confirm' => $this->l('Delete selected items?'),
|
||||
'icon' => 'icon-trash'
|
||||
)
|
||||
);
|
||||
$this->theme_dir = _PS_THEME_DIR_;
|
||||
|
||||
$this->_where = ' AND ps.id_shop='.(int)$this->context->shop->id;
|
||||
$this->theme_name = _THEME_NAME_;
|
||||
$this->profile_css_folder = $this->theme_dir.'modules/'.$this->module_name.'/';
|
||||
$this->module_path = __PS_BASE_URI__.'modules/'.$this->module_name.'/';
|
||||
// $this->module_path_resource = $this->module_path.'views/';
|
||||
$this->str_search = array('_APAMP_', '_APQUOT_', '_APAPOST_', '_APTAB_', '_APNEWLINE_', '_APENTER_', '_APOBRACKET_', '_APCBRACKET_', '_APOCBRACKET_', '_APCCBRACKET_',);
|
||||
$this->str_relace = array('&', '\"', '\'', '\t', '\r', '\n', '[', ']', '{', '}');
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
if ($object->page == 'product_detail') {
|
||||
$this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderProductDetail');
|
||||
} else {
|
||||
$this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderHome');
|
||||
}
|
||||
$this->redirect_after .= '&id_appagebuilder_details='.$object->id;
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
parent::postProcess();
|
||||
if (count($this->errors) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Tools::getIsset('duplicateappagebuilder_details')) {
|
||||
$id = Tools::getValue('id_appagebuilder_details');
|
||||
$model = new ApPageBuilderDetailsModel($id);
|
||||
$duplicate_object = $model->duplicateObject();
|
||||
$duplicate_object->name = $this->l('Duplicate of').' '.$duplicate_object->name;
|
||||
$old_key = $duplicate_object->plist_key;
|
||||
$duplicate_object->plist_key = 'detail'.ApPageSetting::getRandomNumber();
|
||||
if ($duplicate_object->add()) {
|
||||
//duplicate shortCode
|
||||
$filecontent = Tools::file_get_contents(apPageHelper::getConfigDir('theme_details').$old_key.'.tpl');
|
||||
ApPageSetting::writeFile(apPageHelper::getConfigDir('theme_details'), $duplicate_object->plist_key.'.tpl', $filecontent);
|
||||
$this->redirect_after = self::$currentIndex.'&token='.$this->token;
|
||||
$this->redirect();
|
||||
} else {
|
||||
Tools::displayError('Can not duplicate Profiles');
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('saveELement')) {
|
||||
$filecontent = Tools::getValue('filecontent');
|
||||
$fileName = Tools::getValue('fileName');
|
||||
apPageHelper::createDir(apPageHelper::getConfigDir('theme_details'));
|
||||
ApPageSetting::writeFile(apPageHelper::getConfigDir('theme_details'), $fileName.'.tpl', $filecontent);
|
||||
}
|
||||
}
|
||||
|
||||
public function convertObjectToTpl($object_form)
|
||||
{
|
||||
$tpl = '';
|
||||
|
||||
foreach ($object_form as $object) {
|
||||
if ($object['name'] == 'functional_buttons') {
|
||||
//DONGND:: fix can save group column when change class
|
||||
if (isset($object['form']['class']) && $object['form']['class'] != '') {
|
||||
$tpl .= '<div class="'.$object['form']['class'].'">';
|
||||
} else {
|
||||
$tpl .= '<div class="row">';
|
||||
}
|
||||
foreach ($object['columns'] as $objectC) {
|
||||
$tpl .= '<div class="'.$this->convertToColumnClass($objectC['form']).'">';
|
||||
$tpl .= $this->convertObjectToTpl($objectC['sub']);
|
||||
$tpl .= '
|
||||
</div>';
|
||||
}
|
||||
|
||||
$tpl .= '</div>';
|
||||
} else if ($object['name'] == 'code') {
|
||||
$tpl .= $object['code'];
|
||||
} else {
|
||||
if (!isset($this->file_content[$object['name']])) {
|
||||
$this->returnFileContent($object['name']);
|
||||
//DONGND:: add config to type gallery
|
||||
if ($object['name'] == "product_image_with_thumb" || $object['name'] == "product_image_show_all") {
|
||||
$strdata = '';
|
||||
foreach ($object['form'] as $key => $value) {
|
||||
$strdata .= ' data-'.$key.'="'.$value.'"';
|
||||
}
|
||||
$this->file_content[$object['name']] = str_replace('id="content">', 'id="content"'.$strdata.'>', $this->file_content[$object['name']]);
|
||||
}
|
||||
}
|
||||
//add class
|
||||
$tpl .= $this->file_content[$object['name']];
|
||||
}
|
||||
}
|
||||
return $tpl;
|
||||
}
|
||||
|
||||
public function convertToColumnClass($form)
|
||||
{
|
||||
$class = '';
|
||||
foreach ($form as $key => $val) {
|
||||
//DONGND:: check class name of column
|
||||
if ($key == 'class') {
|
||||
if ($val != '') {
|
||||
$class .= ($class=='')?$val:' '.$val;
|
||||
}
|
||||
} else {
|
||||
$class .= ($class=='')?'col-'.$key.'-'.$val:' col-'.$key.'-'.$val;
|
||||
}
|
||||
}
|
||||
return $class;
|
||||
}
|
||||
|
||||
public function returnFileContent($pelement)
|
||||
{
|
||||
$tpl_dir = apPageHelper::getConfigDir('theme_details').$pelement.'.tpl';
|
||||
if (!file_exists($tpl_dir)) {
|
||||
$tpl_dir = apPageHelper::getConfigDir('module_details').$pelement.'.tpl';
|
||||
}
|
||||
$this->file_content[$pelement] = Tools::file_get_contents($tpl_dir);
|
||||
return $this->file_content[$pelement];
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
if (Tools::getIsset('pelement')) {
|
||||
$helper = new HelperForm();
|
||||
$helper->submit_action = 'saveELement';
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'filecontent',
|
||||
'label' => $this->l('File Content'),
|
||||
'desc' => $this->l('Please carefully when edit tpl file'),
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'fileName',
|
||||
)
|
||||
);
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => sprintf($this->l('You are Editing file: %s'), Tools::getValue('pelement').'.tpl'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'action' => Context::getContext()->link->getAdminLink('AdminApPageBuilderShortcodes'),
|
||||
'input' => $inputs,
|
||||
'name' => 'importData',
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'button btn btn-default pull-right'
|
||||
),
|
||||
'tinymce' => false,
|
||||
),
|
||||
);
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getFileContent()
|
||||
);
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
$this->initToolbar();
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('duplicate');
|
||||
$this->addRowAction('delete');
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
public function getFileContent()
|
||||
{
|
||||
$pelement = Tools::getValue('pelement');
|
||||
$tpl_dir = apPageHelper::getConfigDir('theme_details').$pelement.'.tpl';
|
||||
if (!file_exists($tpl_dir)) {
|
||||
$tpl_dir = apPageHelper::getConfigDir('module_details').$pelement.'.tpl';
|
||||
}
|
||||
return array('fileName' => $pelement, 'filecontent' => Tools::file_get_contents($tpl_dir));
|
||||
}
|
||||
|
||||
public function setHelperDisplay(Helper $helper)
|
||||
{
|
||||
parent::setHelperDisplay($helper);
|
||||
$this->helper->module = APPageBuilder::getInstance();
|
||||
}
|
||||
|
||||
public function processDelete()
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
Tools::deleteFile(apPageHelper::getConfigDir('theme_details').$object->plist_key.'.tpl');
|
||||
parent::processDelete();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$this->initToolbar();
|
||||
$this->context->controller->addJqueryUI('ui.sortable');
|
||||
$this->context->controller->addJqueryUI('ui.draggable');
|
||||
//$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/detail.js');
|
||||
$this->context->controller->addCss(apPageHelper::getCssAdminDir().'admin/form.css');
|
||||
$source_file = Tools::scandir(apPageHelper::getConfigDir('theme_details'), 'tpl');
|
||||
|
||||
if (is_dir(apPageHelper::getConfigDir('theme_details'))) {
|
||||
$source_template_file = Tools::scandir(apPageHelper::getConfigDir('theme_details'), 'tpl');
|
||||
$source_file = array_merge($source_file, $source_template_file);
|
||||
}
|
||||
|
||||
$params = array('gridLeft' => array(), 'gridRight' => array());
|
||||
|
||||
$this->object->params = str_replace($this->str_search, $this->str_relace, $this->object->params);
|
||||
|
||||
$config_dir = apPageHelper::getConfigDir('theme_details') . 'config.json';
|
||||
if (!file_exists($config_dir)) {
|
||||
$config_dir = apPageHelper::getConfigDir('module_details') . 'config.json';
|
||||
}
|
||||
|
||||
$config_file = Tools::jsonDecode(Tools::file_get_contents($config_dir), true);
|
||||
$element_by_name = array();
|
||||
foreach ($config_file as $k1 => $groups) {
|
||||
foreach ($groups['group'] as $k2 => $group) {
|
||||
$config_file[$k1]['group'][$k2]['dataForm'] = (!isset($group['data-form']))?'':Tools::jsonEncode($group['data-form']);
|
||||
if (isset($group['file'])) {
|
||||
$element_by_name[$group['file']] = $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->object->params)) {
|
||||
//add sample data
|
||||
if (Tools::getIsset('sampledetail')) {
|
||||
switch (Tools::getValue('sampledetail')) {
|
||||
case 'product_image_thumbs_bottom':
|
||||
$this->object->url_img_preview = 'https://i.pinimg.com/originals/8c/16/f9/8c16f9f024af16977adc1f618872eb8b.jpg';
|
||||
$this->object->params = '{"gridLeft":{"0":{"name":"functional_buttons","form":"","columns":{"0":{"form":{"form_id":"form_9367402777406408","md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_image_with_thumb","form":{"templateview":"bottom","numberimage":"5","numberimage1200":"5","numberimage992":"4","numberimage768":"3","numberimage576":"3","numberimage480":"2","numberimage360":"2","templatemodal":"1","templatezoomtype":"out","zoomposition":"right","zoomwindowwidth":"400","zoomwindowheight":"400"}}}},"1":{"form":{"form_id":"form_15874367062488778","md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_detail_name","form":""},"1":{"name":"hook_display_product_additional_info","form":""},"2":{"name":"hook_display_leo_product_review_extra","form":""},"3":{"name":"product_price","form":""},"4":{"name":"product_description_short","form":""},"5":{"name":"product_customization","form":""},"6":{"name":"product_actions_form","form":""},"7":{"name":"hook_display_reassurance","form":""}}},"2":{"form":{"form_id":"form_4666379129988496","md":12,"lg":12,"xl":12,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_more_info_tab","form":""},"1":{"name":"product_accessories","form":""},"2":{"name":"hook_display_footer_product","form":""}}}}}},"class":"product-image-thumbs product-thumbs-bottom"}';
|
||||
break;
|
||||
case 'product_image_thumbs_left':
|
||||
$this->object->url_img_preview = 'https://i.pinimg.com/originals/98/b4/b0/98b4b05fef8913b2a37cbb592b921e7b.jpg';
|
||||
$this->object->params = '{"gridLeft":{"0":{"name":"functional_buttons","form":"","columns":{"0":{"form":{"md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_image_with_thumb","form":{"templateview":"left","numberimage":"5","numberimage1200":"4","numberimage992":"4","numberimage768":"3","numberimage576":"3","numberimage480":"2","numberimage360":"2","templatemodal":"1","templatezoomtype":"in","zoomposition":"right","zoomwindowwidth":"400","zoomwindowheight":"400"}}}},"1":{"form":{"md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_detail_name","form":""},"1":{"name":"hook_display_product_additional_info","form":""},"2":{"name":"hook_display_leo_product_review_extra","form":""},"3":{"name":"product_price","form":""},"4":{"name":"product_description_short","form":""},"5":{"name":"product_customization","form":""},"6":{"name":"product_actions_form","form":""},"7":{"name":"hook_display_reassurance","form":""}}},"2":{"form":{"md":12,"lg":12,"xl":12,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_more_info_accordions","form":""},"1":{"name":"product_accessories","form":""},"2":{"name":"hook_display_footer_product","form":""}}}}}},"class":"product-image-thumbs product-thumbs-left"}';
|
||||
break;
|
||||
case 'product_image_thumbs_right':
|
||||
$this->object->url_img_preview = 'https://i.pinimg.com/originals/81/c4/41/81c441c1b2f6c3e56b3da56b65324423.jpg';
|
||||
$this->object->params = '{"gridLeft":{"0":{"name":"functional_buttons","form":"","columns":{"0":{"form":{"md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_image_with_thumb","form":{"templateview":"right","numberimage":"5","numberimage1200":"4","numberimage992":"4","numberimage768":"3","numberimage576":"3","numberimage480":"2","numberimage360":"2","templatemodal":"1","templatezoomtype":"in","zoomposition":"right","zoomwindowwidth":"400","zoomwindowheight":"400"}}}},"1":{"form":{"md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_detail_name","form":""},"1":{"name":"hook_display_product_additional_info","form":""},"2":{"name":"hook_display_leo_product_review_extra","form":""},"3":{"name":"product_price","form":""},"4":{"name":"product_description_short","form":""},"5":{"name":"product_customization","form":""},"6":{"name":"product_actions_form","form":""},"7":{"name":"hook_display_reassurance","form":""}}},"2":{"form":{"md":12,"lg":12,"xl":12,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_more_info_default","form":""},"1":{"name":"product_accessories","form":""},"2":{"name":"hook_display_footer_product","form":""}}}}}},"class":"product-image-thumbs product-thumbs-right"}';
|
||||
break;
|
||||
case 'product_image_no_thumbs':
|
||||
$this->object->url_img_preview = 'https://i.pinimg.com/originals/60/ca/57/60ca570f6a8254c3741d8c9db78eb3d5.jpg';
|
||||
$this->object->params = '{"gridLeft":{"0":{"name":"functional_buttons","form":"","columns":{"0":{"form":{"md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_image_with_thumb","form":{"templateview":"none","numberimage":"5","numberimage1200":"5","numberimage992":"4","numberimage768":"3","numberimage576":"3","numberimage480":"2","numberimage360":"2","templatemodal":"1","templatezoomtype":"in","zoomposition":"right","zoomwindowwidth":"400","zoomwindowheight":"400"}}}},"1":{"form":{"md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_detail_name","form":""},"1":{"name":"hook_display_product_additional_info","form":""},"2":{"name":"hook_display_leo_product_review_extra","form":""},"3":{"name":"product_price","form":""},"4":{"name":"product_description_short","form":""},"5":{"name":"product_customization","form":""},"6":{"name":"product_actions_form","form":""},"7":{"name":"hook_display_reassurance","form":""}}},"2":{"form":{"md":12,"lg":12,"xl":12,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_more_info_tab","form":""},"1":{"name":"product_accessories","form":""},"2":{"name":"hook_display_footer_product","form":""}}}}}},"class":"product-image-thumbs no-thumbs"}';
|
||||
break;
|
||||
case 'product_image_no_thumbs_fullwidth':
|
||||
$this->object->url_img_preview = 'https://i.pinimg.com/originals/c5/d9/02/c5d9025b68250832a31eac3b6d344955.jpg';
|
||||
$this->object->params = '{"gridLeft":{"0":{"name":"functional_buttons","form":"","columns":{"0":{"form":{"class":"","xl":"12","lg":"12","md":"12","sm":"12","xs":"12","sp":"12"},"element":"column","sub":{"0":{"name":"product_image_with_thumb","form":{"templateview":"none","numberimage":"5","numberimage1200":"5","numberimage992":"4","numberimage768":"3","numberimage576":"3","numberimage480":"2","numberimage360":"2","templatemodal":"1","templatezoomtype":"in","zoomposition":"right","zoomwindowwidth":"400","zoomwindowheight":"400"}}}},"1":{"form":{"class":"offset-lg-2 offset-xl-2","xl":"8","lg":"8","md":"12","sm":"12","xs":"12","sp":"12"},"element":"column","sub":{"0":{"name":"product_detail_name","form":""},"1":{"name":"hook_display_product_additional_info","form":""},"2":{"name":"hook_display_leo_product_review_extra","form":""},"3":{"name":"product_price","form":""},"4":{"name":"product_description_short","form":""},"5":{"name":"product_customization","form":""},"6":{"name":"product_actions_form","form":""},"7":{"name":"hook_display_reassurance","form":""},"8":{"name":"product_more_info_tab","form":""}}},"2":{"form":{"class":"","xl":"12","lg":"12","md":"12","sm":"12","xs":"12","sp":"12"},"element":"column","sub":{"0":{"name":"product_accessories","form":""},"1":{"name":"hook_display_footer_product","form":""}}}}}},"class":"product-image-thumbs no-thumbs"}';
|
||||
break;
|
||||
case 'product_image_gallery':
|
||||
$this->object->url_img_preview = 'https://i.pinimg.com/originals/b1/a8/b9/b1a8b9381d8d3e3c4d13dfe24231581f.jpg';
|
||||
$this->object->params = '{"gridLeft":{"0":{"name":"functional_buttons","form":"","columns":{"0":{"form":{"md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_image_show_all","form":{"templatezoomtype":"in","zoomposition":"right","zoomwindowwidth":"400","zoomwindowheight":"400"}}}},"1":{"form":{"md":6,"lg":6,"xl":6,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_detail_name","form":""},"1":{"name":"hook_display_product_additional_info","form":""},"2":{"name":"hook_display_leo_product_review_extra","form":""},"3":{"name":"product_price","form":""},"4":{"name":"product_description_short","form":""},"5":{"name":"product_customization","form":""},"6":{"name":"product_actions_form","form":""},"7":{"name":"hook_display_reassurance","form":""}}},"2":{"form":{"md":12,"lg":12,"xl":12,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_more_info_tab","form":""},"1":{"name":"product_accessories","form":""},"2":{"name":"hook_display_footer_product","form":""}}}}}},"class":"product-image-gallery"}';
|
||||
break;
|
||||
case 'product_image_no_thumbs_center':
|
||||
$this->object->url_img_preview = 'https://i.pinimg.com/originals/38/99/1a/38991a8c1582669d29abe889bc0d5f52.jpg';
|
||||
$this->object->params = '{"gridLeft":{"0":{"name":"functional_buttons","form":"","columns":{"0":{"form":{"class":"","xl":"4","lg":"4","md":"12","sm":"12","xs":"12","sp":"12"},"element":"column","sub":{"0":{"name":"product_detail_name","form":""},"1":{"name":"hook_display_product_additional_info","form":""},"2":{"name":"hook_display_leo_product_review_extra","form":""},"3":{"name":"product_price","form":""},"4":{"name":"product_description_short","form":""},"5":{"name":"hook_display_reassurance","form":""}}},"1":{"form":{"class":"","xl":"5","lg":"5","md":"12","sm":"12","xs":"12","sp":"12"},"element":"column","sub":{"0":{"name":"product_image_with_thumb","form":{"templateview":"none","numberimage":"5","numberimage1200":"5","numberimage992":"4","numberimage768":"3","numberimage576":"3","numberimage480":"2","numberimage360":"2","templatemodal":"1","templatezoomtype":"in","zoomposition":"right","zoomwindowwidth":"400","zoomwindowheight":"400"}}}},"2":{"form":{"class":"","xl":"3","lg":"3","md":"12","sm":"12","xs":"12","sp":"12"},"element":"column","sub":{"0":{"name":"product_customization","form":""},"1":{"name":"product_actions_form","form":""}}},"3":{"form":{"md":12,"lg":12,"xl":12,"sm":12,"xs":12,"sp":12},"element":"column","sub":{"0":{"name":"product_more_info_tab","form":""},"1":{"name":"product_accessories","form":""},"2":{"name":"hook_display_footer_product","form":""}}}}}},"class":"product-image-thumbs no-thumbs"}';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$params = Tools::jsonDecode($this->object->params, true);
|
||||
if ($params['gridLeft']) {
|
||||
foreach ($params['gridLeft'] as $key => $value) {
|
||||
$params['gridLeft'][$key]['dataForm'] = (!isset($value['form']))?'':Tools::jsonEncode($value['form']);
|
||||
|
||||
if (isset($element_by_name[$value['name']])) {
|
||||
$params['gridLeft'][$key]['config'] = $element_by_name[$value['name']];
|
||||
}
|
||||
if ($value['name'] == "functional_buttons") {
|
||||
foreach ($value['columns'] as $k => $v) {
|
||||
$params['gridLeft'][$key]['columns'][$k]['dataForm'] = (!isset($v['form']))?'':Tools::jsonEncode($v['form']);
|
||||
foreach ($v['sub'] as $ke => $ve) {
|
||||
$params['gridLeft'][$key]['columns'][$k]['sub'][$ke]['dataForm'] = (!isset($ve['form']))?'':Tools::jsonEncode($ve['form']);
|
||||
if (isset($element_by_name[$ve['name']])) {
|
||||
$params['gridLeft'][$key]['columns'][$k]['sub'][$ke]['config'] = $element_by_name[$ve['name']];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// echo '<pre>';print_r($params);die;
|
||||
|
||||
$block_list = array(
|
||||
'gridLeft' => array('title' => 'Product-Layout', 'class' => 'left-block'),
|
||||
);
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Ap Profile Manage'),
|
||||
'icon' => 'icon-folder-close'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Name'),
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Product List Key'),
|
||||
'name' => 'plist_key',
|
||||
'readonly' => 'readonly',
|
||||
'desc' => $this->l('Tpl File name'),
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Class'),
|
||||
'type' => 'text',
|
||||
'name' => 'class_detail',
|
||||
'width' => 140
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Url Image Preview'),
|
||||
'type' => 'text',
|
||||
'name' => 'url_img_preview',
|
||||
'desc' => $this->l('Only for developers'),
|
||||
'width' => 140
|
||||
),
|
||||
array(
|
||||
'type' => 'ap_proGrid',
|
||||
'name' => 'ap_proGrid',
|
||||
'params' => $params,
|
||||
'blockList' => $block_list,
|
||||
'elements' => $config_file,
|
||||
'demodetaillink' => 'index.php?controller=AdminApPageBuilderDetails'.'&token='.Tools::getAdminTokenLite('AdminApPageBuilderDetails').'&addappagebuilder_details',
|
||||
'element_by_name' => $element_by_name,
|
||||
'widthList' => ApPageSetting::returnWidthList(),
|
||||
'columnGrids' => ApPageSetting::getColumnGrid(),
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'params'
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'submitAddappagebuilder_detailsAndStay',
|
||||
)
|
||||
),
|
||||
'buttons' => array(
|
||||
'save-and-stay' => array(
|
||||
'title' => $this->l('Save and Stay'),
|
||||
'id' => 'saveAndStay',
|
||||
'type' => 'button',
|
||||
'class' => 'btn btn-default pull-right ',
|
||||
'icon' => 'process-icon-save')
|
||||
)
|
||||
);
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function replaceSpecialStringToHtml($arr)
|
||||
{
|
||||
foreach ($arr as &$v) {
|
||||
if ($v['name'] == 'code') {
|
||||
// validate module
|
||||
$v['code'] = str_replace($this->str_search, $this->str_relace, $v['code']);
|
||||
} else {
|
||||
if ($v['name'] == 'functional_buttons') {
|
||||
foreach ($v as &$f) {
|
||||
if ($f['name'] == 'code') {
|
||||
// validate module
|
||||
$f['code'] = str_replace($this->str_search, $this->str_relace, $f['code']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function getFieldsValue($obj)
|
||||
{
|
||||
$file_value = parent::getFieldsValue($obj);
|
||||
if (!$obj->id) {
|
||||
$num = ApPageSetting::getRandomNumber();
|
||||
$file_value['plist_key'] = 'detail'.$num;
|
||||
$file_value['name'] = $file_value['plist_key'];
|
||||
$file_value['class_detail'] = 'detail-'.$num;
|
||||
}
|
||||
return $file_value;
|
||||
}
|
||||
|
||||
public function processAdd()
|
||||
{
|
||||
if ($obj = parent::processAdd()) {
|
||||
$this->saveTplFile($obj->plist_key, $obj->params);
|
||||
}
|
||||
}
|
||||
|
||||
public function processUpdate()
|
||||
{
|
||||
if ($obj = parent::processUpdate()) {
|
||||
$this->saveTplFile($obj->plist_key, $obj->params);
|
||||
}
|
||||
}
|
||||
|
||||
//save file
|
||||
public function saveTplFile($plist_key, $params)
|
||||
{
|
||||
// validate module
|
||||
unset($params);
|
||||
//if (Tools::get)
|
||||
$data_form = str_replace($this->str_search, $this->str_relace, Tools::getValue('params', ''));
|
||||
$data_form = Tools::jsonDecode($data_form, true);
|
||||
|
||||
$grid_left = $data_form['gridLeft'];
|
||||
//get header
|
||||
|
||||
$tpl_grid = $this->returnFileContent('header_product');
|
||||
//change class
|
||||
// echo '<pre>';print_r($grid_left);die;
|
||||
$tpl_grid = str_replace('class="product-detail', 'class="product-detail '.Tools::getValue('class_detail', '').' '.Tools::getValue('main_class', ''), $tpl_grid);
|
||||
//die($tpl_grid);
|
||||
$tpl_grid .= $this->convertObjectToTpl($grid_left);
|
||||
$tpl_grid .= $this->returnFileContent('footer_product');
|
||||
|
||||
$tpl_grid = preg_replace('/\{\*[\s\S]*?\*\}/', '', $tpl_grid);
|
||||
|
||||
$folder = apPageHelper::getConfigDir('theme_details');
|
||||
if (!is_dir($folder)) {
|
||||
mkdir($folder, 0755, true);
|
||||
}
|
||||
$file = $plist_key.'.tpl';
|
||||
//$tpl_grid = preg_replace('/\{\*[\s\S]*?\*\}/', '', $tpl_grid);
|
||||
//$tpl_grid = str_replace(" mod='appagebuilder'", '', $tpl_grid);
|
||||
|
||||
//die($tpl_grid."--");
|
||||
ApPageSetting::writeFile($folder, $file, $tpl_grid);
|
||||
}
|
||||
|
||||
public function processStatus()
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
if ($object->toggleStatus()) {
|
||||
$matches = array();
|
||||
if (preg_match('/[\?|&]controller=([^&]*)/', (string)$_SERVER['HTTP_REFERER'], $matches) !== false && Tools::strtolower($matches[1]) != Tools::strtolower(preg_replace('/controller/i', '', get_class($this)))) {
|
||||
$this->redirect_after = preg_replace('/[\?|&]conf=([^&]*)/i', '', (string)$_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->redirect_after = self::$currentIndex.'&token='.$this->token;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating the status for an object.')
|
||||
.'<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
public function displayDuplicateLink($token = null, $id = null, $name = null)
|
||||
{
|
||||
$controller = 'AdminApPageBuilderDetails';
|
||||
$token = Tools::getAdminTokenLite($controller);
|
||||
$html = '<a href="#" title="Duplicate" onclick="confirm_link(\'\', \'Duplicate Product Details ID '.$id.'. If you wish to proceed, click "Yes". If not, click "No".\', \'Yes\', \'No\', \'index.php?controller='.$controller.'&id_appagebuilder_details='.$id.'&duplicateappagebuilder_details&token='.$token.'\', \'#\')">
|
||||
<i class="icon-copy"></i> Duplicate
|
||||
</a>';
|
||||
|
||||
// validate module
|
||||
unset($name);
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function access($action, $disable = false)
|
||||
{
|
||||
if (Tools::getIsset('update'.$this->table) && Tools::getIsset($this->identifier)) {
|
||||
// Allow person see "EDIT" form
|
||||
$action = 'view';
|
||||
}
|
||||
return parent::access($action, $disable);
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
if (count($this->errors) <= 0) {
|
||||
if( Tools::isSubmit('duplicate'.$this->table) ) {
|
||||
if ($this->id_object) {
|
||||
if (!$this->access('add'))
|
||||
{
|
||||
$this->errors[] = $this->trans('You do not have permission to duplicate this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
}
|
||||
}elseif(Tools::getIsset('saveELement') && Tools::getValue('saveELement')){
|
||||
if (!$this->access('edit'))
|
||||
{
|
||||
$this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1223
modules/appagebuilder/controllers/admin/AdminApPageBuilderHome.php
Normal file
@@ -0,0 +1,414 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/Helper.php');
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class AdminApPageBuilderHookController extends ModuleAdminControllerCore
|
||||
{
|
||||
/**
|
||||
* @var Boolean $display_key
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
public $display_key = 0;
|
||||
/**
|
||||
* @var Array $hookspos
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
public $hookspos = array();
|
||||
/**
|
||||
* @var Array $ownPositions
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
// public $ownPositions = array();
|
||||
/**
|
||||
* @var String $theme_name
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
public $theme_name;
|
||||
/**
|
||||
* @var String $theme_name
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
public $themeKey;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'leohook';
|
||||
$this->className = 'AdminApPageBuilderHook';
|
||||
$this->lang = true;
|
||||
$this->context = Context::getContext();
|
||||
parent::__construct();
|
||||
$this->display_key = (int)Tools::getValue('show_modules');
|
||||
|
||||
// $this->ownPositions = array(
|
||||
// 'displayHeaderRight',
|
||||
// 'displaySlideshow',
|
||||
// 'topNavigation',
|
||||
// 'displayPromoteTop',
|
||||
// 'displayBottom',
|
||||
// 'displayMassBottom'
|
||||
// );
|
||||
$this->hookspos = ApPageSetting::getHook();
|
||||
$this->theme_name = _THEME_NAME_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build List linked Icons Toolbar
|
||||
*/
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
if (empty($this->display)) {
|
||||
$this->page_header_toolbar_btn['save'] = array(
|
||||
'href' => 'index.php?tab=AdminApPageBuilderHook&token='.Tools::getAdminTokenLite('AdminApPageBuilderHook').'&action=savepos',
|
||||
'id' => 'savepos',
|
||||
'desc' => $this->l('Save Positions')
|
||||
);
|
||||
}
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
/**
|
||||
* get live Edit URL
|
||||
*/
|
||||
public function getLiveEditUrl($live_edit_params)
|
||||
{
|
||||
$url = $this->context->shop->getBaseURL().Dispatcher::getInstance()->createUrl('index', (int)$this->context->language->id, $live_edit_params);
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS')) {
|
||||
$url = str_replace('index.php', '', $url);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* add toolbar icons
|
||||
*/
|
||||
public function initToolbar()
|
||||
{
|
||||
$this->context->smarty->assign('toolbar_scroll', 1);
|
||||
$this->context->smarty->assign('show_toolbar', 1);
|
||||
$this->context->smarty->assign('toolbar_btn', $this->toolbar_btn);
|
||||
$this->context->smarty->assign('title', $this->toolbar_title);
|
||||
}
|
||||
|
||||
/**
|
||||
* render list of modules following positions in the layout editor.
|
||||
*/
|
||||
public function renderList()
|
||||
{
|
||||
$filePath = _PS_ALL_THEMES_DIR_.$this->theme_name.'';
|
||||
$showed = true;
|
||||
$xml = simplexml_load_file($filePath.'/config.xml');
|
||||
|
||||
if (isset($xml->theme_key)) {
|
||||
$this->themeKey = trim((string)$xml->theme_key);
|
||||
}
|
||||
$this->themeKey = '1111';
|
||||
if ($this->themeKey) {
|
||||
$this->initToolbarTitle();
|
||||
$this->initToolbar();
|
||||
$hookspos = $this->hookspos;
|
||||
|
||||
foreach ($hookspos as $hook) {
|
||||
if (Hook::getIdByName($hook)) {
|
||||
// validate module
|
||||
} else {
|
||||
$new_hook = new Hook();
|
||||
$new_hook->name = pSQL($hook);
|
||||
$new_hook->title = pSQL($hook);
|
||||
$new_hook->add();
|
||||
// $id_hook = $new_hook->id;
|
||||
}
|
||||
}
|
||||
|
||||
// $sql = 'UPDATE `'._DB_PREFIX_.'hook` SET position=1, live_edit=1
|
||||
// WHERE name in ("'.implode('","', $hookspos).'") ';
|
||||
// Db::getInstance(_PS_USE_SQL_SLAVE_)->execute($sql);
|
||||
|
||||
$modules = Module::getModulesInstalled(0);
|
||||
$assoc_modules_id = array();
|
||||
|
||||
$assoc_modules_id = $module_instances = array();
|
||||
foreach ($modules as $module) {
|
||||
if ($tmp_instance = Module::getInstanceById((int)$module['id_module'])) {
|
||||
// We want to be able to sort modules by display name
|
||||
$module_instances[$tmp_instance->displayName] = $tmp_instance;
|
||||
// But we also want to associate hooks to modules using the modules IDs
|
||||
$assoc_modules_id[(int)$module['id_module']] = $tmp_instance->displayName;
|
||||
}
|
||||
}
|
||||
$hooks = Hook::getHooks(!(int)Tools::getValue('hook_position'));
|
||||
|
||||
$hookModules = array();
|
||||
|
||||
$hookedModules = array();
|
||||
foreach ($hooks as $key => $hook) {
|
||||
// validate module
|
||||
unset($key);
|
||||
|
||||
$k = $hook['name'];
|
||||
$k = (Tools::strtolower(Tools::substr($k, 0, 1)).Tools::substr($k, 1));
|
||||
if (in_array($k, $hookspos)) {
|
||||
// Get all modules for this hook or only the filtered module
|
||||
$hookModules[$k]['modules'] = Hook::getModulesFromHook($hook['id_hook'], $this->display_key);
|
||||
$hookModules[$k]['module_count'] = count($hookModules[$k]['modules']);
|
||||
|
||||
if (is_array($hookModules[$k]['modules']) && !empty($hookModules[$k]['modules'])) {
|
||||
foreach ($hookModules[$k]['modules'] as $module_key => $module) {
|
||||
if (isset($assoc_modules_id[$module['id_module']])) {
|
||||
$hookedModules[] = $module['id_module'];
|
||||
$hookModules[$k]['modules'][$module_key]['instance'] = $module_instances[$assoc_modules_id[$module['id_module']]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$instances = array();
|
||||
foreach ($modules as $module) {
|
||||
if ($tmp_instance = Module::getInstanceById($module['id_module'])) {
|
||||
foreach ($hookspos as $hk) {
|
||||
$retro_hook_name = Hook::getRetroHookName($hk);
|
||||
$hook_callable = is_callable(array($tmp_instance, 'hook'.$hk));
|
||||
$hook_retro_callable = is_callable(array($tmp_instance, 'hook'.$retro_hook_name));
|
||||
if ($hook_retro_callable || $hook_callable) {
|
||||
$instances[$tmp_instance->displayName] = $tmp_instance;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ksort($instances);
|
||||
|
||||
$tpl = $this->createTemplate('panel.tpl');
|
||||
|
||||
// $this->context->controller->addJqueryUI('ui.sortable');
|
||||
// $this->context->controller->addJqueryUI('ui.draggable');
|
||||
$this->context->controller->addCss(__PS_BASE_URI__.str_replace('//', '/', 'modules/appagebuilder').'/css/admin/style_hook_cpanel.css', 'all');
|
||||
$this->context->controller->addJs(__PS_BASE_URI__.str_replace('//', '/', 'modules/appagebuilder').'/js/jquery-ui-1.10.3.custom.min.js', 'all');
|
||||
$tpl->assign(array(
|
||||
'showed' => $showed,
|
||||
'toolbar' => $this->context->smarty->fetch('toolbar.tpl'),
|
||||
'modules' => $instances,
|
||||
'hookspos' => $hookspos,
|
||||
'URI' => __PS_BASE_URI__.'modules/',
|
||||
'hookModules' => $hookModules,
|
||||
'noModuleConfig' => $this->l('No Configuration For This Module'),
|
||||
'currentURL' => 'index.php?tab=AdminApPageBuilderHook&token='.Tools::getAdminTokenLite('AdminApPageBuilderHook').'',
|
||||
// 'moduleEditURL' => 'index.php?tab=AdminApPageBuilderHook&token='.Tools::getAdminTokenLite('AdminApPageBuilderHook').'',
|
||||
'moduleEditURL' => 'index.php?controller=adminmodules&token='.Tools::getAdminTokenLite('AdminModules').'&tab_module=Home',
|
||||
));
|
||||
|
||||
return $tpl->fetch();
|
||||
} else {
|
||||
$tpl = $this->createTemplate('error.tpl');
|
||||
$tpl->assign(array(
|
||||
'showed' => false,
|
||||
'themeURL' => 'index.php?controller=AdminThemes&token='.Tools::getAdminTokenLite('AdminThemes')
|
||||
));
|
||||
return $tpl->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process posting data
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
if (count($this->errors) > 0) {
|
||||
if ($this->ajax) {
|
||||
$array = array('hasError' => true, 'errors' => $this->errors[0]);
|
||||
die(Tools::jsonEncode($array));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (Tools::getValue('action') && Tools::getValue('action') == 'modulehook') {
|
||||
// AJAX EDIT HOOK - READ
|
||||
$id = (int)Tools::getValue('id');
|
||||
|
||||
$tmp_instance = Module::getInstanceById($id);
|
||||
$hooks = array();
|
||||
|
||||
foreach ($this->hookspos as $hk) {
|
||||
$retro_hook_name = Hook::getRetroHookName($hk);
|
||||
$hook_callable = is_callable(array($tmp_instance, 'hook'.$hk));
|
||||
$hook_retro_callable = is_callable(array($tmp_instance, 'hook'.$retro_hook_name));
|
||||
|
||||
if ($hook_retro_callable || $hook_callable) {
|
||||
$hooks[] = $hk;
|
||||
}
|
||||
}
|
||||
$hooks = implode('|', $hooks);
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'leohook` WHERE id_module='.(int)$id.' AND theme="'.pSQL($this->theme_name).'" AND id_shop='.(int)($this->context->shop->id);
|
||||
|
||||
if ($row = Db::getInstance()->getRow($sql)) {
|
||||
die('{"hasError" : false, "hook" : "'.$row['name_hook'].'","hooks":"'.$hooks.'"}');
|
||||
} else {
|
||||
die('{"hasError" : true, "errors" : "Can not update module position","hooks":"'.$hooks.'"}');
|
||||
}
|
||||
}
|
||||
if (Tools::getValue('action') && Tools::getValue('action') == 'overridehook') {
|
||||
// AJAX EDIT HOOK - SAVE
|
||||
$id_module = (int)Tools::getValue('hdidmodule');
|
||||
$name_hook = Tools::getValue('name_hook');
|
||||
if (is_numeric($name_hook)) {
|
||||
$sql = 'DELETE FROM`'._DB_PREFIX_.'leohook` WHERE id_module='.(int)$id_module.' AND theme="'.pSQL($this->theme_name).'" AND id_shop='.(int)($this->context->shop->id);
|
||||
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->execute($sql);
|
||||
die('{"hasError" : false, "errors" : "done!delete module position"}');
|
||||
} elseif ($name_hook) {
|
||||
$desHook = Tools::getValue('deshook');
|
||||
$desHookId = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT id_hook FROM `'._DB_PREFIX_."hook` WHERE name='".pSQL($desHook)."'");
|
||||
$sql = 'SELECT *
|
||||
FROM `'._DB_PREFIX_.'leohook` WHERE id_hook= '.(int)$desHookId.' AND id_module='.(int)$id_module.' AND theme="'.pSQL($this->theme_name).'" AND id_shop='.(int)($this->context->shop->id);
|
||||
|
||||
if ($row = Db::getInstance()->getRow($sql)) {
|
||||
$sql = ' UPDATE `'._DB_PREFIX_.'leohook` SET `id_hook`='.(int)$desHookId.', name_hook="'.pSQL($name_hook).'"
|
||||
WHERE id_module='.(int)$id_module.' AND theme="'.pSQL($this->theme_name).'" AND id_shop='.(int)($this->context->shop->id);
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->execute($sql);
|
||||
} else {
|
||||
$sql = ' INSERT INTO `'._DB_PREFIX_.'leohook` (id_hook, id_module, id_shop, theme, name_hook)
|
||||
VALUES('.(int)$desHookId.','.(int)$id_module.','.(int)($this->context->shop->id).',"'.pSQL($this->theme_name).'","'.pSQL($name_hook).'")';
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->execute($sql);
|
||||
}
|
||||
die('{"hasError" : false, "errors" : "done!update module position"}');
|
||||
}
|
||||
die('{"hasError" : true, "errors" : "Can not update module position"}');
|
||||
}
|
||||
if (Tools::getValue('action') && Tools::getValue('action') == 'savepos') {
|
||||
// SUBMIT - SAVE HOOK
|
||||
$positions = Tools::getValue('position');
|
||||
$way = (int)(Tools::getValue('way'));
|
||||
$unhook = Tools::getValue('unhook');
|
||||
$id_shop = Context::getContext()->shop->id;
|
||||
|
||||
if (is_array($unhook)) {
|
||||
foreach ($unhook as $id_module => $str_hookId) {
|
||||
$hookIds = explode(',', $str_hookId);
|
||||
foreach ($hookIds as $hookId) {
|
||||
$module = Module::getInstanceById($id_module);
|
||||
if (Validate::isLoadedObject($module)) {
|
||||
!$module->unregisterHook((int)$hookId, array($id_shop));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($positions) && !empty($positions)) {
|
||||
foreach ($positions as $pos) {
|
||||
$tmp = explode('|', $pos);
|
||||
if (count($tmp) == 2 && $tmp[0] && $tmp[1]) {
|
||||
$position = $tmp[0];
|
||||
$hookId = Hook::getIdByName($position);
|
||||
$oldhooks = explode(',', Tools::getValue($position));
|
||||
|
||||
$ids = explode(',', $tmp[1]);
|
||||
if ($hookId && count($oldhooks)) {
|
||||
foreach ($ids as $index => $id_module) {
|
||||
$module = Module::getInstanceById($id_module);
|
||||
|
||||
if (Validate::isLoadedObject($module) && isset($oldhooks[$index]) && is_numeric($oldhooks[$index]) && $oldhooks[$index] != $hookId) {
|
||||
// MOVE MODULE TO OTHER HOOK
|
||||
$sql = 'UPDATE `'._DB_PREFIX_.'hook_module` SET id_hook='.(int)$hookId.'
|
||||
WHERE id_module='.(int)$id_module.' AND id_hook='.(int)$oldhooks[$index].' AND id_shop='.(int)($id_shop);
|
||||
try {
|
||||
// FIX: Drag a module to one hook in 2 times. Save 500 error
|
||||
Db::getInstance(_PS_USE_SQL_SLAVE_)->execute($sql);
|
||||
} catch (Exception $ex) {
|
||||
}
|
||||
} elseif (Validate::isLoadedObject($module) && (!isset($oldhooks[$index]) || !(int)$oldhooks[$index])) {
|
||||
$this->registerHook($id_module, $hookId, array($id_shop));
|
||||
echo 'new:'.$id_module;
|
||||
}
|
||||
$module->updatePosition($hookId, $way, $index + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
die('{"hasError" : false, "errors" : "update module position"}');
|
||||
}
|
||||
}
|
||||
|
||||
public function registerHook($id_module, $id_hook, $shop_list = null)
|
||||
{
|
||||
// If shop lists is null, we fill it with all shops
|
||||
if (is_null($shop_list)) {
|
||||
$shop_list = Shop::getShops(true, null, true);
|
||||
}
|
||||
|
||||
$return = true;
|
||||
foreach ($shop_list as $shop_id) {
|
||||
// Check if already register
|
||||
$sql = 'SELECT hm.`id_module`
|
||||
FROM `'._DB_PREFIX_.'hook_module` hm, `'._DB_PREFIX_.'hook` h
|
||||
WHERE hm.`id_module` = '.(int)($id_module).' AND h.`id_hook` = '.(int)$id_hook.'
|
||||
AND h.`id_hook` = hm.`id_hook` AND `id_shop` = '.(int)$shop_id;
|
||||
|
||||
|
||||
if (Db::getInstance()->getRow($sql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get module position in hook
|
||||
$sql = 'SELECT MAX(`position`) AS position
|
||||
FROM `'._DB_PREFIX_.'hook_module`
|
||||
WHERE `id_hook` = '.(int)$id_hook.' AND `id_shop` = '.(int)$shop_id;
|
||||
if (!$position = Db::getInstance()->getValue($sql)) {
|
||||
$position = 0;
|
||||
}
|
||||
|
||||
// Register module in hook
|
||||
$return &= Db::getInstance()->insert('hook_module', array(
|
||||
'id_module' => (int)$id_module,
|
||||
'id_hook' => (int)$id_hook,
|
||||
'id_shop' => (int)$shop_id,
|
||||
'position' => (int)($position + 1),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
if (count($this->errors) <= 0) {
|
||||
if(Tools::getIsset('updateleohook') && Tools::getValue('updateleohook')){
|
||||
if (!$this->access('edit'))
|
||||
{
|
||||
$this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageSetting.php');
|
||||
|
||||
class AdminApPageBuilderImagesController extends ModuleAdminController
|
||||
{
|
||||
protected $max_image_size = null;
|
||||
public $theme_name;
|
||||
public $module_name = 'appagebuilder';
|
||||
public $img_path;
|
||||
public $folder_name;
|
||||
public $module_path;
|
||||
public $tpl_path;
|
||||
public $theme_dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->theme_dir = _PS_THEME_DIR_;
|
||||
$this->folder_name = Tools::getIsset('imgDir') ? Tools::getValue('imgDir') : 'images';
|
||||
$this->bootstrap = true;
|
||||
$this->max_image_size = (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE');
|
||||
$this->theme_name = _THEME_NAME_;
|
||||
$this->img_path = apPageHelper::getImgThemeDir($this->folder_name);
|
||||
$this->img_url = apPageHelper::getImgThemeUrl($this->folder_name);
|
||||
$this->className = 'ApPageBuilderImages';
|
||||
$this->context = Context::getContext();
|
||||
$this->module_path = __PS_BASE_URI__.'modules/'.$this->module_name.'/';
|
||||
$this->tpl_path = _PS_ROOT_DIR_.'/modules/'.$this->module_name.'/views/templates/admin';
|
||||
|
||||
# LIVE THEME EDITER
|
||||
$leo_controller = Tools::getValue('leo_controller');
|
||||
if ($leo_controller == 'live_theme_edit') {
|
||||
$this->context->controller->addCss(apPageHelper::getCssAdminDir().'admin/images.css', 'all');
|
||||
|
||||
$this->img_path = _PS_ALL_THEMES_DIR_._THEME_NAME_.'/assets/img/patterns/';
|
||||
$this->img_url = __PS_BASE_URI__.'themes/'._THEME_NAME_.'/assets/img/patterns/';
|
||||
$this->context->controller->addCss(apPageHelper::getCssAdminDir().'admin/images.css', 'all');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Live Theme Editor
|
||||
*/
|
||||
public function renderList()
|
||||
{
|
||||
$tpl = $this->createTemplate('imagemanager.tpl');
|
||||
$sort_by = Tools::getValue('sortBy');
|
||||
$images = $this->getImageList($sort_by);
|
||||
$image_uploader = new HelperImageUploader('file');
|
||||
$image_uploader->setSavePath($this->img_path);
|
||||
$image_uploader->setMultiple(true)->setUseAjax(true)->setUrl(Context::getContext()->link->getAdminLink('AdminApPageBuilderImages').'&ajax=1&action=addimage&leo_controller=live_theme_edit'); // url upload image
|
||||
|
||||
$tpl->assign(array(
|
||||
'img_dir' => $this->folder_name,
|
||||
'countImages' => count($images),
|
||||
'images' => $images,
|
||||
'max_image_size' => $this->max_image_size / 1024 / 1024,
|
||||
'image_uploader' => $image_uploader->render(),
|
||||
'imgManUrl' => Context::getContext()->link->getAdminLink('AdminApPageBuilderImages'),
|
||||
'token' => $this->token,
|
||||
'url_param' => '&leo_controller=live_theme_edit'
|
||||
));
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Live Theme Editor
|
||||
*/
|
||||
public function ajaxProcessReloadBackground()
|
||||
{
|
||||
$sort_by = Tools::getValue('sortBy');
|
||||
$tpl = $this->createTemplate('imagemanager.tpl');
|
||||
$images = $this->getImageList($sort_by);
|
||||
$tpl->assign(array(
|
||||
'images' => $images,
|
||||
'reloadBack' => 1,
|
||||
));
|
||||
die(Tools::jsonEncode($tpl->fetch()));
|
||||
}
|
||||
|
||||
public function getImageList($sortBy)
|
||||
{
|
||||
$path = $this->img_path;
|
||||
# CACH 1 : lay cac file anh
|
||||
$images = glob($path.'{*.jpeg,*.JPEG,*.jpg,*.JPG,*.gif,*.GIF,*.png,*.PNG}', GLOB_BRACE);
|
||||
if ($images === null) {
|
||||
# CACH 2 : lay cac file anh
|
||||
$files = scandir($path);
|
||||
$files = array_diff($files, array('..', '.')); # insert code
|
||||
|
||||
$images = array();
|
||||
foreach ($files as $key => $image) {
|
||||
# validate module
|
||||
unset($key);
|
||||
$ext = Tools::substr($image, strrpos($image, '.') + 1);
|
||||
if (in_array($ext, array('jpg', 'jpeg', 'png', 'gif', 'JPG', 'JPEG', 'PNG', 'GIF'))) {
|
||||
$images[] = $image;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($sortBy == 'name_desc') {
|
||||
rsort($images);
|
||||
}
|
||||
|
||||
if ($sortBy == 'date' || $sortBy == 'date_desc') {
|
||||
ksort($images);
|
||||
}
|
||||
if ($sortBy == 'date_desc') {
|
||||
rsort($images);
|
||||
}
|
||||
|
||||
$result = array();
|
||||
foreach ($images as &$file) {
|
||||
$fileInfo = pathinfo($file);
|
||||
$result[] = array(
|
||||
'name' => $fileInfo['basename'],
|
||||
'link' => $this->img_url.$fileInfo['basename']);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function renderTemplate($tpl_name)
|
||||
{
|
||||
$path = '';
|
||||
if (file_exists($this->theme_dir.'modules/'.$this->module->name.'/views/templates/admin/'.$tpl_name) && $this->viewAccess()) {
|
||||
$path = $this->theme_dir.'modules/'.$this->module->name.'/views/templates/admin/'.$tpl_name;
|
||||
} elseif (file_exists($this->getTemplatePath().$this->override_folder.$tpl_name) && $this->viewAccess()) {
|
||||
$path = $this->getTemplatePath().$this->override_folder.$tpl_name;
|
||||
}
|
||||
$content = Context::getContext()->smarty->fetch($path);
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Manage Image
|
||||
*/
|
||||
public function ajaxProcessManageImage()
|
||||
{
|
||||
$smarty = Context::getContext()->smarty;
|
||||
$sort_by = Tools::getValue('sortBy');
|
||||
$images = $this->getImageList($sort_by);
|
||||
$image_uploader = new HelperImageUploader('file');
|
||||
$image_uploader->setSavePath($this->img_path);
|
||||
$image_uploader->setTemplateDirectory($this->tpl_path.'/helpers/uploader');
|
||||
|
||||
$image_uploader->setTemplate('ajax.tpl');
|
||||
$image_uploader->setMultiple(true)->setUseAjax(true)->setUrl(Context::getContext()->link->getAdminLink('AdminApPageBuilderImages').'&ajax=1&action=addimage&imgDir='.$this->folder_name);
|
||||
$upload_html = $image_uploader->render();
|
||||
$smarty->assign(array(
|
||||
'img_dir' => $this->folder_name,
|
||||
'widget' => Tools::getValue('widget'),
|
||||
'countImages' => count($images),
|
||||
'images' => $images,
|
||||
'max_image_size' => $this->max_image_size / 1024 / 1024,
|
||||
'image_uploader' => $upload_html,
|
||||
'imgManUrl' => Context::getContext()->link->getAdminLink('AdminApPageBuilderImages'),
|
||||
'token' => $this->token,
|
||||
'link' => Context::getContext()->link,
|
||||
));
|
||||
die($this->renderTemplate('imagemanager.tpl'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Add Image
|
||||
*/
|
||||
public function ajaxProcessAddImage()
|
||||
{
|
||||
if (isset($_FILES['file'])) {
|
||||
try {
|
||||
$image_uploader = new HelperUploader('file');
|
||||
|
||||
if (!file_exists($this->img_path)) {
|
||||
mkdir($this->img_path, 0755, true);
|
||||
}
|
||||
$image_uploader->setSavePath($this->img_path);
|
||||
$image_uploader->setAcceptTypes(array('jpeg', 'gif', 'png', 'jpg'))->setMaxSize($this->max_image_size);
|
||||
$total_errors = array();
|
||||
|
||||
$files = $image_uploader->process();
|
||||
foreach ($files as &$file) {
|
||||
$errors = array();
|
||||
// Evaluate the memory required to resize the image: ifit's too much, you can't resize it.
|
||||
if (!ImageManager::checkImageMemoryLimit($file['save_path'])) {
|
||||
$errors[] = Tools::displayError('Due to memory limit restrictions, this image cannot be loaded.
|
||||
Please increase your memory_limit value via your server\'s configuration settings.');
|
||||
}
|
||||
if (count($errors)) {
|
||||
$total_errors = array_merge($total_errors, $errors);
|
||||
}
|
||||
//unlink($file['save_path']);
|
||||
//Necesary to prevent hacking
|
||||
unset($file['save_path']);
|
||||
//Add image preview and delete url
|
||||
}
|
||||
if (count($total_errors)) {
|
||||
$this->context->controller->errors = array_merge($this->context->controller->errors, $total_errors);
|
||||
}
|
||||
$images = $this->getImageList('date');
|
||||
$tpl = $this->createTemplate('imagemanager.tpl');
|
||||
$tpl->assign(array(
|
||||
'images' => $images,
|
||||
'reloadSliderImage' => 1,
|
||||
'link' => Context::getContext()->link
|
||||
));
|
||||
|
||||
die(Tools::jsonEncode($tpl->fetch()));
|
||||
} catch (Exception $ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Sort Image
|
||||
*/
|
||||
public function ajaxProcessReLoadSliderImage()
|
||||
{
|
||||
$tpl = $this->createTemplate('imagemanager.tpl');
|
||||
$sort_by = Tools::getValue('sortBy');
|
||||
$images = $this->getImageList($sort_by);
|
||||
$tpl->assign(array(
|
||||
'images' => $images,
|
||||
'reloadSliderImage' => 1,
|
||||
'link' => Context::getContext()->link
|
||||
));
|
||||
die(Tools::jsonEncode($tpl->fetch()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Action Delete Image
|
||||
*/
|
||||
public function ajaxProcessDeleteImage()
|
||||
{
|
||||
if (($img_name = Tools::getValue('imgName', false)) !== false) {
|
||||
unlink($this->img_path.$img_name);
|
||||
$images = $this->getImageList('date');
|
||||
$tpl = $this->createTemplate('imagemanager.tpl');
|
||||
$tpl->assign(array(
|
||||
'images' => $images,
|
||||
'reloadSliderImage' => 1,
|
||||
'link' => Context::getContext()->link
|
||||
));
|
||||
|
||||
die(Tools::jsonEncode($tpl->fetch()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class AdminApPageBuilderModuleController extends ModuleAdminControllerCore
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$url = 'index.php?controller=AdminModules&configure=appagebuilder&token='.Tools::getAdminTokenLite('AdminModules');
|
||||
Tools::redirectAdmin($url);
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,480 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageBuilderPositionsModel.php');
|
||||
|
||||
class AdminApPageBuilderPositionsController extends ModuleAdminControllerCore
|
||||
{
|
||||
public $position_js_folder = '';
|
||||
public $position_css_folder = '';
|
||||
public $module_name = 'appagebuilder';
|
||||
public $explicit_select;
|
||||
public $order_by;
|
||||
public $order_way;
|
||||
public $theme_dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'appagebuilder_positions';
|
||||
$this->className = 'ApPageBuilderPositionsModel';
|
||||
$this->lang = false;
|
||||
$this->explicit_select = true;
|
||||
$this->allow_export = true;
|
||||
$this->context = Context::getContext();
|
||||
$this->order_by = 'position';
|
||||
$this->order_way = 'DESC';
|
||||
$this->_join = '
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_positions_shop` ps ON (ps.`id_appagebuilder_positions` = a.`id_appagebuilder_positions`)';
|
||||
parent::__construct();
|
||||
$this->fields_list = array(
|
||||
'id_appagebuilder_positions' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 50,
|
||||
'class' => 'fixed-width-xs'
|
||||
),
|
||||
'position' => array(
|
||||
'title' => $this->l('Position'),
|
||||
'width' => 140,
|
||||
'type' => 'text',
|
||||
'filter_key' => 'a!position',
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'width' => 140,
|
||||
'type' => 'text',
|
||||
'filter_key' => 'a!name',
|
||||
'remove_onclick' => true
|
||||
),
|
||||
'position_key' => array(
|
||||
'title' => $this->l('Key'),
|
||||
'filter_key' => 'a!position_key',
|
||||
'type' => 'text',
|
||||
'width' => 140,
|
||||
'remove_onclick' => true
|
||||
)
|
||||
);
|
||||
$this->list_no_link = 'no';
|
||||
$this->bulk_actions = array(
|
||||
'delete' => array(
|
||||
'text' => $this->l('Delete selected'),
|
||||
'confirm' => $this->l('Delete selected items?'),
|
||||
'icon' => 'icon-trash'
|
||||
),
|
||||
'correctlink' => array(
|
||||
'text' => $this->l('Correct Image Link'),
|
||||
'confirm' => $this->l('Are you sure you want to change image url from old theme to new theme?'),
|
||||
'icon' => 'icon-edit'
|
||||
),
|
||||
'insertLang' => array(
|
||||
'text' => $this->l('Auto Input Data for New Lang'),
|
||||
'confirm' => $this->l('Auto insert data for new language?'),
|
||||
'icon' => 'icon-edit'
|
||||
)
|
||||
);
|
||||
$this->_where = ' AND ps.id_shop='.(int)$this->context->shop->id;
|
||||
|
||||
$this->theme_dir = _PS_THEME_DIR_;
|
||||
$this->position_css_folder = _PS_THEME_DIR_.apPageHelper::getCssDir().'positions/';
|
||||
$this->position_js_folder = _PS_THEME_DIR_.apPageHelper::getJsDir().'positions/';
|
||||
|
||||
if (!is_dir($this->position_css_folder)) {
|
||||
mkdir($this->position_css_folder, 0755, true);
|
||||
}
|
||||
if (!is_dir($this->position_js_folder)) {
|
||||
mkdir($this->position_js_folder, 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
public function processDelete()
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
// Check using other profile
|
||||
$result = ApPageBuilderPositionsModel::getProfileUsingPosition($object->id);
|
||||
if (!$result) {
|
||||
$object = parent::processDelete();
|
||||
if ($object->position_key) {
|
||||
Tools::deleteFile($this->position_css_folder.$object->position.$object->position_key.'.css');
|
||||
Tools::deleteFile($this->position_js_folder.$object->position.$object->position_key.'.js');
|
||||
}
|
||||
} else {
|
||||
$name_profile = '';
|
||||
$sep = '';
|
||||
foreach ($result as $item) {
|
||||
$name_profile .= $sep.$item['name'];
|
||||
$sep = ', ';
|
||||
}
|
||||
$this->errors[] = sprintf($this->l('Can not delete position "%s", it is being used by Profile : "%s"'), $object->name, $name_profile);
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
public function processBulkDelete()
|
||||
{
|
||||
// Remove resouce and update table profiles
|
||||
$arr = $this->boxes;
|
||||
if (!$arr) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($arr as $id) {
|
||||
$profiles = ApPageBuilderPositionsModel::getProfileUsingPosition($id);
|
||||
$object = new ApPageBuilderPositionsModel($id);
|
||||
if (!$profiles) {
|
||||
$object->delete();
|
||||
if ($object->position_key) {
|
||||
Tools::deleteFile($this->position_css_folder.$object->position.$object->position_key.'.css');
|
||||
Tools::deleteFile($this->position_js_folder.$object->position.$object->position_key.'.js');
|
||||
}
|
||||
} else {
|
||||
$name_profile = '';
|
||||
$sep = '';
|
||||
foreach ($profiles as $profile) {
|
||||
$name_profile .= $sep.$profile['name'];
|
||||
$sep = ', ';
|
||||
}
|
||||
$this->errors[] = sprintf($this->l('Can not delete position "%s", it is being used by Profile : "%s"'), $object->name, $name_profile);
|
||||
}
|
||||
}
|
||||
if (empty($this->errors)) {
|
||||
$this->confirmations[] = $this->_conf[1];
|
||||
}
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
$this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderHome');
|
||||
$this->redirect_after .= '&id_appagebuilder_positions='.$object->id;
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
public function processStatus()
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
if ($object->toggleStatus()) {
|
||||
$matches = array();
|
||||
if (preg_match('/[\?|&]controller=([^&]*)/', (string)$_SERVER['HTTP_REFERER'], $matches) !== false && Tools::strtolower($matches[1]) != Tools::strtolower(preg_replace('/controller/i', '', get_class($this)))) {
|
||||
$this->redirect_after = preg_replace('/[\?|&]conf=([^&]*)/i', '', (string)$_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->redirect_after = self::$currentIndex.'&token='.$this->token;
|
||||
}
|
||||
|
||||
$id_category = (($id_category = (int)Tools::getValue('id_category')) && Tools::getValue('id_product')) ? '&id_category='.$id_category : '';
|
||||
$this->redirect_after .= '&conf=5'.$id_category;
|
||||
} else {
|
||||
$this->errors[] = $this->l('You can not disable default profile, Please select other profile as default');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('An error occurred while updating the status for an object.').' <b>'.$this->table.'</b> '.$this->l('(cannot load object)');
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
parent::postProcess();
|
||||
if (count($this->errors) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Tools::getIsset('duplicateappagebuilder_positions')) {
|
||||
$id = Tools::getValue('id_appagebuilder_positions');
|
||||
$this->duplicatePosition($id, '');
|
||||
}
|
||||
|
||||
# Delete POSITIONS NOT USE
|
||||
if (Tools::getValue('leo_delete_position') && Tools::getValue('leo_delete_position')) {
|
||||
apPageHelper::processDeleteOldPosition();
|
||||
$this->confirmations[] = 'POSITIONS NOT USE have been deleted successfully.';
|
||||
}
|
||||
}
|
||||
|
||||
public function duplicatePosition($id, $type = '', $name = '')
|
||||
{
|
||||
$id = (int)$id;
|
||||
$object = ApPageBuilderPositionsModel::getPositionById($id);
|
||||
if ($object) {
|
||||
$key = ApPageSetting::getRandomNumber();
|
||||
$old_key = $object['position_key'];
|
||||
$name = $name ? $name : $this->l('Duplicate ').$key;
|
||||
$data = array('name' => $name, 'position' => $object['position'], 'position_key' => 'duplicate_'.$key);
|
||||
$model = new ApPageBuilderPositionsModel();
|
||||
$duplicate_id = $model->addAuto($data);
|
||||
AdminApPageBuilderShortcodesController::duplcateDataPosition($id, $duplicate_id);
|
||||
if ($duplicate_id) {
|
||||
//duplicate shortCode
|
||||
ApPageSetting::writeFile($this->position_js_folder, $data['position'].$data['position_key'].'.js', Tools::file_get_contents($this->position_js_folder.$data['position'].$old_key.'.js'));
|
||||
ApPageSetting::writeFile($this->position_css_folder, $data['position'].$data['position_key'].'.css', Tools::file_get_contents($this->position_css_folder.$data['position'].$old_key.'.css'));
|
||||
if ($type != 'ajax') {
|
||||
$this->redirect_after = self::$currentIndex.'&token='.$this->token;
|
||||
$this->redirect();
|
||||
} else {
|
||||
return $duplicate_id;
|
||||
}
|
||||
} else {
|
||||
if ($type != 'ajax') {
|
||||
Tools::displayError('Can not duplicate Position');
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else if ($type != 'ajax') {
|
||||
Tools::displayError('Can not duplicate Position');
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->initToolbar();
|
||||
|
||||
$this->addRowAction('view');
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('duplicate');
|
||||
$this->addRowAction('delete');
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$this->initToolbar();
|
||||
$this->context->controller->addJqueryUI('ui.sortable');
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Ap Position Manage'),
|
||||
'icon' => 'icon-folder-close'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Name'),
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Position Key'),
|
||||
'name' => 'position_key',
|
||||
'required' => true,
|
||||
'desc' => $this->l('Use it to save as file name of css and js of Position'),
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Type'),
|
||||
'name' => 'position',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'header',
|
||||
'name' => $this->l('Header'),
|
||||
),
|
||||
array(
|
||||
'id' => 'content',
|
||||
'name' => $this->l('Content'),
|
||||
),
|
||||
array(
|
||||
'id' => 'footer',
|
||||
'name' => $this->l('Footer'),
|
||||
),
|
||||
array(
|
||||
'id' => 'product',
|
||||
'name' => $this->l('Product'),
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Custom Css'),
|
||||
'name' => 'css',
|
||||
'desc' => sprintf($this->l('Please set write Permission for folder %s'), $this->position_css_folder),
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Custom Js'),
|
||||
'name' => 'js',
|
||||
'desc' => sprintf($this->l('Please set write Permission for folder %s'), $this->position_js_folder),
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
),
|
||||
'buttons' => array(
|
||||
'save-and-stay' => array(
|
||||
'title' => $this->l('Save and Stay'),
|
||||
'name' => 'submitAdd'.$this->table.'AndStay',
|
||||
'type' => 'submit',
|
||||
'class' => 'btn btn-default pull-right',
|
||||
'icon' => 'process-icon-save'
|
||||
))
|
||||
);
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function getFieldsValue($obj)
|
||||
{
|
||||
$file_value = parent::getFieldsValue($obj);
|
||||
if ($obj->id && $obj->position_key) {
|
||||
$file_value['css'] = Tools::file_get_contents($this->position_css_folder.$obj->position.$obj->position_key.'.css');
|
||||
$file_value['js'] = Tools::file_get_contents($this->position_js_folder.$obj->position.$obj->position_key.'.js');
|
||||
} else {
|
||||
$file_value['position_key'] = 'position'.ApPageSetting::getRandomNumber();
|
||||
}
|
||||
return $file_value;
|
||||
}
|
||||
|
||||
public function processAdd()
|
||||
{
|
||||
if ($obj = parent::processAdd()) {
|
||||
$this->saveCustomJsAndCss($obj->position.$obj->position_key, '');
|
||||
}
|
||||
}
|
||||
|
||||
public function processUpdate()
|
||||
{
|
||||
// Check ifchange position => need delete current file css/js before update
|
||||
$old_object = parent::loadObject();
|
||||
if ($obj = parent::processUpdate()) {
|
||||
$this->saveCustomJsAndCss($obj->position.$obj->position_key, $old_object->position.$obj->position_key);
|
||||
}
|
||||
}
|
||||
|
||||
public function saveCustomJsAndCss($key, $old_key = '')
|
||||
{
|
||||
// Delete old file
|
||||
if ($old_key) {
|
||||
Tools::deleteFile($this->position_css_folder.$old_key.'.css');
|
||||
Tools::deleteFile($this->position_js_folder.$old_key.'.js');
|
||||
}
|
||||
//DONGND:: validate
|
||||
// if (!empty(Tools::getValue('js'))) {
|
||||
if (Tools::getValue('js') != '') {
|
||||
ApPageSetting::writeFile($this->position_js_folder, $key.'.js', Tools::getValue('js'));
|
||||
}
|
||||
//DONGND:: validate
|
||||
// if (!empty(Tools::getValue('css'))) {
|
||||
if (Tools::getValue('css') != '') {
|
||||
ApPageSetting::writeFile($this->position_css_folder, $key.'.css', Tools::getValue('css'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto create a position for page build profile editing/creating
|
||||
* @param type $obj
|
||||
*/
|
||||
public function autoCreatePosition($obj)
|
||||
{
|
||||
$model = new ApPageBuilderPositionsModel();
|
||||
$id = $model->addAuto($obj);
|
||||
if ($id) {
|
||||
$this->saveCustomJsAndCss($obj['position'].$obj['position_key'], '');
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
public function updateName($id, $name)
|
||||
{
|
||||
return ApPageBuilderPositionsModel::updateName($id, $name);
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
# Delete POSITIONS NOT USE
|
||||
switch ($this->display) {
|
||||
default:
|
||||
$this->toolbar_btn['eraser'] = array(
|
||||
'href' => self::$currentIndex.'&leo_delete_position=1&token='.$this->token,
|
||||
'desc' => $this->l('Delete position do not use (fix error when create profile)'),
|
||||
'imgclass' => 'eraser',
|
||||
'class' => 'leo_delete_position',
|
||||
);
|
||||
}
|
||||
parent::initToolbar();
|
||||
}
|
||||
|
||||
public function setMedia($isNewTheme = false)
|
||||
{
|
||||
parent::setMedia($isNewTheme);
|
||||
Context::getContext()->controller->addJs(apPageHelper::getJsAdminDir().'admin/form_admin_positions.js');
|
||||
Media::addJsDefL('leo_confirm_text', $this->l('Are you sure you want to Delete do not use position. Please back-up all thing before?'));
|
||||
Media::addJsDefL('leo_form_submit', Context::getContext()->link->getAdminLink('AdminApPageBuilderPositions'));
|
||||
}
|
||||
|
||||
public function displayDuplicateLink($token = null, $id = null, $name = null)
|
||||
{
|
||||
$controller = 'AdminApPageBuilderPositions';
|
||||
$token = Tools::getAdminTokenLite($controller);
|
||||
$html = '<a href="#" title="Duplicate" onclick="confirm_link(\'\', \'Duplicate Position ID '.$id.'. If you wish to proceed, click "Yes". If not, click "No".\', \'Yes\', \'No\', \'index.php?controller='.$controller.'&id_appagebuilder_positions='.$id.'&duplicateappagebuilder_positions&token='.$token.'\', \'#\')">
|
||||
<i class="icon-copy"></i> Duplicate
|
||||
</a>';
|
||||
|
||||
// validate module
|
||||
unset($name);
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function access($action, $disable = false)
|
||||
{
|
||||
if (Tools::getIsset('update'.$this->table) && Tools::getIsset($this->identifier)) {
|
||||
// Allow person see "EDIT" form
|
||||
$action = 'view';
|
||||
}
|
||||
return parent::access($action, $disable);
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
if (count($this->errors) <= 0) {
|
||||
if( Tools::isSubmit('duplicate'.$this->table) ) {
|
||||
if ($this->id_object) {
|
||||
if (!$this->access('add'))
|
||||
{
|
||||
$this->errors[] = $this->trans('You do not have permission to duplicate this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
}
|
||||
}elseif(Tools::getIsset('leo_delete_position') && Tools::getValue('leo_delete_position')){
|
||||
if (!$this->access('delete'))
|
||||
{
|
||||
$this->errors[] = $this->trans('You do not have permission to delelte this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class AdminAdminApthemeConfigLiveController extends ModuleAdminControllerCore
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,492 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageBuilderProductsModel.php');
|
||||
|
||||
class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
|
||||
{
|
||||
private $theme_name = '';
|
||||
public $module_name = 'appagebuilder';
|
||||
public $tpl_save = '';
|
||||
public $file_content = array();
|
||||
public $explicit_select;
|
||||
public $order_by;
|
||||
public $order_way;
|
||||
public $profile_css_folder;
|
||||
public $module_path;
|
||||
// public $module_path_resource;
|
||||
public $str_search = array();
|
||||
public $str_relace = array();
|
||||
public $theme_dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'appagebuilder_products';
|
||||
$this->className = 'ApPageBuilderProductsModel';
|
||||
$this->lang = false;
|
||||
$this->explicit_select = true;
|
||||
$this->allow_export = true;
|
||||
$this->context = Context::getContext();
|
||||
$this->_join = '
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_products_shop` ps ON (ps.`id_appagebuilder_products` = a.`id_appagebuilder_products`)';
|
||||
$this->_select .= ' ps.active as active, ';
|
||||
|
||||
$this->order_by = 'id_appagebuilder_products';
|
||||
$this->order_way = 'DESC';
|
||||
parent::__construct();
|
||||
$this->fields_list = array(
|
||||
'id_appagebuilder_products' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 50,
|
||||
'class' => 'fixed-width-xs'
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'width' => 140,
|
||||
'type' => 'text',
|
||||
'filter_key' => 'a!name'
|
||||
),
|
||||
'plist_key' => array(
|
||||
'title' => $this->l('Product List Key'),
|
||||
'filter_key' => 'a!plist_key',
|
||||
'type' => 'text',
|
||||
'width' => 140,
|
||||
),
|
||||
'class' => array(
|
||||
'title' => $this->l('Class'),
|
||||
'width' => 140,
|
||||
'type' => 'text',
|
||||
'filter_key' => 'a!class',
|
||||
'orderby' => false
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Is Default'),
|
||||
'active' => 'status',
|
||||
'filter_key' => 'ps!active',
|
||||
'align' => 'text-center',
|
||||
'type' => 'bool',
|
||||
'class' => 'fixed-width-sm',
|
||||
'orderby' => false
|
||||
),
|
||||
);
|
||||
$this->bulk_actions = array(
|
||||
'delete' => array(
|
||||
'text' => $this->l('Delete selected'),
|
||||
'confirm' => $this->l('Delete selected items?'),
|
||||
'icon' => 'icon-trash'
|
||||
)
|
||||
);
|
||||
$this->theme_dir = _PS_THEME_DIR_;
|
||||
|
||||
$this->_where = ' AND ps.id_shop='.(int)$this->context->shop->id;
|
||||
$this->theme_name = _THEME_NAME_;
|
||||
$this->profile_css_folder = $this->theme_dir.'modules/'.$this->module_name.'/';
|
||||
$this->module_path = __PS_BASE_URI__.'modules/'.$this->module_name.'/';
|
||||
// $this->module_path_resource = $this->module_path.'views/';
|
||||
$this->str_search = array('_APAMP_', '_APQUOT_', '_APAPOST_', '_APTAB_', '_APNEWLINE_', '_APENTER_', '_APOBRACKET_', '_APCBRACKET_', '_APOCBRACKET_', '_APCCBRACKET_');
|
||||
$this->str_relace = array('&', '\"', '\'', '\t', '\r', '\n', '[', ']', '{', '}');
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
if ($object->page == 'product_detail') {
|
||||
$this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderProductDetail');
|
||||
} else {
|
||||
$this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderHome');
|
||||
}
|
||||
$this->redirect_after .= '&id_appagebuilder_products='.$object->id;
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
parent::postProcess();
|
||||
|
||||
if (count($this->errors) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Tools::getIsset('duplicateappagebuilder_products')) {
|
||||
$id = Tools::getValue('id_appagebuilder_products');
|
||||
$model = new ApPageBuilderProductsModel($id);
|
||||
$duplicate_object = $model->duplicateObject();
|
||||
if(isset($model->params)){
|
||||
# FIX : insert code can not duplicate
|
||||
$duplicate_object->params = $model->params;
|
||||
}
|
||||
$duplicate_object->name = $this->l('Duplicate of').' '.$duplicate_object->name;
|
||||
$old_key = $duplicate_object->plist_key;
|
||||
$duplicate_object->plist_key = 'plist'.ApPageSetting::getRandomNumber();
|
||||
if ($duplicate_object->add()) {
|
||||
//duplicate shortCode
|
||||
$filecontent = Tools::file_get_contents(apPageHelper::getConfigDir('theme_profiles').$old_key.'.tpl');
|
||||
ApPageSetting::writeFile(apPageHelper::getConfigDir('theme_profiles'), $duplicate_object->plist_key.'.tpl', $filecontent);
|
||||
$this->redirect_after = self::$currentIndex.'&token='.$this->token;
|
||||
$this->redirect();
|
||||
} else {
|
||||
Tools::displayError('Can not duplicate Profiles');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Tools::isSubmit('saveELement')) {
|
||||
$filecontent = Tools::getValue('filecontent');
|
||||
$fileName = Tools::getValue('fileName');
|
||||
if (!is_dir($this->theme_dir.'modules/appagebuilder/views/templates/front/products/')) {
|
||||
if (!is_dir($this->theme_dir.'modules/appagebuilder/views/templates/front/products/')) {
|
||||
mkdir($this->theme_dir.'modules/appagebuilder/views/templates/front/products/', 0755, true);
|
||||
}
|
||||
}
|
||||
ApPageSetting::writeFile($this->theme_dir.'modules/appagebuilder/views/templates/front/products/', $fileName.'.tpl', $filecontent);
|
||||
}
|
||||
}
|
||||
|
||||
public function convertObjectToTpl($object_form)
|
||||
{
|
||||
$tpl = '';
|
||||
foreach ($object_form as $object) {
|
||||
if ($object['name'] == 'functional_buttons') {
|
||||
$tpl .= ApPageSetting::getProductFunctionalButtons();
|
||||
$tpl .= $this->convertObjectToTpl($object['element']);
|
||||
$tpl .= '</div>';
|
||||
} else if ($object['name'] == 'code') {
|
||||
$tpl .= $object['code'];
|
||||
} else {
|
||||
if (!isset($this->file_content[$object['name']])) {
|
||||
$this->returnFileContent($object['name']);
|
||||
}
|
||||
$tpl .= $this->file_content[$object['name']];
|
||||
}
|
||||
}
|
||||
return $tpl;
|
||||
}
|
||||
|
||||
public function returnFileContent($pelement)
|
||||
{
|
||||
$tpl_dir = $this->theme_dir.'modules/appagebuilder/views/templates/front/products/'.$pelement.'.tpl';
|
||||
if (!file_exists($tpl_dir)) {
|
||||
$tpl_dir = _PS_MODULE_DIR_.'appagebuilder/views/templates/front/products/'.$pelement.'.tpl';
|
||||
}
|
||||
$this->file_content[$pelement] = Tools::file_get_contents($tpl_dir);
|
||||
return $this->file_content[$pelement];
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
if (Tools::getIsset('pelement')) {
|
||||
$helper = new HelperForm();
|
||||
$helper->submit_action = 'saveELement';
|
||||
$inputs = array(
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'filecontent',
|
||||
'label' => $this->l('File Content'),
|
||||
'desc' => $this->l('Please carefully when edit tpl file'),
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'fileName',
|
||||
)
|
||||
);
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => sprintf($this->l('You are Editing file: %s'), Tools::getValue('pelement').'.tpl'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'action' => Context::getContext()->link->getAdminLink('AdminApPageBuilderShortcodes'),
|
||||
'input' => $inputs,
|
||||
'name' => 'importData',
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'button btn btn-default pull-right'
|
||||
),
|
||||
'tinymce' => false,
|
||||
),
|
||||
);
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getFileContent()
|
||||
);
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
$this->initToolbar();
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('duplicate');
|
||||
$this->addRowAction('delete');
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
public function getFileContent()
|
||||
{
|
||||
$pelement = Tools::getValue('pelement');
|
||||
$tpl_dir = $this->theme_dir.'modules/appagebuilder/views/templates/front/products/'.$pelement.'.tpl';
|
||||
if (!file_exists($tpl_dir)) {
|
||||
$tpl_dir = _PS_MODULE_DIR_.'appagebuilder/views/templates/front/products/'.$pelement.'.tpl';
|
||||
}
|
||||
return array('fileName' => $pelement, 'filecontent' => Tools::file_get_contents($tpl_dir));
|
||||
}
|
||||
|
||||
public function setHelperDisplay(Helper $helper)
|
||||
{
|
||||
parent::setHelperDisplay($helper);
|
||||
$this->helper->module = APPageBuilder::getInstance();
|
||||
}
|
||||
|
||||
public function processDelete()
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
Tools::deleteFile(apPageHelper::getConfigDir('theme_profiles').$object->plist_key.'.tpl');
|
||||
parent::processDelete();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$this->initToolbar();
|
||||
$this->context->controller->addJqueryUI('ui.sortable');
|
||||
$this->context->controller->addJqueryUI('ui.draggable');
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/product-list.js');
|
||||
$this->context->controller->addCss(apPageHelper::getCssAdminDir().'admin/form.css');
|
||||
$source_file = Tools::scandir(_PS_MODULE_DIR_.'appagebuilder/views/templates/front/products/', 'tpl');
|
||||
if (is_dir($this->theme_dir.'modules/appagebuilder/views/templates/front/products/')) {
|
||||
$source_template_file = Tools::scandir($this->theme_dir.'modules/appagebuilder/views/templates/front/products/', 'tpl');
|
||||
$source_file = array_merge($source_file, $source_template_file);
|
||||
}
|
||||
$elements = array();
|
||||
$icon_list = ApPageSetting::getProductElementIcon();
|
||||
foreach ($source_file as $value) {
|
||||
$fileName = basename($value, '.tpl');
|
||||
if ($fileName == 'index') {
|
||||
continue;
|
||||
}
|
||||
$elements[$fileName] = array(
|
||||
'name' => str_replace('_', ' ', $fileName),
|
||||
'icon' => (isset($icon_list[$fileName]) ? $icon_list[$fileName] : 'icon-sun'));
|
||||
}
|
||||
$params = array('gridLeft' => array(), 'gridRight' => array());
|
||||
|
||||
$this->object->params = str_replace($this->str_search, $this->str_relace, $this->object->params);
|
||||
|
||||
if (isset($this->object->params)) {
|
||||
$params = Tools::jsonDecode($this->object->params, true);
|
||||
}
|
||||
|
||||
//$params['gridLeft'] = $this->replaceSpecialStringToHtml($params['gridLeft']);
|
||||
//$params['gridRight'] = $this->replaceSpecialStringToHtml($params['gridRight']);
|
||||
|
||||
$block_list = array(
|
||||
'gridLeft' => array('title' => 'Product-Image', 'class' => 'left-block'),
|
||||
'gridRight' => array('title' => 'Product-Meta', 'class' => 'right-block'),
|
||||
);
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Ap Profile Manage'),
|
||||
'icon' => 'icon-folder-close'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Name'),
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Product List Key'),
|
||||
'name' => 'plist_key',
|
||||
'readonly' => 'readonly',
|
||||
'desc' => $this->l('Tpl File name'),
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Class'),
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'width' => 140
|
||||
),
|
||||
array(
|
||||
'type' => 'ap_proGrid',
|
||||
'name' => 'ap_proGrid',
|
||||
'label' => $this->l('Layout'),
|
||||
'elements' => $elements,
|
||||
'params' => $params,
|
||||
'blockList' => $block_list
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'params'
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'submitAddappagebuilder_productsAndStay',
|
||||
)
|
||||
),
|
||||
'buttons' => array(
|
||||
'save-and-stay' => array(
|
||||
'title' => $this->l('Save and Stay'),
|
||||
'id' => 'saveAndStay',
|
||||
'type' => 'button',
|
||||
'class' => 'btn btn-default pull-right ',
|
||||
'icon' => 'process-icon-save')
|
||||
)
|
||||
);
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function replaceSpecialStringToHtml($arr)
|
||||
{
|
||||
foreach ($arr as &$v) {
|
||||
if ($v['name'] == 'code') {
|
||||
// validate module
|
||||
$v['code'] = str_replace($this->str_search, $this->str_relace, $v['code']);
|
||||
} else {
|
||||
if ($v['name'] == 'functional_buttons') {
|
||||
foreach ($v as &$f) {
|
||||
if ($f['name'] == 'code') {
|
||||
// validate module
|
||||
$f['code'] = str_replace($this->str_search, $this->str_relace, $f['code']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function getFieldsValue($obj)
|
||||
{
|
||||
$file_value = parent::getFieldsValue($obj);
|
||||
if (!$obj->id) {
|
||||
$num = ApPageSetting::getRandomNumber();
|
||||
$file_value['plist_key'] = 'plist'.$num;
|
||||
$file_value['name'] = $file_value['plist_key'];
|
||||
$file_value['class'] = 'product-list-'.$num;
|
||||
}
|
||||
return $file_value;
|
||||
}
|
||||
|
||||
public function processAdd()
|
||||
{
|
||||
if ($obj = parent::processAdd()) {
|
||||
$this->saveTplFile($obj->plist_key, $obj->params);
|
||||
}
|
||||
}
|
||||
|
||||
public function processUpdate()
|
||||
{
|
||||
if ($obj = parent::processUpdate()) {
|
||||
$this->saveTplFile($obj->plist_key, $obj->params);
|
||||
}
|
||||
}
|
||||
|
||||
public function saveTplFile($plist_key, $params)
|
||||
{
|
||||
// validate module
|
||||
unset($params);
|
||||
//if (Tools::get)
|
||||
$data_form = str_replace($this->str_search, $this->str_relace, Tools::getValue('params', ''));
|
||||
$data_form = Tools::jsonDecode($data_form, true);
|
||||
|
||||
$grid_left = $data_form['gridLeft'];
|
||||
$grid_right = $data_form['gridRight'];
|
||||
$tpl_grid = ApPageSetting::getProductContainer();
|
||||
$tpl_grid .= ApPageSetting::getProductLeftBlock().$this->convertObjectToTpl($grid_left)."</div>\n";
|
||||
$tpl_grid .= ApPageSetting::getProductRightBlock().$this->convertObjectToTpl($grid_right)."</div>\n";
|
||||
$tpl_grid .= ApPageSetting::getProductContainerEnd();
|
||||
$folder = apPageHelper::getConfigDir('theme_profiles');
|
||||
if (!is_dir($folder)) {
|
||||
mkdir($folder, 0755, true);
|
||||
}
|
||||
$file = $plist_key.'.tpl';
|
||||
$tpl_grid = preg_replace('/\{\*[\s\S]*?\*\}/', '', $tpl_grid);
|
||||
$tpl_grid = str_replace(" mod='appagebuilder'", '', $tpl_grid);
|
||||
|
||||
//die($tpl_grid."--");
|
||||
ApPageSetting::writeFile($folder, $file, $tpl_grid);
|
||||
}
|
||||
|
||||
public function processStatus()
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
if ($object->toggleStatus()) {
|
||||
$matches = array();
|
||||
if (preg_match('/[\?|&]controller=([^&]*)/', (string)$_SERVER['HTTP_REFERER'], $matches) !== false && Tools::strtolower($matches[1]) != Tools::strtolower(preg_replace('/controller/i', '', get_class($this)))) {
|
||||
$this->redirect_after = preg_replace('/[\?|&]conf=([^&]*)/i', '', (string)$_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->redirect_after = self::$currentIndex.'&token='.$this->token;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating the status for an object.')
|
||||
.'<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
public function displayDuplicateLink($token = null, $id = null, $name = null)
|
||||
{
|
||||
$controller = 'AdminApPageBuilderProducts';
|
||||
$token = Tools::getAdminTokenLite($controller);
|
||||
$html = '<a href="#" title="Duplicate" onclick="confirm_link(\'\', \'Duplicate Product List ID '.$id.'. If you wish to proceed, click "Yes". If not, click "No".\', \'Yes\', \'No\', \'index.php?controller='.$controller.'&id_appagebuilder_products='.$id.'&duplicateappagebuilder_products&token='.$token.'\', \'#\')">
|
||||
<i class="icon-copy"></i> Duplicate
|
||||
</a>';
|
||||
|
||||
// validate module
|
||||
unset($name);
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function access($action, $disable = false)
|
||||
{
|
||||
if (Tools::getIsset('update'.$this->table) && Tools::getIsset($this->identifier)) {
|
||||
// Allow person see "EDIT" form
|
||||
$action = 'view';
|
||||
}
|
||||
return parent::access($action, $disable);
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
if (count($this->errors) <= 0) {
|
||||
if( Tools::isSubmit('duplicate'.$this->table) ) {
|
||||
if ($this->id_object) {
|
||||
if (!$this->access('add'))
|
||||
{
|
||||
$this->errors[] = $this->trans('You do not have permission to duplicate this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,798 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageBuilderProfilesModel.php');
|
||||
|
||||
class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
|
||||
{
|
||||
private $theme_name = '';
|
||||
public $profile_js_folder = '';
|
||||
public $profile_css_folder = '';
|
||||
public $module_name = 'appagebuilder';
|
||||
public $explicit_select;
|
||||
public $order_by;
|
||||
public $order_way;
|
||||
public $theme_dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'appagebuilder_profiles';
|
||||
$this->className = 'ApPageBuilderProfilesModel';
|
||||
$this->lang = false;
|
||||
$this->explicit_select = true;
|
||||
$this->allow_export = true;
|
||||
|
||||
parent::__construct();
|
||||
$this->theme_dir = _PS_ALL_THEMES_DIR_._THEME_NAME_.'/';
|
||||
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$this->order_by = 'page';
|
||||
$this->order_way = 'DESC';
|
||||
$alias = 'sa';
|
||||
|
||||
$id_shop = (int)$this->context->shop->id;
|
||||
$this->_join .= ' JOIN `'._DB_PREFIX_.'appagebuilder_profiles_shop`
|
||||
sa ON (a.`id_appagebuilder_profiles` = sa.`id_appagebuilder_profiles` AND sa.id_shop = '.$id_shop.')';
|
||||
$this->_select .= ' sa.active as active, ';
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_appagebuilder_profiles' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 50,
|
||||
'class' => 'fixed-width-xs'
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'width' => 140,
|
||||
'type' => 'text',
|
||||
'filter_key' => 'a!name'
|
||||
),
|
||||
'profile_key' => array(
|
||||
'title' => $this->l('Key'),
|
||||
'filter_key' => 'a!profile_key',
|
||||
'type' => 'text',
|
||||
'width' => 140,
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Is Default'),
|
||||
'active' => 'status',
|
||||
'filter_key' => $alias.'!active',
|
||||
'align' => 'text-center',
|
||||
'type' => 'bool',
|
||||
'class' => 'fixed-width-sm',
|
||||
'orderby' => false
|
||||
),
|
||||
);
|
||||
$this->bulk_actions = array(
|
||||
'delete' => array(
|
||||
'text' => $this->l('Delete selected'),
|
||||
'confirm' => $this->l('Delete selected items?'),
|
||||
'icon' => 'icon-trash'
|
||||
),
|
||||
'insertLang' => array(
|
||||
'text' => $this->l('Auto Input Data for New Lang'),
|
||||
'confirm' => $this->l('Auto insert data for new language?'),
|
||||
'icon' => 'icon-edit'
|
||||
)
|
||||
);
|
||||
|
||||
$this->_where = ' AND sa.id_shop='.(int)$this->context->shop->id;
|
||||
$this->theme_name = _THEME_NAME_;
|
||||
|
||||
$this->profile_css_folder = _PS_THEME_DIR_.apPageHelper::getCssDir().'profiles/';
|
||||
$this->profile_js_folder = _PS_THEME_DIR_.apPageHelper::getJsDir().'profiles/';
|
||||
|
||||
if (!is_dir($this->profile_css_folder)) {
|
||||
mkdir($this->profile_css_folder, 0755, true);
|
||||
}
|
||||
if (!is_dir($this->profile_js_folder)) {
|
||||
mkdir($this->profile_js_folder, 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
|
||||
|
||||
$this->page_header_toolbar_btn['SaveAndStay'] = array(
|
||||
'href' => 'javascript:void(0);',
|
||||
'desc' => $this->l('Save and stay'),
|
||||
'js' => 'SaveAndStayAdminApPageBuilderProfiles()',
|
||||
'icon' => 'process-icon-save',
|
||||
);
|
||||
$this->page_header_toolbar_btn['Save'] = array(
|
||||
'href' => 'javascript:void(0);',
|
||||
'desc' => $this->l('Save'),
|
||||
'js' => 'SaveAdminApPageBuilderProfiles()',
|
||||
'icon' => 'process-icon-save',
|
||||
);
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
public function setMedia($isNewTheme = false)
|
||||
{
|
||||
parent::setMedia($isNewTheme);
|
||||
$this->addJqueryPlugin('tagify');
|
||||
}
|
||||
|
||||
public function processDelete()
|
||||
{
|
||||
$object = $this->loadObject();
|
||||
|
||||
if ($object && !$object->active) {
|
||||
$object = parent::processDelete();
|
||||
if ($object->profile_key) {
|
||||
Tools::deleteFile($this->profile_css_folder.$object->profile_key.'.css');
|
||||
Tools::deleteFile($this->profile_js_folder.$object->profile_key.'.js');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Can not delete Default Profile.');
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
public function processBulkDelete()
|
||||
{
|
||||
$arr = $this->boxes;
|
||||
if (!$arr) {
|
||||
return;
|
||||
}
|
||||
foreach ($arr as $id) {
|
||||
$object = new $this->className($id);
|
||||
if ($object && !$object->active) {
|
||||
$object->delete();
|
||||
if ($object->profile_key) {
|
||||
Tools::deleteFile($this->profile_css_folder.$object->profile_key.'.css');
|
||||
Tools::deleteFile($this->profile_js_folder.$object->profile_key.'.js');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('Can not delete Default Profile.');
|
||||
}
|
||||
}
|
||||
if (empty($this->errors)) {
|
||||
$this->confirmations[] = $this->_conf[1];
|
||||
}
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
//echo 'here';die;
|
||||
$object = $this->loadObject();
|
||||
if ($object->page == 'product_detail') {
|
||||
$this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderProductDetail');
|
||||
} else {
|
||||
$this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderHome');
|
||||
}
|
||||
$this->redirect_after .= '&id_appagebuilder_profiles='.$object->id;
|
||||
$this->redirect();
|
||||
}
|
||||
|
||||
public function displayViewLink($token = null, $id, $name = null)
|
||||
{
|
||||
// validate module
|
||||
unset($name);
|
||||
$token = Context::getContext()->link->getAdminLink('AdminApPageBuilderHome');
|
||||
$href = $token . '&id_appagebuilder_profiles='.$id;
|
||||
$html = '<a href="'.$href.'" class="btn btn-default" title="View"><i class="icon-search-plus"></i> View</a>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function processBulkinsertLang()
|
||||
{
|
||||
// Remove resouce and update table profiles
|
||||
$arr = $this->boxes;
|
||||
if (!$arr) {
|
||||
// validate module
|
||||
$arr[] = Tools::getValue('id');
|
||||
}
|
||||
|
||||
if (!$arr) {
|
||||
return;
|
||||
}
|
||||
foreach ($arr as $item) {
|
||||
if ($item) {
|
||||
//has profile id
|
||||
$pfile = new ApPageBuilderProfilesModel($item);
|
||||
$id_positions = array($pfile->header, $pfile->content, $pfile->footer, $pfile->product);
|
||||
$list_position = $pfile->getPositionsForProfile($id_positions);
|
||||
$list_pos_id = array();
|
||||
foreach ($list_position as $v) {
|
||||
// validate module
|
||||
$list_pos_id[] = $v['id_appagebuilder_positions'];
|
||||
}
|
||||
$s_model = new ApPageBuilderModel();
|
||||
$list_short_c = $s_model->getAllItemsByPositionId($list_pos_id);
|
||||
$context = Context::getContext();
|
||||
$id_lang = (int)$context->language->id;
|
||||
foreach ($list_short_c as $shor_code) {
|
||||
$s_model = new ApPageBuilderModel($shor_code['id']);
|
||||
if ($s_model->params) {
|
||||
foreach ($s_model->params as $key => $value) {
|
||||
if ($key != $id_lang) {
|
||||
// validate module
|
||||
$s_model->params[$key] = $s_model->params[$id_lang];
|
||||
}
|
||||
// validate module
|
||||
unset($value);
|
||||
}
|
||||
}
|
||||
$s_model->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function processStatus()
|
||||
{
|
||||
if (Validate::isLoadedObject($object = $this->loadObject())) {
|
||||
if ($object->toggleStatus()) {
|
||||
$matches = array();
|
||||
if (preg_match('/[\?|&]controller=([^&]*)/', (string)$_SERVER['HTTP_REFERER'], $matches) !== false && Tools::strtolower($matches[1]) != Tools::strtolower(preg_replace('/controller/i', '', get_class($this)))) {
|
||||
$this->redirect_after = preg_replace('/[\?|&]conf=([^&]*)/i', '', (string)$_SERVER['HTTP_REFERER']);
|
||||
} else {
|
||||
$this->redirect_after = self::$currentIndex.'&token='.$this->token;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You can not disable default profile, Please select other profile as default');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while updating the status for an object.')
|
||||
.'<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
parent::postProcess();
|
||||
if (count($this->errors) > 0) {
|
||||
return;
|
||||
}
|
||||
if (Tools::getIsset('duplicateappagebuilder_profiles')) {
|
||||
// $context = Context::getContext();
|
||||
// $id_shop = $context->shop->id;
|
||||
$id = Tools::getValue('id_appagebuilder_profiles');
|
||||
$model = new ApPageBuilderProfilesModel($id);
|
||||
|
||||
if($model){
|
||||
$old_key = $model->profile_key;
|
||||
$model->profile_key = $profile_key = 'profile'.ApPageSetting::getRandomNumber();
|
||||
$model->id = null;
|
||||
$model->name = $this->l('Duplicate of ') . $model->name;
|
||||
$model->active = '';
|
||||
$model->friendly_url = array();
|
||||
$duplicate_object = $model->save();
|
||||
|
||||
if($duplicate_object){
|
||||
//duplicate shortCode
|
||||
$id_new = $model->id;
|
||||
ApPageSetting::writeFile($this->profile_js_folder, $profile_key.'.js', Tools::file_get_contents($this->profile_js_folder.$old_key.'.js'));
|
||||
ApPageSetting::writeFile($this->profile_css_folder, $profile_key.'.css', Tools::file_get_contents($this->profile_css_folder.$old_key.'.css'));
|
||||
AdminApPageBuilderShortcodesController::duplicateData($id, $id_new);
|
||||
$this->redirect_after = self::$currentIndex.'&token='.$this->token;
|
||||
$this->redirect();
|
||||
}else{
|
||||
Tools::displayError('Can not create new profile');
|
||||
}
|
||||
} else {
|
||||
Tools::displayError('Profile is not exist to duplicate');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->initToolbar();
|
||||
$this->addRowAction('view');
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('duplicate');
|
||||
$this->addRowAction('delete');
|
||||
$this->context->controller->addCss(apPageHelper::getCssAdminDir().'admin/form.css');
|
||||
$tpl_name = 'list.tpl';
|
||||
$path = '';
|
||||
if (file_exists($this->theme_dir.'modules/'.$this->module->name.'/views/templates/admin/'.$tpl_name)) {
|
||||
$path = $this->theme_dir.'modules/'.$this->module->name.'/views/templates/admin/'.$tpl_name;
|
||||
} elseif (file_exists($this->getTemplatePath().$this->override_folder.$tpl_name)) {
|
||||
$path = $this->getTemplatePath().$this->override_folder.$tpl_name;
|
||||
}
|
||||
$model = new ApPageBuilderProfilesModel();
|
||||
$list_profiles = $model->getAllProfileByShop();
|
||||
// Build url for back from live edit page, it is stored in cookie and read in fontContent function below
|
||||
$controller = 'AdminApPageBuilderHome';
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
$url_edit_profile_token = Tools::getAdminTokenLite($controller);
|
||||
$params = array('token' => $url_edit_profile_token);
|
||||
$url_edit_profile = dirname($_SERVER['PHP_SELF']).'/'.Dispatcher::getInstance()->createUrl($controller, $id_lang, $params, false);
|
||||
$live_edit_params = array(
|
||||
'ap_live_edit' => true,
|
||||
'ad' => basename(_PS_ADMIN_DIR_),
|
||||
'liveToken' => Tools::getAdminTokenLite('AdminModulesPositions'),
|
||||
'id_employee' => (int)Context::getContext()->employee->id,
|
||||
'id_shop' => (int)Context::getContext()->shop->id
|
||||
);
|
||||
$url_live_edit = $this->getLiveEditUrl($live_edit_params);
|
||||
$lang = '';
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages(true)) > 1) {
|
||||
$lang = Language::getIsoById($this->context->employee->id_lang).'/';
|
||||
}
|
||||
$url_preview = $this->context->shop->getBaseUrl().(Configuration::get('PS_REWRITING_SETTINGS') ? '' : 'index.php').$lang;
|
||||
$cookie = new Cookie('url_live_back');
|
||||
$cookie->setExpire(time() + 60 * 60);
|
||||
$cookie->variable_name = $url_edit_profile;
|
||||
$cookie->write();
|
||||
// Save token for check valid
|
||||
$cookie = new Cookie('ap_token'); //make your own cookie
|
||||
$cookie->setExpire(time() + 60 * 60);
|
||||
$cookie->variable_name = $live_edit_params['liveToken'];
|
||||
$cookie->write();
|
||||
$profile_link = $this->context->link->getAdminLink('AdminApPageBuilderProfiles').'&addappagebuilder_profiles';
|
||||
$this->context->smarty->assign(array(
|
||||
'profile_link' => $profile_link,
|
||||
'url_preview' => $url_preview,
|
||||
'list_profile' => $list_profiles,
|
||||
'url_live_edit' => $url_live_edit,
|
||||
'url_profile_detail' => $this->context->link->getAdminLink('AdminApPageBuilderProfiles'),
|
||||
'url_edit_profile_token' => $url_edit_profile_token,
|
||||
'url_edit_profile' => $url_edit_profile));
|
||||
$content = $this->context->smarty->fetch($path);
|
||||
$path_guide = $this->getTemplatePath().'guide.tpl';
|
||||
$guide_box = ApPageSetting::buildGuide($this->context, $path_guide, 0);
|
||||
return $guide_box.parent::renderList().$content;
|
||||
//return parent::renderList();
|
||||
}
|
||||
|
||||
public function getLiveEditUrl($live_edit_params)
|
||||
{
|
||||
$lang = '';
|
||||
$admin_dir = dirname($_SERVER['PHP_SELF']);
|
||||
$admin_dir = Tools::substr($admin_dir, strrpos($admin_dir, '/') + 1);
|
||||
$dir = str_replace($admin_dir, '', dirname($_SERVER['SCRIPT_NAME']));
|
||||
if (Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages(true)) > 1) {
|
||||
$lang = Language::getIsoById(Context::getContext()->employee->id_lang).'/';
|
||||
}
|
||||
$url = Tools::getCurrentUrlProtocolPrefix().Tools::getHttpHost().$dir.$lang.
|
||||
Dispatcher::getInstance()->createUrl('index', (int)Context::getContext()->language->id, $live_edit_params);
|
||||
return $url;
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$this->initToolbar();
|
||||
$this->context->controller->addJqueryUI('ui.sortable');
|
||||
$groups = Group::getGroups($this->default_form_language, true);
|
||||
// UNSET GROUP_BOX
|
||||
if ($this->object->id == '') {
|
||||
$model = new ApPageBuilderProfilesModel();
|
||||
$list_profiles = $model->getAllProfileByShop();
|
||||
foreach ($list_profiles as $profile) {
|
||||
$group_boxs = $profile['group_box'];
|
||||
$aray_group_box = explode(',', $group_boxs);
|
||||
foreach ($aray_group_box as $group_box) {
|
||||
if ($group_box!=1&&$group_box!=2&&$group_box!=3) {
|
||||
while ($group = current($groups)) {
|
||||
if ($group['id_group'] == $group_box) {
|
||||
unset($groups[key($groups)]);
|
||||
}
|
||||
next($groups);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Ap Profile Manage'),
|
||||
'icon' => 'icon-folder-close'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Name'),
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'hint' => $this->l('Invalid characters:'),' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Friendly URL'),
|
||||
'name' => 'friendly_url',
|
||||
'lang' => true,
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Meta title'),
|
||||
'name' => 'meta_title',
|
||||
'id' => 'name', // for copyMeta2friendlyURL compatibility
|
||||
'lang' => true,
|
||||
// 'required' => true,
|
||||
'class' => 'copyMeta2friendlyURL',
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Meta description'),
|
||||
'name' => 'meta_description',
|
||||
'lang' => true,
|
||||
'cols' => 40,
|
||||
'rows' => 10,
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'tags',
|
||||
'label' => $this->l('Meta keywords'),
|
||||
'name' => 'meta_keywords',
|
||||
'lang' => true,
|
||||
'hint' => array(
|
||||
$this->l('Invalid characters:').' <>;=#{}',
|
||||
$this->l('To add "tags" click in the field, write something, and then press "Enter."')
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Profile Key'),
|
||||
'name' => 'profile_key',
|
||||
'readonly' => 'readonly',
|
||||
'desc' => $this->l('Use it to save as file name of css and js of profile'),
|
||||
'hint' => $this->l('Invalid characters:').' <>;=#{}'
|
||||
),
|
||||
array(
|
||||
'type' => 'group',
|
||||
'label' => $this->l('Apply default profile for these groups'),
|
||||
'name' => 'groupBox',
|
||||
'values' => $groups,
|
||||
'col' => '6',
|
||||
'hint' => $this->l('Select the groups that you would like to apply this profile is default.')
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'dump_name',
|
||||
'html_content' => '<div class="alert alert-info">'.$this->l('Fullwidth Function: is only for develop')
|
||||
.'<br/>'.$this->l('To use this function, you have to download')
|
||||
.'<br/><a href="http://demothemes.info/prestashop/appagebuilder/header.tpl.zip" title="'.$this->l('Header file').'">'
|
||||
.'<b>header.tpl</b></a>'
|
||||
.'<br/><a href="http://demothemes.info/prestashop/appagebuilder/footer.tpl.zip" title="'.$this->l('Footer file').'">'
|
||||
.'<b>footer.tpl</b></a><br/>'
|
||||
.$this->l('file and compare or override in themes folder').'</div>'
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'fullwidth_index_hook',
|
||||
'label' => $this->l('Fullwidth Homepage'),
|
||||
'class' => 'checkbox-group',
|
||||
'desc' => $this->l('The setting full-width for above HOOKS, apply for Home page'),
|
||||
'values' => array(
|
||||
'query' => self::getCheckboxIndexHook(),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'fullwidth_other_hook',
|
||||
'label' => $this->l('Fullwidth other Pages'),
|
||||
'class' => 'checkbox-group',
|
||||
'desc' => $this->l('The setting full-width for above HOOKS, apply for all OTHER pages ( not Home page )'),
|
||||
'values' => array(
|
||||
'query' => self::getCheckboxOtherHook(),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'disable_cache_hook',
|
||||
'label' => $this->l('Disable cache Hooks'),
|
||||
'class' => 'checkbox-group',
|
||||
'desc' => $this->l('Some modules always update data, disable cache for those modules show correct info.'),
|
||||
'values' => array(
|
||||
'query' => self::getCheckboxCacheHook(),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
//'label' => $this->l('Profile For Page'),
|
||||
'name' => 'page',
|
||||
'class' => 'hide',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'index',
|
||||
'name' => $this->l('Index'),
|
||||
),
|
||||
array(
|
||||
'id' => 'product_detail',
|
||||
'name' => $this->l('Product Detail'),
|
||||
)
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
),
|
||||
'buttons' => array(
|
||||
'save-and-stay' => array(
|
||||
'title' => $this->l('Save and Stay'),
|
||||
'name' => 'submitAdd'.$this->table.'AndStay',
|
||||
'type' => 'submit',
|
||||
'class' => 'btn btn-default pull-right',
|
||||
'icon' => 'process-icon-save'
|
||||
)
|
||||
)
|
||||
);
|
||||
$is_edit = Tools::getValue('id_appagebuilder_profiles');
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Custom Css'),
|
||||
'name' => 'css',
|
||||
'desc' => sprintf($this->l('Please set write Permission for folder %s'), $this->profile_css_folder),
|
||||
);
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('Custom Js'),
|
||||
'name' => 'js',
|
||||
'desc' => sprintf($this->l('Please set write Permission for folder %s'), $this->profile_js_folder),
|
||||
);
|
||||
// Display link view if it existed
|
||||
if ($is_edit) {
|
||||
$profile_link = $this->context->link->getAdminLink('AdminApPageBuilderHome').'&id_appagebuilder_profiles='.$is_edit;
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'name' => 'dess',
|
||||
'html_content' => '<a class="btn btn-info" href="'.$profile_link.'">
|
||||
<i class="icon icon-table"></i> '.$this->l('View and edit use mode Layout design').' >></a>'
|
||||
);
|
||||
}
|
||||
|
||||
$default_index_hook = $this->getDefaultIndexHook();
|
||||
$default_other_hook = $this->getDefaultOtherHook();
|
||||
$default_disable_cache_hook = $this->getDefaultDisableCacheHook();
|
||||
foreach ($default_index_hook as $key => $value) {
|
||||
$this->fields_value['fullwidth_index_hook_'.$key] = $value;
|
||||
}
|
||||
foreach ($default_other_hook as $key => $value) {
|
||||
$this->fields_value['fullwidth_other_hook_'.$key] = $value;
|
||||
}
|
||||
foreach ($default_disable_cache_hook as $key => $value) {
|
||||
$this->fields_value['disable_cache_hook_'.$key] = $value;
|
||||
}
|
||||
foreach ($groups as $group) {
|
||||
$this->fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], in_array($group['id_group'], explode(',', $this->object->group_box)));
|
||||
}
|
||||
|
||||
$path_guide = $this->getTemplatePath().'guide.tpl';
|
||||
$guide_box = ApPageSetting::buildGuide($this->context, $path_guide, 2);
|
||||
return $guide_box.parent::renderForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read file css + js to form when add/edit
|
||||
*/
|
||||
public function getFieldsValue($obj)
|
||||
{
|
||||
$file_value = parent::getFieldsValue($obj);
|
||||
if ($obj->id && $obj->profile_key) {
|
||||
$file_value['css'] = Tools::file_get_contents($this->profile_css_folder.$obj->profile_key.'.css');
|
||||
$file_value['js'] = Tools::file_get_contents($this->profile_js_folder.$obj->profile_key.'.js');
|
||||
} else {
|
||||
$file_value['profile_key'] = 'profile'.ApPageSetting::getRandomNumber();
|
||||
}
|
||||
return $file_value;
|
||||
}
|
||||
|
||||
public function processAdd()
|
||||
{
|
||||
parent::validateRules();
|
||||
if (count($this->errors)) {
|
||||
return false;
|
||||
}
|
||||
if ($this->object = parent::processAdd()) {
|
||||
$this->saveCustomJsAndCss($this->object->profile_key, '');
|
||||
}
|
||||
$this->processParams();
|
||||
if (!Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
|
||||
$this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderHome');
|
||||
$this->redirect_after .= '&id_appagebuilder_profiles='.($this->object->id);
|
||||
$this->redirect();
|
||||
}
|
||||
}
|
||||
|
||||
public function processUpdate()
|
||||
{
|
||||
parent::validateRules();
|
||||
if (count($this->errors)) {
|
||||
return false;
|
||||
}
|
||||
if ($this->object = parent::processUpdate()) {
|
||||
$this->saveCustomJsAndCss($this->object->profile_key, $this->object->profile_key);
|
||||
}
|
||||
|
||||
$this->processParams();
|
||||
if (!Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
|
||||
$this->redirect_after = Context::getContext()->link->getAdminLink('AdminApPageBuilderHome');
|
||||
$this->redirect_after .= '&id_appagebuilder_profiles='.($this->object->id);
|
||||
$this->redirect();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fullwidth hook, save to params
|
||||
*/
|
||||
public function processParams()
|
||||
{
|
||||
$params = Tools::jsonDecode($this->object->params);
|
||||
if ($params === null) {
|
||||
$params = new stdClass();
|
||||
}
|
||||
|
||||
# get post index hook
|
||||
$index_hook = ApPageSetting::getIndexHook();
|
||||
$post_index_hooks = array();
|
||||
foreach ($index_hook as $key => $value) {
|
||||
// validate module
|
||||
$post_index_hooks[$value] = Tools::getValue('fullwidth_index_hook_'.$value) ?
|
||||
Tools::getValue('fullwidth_index_hook_'.$value) : ApPageSetting::HOOK_BOXED;
|
||||
// validate module
|
||||
unset($key);
|
||||
}
|
||||
$params->fullwidth_index_hook = $post_index_hooks;
|
||||
|
||||
# get post other hook
|
||||
$other_hook = ApPageSetting::getOtherHook();
|
||||
$post_other_hooks = array();
|
||||
foreach ($other_hook as $key => $value) {
|
||||
// validate module
|
||||
$post_other_hooks[$value] = Tools::getValue('fullwidth_other_hook_'.$value) ? Tools::getValue('fullwidth_other_hook_'.$value) : ApPageSetting::HOOK_BOXED;
|
||||
// validate module
|
||||
unset($key);
|
||||
}
|
||||
$params->fullwidth_other_hook = $post_other_hooks;
|
||||
|
||||
# get post disable hook
|
||||
$cache_hooks = ApPageSetting::getCacheHook();
|
||||
$post_disable_hooks = array();
|
||||
foreach ($cache_hooks as $key => $value) {
|
||||
// validate module
|
||||
$post_disable_hooks[$value] = Tools::getValue('disable_cache_hook_'.$value) ? Tools::getValue('disable_cache_hook_'.$value) : ApPageSetting::HOOK_BOXED;
|
||||
// validate module
|
||||
unset($key);
|
||||
}
|
||||
$params->disable_cache_hook = $post_disable_hooks;
|
||||
|
||||
|
||||
# Save to params
|
||||
$this->object->params = Tools::jsonEncode($params);
|
||||
|
||||
# Save group_box
|
||||
if (Tools::getValue('groupBox')) {
|
||||
$this->object->group_box = implode(',', Tools::getValue('groupBox'));
|
||||
} else {
|
||||
$this->object->group_box = '';
|
||||
}
|
||||
|
||||
$this->object->save();
|
||||
}
|
||||
|
||||
public function saveCustomJsAndCss($key, $old_key = '')
|
||||
{
|
||||
# DELETE OLD FILE
|
||||
if ($old_key) {
|
||||
Tools::deleteFile($this->profile_css_folder.$old_key.'.css');
|
||||
Tools::deleteFile($this->profile_js_folder.$old_key.'.js');
|
||||
}
|
||||
|
||||
if (Tools::getValue('js') != '') {
|
||||
ApPageSetting::writeFile($this->profile_js_folder, $key.'.js', Tools::getValue('js'));
|
||||
}
|
||||
|
||||
if (Tools::getValue('css') != '') {
|
||||
# FIX CUSTOMER CAN NOT TYPE "\"
|
||||
$temp = Tools::getAllValues();
|
||||
$css = $temp['css'];
|
||||
ApPageSetting::writeFile($this->profile_css_folder, $key.'.css', $css);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate form : create checkbox in admin form ( add/edit profile )
|
||||
*/
|
||||
public static function getCheckboxIndexHook()
|
||||
{
|
||||
$ids = ApPageSetting::getIndexHook();
|
||||
$names = ApPageSetting::getIndexHook();
|
||||
return apPageHelper::getArrayOptions($ids, $names);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate form : create checkbox in admin form ( add/edit profile )
|
||||
*/
|
||||
public static function getCheckboxOtherHook()
|
||||
{
|
||||
$ids = ApPageSetting::getOtherHook();
|
||||
$names = ApPageSetting::getOtherHook();
|
||||
return apPageHelper::getArrayOptions($ids, $names);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate form : create checkbox in admin form ( add/edit profile )
|
||||
*/
|
||||
public static function getCheckboxCacheHook()
|
||||
{
|
||||
$ids = ApPageSetting::getCacheHook();
|
||||
$names = ApPageSetting::getCacheHook();
|
||||
return apPageHelper::getArrayOptions($ids, $names);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fullwidth hook from database or default
|
||||
*/
|
||||
public function getDefaultIndexHook()
|
||||
{
|
||||
$params = Tools::jsonDecode($this->object->params);
|
||||
return isset($params->fullwidth_index_hook) ? $params->fullwidth_index_hook : ApPageSetting::getIndexHook(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fullwidth hook from database or default
|
||||
*/
|
||||
public function getDefaultOtherHook()
|
||||
{
|
||||
$params = Tools::jsonDecode($this->object->params);
|
||||
return isset($params->fullwidth_other_hook) ? $params->fullwidth_other_hook : ApPageSetting::getOtherHook(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fullwidth hook from database or default
|
||||
*/
|
||||
public function getDefaultDisableCacheHook()
|
||||
{
|
||||
$params = Tools::jsonDecode($this->object->params);
|
||||
return isset($params->disable_cache_hook) ? $params->disable_cache_hook : ApPageSetting::getCacheHook(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
if (count($this->errors) <= 0) {
|
||||
if( Tools::isSubmit('duplicate'.$this->table) ) {
|
||||
if ($this->id_object) {
|
||||
if (!$this->access('add'))
|
||||
{
|
||||
$this->errors[] = $this->trans('You do not have permission to duplicate this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,625 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageBuilderShortcodeModel.php');
|
||||
|
||||
class AdminApPageBuilderShortcodeController extends ModuleAdminControllerCore
|
||||
{
|
||||
public $tpl_path;
|
||||
public $module_name;
|
||||
public static $shortcode_lang;
|
||||
public static $language;
|
||||
public $theme_dir;
|
||||
public static $lang_id;
|
||||
public $tpl_controller_path;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'appagebuilder_shortcode';
|
||||
$this->identifier = 'id_appagebuilder_shortcode';
|
||||
$this->className = 'ApPageBuilderShortcodeModel';
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$this->_join = '
|
||||
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps ON (ps.`id_appagebuilder_shortcode` = a.`id_appagebuilder_shortcode` AND ps.`id_shop` = '.$id_shop.')';
|
||||
$this->_select .= ' ps.active as active, ';
|
||||
$this->lang = true;
|
||||
$this->shop = true;
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('duplicate');
|
||||
$this->addRowAction('delete');
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
|
||||
$this->fields_list = array(
|
||||
'id_appagebuilder_shortcode' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'type' => 'text',
|
||||
'class' => 'fixed-width-sm'
|
||||
),
|
||||
'shortcode_name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'shortcode_key' => array(
|
||||
'title' => $this->l('Key'),
|
||||
'type' => 'text',
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Status'),
|
||||
'active' => 'status',
|
||||
'type' => 'bool',
|
||||
'class' => 'fixed-width-sm'
|
||||
),
|
||||
);
|
||||
|
||||
$this->_defaultOrderBy = 'id_appagebuilder_shortcode';
|
||||
$this->module_name = 'appagebuilder';
|
||||
$this->tpl_path = _PS_ROOT_DIR_.'/modules/'.$this->module_name.'/views/templates/admin';
|
||||
self::$language = Language::getLanguages(false);
|
||||
$this->theme_dir = _PS_THEME_DIR_;
|
||||
$this->tpl_controller_path = _PS_ROOT_DIR_.'/modules/'.$this->module_name.'/views/templates/admin/ap_page_builder_shortcode/';
|
||||
apPageHelper::loadShortCode(_PS_THEME_DIR_);
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
//DONGND:: get list shortcode to tiny mce
|
||||
if (Tools::getIsset('get_listshortcode'))
|
||||
{
|
||||
die($this->module->getListShortCodeForEditor());
|
||||
}
|
||||
else
|
||||
{
|
||||
parent::initContent();
|
||||
}
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
|
||||
$txt_legend = '';
|
||||
if (Validate::isLoadedObject($this->object)) {
|
||||
$this->display = 'edit';
|
||||
$txt_legend = $this->l('Edit Shortcode');
|
||||
} else {
|
||||
$this->display = 'add';
|
||||
$txt_legend = $this->l('Add New Shortcode');
|
||||
}
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $txt_legend,
|
||||
'icon' => 'icon-cogs',
|
||||
),
|
||||
'input' => array(
|
||||
// array(
|
||||
// 'type' => 'hidden',
|
||||
// 'name' => 'id_appagebuilder_shortcode',
|
||||
// ),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'id_appagebuilder',
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'shortcode_content',
|
||||
),
|
||||
array(
|
||||
'type' => 'hidden',
|
||||
'name' => 'stay_page',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'lang' => true,
|
||||
'required' => true,
|
||||
'label' => $this->l('Shortcode Name'),
|
||||
'name' => 'shortcode_name',
|
||||
),
|
||||
array(
|
||||
'type' => 'textbutton',
|
||||
'label' => $this->l('Shortcode Key'),
|
||||
'name' => 'shortcode_key',
|
||||
'readonly' => 'readonly',
|
||||
'lang' => false,
|
||||
'button' => array(
|
||||
'label' => $this->l('Copy To Clipboard'),
|
||||
'class' => 'bt_copy_clipboard shortcode_key',
|
||||
'attributes' => array(
|
||||
// 'onclick' => 'alert(\'something done\');'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'is_bool' => true, //retro compat 1.5
|
||||
'label' => $this->l('Active'),
|
||||
'name' => 'active',
|
||||
'default_value' => 1,
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled'),
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled'),
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'shortcode_save_btn btn btn-default pull-right',
|
||||
'name' => 'submitApShortcode',
|
||||
),
|
||||
'buttons' => array(
|
||||
'save_and_preview' => array(
|
||||
'name' => 'submitApShortcodeAndStay',
|
||||
'type' => 'submit',
|
||||
'title' => $this->l('Save and stay'),
|
||||
'class' => 'shortcode_save_stay_btn btn btn-default pull-right',
|
||||
'icon' => 'process-icon-save-and-stay'
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
if (Validate::isLoadedObject($this->object)) {
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'textbutton',
|
||||
'label' => $this->l('Embed Hook'),
|
||||
'name' => 'shortcode_embedded_hook',
|
||||
'readonly' => 'readonly',
|
||||
'desc' => $this->l('Insert embed hook in any tpl file'),
|
||||
'lang' => false,
|
||||
'button' => array(
|
||||
'label' => $this->l('Copy To Clipboard'),
|
||||
'class' => 'bt_copy_clipboard shortcode_embedded_hook',
|
||||
'attributes' => array(
|
||||
// 'onclick' => 'alert(\'something done\');'
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'textbutton',
|
||||
'label' => $this->l('Embed Code'),
|
||||
'name' => 'shortcode_embedded_code',
|
||||
'readonly' => 'readonly',
|
||||
'desc' => $this->l('Insert embed code in any content with editor'),
|
||||
'lang' => false,
|
||||
'button' => array(
|
||||
'label' => $this->l('Copy To Clipboard'),
|
||||
'class' => 'bt_copy_clipboard shortcode_embedded_code',
|
||||
'attributes' => array(
|
||||
// 'onclick' => 'alert(\'something done\');'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$this->context->controller->addJqueryUI('ui.sortable');
|
||||
$this->context->controller->addJqueryUI('ui.draggable');
|
||||
$this->context->controller->addCss(apPageHelper::getCssAdminDir().'admin/form.css');
|
||||
$this->context->controller->addCss(apPageHelper::getCssAdminDir().'animate.css');
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/home.js');
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/isotope.pkgd.min.js');
|
||||
$this->context->controller->addJS(_PS_JS_DIR_.'tiny_mce/tiny_mce.js');
|
||||
|
||||
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/jquery-validation-1.9.0/jquery.validate.js');
|
||||
$this->context->controller->addCss(apPageHelper::getJsAdminDir().'admin/jquery-validation-1.9.0/screen.css');
|
||||
|
||||
// $version = Configuration::get('PS_INSTALL_VERSION');
|
||||
// $tiny_path = ($version >= '1.6.0.13') ? 'admin/' : '';
|
||||
// $tiny_path .= 'tinymce.inc.js';
|
||||
|
||||
// Pham_Khanh_Dong fix loading TINY_MCE library for all Prestashop_Versions
|
||||
$tiny_path = 'tinymce.inc.js';
|
||||
if (version_compare(_PS_VERSION_, '1.6.0.13', '>')) {
|
||||
$tiny_path = 'admin/tinymce.inc.js';
|
||||
}
|
||||
|
||||
$this->context->controller->addJS(_PS_JS_DIR_.$tiny_path);
|
||||
$bo_theme = ((Validate::isLoadedObject($this->context->employee) && $this->context->employee->bo_theme) ? $this->context->employee->bo_theme : 'default');
|
||||
if (!file_exists(_PS_BO_ALL_THEMES_DIR_.$bo_theme.DIRECTORY_SEPARATOR.'template')) {
|
||||
$bo_theme = 'default';
|
||||
}
|
||||
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload.js');
|
||||
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js');
|
||||
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-validate.js');
|
||||
$this->context->controller->addJs(__PS_BASE_URI__.'js/vendor/spin.js');
|
||||
$this->context->controller->addJs(__PS_BASE_URI__.'js/vendor/ladda.js');
|
||||
|
||||
//load javascript for menu tree
|
||||
$tree = new HelperTreeCategories('123', null);
|
||||
$tree->render();
|
||||
|
||||
// if (isset($result_profile) && $result_profile) {
|
||||
|
||||
$languages = array();
|
||||
foreach (Language::getLanguages(false) as $lang) {
|
||||
$languages[$lang['iso_code']] = $lang['id_lang'];
|
||||
}
|
||||
|
||||
// get shortcode information
|
||||
$shortcode_infos = ApShortCodeBase::getShortCodeInfos();
|
||||
//include all short code default
|
||||
$shortcodes = Tools::scandir($this->tpl_path.'/ap_page_builder_shortcodes', 'tpl');
|
||||
$shortcode_form = array();
|
||||
foreach ($shortcodes as $s_from) {
|
||||
if ($s_from == 'shortcodelist.tpl') {
|
||||
continue;
|
||||
}
|
||||
$shortcode_form[] = $this->tpl_path.'/ap_page_builder_shortcodes/'.$s_from;
|
||||
};
|
||||
$tpl = $this->createTemplate('home.tpl');
|
||||
|
||||
$model = new ApPageBuilderShortcodeModel();
|
||||
|
||||
$data_shortcode_content = array();
|
||||
$positions_dum = array();
|
||||
|
||||
$data_form = '{}';
|
||||
|
||||
$id_appagebuilder = ApPageBuilderModel::getIdByIdShortCode($this->object->id);
|
||||
|
||||
if ($id_appagebuilder) {
|
||||
$positions_dum = $model->getShortCodeContent($id_appagebuilder);
|
||||
$temp = $positions_dum['content'];
|
||||
|
||||
foreach ($temp as $key_hook => &$row) {
|
||||
if (!is_array($row)) {
|
||||
$row = array('hook_name' => $key_hook, 'content' => '');
|
||||
}
|
||||
if ($key_hook == 'displayLeftColumn' || $key_hook == 'displayRightColumn') {
|
||||
$row['class'] = 'col-md-3';
|
||||
} else {
|
||||
$row['class'] = 'col-md-12';
|
||||
}
|
||||
}
|
||||
$data_shortcode_content = $temp;
|
||||
$data = $model->getAllItems($id_appagebuilder);
|
||||
$data_form = Tools::jsonEncode($data['dataForm']);
|
||||
}
|
||||
|
||||
$tpl->assign(array(
|
||||
'data_shortcode_content' => $data_shortcode_content,
|
||||
// 'positions' => $positions,
|
||||
// 'listPositions' => $list_positions,
|
||||
// 'dataByHook' => $data_by_hook,
|
||||
// 'exportItems' => $export_items,
|
||||
// 'currentProfile' => $result_profile,
|
||||
// 'currentPosition' => $current_position,
|
||||
// 'profilesList' => $this->getAllProfiles($result_profile['id_appagebuilder_profiles']),
|
||||
'tplPath' => $this->tpl_path,
|
||||
'ajaxShortCodeUrl' => Context::getContext()->link->getAdminLink('AdminApPageBuilderShortcodes'),
|
||||
'ajaxHomeUrl' => Context::getContext()->link->getAdminLink('AdminApPageBuilderHome'),
|
||||
'shortcodeForm' => $shortcode_form,
|
||||
'moduleDir' => _MODULE_DIR_,
|
||||
'imgModuleLink' => apPageHelper::getImgThemeUrl(),
|
||||
'shortcodeInfos' => Tools::jsonEncode($shortcode_infos),
|
||||
'languages' => Tools::jsonEncode($languages),
|
||||
'dataForm' => $data_form,
|
||||
// 'errorText' => $this->error_text,
|
||||
'imgController' => Context::getContext()->link->getAdminLink('AdminApPageBuilderImages'),
|
||||
'widthList' => ApPageSetting::returnWidthList(),
|
||||
'lang_id' => (int)$this->context->language->id,
|
||||
// 'idProfile' => '',
|
||||
// 'checkSaveMultithreading' => $check_save_multithreading,
|
||||
// 'checkSaveSubmit' => $check_save_submit,
|
||||
// 'errorSubmit' => $errorSubmit
|
||||
'listAnimation' => ApPageSetting::getAnimationsColumnGroup(),
|
||||
));
|
||||
// return $guide_box.$tpl->fetch();
|
||||
// } else {
|
||||
// $this->errors[] = $this->l('Your Profile ID is not exist!');
|
||||
// }
|
||||
|
||||
return parent::renderForm().$tpl->fetch();
|
||||
}
|
||||
|
||||
public function getFieldsValue($obj)
|
||||
{
|
||||
$file_value = parent::getFieldsValue($obj);
|
||||
|
||||
if ($file_value['shortcode_key'] == '') {
|
||||
$file_value['shortcode_key'] = 'sc'.ApPageSetting::getRandomNumber();
|
||||
} else {
|
||||
$file_value['shortcode_embedded_hook'] = "{hook h='displayApSC' sc_key=".$file_value['shortcode_key']."}";
|
||||
$file_value['shortcode_embedded_code'] = "[ApSC sc_key=".$file_value['shortcode_key']."][/ApSC]";
|
||||
}
|
||||
|
||||
return $file_value;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (count($this->errors) > 0) {
|
||||
return;
|
||||
}
|
||||
if (Tools::isSubmit('submitAddappagebuilder_shortcode')) {
|
||||
parent::validateRules();
|
||||
|
||||
if ((int) Tools::getValue('id_appagebuilder_shortcode')) {
|
||||
$mess_id = '4';
|
||||
} else {
|
||||
$mess_id = '3';
|
||||
}
|
||||
|
||||
$shortcode_obj = new ApPageBuilderShortcodeModel((int) Tools::getValue('id_appagebuilder_shortcode'));
|
||||
$shortcode_obj->shortcode_key = Tools::getValue('shortcode_key');
|
||||
$shortcode_obj->active = Tools::getValue('active');
|
||||
|
||||
//DONGND:: fields multi lang
|
||||
$languages = Language::getLanguages();
|
||||
$name = array();
|
||||
foreach ($languages as $key => $value) {
|
||||
$name[$value['id_lang']] = Tools::getValue('shortcode_name_'.$value['id_lang']);
|
||||
}
|
||||
$shortcode_obj->shortcode_name = $name;
|
||||
|
||||
$shortcode_obj->save();
|
||||
|
||||
$shortcode_content = Tools::jsonDecode(Tools::getValue('shortcode_content'), 1);
|
||||
|
||||
$id_appagebuilder = ApPageBuilderModel::getIdByIdShortCode($shortcode_obj->id);
|
||||
if ($id_appagebuilder) {
|
||||
$obj_model = new ApPageBuilderModel($id_appagebuilder);
|
||||
} else {
|
||||
$obj_model = new ApPageBuilderModel();
|
||||
}
|
||||
|
||||
$obj_model->hook_name = 'apshortcode';
|
||||
$obj_model->id_appagebuilder_shortcode = $shortcode_obj->id;
|
||||
|
||||
if (isset($shortcode_content['groups'])) {
|
||||
foreach (self::$language as $lang) {
|
||||
$params = '';
|
||||
if (self::$shortcode_lang) {
|
||||
foreach (self::$shortcode_lang as &$s_type) {
|
||||
foreach ($s_type as $key => $value) {
|
||||
$s_type[$key] = $key.'_'.$lang['id_lang'];
|
||||
// validate module
|
||||
unset($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
$obj_model->params[$lang['id_lang']] = '';
|
||||
ApShortCodesBuilder::$lang_id = $lang['id_lang'];
|
||||
foreach ($shortcode_content['groups'] as $groups) {
|
||||
$params = $this->getParamByHook($groups, $params, '');
|
||||
}
|
||||
$obj_model->params[$lang['id_lang']] = $params;
|
||||
}
|
||||
}
|
||||
|
||||
if ($obj_model->id) {
|
||||
$obj_model->save();
|
||||
} else {
|
||||
$obj_model->add();
|
||||
}
|
||||
|
||||
if ($shortcode_obj->save()) {
|
||||
$this->module->clearShortCodeCache($shortcode_obj->shortcode_key);
|
||||
|
||||
if (Tools::getValue('stay_page')) {
|
||||
# validate module
|
||||
$this->redirect_after = self::$currentIndex.'&'.$this->identifier.'='.$shortcode_obj->id.'&conf='.$mess_id.'&update'.$this->table.'&token='.$this->token;
|
||||
} else {
|
||||
# validate module
|
||||
$this->redirect_after = self::$currentIndex.'&conf=4&token='.$this->token;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (Tools::getIsset('duplicateappagebuilder_shortcode')) {
|
||||
//DONGND:: duplicate
|
||||
if (Tools::getIsset('id_appagebuilder_shortcode') && (int)Tools::getValue('id_appagebuilder_shortcode')) {
|
||||
if ($shortcode_obj = new ApPageBuilderShortcodeModel((int) Tools::getValue('id_appagebuilder_shortcode'))) {
|
||||
$duplicate_object = new ApPageBuilderShortcodeModel();
|
||||
$duplicate_object->active = $shortcode_obj->active;
|
||||
|
||||
$languages = Language::getLanguages();
|
||||
$name = array();
|
||||
foreach ($languages as $key => $value) {
|
||||
$name[$value['id_lang']] = $this->l('Duplicate of').' '.$shortcode_obj->shortcode_name[$value['id_lang']];
|
||||
}
|
||||
|
||||
$duplicate_object->shortcode_name = $name;
|
||||
$duplicate_object->shortcode_key = 'sc'.ApPageSetting::getRandomNumber();
|
||||
|
||||
if ($duplicate_object->add()) {
|
||||
//duplicate shortCode
|
||||
$id_appagebuilder = ApPageBuilderModel::getIdByIdShortCode($shortcode_obj->id);
|
||||
if ($id_appagebuilder) {
|
||||
$obj_model = new ApPageBuilderModel($id_appagebuilder);
|
||||
$duplicate_obj_object = new ApPageBuilderModel();
|
||||
$duplicate_obj_object->hook_name = 'apshortcode';
|
||||
$duplicate_obj_object->id_appagebuilder_shortcode = $duplicate_object->id;
|
||||
$duplicate_obj_object->params = $obj_model->params;
|
||||
$duplicate_obj_object->add();
|
||||
|
||||
$this->redirect_after = self::$currentIndex.'&conf=3&token='.$this->token;
|
||||
} else {
|
||||
$this->redirect_after = self::$currentIndex.'&conf=3&token='.$this->token;
|
||||
}
|
||||
} else {
|
||||
Tools::displayError('Can not duplicate shortcode');
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (Tools::getIsset('statusappagebuilder_shortcode') || Tools::getIsset('deleteappagebuilder_shortcode')) {
|
||||
$shortcode_obj = new ApPageBuilderShortcodeModel((int) Tools::getValue('id_appagebuilder_shortcode'));
|
||||
$this->module->clearShortCodeCache($shortcode_obj->shortcode_key);
|
||||
}
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
private function getParamByHook($groups, $params, $hook, $action = 'save')
|
||||
{
|
||||
$groups['params']['specific_type'] = (isset($groups['params']['specific_type']) && $groups['params']['specific_type']) ? $groups['params']['specific_type'] : '';
|
||||
$groups['params']['controller_pages'] = (isset($groups['params']['controller_pages']) && $groups['params']['controller_pages']) ? $groups['params']['controller_pages'] : '';
|
||||
$groups['params']['controller_id'] = (isset($groups['params']['controller_id']) && $groups['params']['controller_id']) ? $groups['params']['controller_id'] : '';
|
||||
$params .= '[ApRow'.ApShortCodesBuilder::converParamToAttr2($groups['params'], 'ApRow', $this->theme_dir).']';
|
||||
//check exception page
|
||||
$this->saveExceptionConfig($hook, $groups['params']['specific_type'], $groups['params']['controller_pages'], $groups['params']['controller_id']);
|
||||
foreach ($groups['columns'] as $columns) {
|
||||
$columns['params']['specific_type'] = (isset($columns['params']['specific_type']) && $columns['params']['specific_type']) ? $columns['params']['specific_type'] : '';
|
||||
$columns['params']['controller_pages'] = (isset($columns['params']['controller_pages']) && $columns['params']['controller_pages']) ? $columns['params']['controller_pages'] : '';
|
||||
$columns['params']['controller_id'] = (isset($columns['params']['controller_id']) && $columns['params']['controller_id']) ? $columns['params']['controller_id'] : '';
|
||||
$this->saveExceptionConfig($hook, $columns['params']['specific_type'], $columns['params']['controller_pages'], $columns['params']['controller_id']);
|
||||
$params .= '[ApColumn'.ApShortCodesBuilder::converParamToAttr2($columns['params'], 'ApColumn', $this->theme_dir).']';
|
||||
foreach ($columns['widgets'] as $widgets) {
|
||||
if ($widgets['type'] == 'ApTabs' || $widgets['type'] == 'ApAccordions') {
|
||||
$params .= '['.$widgets['type'].ApShortCodesBuilder::converParamToAttr2($widgets['params'], $widgets['type'], $this->theme_dir).']';
|
||||
foreach ($widgets['widgets'] as $sub_widgets) {
|
||||
$type_sub = Tools::substr($widgets['type'], 0, -1);
|
||||
$params .= '['.$type_sub.ApShortCodesBuilder::converParamToAttr2($sub_widgets['params'], str_replace('_', '_sub_', $widgets['type']), $this->theme_dir).']';
|
||||
foreach ($sub_widgets['widgets'] as $sub_widget) {
|
||||
$params .= '['.$sub_widget['type']
|
||||
.ApShortCodesBuilder::converParamToAttr2($sub_widget['params'], $sub_widget['type'], $this->theme_dir).'][/'
|
||||
.$sub_widget['type'].']';
|
||||
}
|
||||
$params .= '[/'.$type_sub.']';
|
||||
}
|
||||
$params .= '[/'.$widgets['type'].']';
|
||||
} else {
|
||||
$params .= '['.$widgets['type'].ApShortCodesBuilder::converParamToAttr2($widgets['params'], $widgets['type'], $this->theme_dir).'][/'.$widgets['type'].']';
|
||||
if ($widgets['type'] == 'ApModule' && $action == 'save') {
|
||||
$is_delete = (int)$widgets['params']['is_display'];
|
||||
if ($is_delete) {
|
||||
if (!isset($widgets['params']['hook'])) {
|
||||
// FIX : Module not choose hook -> error
|
||||
$widgets['params']['hook'] = '';
|
||||
}
|
||||
$this->deleteModuleFromHook($widgets['params']['hook'], $widgets['params']['name_module']);
|
||||
}
|
||||
} else if ($widgets['type'] == 'ApProductCarousel') {
|
||||
if ($widgets['params']['order_way'] == 'random') {
|
||||
$this->config_module[$hook]['productCarousel']['order_way'] = 'random';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$params .= '[/ApColumn]';
|
||||
}
|
||||
$params .= '[/ApRow]';
|
||||
return $params;
|
||||
}
|
||||
|
||||
private function saveExceptionConfig($hook, $type, $page, $ids)
|
||||
{
|
||||
if (!$type) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($type == 'all') {
|
||||
if ($type != '') {
|
||||
$list = explode(',', $page);
|
||||
foreach ($list as $val) {
|
||||
$val = trim($val);
|
||||
if ($val && (!is_array($this->config_module) || !isset($this->config_module[$hook]) || !isset($this->config_module[$hook]['exception']) || !isset($val, $this->config_module[$hook]['exception']))) {
|
||||
$this->config_module[$hook]['exception'][] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->config_module[$hook][$type] = array();
|
||||
if ($type != 'index') {
|
||||
$ids = explode(',', $ids);
|
||||
foreach ($ids as $val) {
|
||||
$val = trim($val);
|
||||
if (!in_array($val, $this->config_module[$hook][$type])) {
|
||||
$this->config_module[$hook][$type][] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function adminContent($assign, $tpl_name)
|
||||
{
|
||||
if (file_exists($this->tpl_controller_path.$tpl_name)) {
|
||||
$tpl = $this->createTemplate($tpl_name);
|
||||
} else {
|
||||
$tpl = $this->createTemplate('ApGeneral.tpl');
|
||||
}
|
||||
$assign['moduleDir'] = _MODULE_DIR_;
|
||||
foreach ($assign as $key => $ass) {
|
||||
$tpl->assign(array($key => $ass));
|
||||
}
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
public function displayDuplicateLink($token = null, $id = null, $name = null)
|
||||
{
|
||||
$href = self::$currentIndex.'&'.$this->identifier.'='.$id.'&duplicate'.$this->table.'&token='.($token != null ? $token : $this->token);
|
||||
$html = '<a href="'.$href.'" title="Duplicate">
|
||||
<i class="icon-copy"></i> Duplicate
|
||||
</a>';
|
||||
|
||||
// validate module
|
||||
unset($name);
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function access($action, $disable = false)
|
||||
{
|
||||
if (Tools::getIsset('update'.$this->table) && Tools::getIsset($this->identifier)) {
|
||||
// Allow person see "EDIT" form
|
||||
$action = 'view';
|
||||
}
|
||||
return parent::access($action, $disable);
|
||||
}
|
||||
|
||||
/**
|
||||
* PERMISSION ACCOUNT demo@demo.com
|
||||
* OVERRIDE CORE
|
||||
*/
|
||||
public function initProcess()
|
||||
{
|
||||
parent::initProcess();
|
||||
|
||||
if (count($this->errors) <= 0) {
|
||||
if( Tools::isSubmit('duplicate'.$this->table) ) {
|
||||
if ($this->id_object) {
|
||||
if (!$this->access('add'))
|
||||
{
|
||||
$this->errors[] = $this->trans('You do not have permission to duplicate this.', array(), 'Admin.Notifications.Error');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/classes/ApPageSetting.php');
|
||||
require_once(_PS_MODULE_DIR_.'appagebuilder/controllers/admin/AdminApPageBuilderPositions.php');
|
||||
|
||||
class AdminApPageBuilderShortcodesController extends ModuleAdminControllerCore
|
||||
{
|
||||
public static $shortcode_lang;
|
||||
public static $language;
|
||||
public static $lang_id;
|
||||
public $file_content = '';
|
||||
protected $max_image_size = null;
|
||||
public $theme_name;
|
||||
public $config_module;
|
||||
public $hook_assign;
|
||||
public $module_name;
|
||||
public $module_path;
|
||||
public $tpl_controller_path;
|
||||
public $tpl_front_path;
|
||||
public $shortcode_dir;
|
||||
public $shortcode_override_dir;
|
||||
public $theme_dir;
|
||||
public $theme_url;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->show_toolbar = true;
|
||||
$this->table = 'appagebuilder';
|
||||
$this->className = 'ApPageBuilderShortCode';
|
||||
$this->context = Context::getContext();
|
||||
$this->module_name = 'appagebuilder';
|
||||
$this->module_path = __PS_BASE_URI__.'modules/'.$this->module_name.'/';
|
||||
$this->tpl_controller_path = _PS_ROOT_DIR_.'/modules/'.$this->module_name.'/views/templates/admin/ap_page_builder_shortcodes/';
|
||||
$this->tpl_front_path = _PS_ROOT_DIR_.'/modules/'.$this->module_name.'/views/templates/font/';
|
||||
$this->shortcode_dir = _PS_MODULE_DIR_.'appagebuilder/classes/shortcodes/';
|
||||
|
||||
self::$language = Language::getLanguages(false);
|
||||
parent::__construct();
|
||||
$this->theme_dir = _PS_THEME_DIR_;
|
||||
$this->theme_url = _THEMES_DIR_._THEME_NAME_.'/';
|
||||
$this->shortcode_override_dir = $this->theme_dir.'modules/appagebuilder/classes/shortcodes/';
|
||||
$this->max_image_size = (int)Configuration::get('PS_PRODUCT_PICTURE_MAX_SIZE');
|
||||
$this->theme_name = _THEME_NAME_;
|
||||
$this->hook_assign = array('rightcolumn', 'leftcolumn', 'home', 'top', 'footer');
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
if (Tools::getIsset('type_shortcode')) {
|
||||
# Run AJAX here for Hight Speed
|
||||
$this->ajaxLoadWidget();
|
||||
}
|
||||
parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate all data relate with profile
|
||||
* @param type int $old_id : current profile id is duplicating
|
||||
* @param type int $new_id : new profile id after duplicated
|
||||
*/
|
||||
public static function duplicateData($old_id, $new_id)
|
||||
{
|
||||
// $context = Context::getContext();
|
||||
$positions = array();
|
||||
$sql = 'SELECT *
|
||||
FROM `'._DB_PREFIX_.'appagebuilder_profiles` p
|
||||
WHERE p.id_appagebuilder_profiles='.(int)$old_id;
|
||||
$result = Db::getInstance()->getRow($sql);
|
||||
if ($result) {
|
||||
$positions[] = $result['header'];
|
||||
$positions[] = $result['content'];
|
||||
$positions[] = $result['footer'];
|
||||
$positions[] = $result['product'];
|
||||
}
|
||||
$sql_update = 'UPDATE '._DB_PREFIX_.'appagebuilder_profiles ';
|
||||
$sep = ' SET ';
|
||||
$is_update = false;
|
||||
// Duplicate positions
|
||||
foreach ($positions as $item) {
|
||||
$id = (int)$item;
|
||||
$object = ApPageBuilderPositionsModel::getPositionById($id);
|
||||
if ($object) {
|
||||
$key = ApPageSetting::getRandomNumber();
|
||||
$old_key = $object['position_key'];
|
||||
$name = 'Duplicate '.$key;
|
||||
$data = array('name' => $name, 'position' => $object['position'], 'position_key' => 'duplicate_'.$key);
|
||||
$model = new ApPageBuilderPositionsModel();
|
||||
$duplicate_id = $model->addAuto($data);
|
||||
if ($duplicate_id) {
|
||||
$position_controller = new AdminApPageBuilderPositionsController();
|
||||
$sql_update .= $sep.$data['position'].'='.$duplicate_id;
|
||||
$sep = ', ';
|
||||
$is_update = true;
|
||||
self::duplcateDataPosition($id, $duplicate_id);
|
||||
ApPageSetting::writeFile($position_controller->position_js_folder, $data['position'].$data['position_key'].'.js', Tools::file_get_contents($position_controller->position_js_folder.$data['position'].$old_key.'.js'));
|
||||
ApPageSetting::writeFile($position_controller->position_css_folder, $data['position'].$data['position_key'].'.css', Tools::file_get_contents($position_controller->position_css_folder.$data['position'].$old_key.'.css'));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($is_update) {
|
||||
$sql_update .= ' WHERE id_appagebuilder_profiles='.(int)$new_id;
|
||||
Db::getInstance()->execute($sql_update);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate a position: dulicate data in table appagebuilder_lang; appagebuilder; appagebuilder_shop;
|
||||
* @param type int $old_id: position id for duplicate
|
||||
* @param type int $duplicate_id: new position id
|
||||
*/
|
||||
public static function duplcateDataPosition($old_id, $duplicate_id)
|
||||
{
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
// Get list appagebuilder for copy
|
||||
$sql = 'SELECT * from '._DB_PREFIX_.'appagebuilder p WHERE p.id_appagebuilder_positions='.(int)$old_id;
|
||||
$result = Db::getInstance()->executeS($sql);
|
||||
foreach ($result as $item) {
|
||||
// Duplicate to tables appagebuilder
|
||||
$sql = 'INSERT INTO '._DB_PREFIX_.'appagebuilder (id_appagebuilder_positions, hook_name)
|
||||
VALUES("'.(int)$duplicate_id.'", "'.pSQL($item['hook_name']).'")';
|
||||
Db::getInstance()->execute($sql);
|
||||
// Duplicate to tables appagebuilder_shop
|
||||
$id_new = Db::getInstance()->Insert_ID();
|
||||
$sql = 'INSERT INTO '._DB_PREFIX_.'appagebuilder_shop (id_appagebuilder, id_shop)
|
||||
VALUES('.(int)$id_new.', '.(int)$id_shop.')';
|
||||
Db::getInstance()->execute($sql);
|
||||
// Copy data and languages
|
||||
$sql = 'SELECT * from '._DB_PREFIX_.'appagebuilder_lang p
|
||||
WHERE p.id_appagebuilder='.(int)$item['id_appagebuilder'];
|
||||
$old_data = Db::getInstance()->executeS($sql);
|
||||
foreach ($old_data as $temp) {
|
||||
$sql = 'INSERT INTO '._DB_PREFIX_."appagebuilder_lang (id_appagebuilder, id_lang, params)
|
||||
VALUES('".(int)$id_new."', '".(int)$temp['id_lang']."', '".pSql(apPageHelper::replaceFormId($temp['params']))."')";
|
||||
Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function adminContent($assign, $tpl_name)
|
||||
{
|
||||
if (file_exists($this->tpl_controller_path.$tpl_name)) {
|
||||
$tpl = $this->createTemplate($tpl_name);
|
||||
} else {
|
||||
$tpl = $this->createTemplate('ApGeneral.tpl');
|
||||
}
|
||||
$assign['moduleDir'] = _MODULE_DIR_;
|
||||
foreach ($assign as $key => $ass) {
|
||||
$tpl->assign(array($key => $ass));
|
||||
}
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX :
|
||||
* - load widget or module
|
||||
* - call method of widget
|
||||
*/
|
||||
private function ajaxLoadWidget()
|
||||
{
|
||||
$type_shortcode = Tools::ucfirst(Tools::getValue('type_shortcode'));
|
||||
$type = Tools::getValue('type');
|
||||
$shor_code_dir = '';
|
||||
// Add new widget from apollotheme
|
||||
if ($type === 'widget') {
|
||||
if (!$shor_code_dir = ApPageSetting::requireShortCode($type_shortcode.'.php', $this->theme_dir)) {
|
||||
die($this->l('This short code is not exist'));
|
||||
}
|
||||
if (class_exists($type_shortcode) != true) {
|
||||
// validate module
|
||||
require_once($shor_code_dir);
|
||||
}
|
||||
|
||||
$obj = new $type_shortcode;
|
||||
die($obj->renderForm());
|
||||
} elseif ($type === 'module') {
|
||||
// Custom a module
|
||||
$shor_code_dir = ApPageSetting::requireShortCode('ApModule.php', $this->theme_dir);
|
||||
if (class_exists('ApModule') != true) {
|
||||
// validate module
|
||||
require_once($shor_code_dir);
|
||||
}
|
||||
$obj = new ApModule();
|
||||
die($obj->renderForm());
|
||||
}
|
||||
|
||||
|
||||
|
||||
# RUN WIDGET METHOD - BEGIN
|
||||
$result = array(
|
||||
'hasError' => false,
|
||||
'error' => '',
|
||||
'success' => false,
|
||||
'information' => '',
|
||||
);
|
||||
$type_shortcode = Tools::ucfirst(Tools::getValue('type_shortcode'));
|
||||
if (Tools::getIsset('type_shortcode') && $type_shortcode) {
|
||||
if ($shor_code_dir = ApPageSetting::requireShortCode($type_shortcode.'.php', $this->theme_dir)) {
|
||||
if (class_exists($type_shortcode) != true) {
|
||||
require_once($shor_code_dir);
|
||||
}
|
||||
$obj = new $type_shortcode;
|
||||
$method_name = Tools::getValue('method_name', '');
|
||||
$method_name = 'ajaxCallBack'.Tools::toCamelCase($method_name, true);
|
||||
if (method_exists($obj, $method_name)) {
|
||||
# RUN WIDGET METHOD
|
||||
$obj->{$method_name}();
|
||||
$result['information'] = $method_name . $this->l(' is successful');
|
||||
} else {
|
||||
$result['error'] = sprintf($this->l('%s method is not exist'), $method_name);
|
||||
}
|
||||
} else {
|
||||
$result['error'] = sprintf($this->l('%s is not found'), $type_shortcode.'.php');
|
||||
}
|
||||
} else {
|
||||
$result['error'] = $this->l('type_shortcode param is empty');
|
||||
}
|
||||
|
||||
if (count($result['error'])) {
|
||||
$result['hasError'] = true;
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($result));
|
||||
# RUN WIDGET METHOD - END
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 Apollotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* ApPageBuilder is module help you can build content for your shop
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @author Apollotheme <apollotheme@gmail.com>
|
||||
* @copyright 2007-2015 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class AdminApPageBuilderThemeEditorController extends ModuleAdminControllerCore
|
||||
{
|
||||
public $themeName = '';
|
||||
public $css_patterns;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'appagebuilder_themeeditor';
|
||||
$this->lang = false;
|
||||
$this->context = Context::getContext();
|
||||
parent::__construct();
|
||||
$this->themeName = _THEME_NAME_;
|
||||
$this->js_patterns = _PS_THEME_DIR_.apPageHelper::getJsDir().'patterns/';
|
||||
$this->css_patterns = _PS_THEME_DIR_.apPageHelper::getCssDir().'patterns/';
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (count($this->errors) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Tools::getValue('action') && Tools::getValue('action') == 'savedata' && Tools::getValue('customize')) {
|
||||
$data = LeoFrameworkHelper::getPost(array('action-mode', 'saved_file', 'newfile', 'customize', 'customize_match', 'active'), 0);
|
||||
|
||||
$selectors = $data['customize'];
|
||||
$matches = $data['customize_match'];
|
||||
|
||||
$output = '';
|
||||
|
||||
$cache = array();
|
||||
foreach ($selectors as $match => $customizes) {
|
||||
$output .= "\r\n/* customize for $match */ \r\n";
|
||||
foreach ($customizes as $key => $customize) {
|
||||
if (isset($matches[$match]) && isset($matches[$match][$key])) {
|
||||
$tmp = explode('|', $matches[$match][$key]);
|
||||
$attribute = Tools::strtolower(trim($tmp[1]));
|
||||
if (trim($customize)) {
|
||||
$output .= $tmp[0].' { ';
|
||||
if ($attribute == 'background-image') {
|
||||
$output .= $attribute.':url('.$customize.')';
|
||||
} elseif ($attribute == 'font-size') {
|
||||
$output .= $attribute.':'.$customize.'px';
|
||||
} else if (strpos($attribute, 'color') !== false) {
|
||||
$output .= $attribute.':#'.$customize;
|
||||
} else if ($attribute == 'background') {
|
||||
$output .= $attribute.':#'.$customize;
|
||||
} else {
|
||||
$output .= $attribute.':'.$customize;
|
||||
}
|
||||
$output .= "} \r\n";
|
||||
}
|
||||
$cache[$match][] = array('val' => $customize, 'selector' => $tmp[0], 'attr' => $tmp[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# RENAME
|
||||
if (!empty($data['saved_file']) && !empty($data['newfile'])) {
|
||||
# DELETE PATTERN
|
||||
if (isset($data['saved_file']) && $data['saved_file'] && file_exists($this->css_patterns.$data['saved_file'].'.css')) {
|
||||
unlink($this->css_patterns.$data['saved_file'].'.css');
|
||||
}
|
||||
if (isset($data['saved_file']) && $data['saved_file'] && file_exists($this->css_patterns.$data['saved_file'].'.json')) {
|
||||
unlink($this->css_patterns.$data['saved_file'].'.json');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($data['newfile'])) {
|
||||
# EDIT PATTERN
|
||||
$nameFile = $data['saved_file'] ? $data['saved_file'] : 'profile-'.time();
|
||||
} else {
|
||||
# CREATE PATTERN
|
||||
$nameFile = preg_replace('#\s+#', '-', trim($data['newfile']));
|
||||
}
|
||||
|
||||
if ($data['action-mode'] != 'save-delete') {
|
||||
# CREATE + EDIT
|
||||
if (!is_dir($this->css_patterns)) {
|
||||
mkdir($this->css_patterns, 0755, true);
|
||||
}
|
||||
|
||||
if (!empty($output)) {
|
||||
LeoFrameworkHelper::writeToCache($this->css_patterns, $nameFile, $output);
|
||||
}
|
||||
if (!empty($cache)) {
|
||||
LeoFrameworkHelper::writeToCache($this->css_patterns, $nameFile, Tools::jsonEncode($cache), 'json');
|
||||
}
|
||||
|
||||
if (isset($data['active']) && $data['active']) {
|
||||
# SET ACTIVE - YES
|
||||
apPageHelper::setConfig('C_PROFILE', $nameFile);
|
||||
} elseif (isset($data['active']) && empty($data['active'])) {
|
||||
# SET ACTIVE - NO
|
||||
$pattern_active = apPageHelper::getConfig('C_PROFILE');
|
||||
if ($nameFile == $pattern_active) {
|
||||
apPageHelper::setConfig('C_PROFILE', '');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# SET ACTIVE - NO
|
||||
$pattern_active = apPageHelper::getConfig('C_PROFILE');
|
||||
if ($data['saved_file'] == $pattern_active) {
|
||||
apPageHelper::setConfig('C_PROFILE', '');
|
||||
}
|
||||
# DELETE PATTERN
|
||||
if (isset($data['saved_file']) && $data['saved_file'] && file_exists($this->css_patterns.$data['saved_file'].'.css')) {
|
||||
unlink($this->css_patterns.$data['saved_file'].'.css');
|
||||
}
|
||||
if (isset($data['saved_file']) && $data['saved_file'] && file_exists($this->css_patterns.$data['saved_file'].'.json')) {
|
||||
unlink($this->css_patterns.$data['saved_file'].'.json');
|
||||
}
|
||||
}
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get list of files inside folder path.
|
||||
*/
|
||||
private function getFileList($path, $e = null, $nameOnly = false)
|
||||
{
|
||||
$output = array();
|
||||
$directories = glob($path.'*'.$e);
|
||||
if ($directories) {
|
||||
foreach ($directories as $dir) {
|
||||
$dir = basename($dir);
|
||||
if ($nameOnly) {
|
||||
$dir = str_replace($e, '', $dir);
|
||||
}
|
||||
$output[$dir] = $dir;
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* render list of modules following positions in the layout editor.
|
||||
*/
|
||||
public function renderList()
|
||||
{
|
||||
$filePath = _PS_ALL_THEMES_DIR_.$this->themeName.'';
|
||||
|
||||
$xml = simplexml_load_file($filePath.'/config.xml');
|
||||
|
||||
if (!isset($xml->theme_key) || empty($xml->theme_key)) {
|
||||
return '<div class="panel"><div class="panel-content"><div class="alert alert-warning">'.'This function is only avariable using for Theme from <b><a href=http://www.leotheme.com/ target=_blank>leotheme.com</a></b> or using theme built-in <b>Leo Framework</b>'.'</div></div></div>';
|
||||
}
|
||||
|
||||
$tpl = $this->createTemplate('themeeditor.tpl');
|
||||
Context::getContext()->controller->addCss(apPageHelper::getCssAdminDir().'admin/themeeditor.css');
|
||||
Context::getContext()->controller->addCss(apPageHelper::getCssAdminDir().'colorpicker/css/colorpicker.css');
|
||||
Context::getContext()->controller->addCss(apPageHelper::getCssAdminDir().'paneltool.css');
|
||||
|
||||
Context::getContext()->controller->addJs(apPageHelper::getJsAdminDir().'colorpicker/js/colorpicker.js');
|
||||
Context::getContext()->controller->addJs(apPageHelper::getJsAdminDir().'admin/themeeditor.js');
|
||||
|
||||
|
||||
|
||||
$output = LeoFrameworkHelper::renderEdtiorThemeForm($this->themeName);
|
||||
|
||||
$profiles = $this->getFileList($this->css_patterns, '.css', true);
|
||||
$patterns = $this->getFileList(_PS_ALL_THEMES_DIR_.$this->themeName.'/assets/img/patterns/', '.png');
|
||||
$patternsjpg = $this->getFileList(_PS_ALL_THEMES_DIR_.$this->themeName.'/assets/img/patterns/', '.jpg');
|
||||
|
||||
$patterns = array_merge($patterns, $patternsjpg);
|
||||
$backGroundValue = array(
|
||||
'attachment' => array('scroll', 'fixed', 'local', 'initial', 'inherit'),
|
||||
'repeat' => array('repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'initial', 'inherit'),
|
||||
'position' => array('left top', 'left center', 'left bottom', 'right top', 'right center', 'right bottom', 'center top', 'center center', 'center bottom')
|
||||
);
|
||||
$siteURL = _PS_BASE_URL_.__PS_BASE_URI__;
|
||||
$imgLink = Context::getContext()->link->getAdminLink('AdminApPageBuilderImages').'&leo_controller=live_theme_edit'; // URL LOAD IMAGE BUTTON
|
||||
$backgroundImageURL = _PS_BASE_URL_._THEME_DIR_.'assets/img/patterns/';
|
||||
|
||||
$ssl_enable = Configuration::get('PS_SSL_ENABLED');
|
||||
if ($ssl_enable) {
|
||||
$siteURL = str_replace('http:', 'https:', $siteURL);
|
||||
$imgLink = str_replace('http:', 'https:', $imgLink);
|
||||
$backgroundImageURL = str_replace('http:', 'https:', $backgroundImageURL);
|
||||
}
|
||||
|
||||
$tpl->assign(array(
|
||||
'actionURL' => 'index.php?tab=AdminApPageBuilderThemeEditor&token='.Tools::getAdminTokenLite('AdminApPageBuilderThemeEditor').'&action=savedata',
|
||||
'text_layout' => $this->l('Layout'),
|
||||
'text_elements' => $this->l('Elements'),
|
||||
'profiles' => $profiles,
|
||||
'profiles_active' => apPageHelper::getConfig('c_profile'),
|
||||
'xmlselectors' => $output,
|
||||
'apPageHelper' => apPageHelper::getInstance(),
|
||||
'themeName' => $this->themeName,
|
||||
'patterns' => $patterns,
|
||||
'backgroundImageURL' => $backgroundImageURL,
|
||||
'siteURL' => $siteURL,
|
||||
'customizeFolderURL' => _PS_THEME_URI_.apPageHelper::getCssDir().'patterns/',
|
||||
'backLink' => 'index.php?controller=AdminModules&configure=appagebuilder&token='.Tools::getAdminTokenLite('AdminModules'),
|
||||
'imgLink' => $imgLink,
|
||||
'backGroundValue' => $backGroundValue
|
||||
));
|
||||
|
||||
return $tpl->fetch();
|
||||
}
|
||||
}
|
||||
36
modules/appagebuilder/controllers/admin/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Leo Theme for Prestashop 1.6.x
|
||||
*
|
||||
* @author http://www.leotheme.com
|
||||
* @copyright Copyright (C) October 2013 LeoThemes.com <@emai:leotheme@gmail.com>
|
||||
* <info@leotheme.com>.All rights reserved.
|
||||
* @license GNU General Public License version 2
|
||||
*/
|
||||
|
||||
class ApPageBuilderApPagebuilderHomeModuleFrontController extends FrontController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->display_column_left = false;
|
||||
$this->display_column_right = false;
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
$this->addJS(_THEME_JS_DIR_.'index.js');
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'HOOK_HOME' => Hook::exec('displayHome'),
|
||||
'HOOK_HOME_TAB' => Hook::exec('displayHomeTab'),
|
||||
'HOOK_HOME_TAB_CONTENT' => Hook::exec('displayHomeTabContent')
|
||||
));
|
||||
$this->display_column_left = false;
|
||||
$this->display_column_right = false;
|
||||
$this->context->smarty->assign(array(
|
||||
'page_name' => 'index',
|
||||
));
|
||||
$this->setTemplate('index.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* set html <body id="index"
|
||||
*/
|
||||
public function getPageName()
|
||||
{
|
||||
$page_name = 'index';
|
||||
return $page_name;
|
||||
}
|
||||
|
||||
public function getTemplateVarPage()
|
||||
{
|
||||
$page = parent::getTemplateVarPage();
|
||||
unset($page['body_classes']['page-']);
|
||||
$page['body_classes']['page-index'] = true;
|
||||
return $page;
|
||||
}
|
||||
}
|
||||
36
modules/appagebuilder/controllers/front/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
modules/appagebuilder/controllers/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
419
modules/appagebuilder/css/ApImage360.css
Normal file
692
modules/appagebuilder/css/ApImageHotspot.css
Normal file
@@ -0,0 +1,692 @@
|
||||
.litetooltip-wrapper {
|
||||
position: absolute;
|
||||
font: normal 90% Verdana;
|
||||
z-index: 10000;
|
||||
display: block;
|
||||
visibility: visible;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper.incontainer {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper.incontainer .tooltip-content {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper.top, .litetooltip-wrapper.top-left, .litetooltip-wrapper.top-right {
|
||||
margin-top: -3px;
|
||||
padding: 5px 0px 10px 0px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper.right, .litetooltip-wrapper.right-top, .litetooltip-wrapper.right-bottom {
|
||||
margin-left: 3px;
|
||||
padding: 0px 5px 0px 10px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper.bottom, .litetooltip-wrapper.bottom-left, .litetooltip-wrapper.bottom-right {
|
||||
margin-top: 3px;
|
||||
padding: 10px 0px 5px 0px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper.left, .litetooltip-wrapper.left-top, .litetooltip-wrapper.left-bottom {
|
||||
margin-left: -3px;
|
||||
padding: 0px 10px 0px 5px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow {
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.top {
|
||||
margin-left: -8px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 0px;
|
||||
border-width: 10px 8px 0px 8px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.top-left {
|
||||
margin-left: 8px;
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
position: absolute;
|
||||
border-width: 10px 8px 0px 8px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.top-right {
|
||||
margin-right: 8px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
position: absolute;
|
||||
border-width: 10px 8px 0px 8px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.right {
|
||||
margin-top: -8px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0px;
|
||||
border-width: 8px 10px 8px 0;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.right-top {
|
||||
margin-bottom: 8px;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
border-width: 8px 10px 8px 0;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.right-bottom {
|
||||
margin-top: 8px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
border-width: 8px 10px 8px 0;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.bottom {
|
||||
margin-left: -8px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 0px;
|
||||
border-width: 0px 8px 10px 8px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.bottom-left {
|
||||
margin-left: 8px;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
border-width: 0px 8px 10px 8px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.bottom-right {
|
||||
margin-right: 8px;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
border-width: 0px 8px 10px 8px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.left {
|
||||
margin-top: -8px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0px;
|
||||
border-width: 8px 0px 8px 10px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.left-top {
|
||||
margin-bottom: 8px;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
border-width: 8px 0px 8px 10px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-arrow.left-bottom {
|
||||
margin-top: 8px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
border-width: 8px 0px 8px 10px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-content {
|
||||
padding: 10px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
min-width: 90px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-content .clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-content > p {
|
||||
padding-left: 3px;
|
||||
}
|
||||
/******************************************/
|
||||
/*************** templates ****************/
|
||||
.litetooltip-wrapper .tooltip-menu {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu ul, .litetooltip-wrapper .tooltip-menu ol {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
width: 100%;
|
||||
float: left;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu li {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
list-style: none;
|
||||
float: left;
|
||||
border: solid 1px;
|
||||
clear: both;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu a {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
padding: 5px;
|
||||
margin: 0px;
|
||||
clear: both;
|
||||
min-width: 100%;
|
||||
width: 100%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.AlizarinCrimson {
|
||||
background: #df3030;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.AlizarinCrimson li {
|
||||
border-color: #df3030;
|
||||
border-bottom: solid 1px #d12b2b;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.AlizarinCrimson a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.AlizarinCrimson a:hover {
|
||||
color: #000;
|
||||
background: #f79992;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Geradline {
|
||||
background: #f79992;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Geradline li {
|
||||
border-color: #f79992;
|
||||
border-bottom: solid 1px #ea8880;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Geradline a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Geradline a:hover {
|
||||
color: #fff;
|
||||
background: #ee6a60;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Conifer {
|
||||
background: #a2d959;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Conifer li {
|
||||
border-color: #a2d959;
|
||||
border-bottom: solid 1px #94c652;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Conifer a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Conifer a:hover {
|
||||
color: #fff;
|
||||
background: #7fba00;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Spindle {
|
||||
background: #bfd9f0;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Spindle li {
|
||||
border-color: #bfd9f0;
|
||||
border-bottom: solid 1px #d2e0ec;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Spindle a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Spindle a:hover {
|
||||
color: #fff;
|
||||
background: #6699cc;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.BostonBlue {
|
||||
background: #6699cc;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.BostonBlue li {
|
||||
border-color: #6699cc;
|
||||
border-bottom: solid 1px #4f83b7;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.BostonBlue a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.BostonBlue a:hover {
|
||||
color: #000;
|
||||
background: #bfd9f0;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.CarrotOrange {
|
||||
background: #ed9122;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.CarrotOrange li {
|
||||
border-color: #ed9122;
|
||||
border-bottom: solid 1px #d47f19;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.CarrotOrange a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.CarrotOrange a:hover {
|
||||
color: #000;
|
||||
background: #fecf3d;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Affair {
|
||||
background: #7c4d94;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Affair li {
|
||||
border-color: #7c4d94;
|
||||
border-bottom: solid 1px #8d60a4;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Affair a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.Affair a:hover {
|
||||
color: #fff;
|
||||
background: #a778bf;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.PaleConifer {
|
||||
background: #bad87a;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.PaleConifer li {
|
||||
border-color: #bad87a;
|
||||
border-bottom: solid 1px #9db963;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.PaleConifer a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.PaleConifer a:hover {
|
||||
background: #f5ffbe;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.BrightSun {
|
||||
background: #fec000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.BrightSun li {
|
||||
border-color: #fec000;
|
||||
border-bottom: solid 1px #ebb203;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.BrightSun a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.BrightSun a:hover {
|
||||
background: #fecf3d;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.AmazonLemon {
|
||||
background: #7fba00;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.AmazonLemon li {
|
||||
border-color: #7fba00;
|
||||
border-bottom: solid 1px #8ac903;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.AmazonLemon a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.AmazonLemon a:hover {
|
||||
background: #fde910;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.CoffeeConfetti {
|
||||
background: #593737;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.CoffeeConfetti li {
|
||||
border-color: #593737;
|
||||
border-bottom: solid 1px #734f4f;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.CoffeeConfetti a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.CoffeeConfetti a:hover {
|
||||
color: #000;
|
||||
background: #e9d75a;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.OysterPrim {
|
||||
background: #988d77;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.OysterPrim li {
|
||||
border-color: #988d77;
|
||||
border-bottom: solid 1px #786e59;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.OysterPrim a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu.OysterPrim a:hover {
|
||||
background: #fdfeb8;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .tooltip-menu li.last-child {
|
||||
border-bottom: 0px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .image-right {
|
||||
float: right;
|
||||
margin: 0px 0px 0px 5px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .image-left {
|
||||
float: left;
|
||||
margin: 0px 5px 0px 0px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .video-wrapper {
|
||||
padding-bottom: 56.26%;
|
||||
position: relative;
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .video-wrapper iframe {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template h4 {
|
||||
margin: 0px;
|
||||
padding: 2px 4px 4px 4px;
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template p {
|
||||
margin: 0px;
|
||||
padding: 2px 4px;
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template ul, .litetooltip-wrapper .template ol {
|
||||
margin: 0px;
|
||||
padding: 5px 5px 5px 5px;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template li {
|
||||
padding: 2px 0px;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template p, .litetooltip-wrapper .template ul, .litetooltip-wrapper .template ol {
|
||||
background: #fff;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.AlizarinCrimson, .litetooltip-wrapper .template.AlizarinCrimson h4 {
|
||||
background: #df3030;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.RadicalRed, .litetooltip-wrapper .template.RadicalRed h4 {
|
||||
background: #ff1e53;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.Geradline, .litetooltip-wrapper .template.Geradline h4 {
|
||||
background: #f79992;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.Conifer, .litetooltip-wrapper .template.Conifer h4 {
|
||||
background: #a2d959;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.Limeade, .litetooltip-wrapper .template.Limeade h4 {
|
||||
background: #7fba00;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.AppleGreen, .litetooltip-wrapper .template.AppleGreen h4 {
|
||||
background: #4cc744;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.Spindle, .litetooltip-wrapper .template.Spindle h4 {
|
||||
background: #bfd9f0;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.Danube, .litetooltip-wrapper .template.Danube h4 {
|
||||
background: #6699cc;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.BostonBlue, .litetooltip-wrapper .template.BostonBlue h4 {
|
||||
background: #4182c2;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.CarrotOrange, .litetooltip-wrapper .template.CarrotOrange h4 {
|
||||
background: #ed9122;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.BrightSun, .litetooltip-wrapper .template.BrightSun h4 {
|
||||
background: #fecf3d;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.Affair, .litetooltip-wrapper .template.Affair h4 {
|
||||
background: #7c4d94;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.HotRed, .litetooltip-wrapper .template.HotRed h4 {
|
||||
background: #df3030;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.HotRed p, .litetooltip-wrapper .template.HotRed ul, .litetooltip-wrapper .template.HotRed ol {
|
||||
background: #f79992;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.HuskyBlue, .litetooltip-wrapper .template.HuskyBlue h4 {
|
||||
background: #4182c2;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.HuskyBlue p, .litetooltip-wrapper .template.HuskyBlue ul, .litetooltip-wrapper .template.HuskyBlue ol {
|
||||
background: #bfd9f0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.MoonAffair, .litetooltip-wrapper .template.MoonAffair h4 {
|
||||
background: #7c4d94;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.MoonAffair p, .litetooltip-wrapper .template.MoonAffair ul, .litetooltip-wrapper .template.MoonAffair ol {
|
||||
background: #e8cbf7;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.PaleMint, .litetooltip-wrapper .template.PaleMint h4 {
|
||||
background: #7fba00;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.PaleMint p, .litetooltip-wrapper .template.PaleMint ul, .litetooltip-wrapper .template.PaleMint ol {
|
||||
background: #f5ffbe;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.BlueRomance, .litetooltip-wrapper .template.BlueRomance h4 {
|
||||
background: #0066ff;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.BlueRomance p, .litetooltip-wrapper .template.BlueRomance ul, .litetooltip-wrapper .template.BlueRomance ol {
|
||||
background: #d2f6de;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.AmazonLemon, .litetooltip-wrapper .template.AmazonLemon h4 {
|
||||
background: #7fba00;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.AmazonLemon p, .litetooltip-wrapper .template.AmazonLemon ul, .litetooltip-wrapper .template.AmazonLemon ol {
|
||||
background: #fde910;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.LimeConfier, .litetooltip-wrapper .template.LimeConfier h4 {
|
||||
background: #7fba00;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.LimeConfier p, .litetooltip-wrapper .template.LimeConfier ul, .litetooltip-wrapper .template.LimeConfier ol {
|
||||
background: #a2d959;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.MustardSun, .litetooltip-wrapper .template.MustardSun h4 {
|
||||
background: #ed9122;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.MustardSun p, .litetooltip-wrapper .template.MustardSun ul, .litetooltip-wrapper .template.MustardSun ol {
|
||||
background: #fecf3d;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.AtollSea, .litetooltip-wrapper .template.AtollSea h4 {
|
||||
background: #0a6f75;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.AtollSea p, .litetooltip-wrapper .template.AtollSea ul, .litetooltip-wrapper .template.AtollSea ol {
|
||||
background: #fecf3d;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.BlazeOrange, .litetooltip-wrapper .template.BlazeOrange h4 {
|
||||
background: #ff6600;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.BlazeOrange p, .litetooltip-wrapper .template.BlazeOrange ul, .litetooltip-wrapper .template.BlazeOrange ol {
|
||||
background: #0a6f75;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.CoffeeConfetti, .litetooltip-wrapper .template.CoffeeConfetti h4 {
|
||||
background: #593737;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.CoffeeConfetti p, .litetooltip-wrapper .template.CoffeeConfetti ul, .litetooltip-wrapper .template.CoffeeConfetti ol {
|
||||
background: #e9d75a;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.OysterPrim, .litetooltip-wrapper .template.OysterPrim h4 {
|
||||
background: #988d77;
|
||||
}
|
||||
|
||||
.litetooltip-wrapper .template.OysterPrim p, .litetooltip-wrapper .template.OysterPrim ul, .litetooltip-wrapper .template.OysterPrim ol {
|
||||
background: #fdfeb8;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.litetooltip-hotspot-wrapper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.litetooltip-hotspot-container {
|
||||
position: relative;
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
.litetooltip-hotspot-container img {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.litetooltip-hotspot-container .hotspot {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.litetooltip-hotspot-container .hotspot .data-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.litetooltip-hotspot-container .blink {
|
||||
opacity: 0.8;
|
||||
-moz-opacity: 0.8;
|
||||
animation: litetooltip_hotspot_blink .6s ease-in infinite;
|
||||
-moz-animation: litetooltip_hotspot_blink .6s ease-in infinite;
|
||||
-ms-animation: litetooltip_hotspot_blink .6s ease-in infinite;
|
||||
-webkit-animation: litetooltip_hotspot_blink .6s ease-in infinite;
|
||||
}
|
||||
|
||||
@keyframes litetooltip_hotspot_blink {
|
||||
to {
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes litetooltip_hotspot_blink {
|
||||
to {
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes litetooltip_hotspot_blink {
|
||||
to {
|
||||
opacity: 0.3;
|
||||
-moz-opacity: 0.3;
|
||||
}
|
||||
}
|
||||
|
||||
@-ms-keyframes litetooltip_hotspot_blink {
|
||||
to {
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
1137
modules/appagebuilder/css/admin/form.css
Normal file
46
modules/appagebuilder/css/admin/images.css
Normal file
@@ -0,0 +1,46 @@
|
||||
/*.adminleosliderlayer #main .bootstrap, .adminleosliderlayer #header, .adminleosliderlayer #footer{display: none}
|
||||
.adminleosliderlayer #main{margin: 0;padding: 0}
|
||||
.adminleosliderlayer #content{margin: 0 !important;padding:0 !important}
|
||||
.adminleosliderlayer .page-head{display: none}*/
|
||||
.adminleosliderlayer #header, .adminleosliderlayer #footer, .adminleosliderlayer #nav-sidebar, .page-head{
|
||||
display: none;
|
||||
}
|
||||
.adminappagebuilderimages #header,.adminappagebuilderimages #footer,.adminappagebuilderimages #nav-sidebar,.adminappagebuilderimages .page-head{
|
||||
display: none;
|
||||
}
|
||||
.page-sidebar #content, .adminleosliderlayer #main{margin: 0;padding: 0}
|
||||
#list-imgs {
|
||||
padding-left: 0;
|
||||
padding-bottom: 1px;
|
||||
margin-bottom: 20px;
|
||||
list-style: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
#list-imgs li a{
|
||||
font-size: 11px
|
||||
}
|
||||
#list-imgs li {
|
||||
float: left;
|
||||
width: 20%;
|
||||
height: 115px;
|
||||
padding: 10px 5px;
|
||||
margin: 0 -1px -1px 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
text-align: center;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
.img-row{
|
||||
overflow: hidden;
|
||||
height: 80px;
|
||||
}
|
||||
.typos{
|
||||
padding: 10px
|
||||
}
|
||||
.typos-wrap .typo {
|
||||
position: relative;
|
||||
min-height: 60px;
|
||||
}
|
||||
.typos-wrap .typo-big{
|
||||
min-height: 123px
|
||||
}
|
||||
36
modules/appagebuilder/css/admin/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision: 13573 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
376
modules/appagebuilder/css/admin/style.css
Normal file
@@ -0,0 +1,376 @@
|
||||
.fl {float: left!important;}
|
||||
.fr {float: right!important;}
|
||||
.list-all-hooks a {
|
||||
margin-left: 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
.icon-AdminApPageBuilder:before {
|
||||
content: "\f044";
|
||||
}
|
||||
|
||||
#home_wrapper .position-cover {
|
||||
border: 1px solid #00aff0;
|
||||
box-shadow: 0 0 5px #eee;
|
||||
padding: 5px;
|
||||
margin-bottom: 30px;
|
||||
transition: all 0.3s ease 0s;
|
||||
}
|
||||
#home_wrapper .position-cover:hover {
|
||||
box-shadow: 0 0 5px #bdbdbd;
|
||||
transition: all 0.6s ease 0s;
|
||||
}
|
||||
.position-area {
|
||||
min-height: 100px;
|
||||
clear: both;
|
||||
}
|
||||
.bootstrap .tree-panel-heading-controls {
|
||||
margin: -2px 0 20px!important;
|
||||
}
|
||||
.modal-body {
|
||||
/*overflow: hidden!important;*/
|
||||
}
|
||||
.column-controll-right .btn-group .btn {
|
||||
background-color: #bbb;
|
||||
transition: all 0.2s ease 0s;
|
||||
}
|
||||
.column-controll-right .btn-group .btn:hover {
|
||||
transition: all 0.3s ease 0s;
|
||||
background-color: #333;
|
||||
}
|
||||
.position-cover .list-position span {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 150px;
|
||||
line-height: 12px;
|
||||
}
|
||||
.box-edit-position {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 5px;
|
||||
padding: 20px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
width: 300px;
|
||||
z-index: 1;
|
||||
}
|
||||
.position-cover .list-position i:hover {
|
||||
color: #000!important;
|
||||
}
|
||||
.position-name i {
|
||||
color: #fff;
|
||||
}
|
||||
.modal.ui-draggable {
|
||||
top:0!important;
|
||||
}
|
||||
.item a {
|
||||
display: table-cell;
|
||||
height: 65px !important;
|
||||
vertical-align: middle;
|
||||
padding: 0 10px 0 40px;
|
||||
}
|
||||
.cover-short-code {
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid transparent;
|
||||
margin: 5px 0;
|
||||
cursor: pointer;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
transition: all 0.2s ease 0s;
|
||||
box-shadow: 0 -2px 0 #e6e6e6 inset;
|
||||
height: 65px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.cover-short-code:hover {
|
||||
background-color: #ededed;
|
||||
transition: all 0.4s ease 0s;
|
||||
color: #333;
|
||||
box-shadow: 0 -2px 0 #bdbdbd inset;
|
||||
}
|
||||
.cover-short-code .icon {
|
||||
left: 20px;
|
||||
position: absolute;
|
||||
top: 35px;
|
||||
}
|
||||
.cover-short-code .label {
|
||||
position: relative;
|
||||
font-weight: bold;
|
||||
color: #0066CC;
|
||||
white-space:normal;
|
||||
padding: 0!important;
|
||||
margin: 0!important;
|
||||
}
|
||||
.cover-short-code:hover .label {
|
||||
color: #333;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.cover-short-code:hover .icon {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#txt-search {
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #fff;
|
||||
}
|
||||
#txt-search:hover, #txt-search:focus {
|
||||
box-shadow: 0 -2px 0 #bdbdbd inset!important;
|
||||
background-color: #fff7d0;
|
||||
}
|
||||
.box-search-widget {
|
||||
opacity: 1;
|
||||
float: right;
|
||||
margin-right: 10px;
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
#tab-new-widget {
|
||||
border-bottom: 1px solid #ddd;
|
||||
min-height: 40px;
|
||||
}
|
||||
#modal_form .tab-content {
|
||||
margin-top: 10px;
|
||||
}
|
||||
#modal_form .btn.is-checked {
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
border: 1px dashed #ddd;
|
||||
}
|
||||
img.icon {
|
||||
max-width: 20px;
|
||||
}
|
||||
#list-slider li {
|
||||
cursor: move;
|
||||
}
|
||||
.list-link-block {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
.list-link-block > li {
|
||||
background-color: #f5f5f5;
|
||||
display: inline-block;
|
||||
padding: 10px 0;
|
||||
width: 100%;
|
||||
}
|
||||
.list-link-block > li .btn-remove-block-link {
|
||||
display: block;
|
||||
}
|
||||
.list-link-block > li:hover .btn-remove-block-link {
|
||||
display: block;
|
||||
}
|
||||
.link_group{
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.link_group .form-group{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.form-group.link_group{
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.link_group > .form-group:first-child{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.link_group > .form-group .form-group{
|
||||
margin-bottom:0px;
|
||||
}
|
||||
.link_group > .form-group:last-child{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.latest-blog-category {
|
||||
background-color: #fefefe;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.latest-blog-category ol, .latest-blog-category li {
|
||||
list-style-type: none;
|
||||
}
|
||||
.list-font-awesome {
|
||||
clear: both;
|
||||
margin: 10px 0 !important;
|
||||
padding: 0;
|
||||
}
|
||||
.list-font-awesome > li, .preview-widget {
|
||||
border: 1px solid #bdbdbd;
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
list-style-type: none;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
width: 30px;
|
||||
}
|
||||
.list-font-awesome .selected, .list-font-awesome > li:hover {
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
transition: all 0.3s ease 0s;
|
||||
}
|
||||
.preview-widget {
|
||||
|
||||
}
|
||||
.dropdown-menu-right .selected {
|
||||
background-color: #bdbdbd;
|
||||
}
|
||||
#s-image{margin: 10px 0;}
|
||||
.open-content i{
|
||||
margin-left:7px;
|
||||
}
|
||||
span.open-content {
|
||||
cursor : pointer;
|
||||
}
|
||||
.row-actived>a{
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.product-container .row-preactive, .element-list .btn-add-column{
|
||||
display: none;
|
||||
}
|
||||
.adminappagebuilderdetails #home_wrapper {
|
||||
margin: 20px auto;
|
||||
}
|
||||
.adminappagebuilderdetails .gridLeft-block-content{
|
||||
min-height: 300px;
|
||||
height: auto;
|
||||
overflow: auto;
|
||||
}
|
||||
.adminappagebuilderdetails .column-action a{
|
||||
color: #ededed
|
||||
}
|
||||
/*
|
||||
.adminappagebuilderdetails .column-row .cover-column{
|
||||
margin-right: -5px;
|
||||
margin-left: -5px;
|
||||
}
|
||||
*/
|
||||
.adminappagebuilderdetails .cover-column{
|
||||
|
||||
}
|
||||
.adminappagebuilderdetails .column-row .content{
|
||||
/*
|
||||
padding: 20px;
|
||||
*/
|
||||
padding: 30px 10px 10px 10px;
|
||||
}
|
||||
.adminappagebuilderdetails .plist-eremove{
|
||||
color: red
|
||||
}
|
||||
|
||||
|
||||
#product-demo-sample{
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
#product-demo-sample .item-demo{
|
||||
margin: 10px 0;
|
||||
}
|
||||
#product-demo-sample .item-demo .block-image{
|
||||
height: 290px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
border: 1px solid #c9ccd3;
|
||||
}
|
||||
#product-demo-sample .item-demo .block-image::before{
|
||||
content: '';
|
||||
position: absolute;
|
||||
z-index: 8;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
opacity: 0;
|
||||
background: #00000082;
|
||||
-moz-transition: all 0.3s ease;
|
||||
-o-transition: all 0.3s ease;
|
||||
-ms-transition: all 0.3s ease;
|
||||
-webkit-transition: all 0.3s ease;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
#product-demo-sample .item-demo .block-image img{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
right: 0px
|
||||
z-index: 7;
|
||||
}
|
||||
#product-demo-sample .item-demo .block-image a{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
z-index: 9;
|
||||
font-size: 13px;
|
||||
padding: 5px 10px;
|
||||
opacity: 0;
|
||||
-moz-transform: translate(-50%,-50%);
|
||||
-o-transform: translate(-50%,-50%);
|
||||
-ms-transform: translate(-50%,-50%);
|
||||
-webkit-transform: translate(-50%,-50%);
|
||||
transform: translate(-50%,-50%);
|
||||
-moz-transition: all 0.3s ease;
|
||||
-o-transition: all 0.3s ease;
|
||||
-ms-transition: all 0.3s ease;
|
||||
-webkit-transition: all 0.3s ease;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
#product-demo-sample .item-demo .block-image:hover a,
|
||||
#product-demo-sample .item-demo .block-image:hover:before{
|
||||
opacity: 1;
|
||||
}
|
||||
#product-demo-sample .item-demo .block-name{
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
background-color: #4D576E;
|
||||
color: #fff;
|
||||
padding: 10px;
|
||||
border-bottom: solid 1px #fff;
|
||||
border-radius: 0 0 5px 5px;
|
||||
}
|
||||
|
||||
|
||||
@media (min-width: 575px) and (max-width: 991px){
|
||||
#product-demo-sample > [class*="col-"]:nth-child(2n + 1){
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
@media (min-width: 992px) and (max-width: 1199px){
|
||||
#product-demo-sample > [class*="col-"]:nth-child(3n + 1){
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1200px) and (max-width: 1399px){
|
||||
#product-demo-sample > [class*="col-"]:nth-child(4n + 1){
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1400px) and (max-width: 1699px){
|
||||
#product-demo-sample > [class*="col-"]{
|
||||
width: 20%;
|
||||
}
|
||||
#product-demo-sample > [class*="col-"]:nth-child(5n + 1){
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1700px){
|
||||
#product-demo-sample > [class*="col-"]{
|
||||
width: 16.66667%;
|
||||
}
|
||||
#product-demo-sample > [class*="col-"]:nth-child(6n + 1){
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
@media(max-width: 576px){
|
||||
#product-demo-sample > [class*="col-"]{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.aprow_rtl button{
|
||||
min-width: 200px !important;
|
||||
text-align: left !important;
|
||||
padding-left: 10px !important;
|
||||
}
|
||||
#modal_form .modal-dialog {
|
||||
width: 1200px;
|
||||
}
|
||||
#modal_form .modal-lg {
|
||||
width: 1200px;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
.t_span4 {
|
||||
padding-left: 0 !important;
|
||||
padding-right: 20px !important;
|
||||
}
|
||||
.form-group.aprow_font_option{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.t_span4 .title-item {
|
||||
font-size: 1.3em;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
.t_span4.col-lg-4 {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.t-help-block{
|
||||
color: #959595;
|
||||
}
|
||||
.t-group-attr{
|
||||
color: #333 !important;
|
||||
font-size: 1.4em !important;
|
||||
font-weight: 600 !important;
|
||||
line-height: 1.4em !important;
|
||||
margin-bottom: 10px !important;
|
||||
margin-left: 0 !important;
|
||||
margin-right: 0 !important;
|
||||
margin-top: 10px !important;
|
||||
}
|
||||
.t-group-attr-h3{
|
||||
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
float: left;
|
||||
margin-right: 45px;
|
||||
padding: 10px 15px;
|
||||
font-size: 18px;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 0;
|
||||
font-weight: 300;
|
||||
margin: 0;
|
||||
}
|
||||
#modal_form .modal-dialog{
|
||||
width: 900px;
|
||||
}
|
||||
#modal_form .modal-backdrop.fade.in
|
||||
{
|
||||
opacity: .5;
|
||||
}
|
||||
#modal_form .modal-dialog{
|
||||
z-index: 1050;
|
||||
}
|
||||
|
||||
216
modules/appagebuilder/css/admin/style_hook_cpanel.css
Normal file
@@ -0,0 +1,216 @@
|
||||
.clearfix:before,.clearfix:after{content:".";display:block;height:0;overflow:hidden}.clearfix:after{clear:both}.clearfix{zoom:1}
|
||||
.leotheme-layout{
|
||||
background:#f2f2f2;
|
||||
width:800px;
|
||||
margin:10 auto;padding:14px
|
||||
}
|
||||
.leotheme-layout > div, .leotheme-layout > div div{
|
||||
position:relative;
|
||||
}
|
||||
.leo-container{ background:#dcdcdc; margin:0px 0px; position:relative; }
|
||||
#leo-displaynav, #leo-header .topbar, #leo-menu, #leo-slideshow, #leo-displayTopColumn,#leo-bottom ,#leo-hfooter{
|
||||
min-height:40px;
|
||||
padding-top:26px;
|
||||
padding-bottom:9px;
|
||||
}
|
||||
|
||||
|
||||
#leo-content {
|
||||
clear:both;
|
||||
display:block;
|
||||
background:#dcdcdc
|
||||
}
|
||||
#leo-content #leo-left,#leo-content #leo-right{ width:25%;float:left; min-height:200px}
|
||||
#leo-content .leo-container,#leo-hheaderright {margin:0; padding-top:26px; padding-bottom:9px }
|
||||
#leo-center{
|
||||
background: #dcdcdc;
|
||||
|
||||
float: left;
|
||||
min-height: 200px;
|
||||
width: 50%;
|
||||
}
|
||||
#leo-center .leo-container{
|
||||
border-left: 1px solid #CCCCCC;
|
||||
border-right: 1px solid #CCCCCC;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
#leologo{ width:18%;float:left; min-height:60px}
|
||||
#leo-hheaderright{
|
||||
display:block;
|
||||
float:right;
|
||||
width:80%;
|
||||
min-height:60px;
|
||||
}
|
||||
.placeholder{
|
||||
background:#FFFFBB;
|
||||
}
|
||||
.module-pos{
|
||||
max-width:299px;
|
||||
margin:6px;
|
||||
margin-left: 12px;
|
||||
cursor:move;
|
||||
}
|
||||
.leo-editmodule{
|
||||
background:#FFF;
|
||||
|
||||
padding:5px 8px;
|
||||
border:solid 1px #CCC;
|
||||
font-size:10px;
|
||||
}
|
||||
.leo-editmodule img{width:14px}
|
||||
.leo-container > div{
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.module-pos .editmod{
|
||||
background: url(../../img/admin/edit.png) no-repeat center center #DFF0D8;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 3px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
#leo-page .pos{
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
left: 0;
|
||||
padding: 4px 12px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
background:#FFF;
|
||||
z-index:10
|
||||
}
|
||||
.leotheme-layout{
|
||||
width:72%;
|
||||
float:left
|
||||
}
|
||||
.holdposition{
|
||||
width:28%;
|
||||
float:left;
|
||||
min-height:600px;
|
||||
background:#e1e1e1;
|
||||
padding-top:24px;
|
||||
margin-top:14px
|
||||
}
|
||||
#overidehook{
|
||||
background:#EEE;
|
||||
padding:12px;
|
||||
position:absolute;
|
||||
z-index:99;
|
||||
-webkit-box-shadow: 0 1px 2px #000;
|
||||
-moz-box-shadow: 0 1px 2px #000;
|
||||
box-shadow:0 1px 2px #000;
|
||||
border:solid 1px #666
|
||||
}
|
||||
#overidehook #oh-close{
|
||||
font-size:10px; font-weight:bold;
|
||||
cursor:hand; cursor:pointer
|
||||
}
|
||||
#leo-copyright{
|
||||
float:left;
|
||||
width:50%;
|
||||
margin-top:40px
|
||||
}
|
||||
#leo-footnav{
|
||||
min-height:50px;
|
||||
padding-top:24px;
|
||||
float:right;
|
||||
width:48%
|
||||
}
|
||||
#leo-footer-buider{
|
||||
|
||||
background:#DCDCDC;
|
||||
padding: 12px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
text-align: center
|
||||
|
||||
}
|
||||
.form-fonts .group-fields{
|
||||
border: solid 1px #EBEDF4;
|
||||
margin-bottom: 12px;
|
||||
padding: 12px;
|
||||
}
|
||||
.help-context-adminmodules{
|
||||
display: none!important;
|
||||
}
|
||||
.process-icon-liveedit{
|
||||
background-image: url("../../img/admin/live-edit.png");
|
||||
}
|
||||
.process-icon-livethemeeditor {
|
||||
background-image: url("../../img/admin/theme-editor.png");
|
||||
}
|
||||
.process-icon-controlpanel {
|
||||
background-image: url("../../img/admin/control-panel.png");
|
||||
}
|
||||
.note, #leo-page .note ul li{
|
||||
font-size:10px; font-weight:normal;
|
||||
}
|
||||
|
||||
.vtab-mode > ul{
|
||||
display: block;
|
||||
width: 220px;
|
||||
float: left;
|
||||
|
||||
}
|
||||
.vtab-mode > ul li {
|
||||
background: #bdc3c7;
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding:10px 0;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
.vtab-mode > ul li a{ padding: 12px; color: #FFF }
|
||||
.vtab-mode > ul li.active{ background:#7f8c8d; }
|
||||
.vtab-mode > div{
|
||||
overflow: hidden;
|
||||
border: #f3f3f3 solid 1px;
|
||||
padding: 12px;
|
||||
margin:12px 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
h2{ color: #F0776C; font-size: 18px }
|
||||
h3 b{ color:#20AAE5; text-transform: uppercase;}
|
||||
.custom-form .toolbarBox .pageTitle h3{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.custom-form .ui-widget-header{
|
||||
background: none;
|
||||
border: none;
|
||||
margin-top: -39px;
|
||||
}
|
||||
.custom-form fieldset{ border: none; }
|
||||
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited{
|
||||
background-image:none;
|
||||
}
|
||||
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active{
|
||||
border-color: #E6E6E6
|
||||
}
|
||||
.ui-tabs .ui-tabs-nav li a{
|
||||
padding:7px 28px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.ui-widget-content, .custom-form .toolbarBox {
|
||||
border-color: #E6E6E6
|
||||
}
|
||||
.inner li {
|
||||
line-height:18px;
|
||||
}
|
||||
#leo-form-setting { margin-top: 60px; font-size: 13px }
|
||||
#leo-form-setting label { font-size: 12px }
|
||||
#leo-form-setting .separation { border-collapse: #E6E6E6 }
|
||||
#leo-form-setting .inner {padding: 12px }
|
||||
#themecontrol-form, #themecontrol-form label, #themecontrol-form input, #themecontrol-form textarea {
|
||||
font-size:12px;
|
||||
}
|
||||
|
||||
.leo_top_25{
|
||||
margin-top: 25px;
|
||||
}
|
||||
209
modules/appagebuilder/css/admin/themeeditor.css
Normal file
@@ -0,0 +1,209 @@
|
||||
.adminappagebuilderthemeeditor #header,.adminappagebuilderthemeeditor #footer,.adminappagebuilderthemeeditor #nav-sidebar,.adminappagebuilderthemeeditor .page-head{
|
||||
display: none;
|
||||
}
|
||||
|
||||
html,body,#content,#livethemeeditor{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.off-customize #main-preview{
|
||||
margin-left: 0
|
||||
}
|
||||
.off-customize #leo-customize span{margin-left: 22px}
|
||||
.off-customize #leo-customize .btn-show{
|
||||
right: -56px;
|
||||
transition:all 0.2s;
|
||||
}
|
||||
.page-wrapper{
|
||||
margin-left:300px;
|
||||
}
|
||||
.off-customize #leo-customize{
|
||||
left: -330px;
|
||||
}
|
||||
|
||||
#customize-form{
|
||||
position: relative;
|
||||
}
|
||||
#main-preview {
|
||||
bottom: 0;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
margin-left: 300px;
|
||||
transition-duration: 0.2s;
|
||||
transition-property: left, right, top, bottom, width, margin;
|
||||
}
|
||||
#main-preview iframe, #top_container, #container, #main,#content, body {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
}
|
||||
.colorpicker{
|
||||
z-index: 9999
|
||||
}
|
||||
#leo-customize{
|
||||
width: 320px;
|
||||
|
||||
position:absolute;
|
||||
top: 0;
|
||||
left:0px;
|
||||
|
||||
z-index: 3;
|
||||
box-shadow: 0 1px 3px #999;
|
||||
transition-duration: 0.2s;
|
||||
transition-property: left, right, top, bottom, width, margin;
|
||||
background: none repeat scroll 0 0 #fff;
|
||||
border-right: 1px solid rgba(0, 0, 0, 0.2);
|
||||
|
||||
}
|
||||
|
||||
#leo-customize .wrapper{
|
||||
|
||||
padding: 12px;
|
||||
}
|
||||
#customize-body input[type="text"]{
|
||||
line-height: 18px;
|
||||
margin: 0;
|
||||
width: 50px;
|
||||
color: #FFF;
|
||||
font-size: 11px;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #DFDFDF;
|
||||
padding: 3px 5px;
|
||||
margin-right: 6px;
|
||||
display: inline-block;
|
||||
}
|
||||
.form-group {
|
||||
margin-right: 6px;
|
||||
}
|
||||
.form-group select{
|
||||
width: 100px
|
||||
}
|
||||
.accordion-inner .form-group .clear-bg{
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.accordion-group label, .form-group label{
|
||||
display: block;
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
}
|
||||
.accordion-group label{
|
||||
float: left;
|
||||
margin-right:7px;
|
||||
|
||||
font-weight: normal;
|
||||
}
|
||||
#leo-customize .btn{
|
||||
padding: 4px 12px;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
}
|
||||
#leo-customize .btn-show{
|
||||
position: absolute;
|
||||
top: 39px;
|
||||
padding:6px 18px;
|
||||
background:#CCC;
|
||||
right:11px;
|
||||
z-index: 99;
|
||||
transition:all 1.2s;
|
||||
cursor: hand;
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
#customize-body .nav-tabs, #customize-body .nav-tabs a{
|
||||
border:none;
|
||||
}
|
||||
#customize-body .nav-tabs a{
|
||||
background: transparent;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
}
|
||||
#customize-body .nav-tabs .active a{
|
||||
background: #FFF
|
||||
}
|
||||
.accordion-heading .accordion-toggle{
|
||||
font-weight: bold;
|
||||
font-family: arial;
|
||||
}
|
||||
.tab-content > .tab-pane, .pill-content > .pill-pane {
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
}
|
||||
.bi-wrapper > div{
|
||||
float: left;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: 3px 4px;
|
||||
border: solid 1px #999;
|
||||
cursor:hand; cursor:pointer;
|
||||
}
|
||||
.bi-wrapper > div.active{
|
||||
border-color:red;
|
||||
}
|
||||
|
||||
#content.bootstrap .panel, #content.bootstrap #dash_version, #content.bootstrap .message-item-initial .message-item-initial-body, #content.bootstrap .timeline .timeline-item .timeline-caption .timeline-panel {
|
||||
padding: 0;
|
||||
}
|
||||
#content.bootstrap h3:not(.modal-title), #content.bootstrap .panel-heading {
|
||||
margin: 0;
|
||||
text-transform: inherit;
|
||||
}
|
||||
#customize-body .tab-content {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#leo-customize .bootstrap .label-success {
|
||||
display: inline-block;
|
||||
width: 92px;
|
||||
}
|
||||
#customize-body .bootstrap .label {
|
||||
border-radius: 0;
|
||||
color: #FFFFFF;
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
vertical-align: baseline;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.page-sidebar #content {
|
||||
margin-left: 0;
|
||||
}
|
||||
.page-sidebar .bootstrap .row{float: left; width: 100%; height: 100%;}
|
||||
.page-sidebar .bootstrap .col-lg-12{width: 100%; height: 100%;}
|
||||
|
||||
.page-sidebar #content.bootstrap {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#main-preview .paneltool {
|
||||
display: none;
|
||||
}
|
||||
.page-sidebar #main-preview {
|
||||
margin-left: 320px;
|
||||
}
|
||||
.off-customize.page-sidebar #main-preview {
|
||||
margin-left:0;
|
||||
}
|
||||
|
||||
#content.bootstrap .panel,
|
||||
#content.bootstrap #dash_version,
|
||||
#content.bootstrap .message-item-initial .message-item-initial-body,
|
||||
#content.bootstrap .timeline .timeline-item .timeline-caption .timeline-panel {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
select.input-setting{margin-right: 0!important}
|
||||
.bg-config{padding: 8px 15px;margin-bottom: 20px; list-style: none;}
|
||||
.bg-config>li {
|
||||
display: inline-block;
|
||||
}
|
||||
3164
modules/appagebuilder/css/animate.css
vendored
Normal file
161
modules/appagebuilder/css/colorpicker/css/colorpicker.css
Normal file
@@ -0,0 +1,161 @@
|
||||
.colorpicker {
|
||||
width: 356px;
|
||||
height: 176px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
background: url(../images/colorpicker_background.png);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
display: none;
|
||||
}
|
||||
.colorpicker_color {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
left: 14px;
|
||||
top: 13px;
|
||||
position: absolute;
|
||||
background: #f00;
|
||||
overflow: hidden;
|
||||
cursor: crosshair;
|
||||
}
|
||||
.colorpicker_color div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
background: url(../images/colorpicker_overlay.png);
|
||||
}
|
||||
.colorpicker_color div div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
overflow: hidden;
|
||||
background: url(../images/colorpicker_select.gif);
|
||||
margin: -5px 0 0 -5px;
|
||||
}
|
||||
.colorpicker_hue {
|
||||
position: absolute;
|
||||
top: 13px;
|
||||
left: 171px;
|
||||
width: 35px;
|
||||
height: 150px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
.colorpicker_hue div {
|
||||
position: absolute;
|
||||
width: 35px;
|
||||
height: 9px;
|
||||
overflow: hidden;
|
||||
background: url(../images/colorpicker_indic.gif) left top;
|
||||
margin: -4px 0 0 0;
|
||||
left: 0px;
|
||||
}
|
||||
.colorpicker_new_color {
|
||||
position: absolute;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
left: 213px;
|
||||
top: 13px;
|
||||
background: #f00;
|
||||
}
|
||||
.colorpicker_current_color {
|
||||
position: absolute;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
left: 283px;
|
||||
top: 13px;
|
||||
background: #f00;
|
||||
}
|
||||
.colorpicker input {
|
||||
background-color: transparent;
|
||||
border: 1px solid transparent;
|
||||
position: absolute;
|
||||
font-size: 10px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #898989;
|
||||
top: 4px;
|
||||
right: 11px;
|
||||
text-align: right;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 11px;
|
||||
}
|
||||
.colorpicker_hex {
|
||||
position: absolute;
|
||||
width: 72px;
|
||||
height: 22px;
|
||||
background: url(../images/colorpicker_hex.png) top;
|
||||
left: 212px;
|
||||
top: 142px;
|
||||
}
|
||||
.colorpicker_hex input {
|
||||
right: 6px;
|
||||
}
|
||||
.colorpicker_field {
|
||||
height: 22px;
|
||||
width: 62px;
|
||||
background-position: top;
|
||||
position: absolute;
|
||||
}
|
||||
.colorpicker_field span {
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
height: 22px;
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
right: 0;
|
||||
cursor: n-resize;
|
||||
}
|
||||
.colorpicker_rgb_r {
|
||||
background-image: url(../images/colorpicker_rgb_r.png);
|
||||
top: 52px;
|
||||
left: 212px;
|
||||
}
|
||||
.colorpicker_rgb_g {
|
||||
background-image: url(../images/colorpicker_rgb_g.png);
|
||||
top: 82px;
|
||||
left: 212px;
|
||||
}
|
||||
.colorpicker_rgb_b {
|
||||
background-image: url(../images/colorpicker_rgb_b.png);
|
||||
top: 112px;
|
||||
left: 212px;
|
||||
}
|
||||
.colorpicker_hsb_h {
|
||||
background-image: url(../images/colorpicker_hsb_h.png);
|
||||
top: 52px;
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_hsb_s {
|
||||
background-image: url(../images/colorpicker_hsb_s.png);
|
||||
top: 82px;
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_hsb_b {
|
||||
background-image: url(../images/colorpicker_hsb_b.png);
|
||||
top: 112px;
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_submit {
|
||||
position: absolute;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
background: url(../images/colorpicker_submit.png) top;
|
||||
left: 322px;
|
||||
top: 142px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.colorpicker_focus {
|
||||
background-position: center;
|
||||
}
|
||||
.colorpicker_hex.colorpicker_focus {
|
||||
background-position: bottom;
|
||||
}
|
||||
.colorpicker_submit.colorpicker_focus {
|
||||
background-position: bottom;
|
||||
}
|
||||
.colorpicker_slider {
|
||||
background-position: bottom;
|
||||
}
|
||||
35
modules/appagebuilder/css/colorpicker/css/index.php
Normal 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;
|
||||
218
modules/appagebuilder/css/colorpicker/css/layout.css
Normal file
@@ -0,0 +1,218 @@
|
||||
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
table {
|
||||
border-collapse:collapse;
|
||||
border-spacing:0;
|
||||
}
|
||||
fieldset,img {
|
||||
border:0;
|
||||
}
|
||||
address,caption,cite,code,dfn,em,strong,th,var {
|
||||
font-style:normal;
|
||||
font-weight:normal;
|
||||
}
|
||||
ol,ul {
|
||||
list-style:none;
|
||||
}
|
||||
caption,th {
|
||||
text-align:left;
|
||||
}
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
font-size:100%;
|
||||
font-weight:normal;
|
||||
}
|
||||
q:before,q:after {
|
||||
content:'';
|
||||
}
|
||||
abbr,acronym { border:0;
|
||||
}
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #52697E;
|
||||
}
|
||||
body {
|
||||
text-align: center;
|
||||
overflow: auto;
|
||||
}
|
||||
.wrapper {
|
||||
width: 700px;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
}
|
||||
h1 {
|
||||
font-size: 21px;
|
||||
height: 47px;
|
||||
line-height: 47px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.navigationTabs {
|
||||
height: 23px;
|
||||
line-height: 23px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
.navigationTabs li {
|
||||
float: left;
|
||||
height: 23px;
|
||||
line-height: 23px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
.navigationTabs li a{
|
||||
float: left;
|
||||
dispaly: block;
|
||||
height: 23px;
|
||||
line-height: 23px;
|
||||
padding: 0 10px;
|
||||
overflow: hidden;
|
||||
color: #52697E;
|
||||
background-color: #eee;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
}
|
||||
.navigationTabs li a:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
.navigationTabs li a.active {
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-bottom: 0px solid;
|
||||
}
|
||||
.tabsContent {
|
||||
border: 1px solid #ccc;
|
||||
border-top: 0px solid;
|
||||
width: 698px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tab {
|
||||
padding: 16px;
|
||||
display: none;
|
||||
}
|
||||
.tab h2 {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
.tab h3 {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.tab p {
|
||||
margin-top: 16px;
|
||||
clear: both;
|
||||
}
|
||||
.tab ul {
|
||||
margin-top: 16px;
|
||||
list-style: disc;
|
||||
}
|
||||
.tab li {
|
||||
margin: 10px 0 0 35px;
|
||||
}
|
||||
.tab a {
|
||||
color: #8FB0CF;
|
||||
}
|
||||
.tab strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
.tab pre {
|
||||
font-size: 11px;
|
||||
margin-top: 20px;
|
||||
width: 668px;
|
||||
overflow: auto;
|
||||
clear: both;
|
||||
}
|
||||
.tab table {
|
||||
width: 100%;
|
||||
}
|
||||
.tab table td {
|
||||
padding: 6px 10px 6px 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
.tab dt {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
#colorSelector {
|
||||
position: relative;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background: url(../images/select.png);
|
||||
}
|
||||
#colorSelector div {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 3px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background: url(../images/select.png) center;
|
||||
}
|
||||
#colorSelector2 {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background: url(../images/select2.png);
|
||||
}
|
||||
#colorSelector2 div {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
left: 4px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background: url(../images/select2.png) center;
|
||||
}
|
||||
#colorpickerHolder2 {
|
||||
top: 32px;
|
||||
left: 0;
|
||||
width: 356px;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker {
|
||||
background-image: url(../images/custom_background.png);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker_hue div {
|
||||
background-image: url(../images/custom_indic.gif);
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker_hex {
|
||||
background-image: url(../images/custom_hex.png);
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker_rgb_r {
|
||||
background-image: url(../images/custom_rgb_r.png);
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker_rgb_g {
|
||||
background-image: url(../images/custom_rgb_g.png);
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker_rgb_b {
|
||||
background-image: url(../images/custom_rgb_b.png);
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker_hsb_s {
|
||||
background-image: url(../images/custom_hsb_s.png);
|
||||
display: none;
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker_hsb_h {
|
||||
background-image: url(../images/custom_hsb_h.png);
|
||||
display: none;
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker_hsb_b {
|
||||
background-image: url(../images/custom_hsb_b.png);
|
||||
display: none;
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker_submit {
|
||||
background-image: url(../images/custom_submit.png);
|
||||
}
|
||||
#colorpickerHolder2 .colorpicker input {
|
||||
color: #778398;
|
||||
}
|
||||
#customWidget {
|
||||
position: relative;
|
||||
height: 36px;
|
||||
}
|
||||
BIN
modules/appagebuilder/css/colorpicker/images/blank.gif
Normal file
|
After Width: | Height: | Size: 49 B |
|
After Width: | Height: | Size: 1.9 KiB |
BIN
modules/appagebuilder/css/colorpicker/images/colorpicker_hex.png
Normal file
|
After Width: | Height: | Size: 532 B |
|
After Width: | Height: | Size: 970 B |
|
After Width: | Height: | Size: 1012 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 86 B |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 970 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 984 B |
|
After Width: | Height: | Size: 1.9 KiB |