first commit
This commit is contained in:
12
modules/.htaccess
Normal file
12
modules/.htaccess
Normal file
@@ -0,0 +1,12 @@
|
||||
<FilesMatch "\.tpl$">
|
||||
# Apache 2.2
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
</IfModule>
|
||||
|
||||
# Apache 2.4
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
449
modules/aapfree/aapfree.php
Normal file
449
modules/aapfree/aapfree.php
Normal file
@@ -0,0 +1,449 @@
|
||||
<?php
|
||||
/**
|
||||
* PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-)
|
||||
*
|
||||
* @author VEKIA https://www.prestashop.com/forums/user/132608-vekia/
|
||||
* @copyright 2010-2021 VEKIA
|
||||
* @license This program is not free software and you can't resell and redistribute it
|
||||
*
|
||||
* CONTACT WITH DEVELOPER http://mypresta.eu
|
||||
* support@mypresta.eu
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class aapfree extends Module
|
||||
{
|
||||
private $_html = '';
|
||||
private $_postErrors = array();
|
||||
public $context;
|
||||
|
||||
function __construct($dontTranslate = false)
|
||||
{
|
||||
$this->name = 'aapfree';
|
||||
$this->version = '1.3.3';
|
||||
$this->author = 'MyPresta.eu';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->mypresta_link = 'https://mypresta.eu/modules/front-office-features/ask-about-product-free.html';
|
||||
$this->need_instance = 0;
|
||||
$this->bootstrap = 1;
|
||||
$this->secure_key = Tools::encrypt($this->name);
|
||||
|
||||
parent::__construct();
|
||||
|
||||
if (!$dontTranslate) {
|
||||
$this->displayName = $this->l('Ask about product free');
|
||||
$this->description = $this->l('Free module that gives possibility to send questions about products');
|
||||
}
|
||||
$this->ps_versions_compliancy = array(
|
||||
'min' => '1.7',
|
||||
'max' => '2.0'
|
||||
);
|
||||
$this->checkforupdates(0, 0);
|
||||
}
|
||||
|
||||
public function hookactionAdminControllerSetMedia($params)
|
||||
{
|
||||
//for update feature purposes
|
||||
}
|
||||
|
||||
public function checkforupdates($display_msg = 0, $form = 0)
|
||||
{
|
||||
// ---------- //
|
||||
// ---------- //
|
||||
// VERSION 16 //
|
||||
// ---------- //
|
||||
// ---------- //
|
||||
$this->mkey = "nlc";
|
||||
if (@file_exists('../modules/' . $this->name . '/key.php')) {
|
||||
@require_once('../modules/' . $this->name . '/key.php');
|
||||
} else {
|
||||
if (@file_exists(dirname(__FILE__) . $this->name . '/key.php')) {
|
||||
@require_once(dirname(__FILE__) . $this->name . '/key.php');
|
||||
} else {
|
||||
if (@file_exists('modules/' . $this->name . '/key.php')) {
|
||||
@require_once('modules/' . $this->name . '/key.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($form == 1) {
|
||||
return '
|
||||
<div class="panel" id="fieldset_myprestaupdates" style="margin-top:20px;">
|
||||
' . ($this->psversion() == 6 || $this->psversion() == 7 ? '<div class="panel-heading"><i class="icon-wrench"></i> ' . $this->l('MyPresta updates') . '</div>' : '') . '
|
||||
<div class="form-wrapper" style="padding:0px!important;">
|
||||
<div id="module_block_settings">
|
||||
<fieldset id="fieldset_module_block_settings">
|
||||
' . ($this->psversion() == 5 ? '<legend style="">' . $this->l('MyPresta updates') . '</legend>' : '') . '
|
||||
<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">
|
||||
<label>' . $this->l('Check updates') . '</label>
|
||||
<div class="margin-form">' . (Tools::isSubmit('submit_settings_updates_now') ? ($this->inconsistency(0) ? '' : '') . $this->checkforupdates(1) : '') . '
|
||||
<button style="margin: 0px; top: -3px; position: relative;" type="submit" name="submit_settings_updates_now" class="button btn btn-default" />
|
||||
<i class="process-icon-update"></i>
|
||||
' . $this->l('Check now') . '
|
||||
</button>
|
||||
</div>
|
||||
<label>' . $this->l('Updates notifications') . '</label>
|
||||
<div class="margin-form">
|
||||
<select name="mypresta_updates">
|
||||
<option value="-">' . $this->l('-- select --') . '</option>
|
||||
<option value="1" ' . ((int)(Configuration::get('mypresta_updates') == 1) ? 'selected="selected"' : '') . '>' . $this->l('Enable') . '</option>
|
||||
<option value="0" ' . ((int)(Configuration::get('mypresta_updates') == 0) ? 'selected="selected"' : '') . '>' . $this->l('Disable') . '</option>
|
||||
</select>
|
||||
<p class="clear">' . $this->l('Turn this option on if you want to check MyPresta.eu for module updates automatically. This option will display notification about new versions of this addon.') . '</p>
|
||||
</div>
|
||||
<label>' . $this->l('Module page') . '</label>
|
||||
<div class="margin-form">
|
||||
<a style="font-size:14px;" href="' . $this->mypresta_link . '" target="_blank">' . $this->displayName . '</a>
|
||||
<p class="clear">' . $this->l('This is direct link to official addon page, where you can read about changes in the module (changelog)') . '</p>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<button type="submit" name="submit_settings_updates"class="button btn btn-default pull-right" />
|
||||
<i class="process-icon-save"></i>
|
||||
' . $this->l('Save') . '
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
<style>
|
||||
#fieldset_myprestaupdates {
|
||||
display:block;clear:both;
|
||||
float:inherit!important;
|
||||
}
|
||||
</style>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
} else {
|
||||
if (defined('_PS_ADMIN_DIR_')) {
|
||||
if (Tools::isSubmit('submit_settings_updates')) {
|
||||
Configuration::updateValue('mypresta_updates', Tools::getValue('mypresta_updates'));
|
||||
}
|
||||
if (Configuration::get('mypresta_updates') != 0 || (bool)Configuration::get('mypresta_updates') != false) {
|
||||
if (Configuration::get('update_' . $this->name) < (date("U") - 259200)) {
|
||||
$actual_version = aapfreeUpdate::verify($this->name, (isset($this->mkey) ? $this->mkey : 'nokey'), $this->version);
|
||||
}
|
||||
if (aapfreeUpdate::version($this->version) < aapfreeUpdate::version(Configuration::get('updatev_' . $this->name)) && Tools::getValue('ajax', 'false') == 'false') {
|
||||
$this->context->controller->warnings[] = '<strong>' . $this->displayName . '</strong>: ' . $this->l('New version available, check http://MyPresta.eu for more informations') . ' <a href="' . $this->mypresta_link . '">' . $this->l('More details in changelog') . '</a>';
|
||||
$this->warning = $this->context->controller->warnings[0];
|
||||
}
|
||||
} else {
|
||||
if (Configuration::get('update_' . $this->name) < (date("U") - 259200)) {
|
||||
$actual_version = aapfreeUpdate::verify($this->name, (isset($this->mkey) ? $this->mkey : 'nokey'), $this->version);
|
||||
}
|
||||
}
|
||||
if ($display_msg == 1) {
|
||||
if (aapfreeUpdate::version($this->version) < aapfreeUpdate::version(aapfreeUpdate::verify($this->name, (isset($this->mkey) ? $this->mkey : 'nokey'), $this->version))) {
|
||||
return "<span style='color:red; font-weight:bold; font-size:16px; margin-right:10px;'>" . $this->l('New version available!') . "</span>";
|
||||
} else {
|
||||
return "<span style='color:green; font-weight:bold; font-size:16px; margin-right:10px;'>" . $this->l('Module is up to date!') . "</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function inconsistency($ret = false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
return (parent::install() &&
|
||||
$this->registerHook('displayProductAdditionalInfo') &&
|
||||
$this->registerHook('actionAdminControllerSetMedia') &&
|
||||
$this->installMailTranslation() &&
|
||||
$this->registerHook('displayHeader'));
|
||||
}
|
||||
|
||||
function installMailTranslation()
|
||||
{
|
||||
$title = array();
|
||||
foreach (Language::getLanguages(true) AS $value) {
|
||||
$title[$value['id_lang']] = 'New inquiry from %1$s about %2$s';
|
||||
}
|
||||
Configuration::updateValue('aapfree_TITLE', $title);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
return (parent::uninstall());
|
||||
}
|
||||
|
||||
public function hookdisplayProductAdditionalInfo($params)
|
||||
{
|
||||
if (Tools::getValue('controller') == 'product' && Tools::getValue('action') == 'quickview') {
|
||||
return;
|
||||
}
|
||||
/* Product informations */
|
||||
$product = new Product((int)Tools::getValue('id_product'), false, $this->context->language->id);
|
||||
$image = Product::getCover((int)$product->id);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'aapfree_link' => $this->context->link,
|
||||
'aapfree_product' => $product,
|
||||
'aapfree_product_cover' => (int)$product->id . '-' . (int)$image['id_image'],
|
||||
'aapfree_GDPR' => (int)Configuration::get('aapfree_GDPR'),
|
||||
'aapfree_GDPRCMS' => (int)Configuration::get('aapfree_GDPRCMS'),
|
||||
'aapfree_SUMMARY' => (int)Configuration::get('aapfree_SUMMARY'),
|
||||
));
|
||||
|
||||
return $this->display(__FILE__, 'views/aapfree-extra.tpl');
|
||||
}
|
||||
|
||||
public function hookdisplayHeader($params)
|
||||
{
|
||||
$this->page_name = Dispatcher::getInstance()->getController();
|
||||
if ($this->page_name == 'product') {
|
||||
$this->context->controller->addCSS($this->_path . 'views/aapfree.css', 'all');
|
||||
$this->context->controller->addJS($this->_path . 'views/aapfree.js');
|
||||
$this->context->controller->addJqueryPlugin('fancybox');
|
||||
Media::addJsDef(array(
|
||||
'aapfree_frontcontroller' => $this->context->link->getModuleLink('aapfree', 'question', array('submitQuestion' => 1)),
|
||||
'aapfree_confirmation' => $this->l('Your e-mail has been sent successfully'),
|
||||
'aapfree_problem' => $this->l('Your e-mail could not be sent. Please check the name and e-mail address and try again.'),
|
||||
'aapfree_title' => $this->l('Question about product'),
|
||||
'aapfree_id_lang' => Context::getContext()->language->id,
|
||||
'aapfree_missingFields' => $this->l('You did not fill required fields'),
|
||||
'aapfree_aapfree_GDPR' => (int)Configuration::get('aapfree_GDPR'),
|
||||
'aapfree_secureKey' => $this->secure_key
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public function _postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitSettings')) {
|
||||
Configuration::updateValue('aapfree_SUMMARY', (int)Tools::getValue('aapfree_SUMMARY'));
|
||||
Configuration::updateValue('aapfree_GDPRCMS', (int)Tools::getValue('aapfree_GDPRCMS'));
|
||||
Configuration::updateValue('aapfree_GDPR', (int)Tools::getValue('aapfree_GDPR'));
|
||||
|
||||
$title = array();
|
||||
foreach (Language::getLanguages(true) AS $value) {
|
||||
$title[$value['id_lang']] = Tools::getValue('aapfree_TITLE_' . $value['id_lang']);
|
||||
}
|
||||
Configuration::updateValue('aapfree_TITLE', $title);
|
||||
|
||||
$this->context->controller->confirmations[] = $this->l('settings updated');
|
||||
}
|
||||
}
|
||||
|
||||
public function psversion($part = 1)
|
||||
{
|
||||
$version = _PS_VERSION_;
|
||||
$exp = $explode = explode(".", $version);
|
||||
if ($part == 1) {
|
||||
return $exp[1];
|
||||
}
|
||||
if ($part == 2) {
|
||||
return $exp[2];
|
||||
}
|
||||
if ($part == 3) {
|
||||
return $exp[3];
|
||||
}
|
||||
if ($part == 4) {
|
||||
return $exp[3];
|
||||
}
|
||||
}
|
||||
|
||||
public function advert()
|
||||
{
|
||||
return '<div class="panel">
|
||||
<h3><i class="icon-wrench"></i> ' . $this->l('I am developing this module for free - if you want') . ' <a class="btn button label label-danger" target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7WE8PTH4ZPYZA">' . $this->l('send me a donation') . '</span></a></h3>
|
||||
<iframe src="//apps.facepages.eu/somestuff/whatsgoingon.html" width="100%" height="150" border="0" style="border:none;"></iframe>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$this->_postProcess();
|
||||
|
||||
return $this->advert() . $this->renderConfigForm() . $this->checkforupdates(0, 1);
|
||||
}
|
||||
|
||||
public function renderConfigForm()
|
||||
{
|
||||
$fields_form_1 = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Configuration'),
|
||||
'icon' => 'icon-cogs',
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'is_bool' => true,
|
||||
'label' => $this->l('Display product summary inside popup'),
|
||||
'desc' => $this->l('Product summary is a product short description'),
|
||||
'name' => 'aapfree_SUMMARY',
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled'),
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled'),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'is_bool' => true,
|
||||
'label' => $this->l('GDPR Compliant'),
|
||||
'name' => 'aapfree_GDPR',
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->l('Enabled'),
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->l('Disabled'),
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Privacy policy page'),
|
||||
'desc' => $this->l('Choose a CMS page with privacy policy details for GDPR purposes'),
|
||||
'name' => 'aapfree_GDPRCMS',
|
||||
'class' => 't',
|
||||
'options' => array(
|
||||
'query' => CMS::getCmsPages($this->context->language->id, null, false),
|
||||
'id' => 'id_cms',
|
||||
'name' => 'meta_title'
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Email title'),
|
||||
'name' => 'aapfree_TITLE',
|
||||
'lang' => true,
|
||||
'desc' => $this->l('Module will use this as a title of email that will be delivered to you (as a shop owner)') .
|
||||
'<br/>' .
|
||||
$this->l('%1$s - will be replaced with logged customer name') .
|
||||
'<br/>' .
|
||||
$this->l('%2$s - will be replaced with product name'),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-default pull-right',
|
||||
'name' => 'submitSettings',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->default_form_language = $this->context->language->id;
|
||||
$helper->module = $this;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$helper->submit_action = 'submitaapfreeConfiguration';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
|
||||
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
||||
$helper->tpl_vars = array(
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id,
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form_1));
|
||||
}
|
||||
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
$title = array();
|
||||
foreach (Language::getLanguages(true) AS $value) {
|
||||
$title[$value['id_lang']] = Configuration::get('aapfree_TITLE', $value['id_lang']);
|
||||
}
|
||||
|
||||
return array(
|
||||
'aapfree_SUMMARY' => Tools::getValue('aapfree_SUMMARY', Configuration::get('aapfree_SUMMARY')),
|
||||
'aapfree_GDPRCMS' => Tools::getValue('aapfree_GDPRCMS', Configuration::get('aapfree_GDPRCMS')),
|
||||
'aapfree_GDPR' => Tools::getValue('aapfree_GDPR', Configuration::get('aapfree_GDPR')),
|
||||
'aapfree_TITLE' => $title,
|
||||
);
|
||||
}
|
||||
|
||||
public function isValidName($name)
|
||||
{
|
||||
$isName = Validate::isName($name);
|
||||
$isShortName = $this->isShortName($name);
|
||||
$isNameLikeAnUrl = $this->isNameLikeAnUrl($name);
|
||||
$isValidName = $isName && $isShortName && !$isNameLikeAnUrl;
|
||||
|
||||
return $isValidName;
|
||||
}
|
||||
|
||||
public function isShortName($name)
|
||||
{
|
||||
$isShortName = (strlen($name) <= 50);
|
||||
|
||||
return $isShortName;
|
||||
}
|
||||
|
||||
public function isNameLikeAnUrl($name)
|
||||
{
|
||||
$regex = "/(https?:[\/]*.*)|([\.]*[[[:alnum:]]+\.[^ ]]*.*)/m";
|
||||
$isNameLikeAnUrl = (bool)preg_match_all($regex, $name);
|
||||
|
||||
return $isNameLikeAnUrl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class aapfreeUpdate extends aapfree
|
||||
{
|
||||
public static function _isCurl()
|
||||
{
|
||||
return function_exists('curl_version');
|
||||
}
|
||||
|
||||
public static function version($version)
|
||||
{
|
||||
$version = (int)str_replace(".", "", $version);
|
||||
if (strlen($version) == 3) {
|
||||
$version = (int)$version . "0";
|
||||
}
|
||||
if (strlen($version) == 2) {
|
||||
$version = (int)$version . "00";
|
||||
}
|
||||
if (strlen($version) == 1) {
|
||||
$version = (int)$version . "000";
|
||||
}
|
||||
if (strlen($version) == 0) {
|
||||
$version = (int)$version . "0000";
|
||||
}
|
||||
|
||||
return (int)$version;
|
||||
}
|
||||
|
||||
public static function verify($module, $key)
|
||||
{
|
||||
if (ini_get("allow_url_fopen")) {
|
||||
if (function_exists("file_get_contents")) {
|
||||
$actual_version = @file_get_contents('http://dev.mypresta.eu/update/get.php?module=' . $module . "&lic=$key&u=" . self::encrypt(_PS_BASE_URL_ . __PS_BASE_URI__));
|
||||
}
|
||||
}
|
||||
Configuration::updateValue("update_" . $module, date("U"));
|
||||
Configuration::updateValue("updatev_" . $module, $actual_version);
|
||||
|
||||
return $actual_version;
|
||||
}
|
||||
|
||||
public static function encrypt($string)
|
||||
{
|
||||
return base64_encode($string);
|
||||
}
|
||||
}
|
||||
12
modules/aapfree/config_pl.xml
Normal file
12
modules/aapfree/config_pl.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>aapfree</name>
|
||||
<displayName><![CDATA[Zapytaj o produkt]]></displayName>
|
||||
<version><![CDATA[1.3.3]]></version>
|
||||
<description><![CDATA[Darmowy moduł pozwalający przesyłać zapytania o produkt]]></description>
|
||||
<author><![CDATA[MyPresta.eu]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
35
modules/aapfree/controllers/front/index.php
Normal file
35
modules/aapfree/controllers/front/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
108
modules/aapfree/controllers/front/question.php
Normal file
108
modules/aapfree/controllers/front/question.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-)
|
||||
*
|
||||
* @author VEKIA https://www.prestashop.com/forums/user/132608-vekia/
|
||||
* @copyright 2010-2019 VEKIA
|
||||
* @license This program is not free software and you can't resell and redistribute it
|
||||
*
|
||||
* CONTACT WITH DEVELOPER http://mypresta.eu
|
||||
* support@mypresta.eu
|
||||
*/
|
||||
|
||||
include_once(dirname(__FILE__) . '../../../aapfree.php');
|
||||
|
||||
class aapfreequestionModuleFrontController extends ModuleFrontController
|
||||
{
|
||||
public function initContent()
|
||||
{
|
||||
if (Module::isEnabled('aapfree') && Tools::getValue('action') == 'sendQuestion' && Tools::getValue('secure_key') == $this->module->secure_key) {
|
||||
// Retrocompatibilty with old theme
|
||||
|
||||
$customerMail = Tools::getValue('email');
|
||||
$author = Tools::getValue('author');
|
||||
$phone = Tools::getValue('phone');
|
||||
$id_product = Tools::getValue('id_product');
|
||||
$question = Tools::getValue('question');
|
||||
|
||||
if (!$customerMail || !$id_product) {
|
||||
die('0');
|
||||
}
|
||||
|
||||
$isValidEmail = Validate::isEmail($customerMail);
|
||||
if (false === $isValidEmail) {
|
||||
die('0');
|
||||
}
|
||||
|
||||
|
||||
/** check if combination **/
|
||||
$combinations_array = array();
|
||||
$combination_id = 0;
|
||||
if (Tools::getValue('group', 'false') != 'false') {
|
||||
$groups = Tools::getValue('group');
|
||||
if (empty($groups)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$combination_id = (int)Product::getIdProductAttributeByIdAttributes(
|
||||
Tools::getValue('id_product'),
|
||||
$groups,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$combination_variable = '';
|
||||
$combination = '';
|
||||
if ($combination_id > 0) {
|
||||
$comb = new Combination($combination_id);
|
||||
if (is_object($comb)) {
|
||||
foreach ($comb->getAttributesName(Tools::getValue('id_lang')) AS $attr) {
|
||||
$attribute = new Attribute($attr['id_attribute'], Tools::getValue('id_lang'));
|
||||
$attribute_group = new AttributeGroup($attribute->id_attribute_group, Tools::getValue('id_lang'));
|
||||
$combinations_array[] = $attribute_group->public_name . ': ' . $attr['name'];
|
||||
}
|
||||
$combination_variable = implode(",", $combinations_array);
|
||||
$combination = '(' . implode(",", $combinations_array) . ')';
|
||||
}
|
||||
}
|
||||
|
||||
/* Email generation */
|
||||
$product = new Product((int)$id_product, false, Tools::getValue('id_lang'));
|
||||
$productLink = Context::getContext()->link->getProductLink($product);
|
||||
|
||||
$templateVars = array(
|
||||
'{product}' => $product->name . $combination,
|
||||
'{combination}' => $combination_variable,
|
||||
'{product_link}' => $productLink,
|
||||
'{productLink}' => $productLink,
|
||||
'{customer}' => $author,
|
||||
'{phone}' => $phone,
|
||||
'{customerMail}' => $customerMail,
|
||||
'{question}' => $question
|
||||
);
|
||||
|
||||
/* Email sending */
|
||||
if (!Mail::Send((int)Tools::getValue('id_lang'),
|
||||
'send_question',
|
||||
sprintf(Configuration::get('aapfree_TITLE', (int)Tools::getValue('id_lang')), $author, $product->name),
|
||||
$templateVars,
|
||||
Configuration::get('PS_SHOP_EMAIL'),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
dirname(__FILE__) . '/mails/',
|
||||
false,
|
||||
Context::getContext()->shop->id,
|
||||
null,
|
||||
$customerMail,
|
||||
$author
|
||||
)) {
|
||||
die('0');
|
||||
}
|
||||
die('1');
|
||||
}
|
||||
die('0');
|
||||
}
|
||||
}
|
||||
35
modules/aapfree/controllers/index.php
Normal file
35
modules/aapfree/controllers/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
35
modules/aapfree/index.php
Normal file
35
modules/aapfree/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
BIN
modules/aapfree/logo.gif
Normal file
BIN
modules/aapfree/logo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 377 B |
BIN
modules/aapfree/logo.png
Normal file
BIN
modules/aapfree/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
35
modules/aapfree/mails/cs/index.php
Normal file
35
modules/aapfree/mails/cs/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
195
modules/aapfree/mails/cs/send_question.html
Normal file
195
modules/aapfree/mails/cs/send_question.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px) {
|
||||
body {
|
||||
width: 218px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 195px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
span.title {
|
||||
font-size: 20px !important;
|
||||
line-height: 23px !important
|
||||
}
|
||||
|
||||
span.subtitle {
|
||||
font-size: 14px !important;
|
||||
line-height: 18px !important;
|
||||
padding-top: 10px !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td.box p {
|
||||
font-size: 12px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 293px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {
|
||||
width: 478px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 450px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail"
|
||||
style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi,</span><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
New inquiry about <a href="{productLink}" target="_blank"><strong>{product}</strong></a></p><br/>Phone: {phone}<br/>Email: {customerMail}<br/><br/>
|
||||
<blockquote>
|
||||
{question}
|
||||
</blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
7
modules/aapfree/mails/cs/send_question.txt
Normal file
7
modules/aapfree/mails/cs/send_question.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
[{shop_url}]
|
||||
|
||||
Hi,
|
||||
|
||||
New inquiry about {product} {productLink}
|
||||
----------------
|
||||
{question}
|
||||
35
modules/aapfree/mails/de/index.php
Normal file
35
modules/aapfree/mails/de/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
195
modules/aapfree/mails/de/send_question.html
Normal file
195
modules/aapfree/mails/de/send_question.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px) {
|
||||
body {
|
||||
width: 218px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 195px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
span.title {
|
||||
font-size: 20px !important;
|
||||
line-height: 23px !important
|
||||
}
|
||||
|
||||
span.subtitle {
|
||||
font-size: 14px !important;
|
||||
line-height: 18px !important;
|
||||
padding-top: 10px !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td.box p {
|
||||
font-size: 12px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 293px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {
|
||||
width: 478px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 450px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail"
|
||||
style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi,</span><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
New inquiry about <a href="{productLink}" target="_blank"><strong>{product}</strong></a></p><br/>Phone: {phone}<br/>Email: {customerMail}<br/><br/>
|
||||
<blockquote>
|
||||
{question}
|
||||
</blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
7
modules/aapfree/mails/de/send_question.txt
Normal file
7
modules/aapfree/mails/de/send_question.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
[{shop_url}]
|
||||
|
||||
Hi,
|
||||
|
||||
New inquiry about {product} {productLink}
|
||||
----------------
|
||||
{question}
|
||||
35
modules/aapfree/mails/en/index.php
Normal file
35
modules/aapfree/mails/en/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
195
modules/aapfree/mails/en/send_question.html
Normal file
195
modules/aapfree/mails/en/send_question.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px) {
|
||||
body {
|
||||
width: 218px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 195px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
span.title {
|
||||
font-size: 20px !important;
|
||||
line-height: 23px !important
|
||||
}
|
||||
|
||||
span.subtitle {
|
||||
font-size: 14px !important;
|
||||
line-height: 18px !important;
|
||||
padding-top: 10px !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td.box p {
|
||||
font-size: 12px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 293px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {
|
||||
width: 478px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 450px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail"
|
||||
style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi,</span><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
New inquiry about <a href="{productLink}" target="_blank"><strong>{product}</strong></a></p><br/>Phone: {phone}<br/>Email: {customerMail}<br/><br/>
|
||||
<blockquote>
|
||||
{question}
|
||||
</blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
7
modules/aapfree/mails/en/send_question.txt
Normal file
7
modules/aapfree/mails/en/send_question.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
[{shop_url}]
|
||||
|
||||
Hi,
|
||||
|
||||
New inquiry about {product} {productLink}
|
||||
----------------
|
||||
{question}
|
||||
35
modules/aapfree/mails/es/index.php
Normal file
35
modules/aapfree/mails/es/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
195
modules/aapfree/mails/es/send_question.html
Normal file
195
modules/aapfree/mails/es/send_question.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px) {
|
||||
body {
|
||||
width: 218px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 195px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
span.title {
|
||||
font-size: 20px !important;
|
||||
line-height: 23px !important
|
||||
}
|
||||
|
||||
span.subtitle {
|
||||
font-size: 14px !important;
|
||||
line-height: 18px !important;
|
||||
padding-top: 10px !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td.box p {
|
||||
font-size: 12px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 293px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {
|
||||
width: 478px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 450px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail"
|
||||
style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi,</span><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
New inquiry about <a href="{productLink}" target="_blank"><strong>{product}</strong></a></p><br/>Phone: {phone}<br/>Email: {customerMail}<br/><br/>
|
||||
<blockquote>
|
||||
{question}
|
||||
</blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
7
modules/aapfree/mails/es/send_question.txt
Normal file
7
modules/aapfree/mails/es/send_question.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
[{shop_url}]
|
||||
|
||||
Hi,
|
||||
|
||||
New inquiry about {product} {productLink}
|
||||
----------------
|
||||
{question}
|
||||
35
modules/aapfree/mails/fr/index.php
Normal file
35
modules/aapfree/mails/fr/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
195
modules/aapfree/mails/fr/send_question.html
Normal file
195
modules/aapfree/mails/fr/send_question.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px) {
|
||||
body {
|
||||
width: 218px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 195px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
span.title {
|
||||
font-size: 20px !important;
|
||||
line-height: 23px !important
|
||||
}
|
||||
|
||||
span.subtitle {
|
||||
font-size: 14px !important;
|
||||
line-height: 18px !important;
|
||||
padding-top: 10px !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td.box p {
|
||||
font-size: 12px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 293px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {
|
||||
width: 478px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 450px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail"
|
||||
style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi,</span><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
New inquiry about <a href="{productLink}" target="_blank"><strong>{product}</strong></a></p><br/>Phone: {phone}<br/>Email: {customerMail}<br/><br/>
|
||||
<blockquote>
|
||||
{question}
|
||||
</blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
7
modules/aapfree/mails/fr/send_question.txt
Normal file
7
modules/aapfree/mails/fr/send_question.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
[{shop_url}]
|
||||
|
||||
Hi,
|
||||
|
||||
New inquiry about {product} {productLink}
|
||||
----------------
|
||||
{question}
|
||||
35
modules/aapfree/mails/index.php
Normal file
35
modules/aapfree/mails/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
35
modules/aapfree/mails/it/index.php
Normal file
35
modules/aapfree/mails/it/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
195
modules/aapfree/mails/it/send_question.html
Normal file
195
modules/aapfree/mails/it/send_question.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px) {
|
||||
body {
|
||||
width: 218px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 195px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
span.title {
|
||||
font-size: 20px !important;
|
||||
line-height: 23px !important
|
||||
}
|
||||
|
||||
span.subtitle {
|
||||
font-size: 14px !important;
|
||||
line-height: 18px !important;
|
||||
padding-top: 10px !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td.box p {
|
||||
font-size: 12px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 293px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {
|
||||
width: 478px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 450px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail"
|
||||
style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi,</span><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
New inquiry about <a href="{productLink}" target="_blank"><strong>{product}</strong></a></p><br/>Phone: {phone}<br/>Email: {customerMail}<br/><br/>
|
||||
<blockquote>
|
||||
{question}
|
||||
</blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
7
modules/aapfree/mails/it/send_question.txt
Normal file
7
modules/aapfree/mails/it/send_question.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
[{shop_url}]
|
||||
|
||||
Hi,
|
||||
|
||||
New inquiry about {product} {productLink}
|
||||
{phone}----------------
|
||||
{question}
|
||||
35
modules/aapfree/mails/pl/index.php
Normal file
35
modules/aapfree/mails/pl/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
195
modules/aapfree/mails/pl/send_question.html
Normal file
195
modules/aapfree/mails/pl/send_question.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px) {
|
||||
body {
|
||||
width: 218px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 195px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
span.title {
|
||||
font-size: 20px !important;
|
||||
line-height: 23px !important
|
||||
}
|
||||
|
||||
span.subtitle {
|
||||
font-size: 14px !important;
|
||||
line-height: 18px !important;
|
||||
padding-top: 10px !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td.box p {
|
||||
font-size: 12px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 293px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {
|
||||
width: 478px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 450px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail"
|
||||
style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Witaj,</span><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
Nowe zapytanie o produkt <a href="{productLink}" target="_blank"><strong>{product}</strong></a></p><br/>Phone: {phone}<br/>Email: {customerMail}<br/><br/>
|
||||
<blockquote>
|
||||
{question}
|
||||
</blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
7
modules/aapfree/mails/pl/send_question.txt
Normal file
7
modules/aapfree/mails/pl/send_question.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
[{shop_url}]
|
||||
|
||||
Witaj
|
||||
|
||||
Nowe zapytanie o produkt {product} {productLink}
|
||||
{phone----------------
|
||||
{question}
|
||||
35
modules/aapfree/mails/pt/index.php
Normal file
35
modules/aapfree/mails/pt/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
195
modules/aapfree/mails/pt/send_question.html
Normal file
195
modules/aapfree/mails/pt/send_question.html
Normal file
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
||||
<title>Message from {shop_name}</title>
|
||||
|
||||
<style>
|
||||
/****** responsive ********/
|
||||
@media only screen and (max-width: 300px) {
|
||||
body {
|
||||
width: 218px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 195px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
span.title {
|
||||
font-size: 20px !important;
|
||||
line-height: 23px !important
|
||||
}
|
||||
|
||||
span.subtitle {
|
||||
font-size: 14px !important;
|
||||
line-height: 18px !important;
|
||||
padding-top: 10px !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
td.box p {
|
||||
font-size: 12px !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 301px) and (max-width: 500px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 293px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 501px) and (max-width: 768px) {
|
||||
body {
|
||||
width: 478px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 450px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile */
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
body {
|
||||
width: 308px !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 285px;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer {
|
||||
width: auto !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.table-recap {
|
||||
width: 285px !important;
|
||||
}
|
||||
|
||||
.table-recap tr td, .conf_body td {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.address {
|
||||
display: block !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.space_address {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body style="background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
|
||||
<table class="table table-mail"
|
||||
style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
|
||||
<tr>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
<td align="center" style="border:none;padding:7px 0">
|
||||
<table class="table" style="width:100%;background-color:#fff">
|
||||
<tr>
|
||||
<td align="center" class="logo" style="border-bottom:4px solid #333!important;border:none;padding:7px 0">
|
||||
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
|
||||
<img src="{shop_logo}" alt="{shop_name}"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" class="titleblock" style="border:none;padding:7px 0">
|
||||
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Hi,</span><br/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" style="background-color:#fbfbfb;border:1px solid #d6d4d4!important;padding:10px!important">
|
||||
<p style="margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;border-bottom:1px solid #d6d4d4!important;padding-bottom:10px">
|
||||
New inquiry about <a href="{productLink}" target="_blank"><strong>{product}</strong></a></p><br/>Phone: {phone}<br/>Email: {customerMail}<br/><br/>
|
||||
<blockquote>
|
||||
{question}
|
||||
</blockquote>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important;border:none"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer" style="border-top:4px solid #333!important;border:none;padding:7px 0">
|
||||
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space" style="width:20px;border:none;padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
7
modules/aapfree/mails/pt/send_question.txt
Normal file
7
modules/aapfree/mails/pt/send_question.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
[{shop_url}]
|
||||
|
||||
Hi,
|
||||
|
||||
New inquiry about {product} {productLink}
|
||||
----------------
|
||||
{question}
|
||||
30
modules/aapfree/translations/ca.php
Normal file
30
modules/aapfree/translations/ca.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_ajax_22c4733a9ceb239bf825a0cecd1cfaec'] = 'Un amic';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2074615eb70699e55b1f9289c6c77c25'] = 'Mòdul d\'Enviar a un amic';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3234e2609dd694d8763c390fe97eba04'] = 'Permetre als clients enviar un enllaç del producte a un amic.';
|
||||
$_MODULE['<{aapfree}prestashop>product_page_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Enviar a un amic';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_11cbd9ec2e4b628c371094b6361b9c96'] = 'El vostre correu s\'ha enviat correctament';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_36fb3f59b4a75949a0db90e7011b21f2'] = 'El vostre correu no s\'ha enviat. Verifiqueu l\'adreça i proveu-ho de nou.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Enviar a un amic';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_d1f092e79827eaffce4a33fa011fde24'] = 'No heu emplenat algun camp requerit';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_5d6103b662f41b07e10687f03aca8fdc'] = 'Receptor:';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_bb6aa0be8236a10e6d3b315ebd5f2547'] = 'Nom del vostre amic';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_099bc8914b5be9e522a29e48cb3c01c4'] = 'Adreça electrònica del vostre amic';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_70397c4b252a5168c5ec003931cea215'] = 'Camps exigits';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_ea4788705e6873b424c65e91c2846b19'] = 'Cancel·lar';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_e81c4e4f2b7b93b481e13a8553c2ae1b'] = 'o';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Enviar';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Enviar a un amic';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_20589174124c25654cac3736e737d2a3'] = 'Enviar aquesta pàgina a un amic que podria estar interessat en aquest tema.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b31afdfa73c89b567778f15180c2dd6c'] = 'El teu email ha estat enviat amb èxit';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_e55de03786f359e2b133f2a74612eba6'] = 'Nom del amic:';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_19f41c3d6db934fb2db1840ddefd2c51'] = 'E-mail del amic:';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2541d938b0a58946090d7abdde0d3890'] = 'enviar';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_68728c1897e5936032fe21ffb6b10c2e'] = 'Tornar a la pàgina del producte';
|
||||
|
||||
|
||||
return $_MODULE;
|
||||
41
modules/aapfree/translations/de.php
Normal file
41
modules/aapfree/translations/de.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2074615eb70699e55b1f9289c6c77c25'] = 'An einen Freund senden';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3234e2609dd694d8763c390fe97eba04'] = 'Ermöglicht den Kunden, einen Artikellink an einen Freund zu senden';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_57206dc27305060c5c29150d3ad00401'] = 'MyPresta Updates';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_d7d90723c19e43735e731a36a2739c8b'] = 'Überprüfen Sie die Verfügbarkeit der Updates';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2c872e677f8b5831f20a66c65e7f8966'] = 'Jetzt prüfen';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_722eb8a4b2d0b1c305d6361bcc7564e7'] = 'Aktualisiert Benachrichtigungen';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_633703a658469b7fab7f42e04e59d27a'] = '-- wählen --';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2faec1f9f8cc7f8f40d521c4dd574f49'] = 'Aktivieren';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_bcfaccebf745acfd5e75351095a5394a'] = 'Deaktivieren';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_cc6fc347e9fd233bddcb7895e307e9a9'] = 'Aktivieren Sie diese Option, wenn Sie MyPresta.eu automatisch nach Modulupdates durchsuchen möchten. Diese Option zeigt Benachrichtigungen über neue Versionen dieses Addons an.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_0d24168598880003b80f9e85b8e1d62a'] = 'Modulseite';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_07ac9eab57de962a9518a7545fd475fe'] = 'Dies ist ein direkter Link zur offiziellen Addon-Seite, auf der Sie über Änderungen im Modul lesen können (changelog)';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_c9cc8cce247e49bae79f15173ce97354'] = 'sparen';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_4c73ce9e52a25c69cf0dce126d548f98'] = 'Neue Version verfügbar, siehe http://MyPresta.eu für weitere Informationen';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_af02b06496e83946e73e69d774782654'] = 'Neue Version verfügbar!';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_358a5fcb448d507b41d7c0a83485973a'] = 'Modul ist auf dem neuesten Stand!';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_11cbd9ec2e4b628c371094b6361b9c96'] = 'Ihre E-Mail wurde erfolgreich gesendet';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_6cec0d7f95fa3a4b3254ff11c15df8c3'] = 'Ihre E-Mail konnte nicht gesendet werden. Bitte überprüfen Sie den Namen und die E-Mail-Adresse und versuchen Sie es erneut.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'An einen Freund senden';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_d1f092e79827eaffce4a33fa011fde24'] = 'Sie haben die erforderlichen Felder nicht ausgefüllt';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_78a7ad1b5b469d19fceabc05b888ab27'] = 'Einstellungen aktualisiert';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_1daca317c1375ca087724663e6fab7ee'] = 'Ich entwickle dieses Modul kostenlos - wenn du willst';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b1167bf6bb5476cd6d7d3065ea8b267b'] = 'Schick mir eine Spende';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_254f642527b45bc260048e30704edb39'] = 'Aufbau';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_bfcd2f36dbbe8518a9041346ed4fe9cb'] = 'GDPR konform';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'aktiviert';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b9f5c797ebbf55adccdd8539a65a0241'] = 'behindert';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3b75aac75dc5f26614dab746da7b081d'] = 'Datenschutzrichtlinie';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_675dfb16d2ef8de7a0db62a83e39b350'] = 'Wählen Sie eine CMS-Seite mit Daten zu Datenschutzrichtlinien für DSGVO-Zwecke';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_ajax_22c4733a9ceb239bf825a0cecd1cfaec'] = 'Ein Freund';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'An einen Freund senden';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_bb6aa0be8236a10e6d3b315ebd5f2547'] = 'Name Ihrer/es Freundin/es';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_099bc8914b5be9e522a29e48cb3c01c4'] = 'E-Mailadresse Ihres Freundes';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_04c3a66c24f289b415ea9aedc6b95547'] = 'Ich nehme an';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_ca0f9a86ca33f1d6baa9051bd7f4ed21'] = 'Datenschutz-Bestimmungen';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_a4f86f7bfc24194b276c22e0ef158197'] = 'Regeln';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Senden';
|
||||
30
modules/aapfree/translations/en.php
Normal file
30
modules/aapfree/translations/en.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_ajax_22c4733a9ceb239bf825a0cecd1cfaec'] = 'A friend';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2074615eb70699e55b1f9289c6c77c25'] = 'Send to a Friend module';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3234e2609dd694d8763c390fe97eba04'] = 'Allows customers to send a product link to a friend.';
|
||||
$_MODULE['<{aapfree}prestashop>product_page_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Send to a friend';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_11cbd9ec2e4b628c371094b6361b9c96'] = 'Your e-mail has been sent successfully';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_36fb3f59b4a75949a0db90e7011b21f2'] = 'Your e-mail could not be sent. Please check the e-mail address and try again.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Send to a friend';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_d1f092e79827eaffce4a33fa011fde24'] = 'You did not fill required fields';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_5d6103b662f41b07e10687f03aca8fdc'] = 'Recipient';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_bb6aa0be8236a10e6d3b315ebd5f2547'] = 'Name of your friend';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_099bc8914b5be9e522a29e48cb3c01c4'] = 'E-mail address of your friend';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_70397c4b252a5168c5ec003931cea215'] = 'Required fields';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_ea4788705e6873b424c65e91c2846b19'] = 'Cancel';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_e81c4e4f2b7b93b481e13a8553c2ae1b'] = 'or';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Send';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Send to a friend';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_20589174124c25654cac3736e737d2a3'] = 'Send this page to a friend who might be interested in the item below.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b31afdfa73c89b567778f15180c2dd6c'] = 'Your email has been sent successfully';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_e55de03786f359e2b133f2a74612eba6'] = 'Friend\'s name';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_19f41c3d6db934fb2db1840ddefd2c51'] = 'Friend\'s email';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2541d938b0a58946090d7abdde0d3890'] = 'send';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_68728c1897e5936032fe21ffb6b10c2e'] = 'Back to product page';
|
||||
|
||||
|
||||
return $_MODULE;
|
||||
41
modules/aapfree/translations/es.php
Normal file
41
modules/aapfree/translations/es.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2074615eb70699e55b1f9289c6c77c25'] = 'Módulo enviar a un amigo';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3234e2609dd694d8763c390fe97eba04'] = 'Permite a los clientes enviar un enlace de producto a un amigo.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_57206dc27305060c5c29150d3ad00401'] = 'Actualizaciones de MyPresta';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_d7d90723c19e43735e731a36a2739c8b'] = 'Revisa actualizaciones';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2c872e677f8b5831f20a66c65e7f8966'] = 'Revisalo ahora';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_722eb8a4b2d0b1c305d6361bcc7564e7'] = 'Actualiza notificaciones';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_633703a658469b7fab7f42e04e59d27a'] = '- seleccionar -';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2faec1f9f8cc7f8f40d521c4dd574f49'] = 'Habilitar';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_bcfaccebf745acfd5e75351095a5394a'] = 'Inhabilitar';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_cc6fc347e9fd233bddcb7895e307e9a9'] = 'Active esta opción si desea comprobar MyPresta.eu para actualizaciones de módulos automáticamente. Esta opción mostrará notificación sobre las nuevas versiones de este complemento.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_0d24168598880003b80f9e85b8e1d62a'] = 'Página del módulo';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_07ac9eab57de962a9518a7545fd475fe'] = 'Este es un enlace directo a la página de addon oficial, donde puede leer sobre los cambios en el módulo (changelog)';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_c9cc8cce247e49bae79f15173ce97354'] = 'Salvar';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_4c73ce9e52a25c69cf0dce126d548f98'] = 'Nueva versión disponible, consulte http://MyPresta.eu para obtener más información';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_af02b06496e83946e73e69d774782654'] = '¡Nueva versión disponible!';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_358a5fcb448d507b41d7c0a83485973a'] = 'El módulo está al día!';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_11cbd9ec2e4b628c371094b6361b9c96'] = 'Su correo electrónico ha sido enviado existosamente';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_6cec0d7f95fa3a4b3254ff11c15df8c3'] = 'Su correo electrónico no pudo ser enviado. Verifique el nombre y la dirección de correo electrónico y vuelva a intentarlo.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Enviar a un amigo';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_d1f092e79827eaffce4a33fa011fde24'] = 'No completó los campos obligatorios';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_78a7ad1b5b469d19fceabc05b888ab27'] = 'Ajustes actualizan';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_1daca317c1375ca087724663e6fab7ee'] = 'Estoy desarrollando este módulo de forma gratuita, si quieres';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b1167bf6bb5476cd6d7d3065ea8b267b'] = 'envíame una donacion';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_254f642527b45bc260048e30704edb39'] = 'Configuración';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_bfcd2f36dbbe8518a9041346ed4fe9cb'] = 'Compatible con GDPR';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Habilitado';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b9f5c797ebbf55adccdd8539a65a0241'] = 'Discapacitado';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3b75aac75dc5f26614dab746da7b081d'] = 'Página de política de privacidad';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_675dfb16d2ef8de7a0db62a83e39b350'] = 'Elija una página de CMS con detalles de política de privacidad para fines de GDPR';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_ajax_22c4733a9ceb239bf825a0cecd1cfaec'] = 'Un amigo';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Enviar a un amigo';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_bb6aa0be8236a10e6d3b315ebd5f2547'] = 'Nombre de su amigo';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_099bc8914b5be9e522a29e48cb3c01c4'] = 'Dirección de correo electrónico de su amigo';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_04c3a66c24f289b415ea9aedc6b95547'] = 'acepto';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_ca0f9a86ca33f1d6baa9051bd7f4ed21'] = 'política de privacidad';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_a4f86f7bfc24194b276c22e0ef158197'] = 'reglas';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Enviar';
|
||||
21
modules/aapfree/translations/eu.php
Normal file
21
modules/aapfree/translations/eu.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{aapfree}prestashop>product_page_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Lagun bati bidali';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_11cbd9ec2e4b628c371094b6361b9c96'] = 'Zure e-mail bidali da';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_36fb3f59b4a75949a0db90e7011b21f2'] = 'Zure e- mail ezin izan da bidali . Mesedez egiaztatu e- mail helbidea eta saiatu berriro .';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Lagun bati bidali';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_d1f092e79827eaffce4a33fa011fde24'] = 'Ez zenuen bete beharreko eremuak';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_5d6103b662f41b07e10687f03aca8fdc'] = 'Nori';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_bb6aa0be8236a10e6d3b315ebd5f2547'] = 'Zure lagunaren izena';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_099bc8914b5be9e522a29e48cb3c01c4'] = 'Zure lagunaren e-mail helbidea';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_ea4788705e6873b424c65e91c2846b19'] = 'Utzi';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Lagun bati bidali';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_e55de03786f359e2b133f2a74612eba6'] = 'Lagunaren izena';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_19f41c3d6db934fb2db1840ddefd2c51'] = 'Lagunaren e-mail helbidea';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2541d938b0a58946090d7abdde0d3890'] = 'bidali';
|
||||
|
||||
|
||||
return $_MODULE;
|
||||
30
modules/aapfree/translations/fr.php
Normal file
30
modules/aapfree/translations/fr.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_ajax_22c4733a9ceb239bf825a0cecd1cfaec'] = 'Un ami';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2074615eb70699e55b1f9289c6c77c25'] = 'Module envoyer à un ami';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3234e2609dd694d8763c390fe97eba04'] = 'Permet à vos clients d\'envoyer des liens à leurs amis';
|
||||
$_MODULE['<{aapfree}prestashop>product_page_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Envoyer à un ami';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_11cbd9ec2e4b628c371094b6361b9c96'] = 'Votre e-mail a bien été envoyé';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_36fb3f59b4a75949a0db90e7011b21f2'] = 'Votre e-mail n\'a pas pu être envoyé. Veuillez vérifier l\'adresse et réessayer.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Envoyer à un ami';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_d1f092e79827eaffce4a33fa011fde24'] = 'Vous n\'avez pas rempli les champs requis';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_5d6103b662f41b07e10687f03aca8fdc'] = 'Destinataire';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_bb6aa0be8236a10e6d3b315ebd5f2547'] = 'Nom de votre ami';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_099bc8914b5be9e522a29e48cb3c01c4'] = 'Adresse e-mail de votre ami';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_70397c4b252a5168c5ec003931cea215'] = 'Champs requis';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_ea4788705e6873b424c65e91c2846b19'] = 'Annuler';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_e81c4e4f2b7b93b481e13a8553c2ae1b'] = 'OU';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Envoyer';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Envoyer à un ami';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_20589174124c25654cac3736e737d2a3'] = 'Envoyer cette page à un ami susceptible d\'être intéressé par le produit ci-dessous';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b31afdfa73c89b567778f15180c2dd6c'] = 'Votre e-mail a bien été envoyé';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_e55de03786f359e2b133f2a74612eba6'] = 'Nom de votre ami :';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_19f41c3d6db934fb2db1840ddefd2c51'] = 'E-mail de votre ami';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2541d938b0a58946090d7abdde0d3890'] = 'Envoyer';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_68728c1897e5936032fe21ffb6b10c2e'] = 'Retour à la fiche produit';
|
||||
|
||||
|
||||
return $_MODULE;
|
||||
30
modules/aapfree/translations/gl.php
Normal file
30
modules/aapfree/translations/gl.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_ajax_22c4733a9ceb239bf825a0cecd1cfaec'] = 'Unha amiga';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2074615eb70699e55b1f9289c6c77c25'] = 'Módulo de Enviar a unha Amiga';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3234e2609dd694d8763c390fe97eba04'] = 'Permítelle á clientela envia-la ligazón dun produto a unha amizade.';
|
||||
$_MODULE['<{aapfree}prestashop>product_page_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Enviar a unha amiga';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_11cbd9ec2e4b628c371094b6361b9c96'] = 'O teu correo electrónico enviouse correctamente';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_36fb3f59b4a75949a0db90e7011b21f2'] = 'Non puido enviarse o teu correo electrónico. Por favor, comproba o enderezo de correo e inténtao de novo.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Enviar a unha amiga';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_d1f092e79827eaffce4a33fa011fde24'] = 'Non encheches os campos obrigatorios';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_5d6103b662f41b07e10687f03aca8fdc'] = 'Destinataria';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_bb6aa0be8236a10e6d3b315ebd5f2547'] = 'Nome da túa amiga';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_099bc8914b5be9e522a29e48cb3c01c4'] = 'Enderezo de correo electrónico da túa amiga';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_70397c4b252a5168c5ec003931cea215'] = 'Campos obrigatorios';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_ea4788705e6873b424c65e91c2846b19'] = 'Cancelar';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_e81c4e4f2b7b93b481e13a8553c2ae1b'] = 'ou';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Enviar';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Enviar a unha amiga';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_20589174124c25654cac3736e737d2a3'] = 'Enviar esta páxina a unha amiga que poida estar interesada no artigo de embaixo.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b31afdfa73c89b567778f15180c2dd6c'] = 'O teu correo electrónico enviouse correctamente';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_e55de03786f359e2b133f2a74612eba6'] = 'Nome da amiga';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_19f41c3d6db934fb2db1840ddefd2c51'] = 'Correo electrónico da amiga';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2541d938b0a58946090d7abdde0d3890'] = 'enviar';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_68728c1897e5936032fe21ffb6b10c2e'] = 'Tornar á páxina do produto';
|
||||
|
||||
|
||||
return $_MODULE;
|
||||
35
modules/aapfree/translations/index.php
Normal file
35
modules/aapfree/translations/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
41
modules/aapfree/translations/it.php
Normal file
41
modules/aapfree/translations/it.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2074615eb70699e55b1f9289c6c77c25'] = 'Modulo Invia ad un amico';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3234e2609dd694d8763c390fe97eba04'] = 'Consente ai clienti di inviare un link prodotto a un amico';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_57206dc27305060c5c29150d3ad00401'] = 'Aggiornamenti MyPresta';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_d7d90723c19e43735e731a36a2739c8b'] = 'Controlla gli aggiornamenti';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2c872e677f8b5831f20a66c65e7f8966'] = 'Controlla ora';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_722eb8a4b2d0b1c305d6361bcc7564e7'] = 'Aggiorna le notifiche';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_633703a658469b7fab7f42e04e59d27a'] = '- seleziona -';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2faec1f9f8cc7f8f40d521c4dd574f49'] = 'Abilitare';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_bcfaccebf745acfd5e75351095a5394a'] = 'Disattivare';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_cc6fc347e9fd233bddcb7895e307e9a9'] = 'Attiva questa opzione se vuoi controllare automaticamente MyPresta.eu per gli aggiornamenti dei moduli. Questa opzione mostrerà la notifica sulle nuove versioni di questo addon.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_0d24168598880003b80f9e85b8e1d62a'] = 'Pagina del modulo';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_07ac9eab57de962a9518a7545fd475fe'] = 'Questo è un link diretto alla pagina ufficiale degli addon, dove puoi leggere le modifiche al modulo (changelog)';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_c9cc8cce247e49bae79f15173ce97354'] = 'Salvare';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_4c73ce9e52a25c69cf0dce126d548f98'] = 'Nuova versione disponibile, controlla http://MyPresta.eu per maggiori informazioni';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_af02b06496e83946e73e69d774782654'] = 'Nuova versione disponibile!';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_358a5fcb448d507b41d7c0a83485973a'] = 'Il modulo è aggiornato!';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_11cbd9ec2e4b628c371094b6361b9c96'] = 'La tua email è stata inviata con successo';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_6cec0d7f95fa3a4b3254ff11c15df8c3'] = 'La tua e-mail non può essere inviata. Si prega di controllare il nome e l\'indirizzo e-mail e riprovare.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Invia ad un amico';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_d1f092e79827eaffce4a33fa011fde24'] = 'Non hai compilato i campi obbligatori';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_78a7ad1b5b469d19fceabc05b888ab27'] = 'Impostazioni aggiornate';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_1daca317c1375ca087724663e6fab7ee'] = 'Sto sviluppando questo modulo gratuitamente - se vuoi';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b1167bf6bb5476cd6d7d3065ea8b267b'] = 'mandami una donazione';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_254f642527b45bc260048e30704edb39'] = 'Configurazione';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_bfcd2f36dbbe8518a9041346ed4fe9cb'] = 'GDPR Compliant';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Abilitato';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b9f5c797ebbf55adccdd8539a65a0241'] = 'Disabilitato';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3b75aac75dc5f26614dab746da7b081d'] = 'Pagina politica sulla privacy';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_675dfb16d2ef8de7a0db62a83e39b350'] = 'Scegli una pagina CMS con i dettagli sulla privacy per gli scopi di GDPR';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_ajax_22c4733a9ceb239bf825a0cecd1cfaec'] = 'Un amico';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_2107f6398c37b4b9ee1e1b5afb5d3b2a'] = 'Invia ad un amico';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_bb6aa0be8236a10e6d3b315ebd5f2547'] = 'Nome del tuo amico';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_099bc8914b5be9e522a29e48cb3c01c4'] = 'Indirizzo email del tuo amico';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_04c3a66c24f289b415ea9aedc6b95547'] = 'accetto';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_ca0f9a86ca33f1d6baa9051bd7f4ed21'] = 'politica sulla riservatezza';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_a4f86f7bfc24194b276c22e0ef158197'] = 'regole';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Invia';
|
||||
50
modules/aapfree/translations/pl.php
Normal file
50
modules/aapfree/translations/pl.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_dc3945107f6c79c489e6ac4070346651'] = 'Zapytaj o produkt';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_ad018a83cb84bfbced2b3f4a76580093'] = 'Darmowy moduł pozwalający przesyłać zapytania o produkt';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_57206dc27305060c5c29150d3ad00401'] = 'Aktualizacje MyPresta';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_d7d90723c19e43735e731a36a2739c8b'] = 'Sprawdź aktualizacje';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2c872e677f8b5831f20a66c65e7f8966'] = 'Sprawdź teraz';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_722eb8a4b2d0b1c305d6361bcc7564e7'] = 'Notyfikacje';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_633703a658469b7fab7f42e04e59d27a'] = '-- wybierz --';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2faec1f9f8cc7f8f40d521c4dd574f49'] = 'Włącz';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_bcfaccebf745acfd5e75351095a5394a'] = 'Wyłacz';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_cc6fc347e9fd233bddcb7895e307e9a9'] = 'Włącz tę opcję, jeżeli chcesz otrzymywać powiadomienia o dostępności aktualizacji dla tego modułu.';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_0d24168598880003b80f9e85b8e1d62a'] = 'Strona modułu';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_07ac9eab57de962a9518a7545fd475fe'] = 'To jest bezpośredni link do strony modułu na stronach mypresta.eu';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_c9cc8cce247e49bae79f15173ce97354'] = 'Zapisz';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_4c73ce9e52a25c69cf0dce126d548f98'] = 'Nowa wersja modułu jest dostępna, sprawdź mypresta.eu';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_2b2972b182c459cca33e2ad5bc02ffa4'] = 'Więcej w changelogu';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_af02b06496e83946e73e69d774782654'] = 'Nowa wersja jest dostępna!';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_358a5fcb448d507b41d7c0a83485973a'] = 'Moduł jest aktualny';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_11cbd9ec2e4b628c371094b6361b9c96'] = 'Email został wysłany poprawnie';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_6cec0d7f95fa3a4b3254ff11c15df8c3'] = 'Email nie może zostać wysłany. Proszę sprawdzić wprowadzony adres email i spróbować ponownie';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_e3b26b08857a2f5bb06e33ec296e9b83'] = 'Pytanie o produkt';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_d1f092e79827eaffce4a33fa011fde24'] = 'Nie wypełniono wszystkich niezbędnych pól';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_78a7ad1b5b469d19fceabc05b888ab27'] = 'Ustawienia zapisane';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_1daca317c1375ca087724663e6fab7ee'] = 'Tworzę ten moduł za darmo, jeżeli chcesz';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b1167bf6bb5476cd6d7d3065ea8b267b'] = 'możesz przesłać drobną kwotę w ramach dotacji';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_254f642527b45bc260048e30704edb39'] = 'Konfiguracja';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_eac081c9261397801f6ab18ca9866a00'] = 'Wyświetl podsumowanie produktu w wyskakującym okienku';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_d2e5ac9e75f6625f22fb5726eac9e2cf'] = 'Podsumowanie produktu to krótki opis produktu';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Włącz';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_b9f5c797ebbf55adccdd8539a65a0241'] = 'Wyłącz';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_bfcd2f36dbbe8518a9041346ed4fe9cb'] = 'Zgodność z RODO';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_3b75aac75dc5f26614dab746da7b081d'] = 'Strona z polityką prywatności';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_675dfb16d2ef8de7a0db62a83e39b350'] = 'Wybierz stronę cms ze szczegółami dotyczacymi polityki prywatności w Twoim sklepie';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_ef36bf88b2184cd346b1cfd2713f8738'] = 'Tytuł wiadomości';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_4ba6a1a6e8be4727ecde000edb5ecbc2'] = 'Moduł wykorzysta ten tekst jako tytuł wiadomości email jaka zostanie Ci dostarczona';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_7f83595872f22ac228de6be09be9c762'] = '%1$s - będzie zastąpiony nazwą klienta który wysyła zapytanie';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree_e7986ed512442d5a194d9b2a51d061ae'] = '%2$s - będzie zastąpione nazwą produktu';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_96fe4ac310724dd6c70dbd0a5b6f2255'] = 'Zapytaj o produkt';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_352519cba02e5e9ce17b9477a012e87c'] = 'Twoje pytanie';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_221e705c06e231636fdbccfdd14f4d5c'] = 'Twoje imię';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_e26eb754ed50f821a7eea67214e5cf8e'] = 'Jesteś zalogowany jako klient - dlatego nie musisz uzupełniać tego pola';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_198584454b0ce1101ff5b50323325aa8'] = 'Twój adres email';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_1f8261d17452a959e013666c5df45e07'] = 'Numer telefonu';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_04c3a66c24f289b415ea9aedc6b95547'] = 'Akceptuję';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_ca0f9a86ca33f1d6baa9051bd7f4ed21'] = 'zasady';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_a4f86f7bfc24194b276c22e0ef158197'] = 'polityki prywatności';
|
||||
$_MODULE['<{aapfree}prestashop>aapfree-extra_94966d90747b97d1f0f206c98a8b1ac3'] = 'Wyślij';
|
||||
87
modules/aapfree/views/aapfree-extra.tpl
Normal file
87
modules/aapfree/views/aapfree-extra.tpl
Normal file
@@ -0,0 +1,87 @@
|
||||
{*
|
||||
*
|
||||
* PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-)
|
||||
*
|
||||
* @author VEKIA https://www.prestashop.com/forums/user/132608-vekia/
|
||||
* @copyright 2010-2021 VEKIA
|
||||
* @license This program is not free software and you can't resell and redistribute it
|
||||
*
|
||||
* CONTACT WITH DEVELOPER http://mypresta.eu
|
||||
* support@mypresta.eu
|
||||
*
|
||||
*}
|
||||
<a id="send_aap_button" class="btn btn-primary" href="#send_AAP_form">
|
||||
<i class="material-icons">help_outline</i>{l s='Ask about product' mod='aapfree'}
|
||||
</a>
|
||||
|
||||
<div style="display: none;">
|
||||
<div id="send_AAP_form" class="card">
|
||||
<div class="card-block">
|
||||
<div class="product clearfix col-lg-12">
|
||||
<img src="{$link->getImageLink($aapfree_product->link_rewrite, $aapfree_product_cover, 'home_default')|escape:'html'}" alt="{$aapfree_product->name|escape:html:'UTF-8'}"/>
|
||||
<div class="product_desc">
|
||||
<p class="product_name"><strong>{$aapfree_product->name}</strong></p>
|
||||
{if $aapfree_SUMMARY == true}
|
||||
{$aapfree_product->description_short nofilter}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<fieldset class="form-group">
|
||||
<label class="form-control-label" for="question">{l s='Your question' mod='aapfree'}</label>
|
||||
<textarea name="aapfree_question" id="aapfree_question" class="form-control"></textarea>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="send_AAP_form_content col-lg-6" id="send_AAP_form_content">
|
||||
<div id="send_AAP_form_error" class="alert alert-danger" style="display:none;"></div>
|
||||
<div class="form_container">
|
||||
{if !Context::getContext()->customer->islogged()}
|
||||
<fieldset class="form-group">
|
||||
<label class="form-control-label" for="author">{l s='Your name' mod='aapfree'}</label>
|
||||
<input id="aapfree_author" name="aapfree_author" type="text" value="" class="form-control"/>
|
||||
</fieldset>
|
||||
{else}
|
||||
<fieldset class="form-group">
|
||||
<label class="form-control-label" for="author">{l s='Your name' mod='aapfree'}</label>
|
||||
<input disabled id="aapfree_author" name="aapfree_author" type="text" value="{Context::getContext()->customer->firstname} {Context::getContext()->customer->lastname}" class="form-control disabled"/>
|
||||
<p class="small">({l s='You are logged as a customer, we get your name automatically from your account details' mod='aapfree'})</p>
|
||||
</fieldset>
|
||||
{/if}
|
||||
{if !Context::getContext()->customer->islogged()}
|
||||
<fieldset class="form-group">
|
||||
<label class="form-control-label" for="aapfree_email">{l s='Your email address' mod='aapfree'}</label>
|
||||
<input id="aapfree_email" name="aapfree_email" type="text" value="" class="form-control"/>
|
||||
</fieldset>
|
||||
{else}
|
||||
<fieldset class="form-group">
|
||||
<label class="form-control-label" for="aapfree_email">{l s='Your email address' mod='aapfree'}</label>
|
||||
<input id="aapfree_email" name="aapfree_email" type="text" value="{Context::getContext()->customer->email}" class="form-control"/>
|
||||
</fieldset>
|
||||
{/if}
|
||||
<fieldset class="form-group">
|
||||
<label class="form-control-label" for="author">{l s='Phone number' mod='aapfree'}</label>
|
||||
<input id="aapfree_phone" name="aapfree_phone" type="text" value="" class="form-control"/>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12 send_AAP_form_content_button">
|
||||
<p class="submit pull-right">
|
||||
{if $aapfree_GDPR == 1}
|
||||
{literal}
|
||||
<input onchange="if($(this).is(':checked')){$('#sendAAPEmail').removeClass('gdpr_disabled'); $('#sendAAPEmail').removeAttr('disabled'); $('#sendAAPEmail').click(function(){aapfreeEmail();});}else{$('#sendAAPEmail').addClass('gdpr_disabled'); $('#sendAAPEmail').off('click'); $('#sendAAPEmail').attr('disabled', 1); }"
|
||||
id="gdpr_checkbox" type="checkbox">
|
||||
{/literal}
|
||||
{l s='I accept ' mod='aapfree'}
|
||||
<a target="_blank"
|
||||
href="{$link->getCmsLink($aapfree_GDPRCMS)}">{l s='privacy policy' mod='aapfree'}</a>
|
||||
{l s='rules' mod='aapfree'}
|
||||
{/if}
|
||||
<input {if $aapfree_GDPR == 1}disabled{/if} id="sendAAPEmail" class="btn btn-primary {if $aapfree_GDPR == 1}gdpr_disabled{/if}" name="sendAAPEmail" type="submit" value="{l s='Send' mod='aapfree'}"/>
|
||||
<input id="id_product_send" name="id_product" type="hidden" value="{$aapfree_product->id}"/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
47
modules/aapfree/views/aapfree.css
Normal file
47
modules/aapfree/views/aapfree.css
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-)
|
||||
*
|
||||
* @author VEKIA https://www.prestashop.com/forums/user/132608-vekia/
|
||||
* @copyright 2010-2021 VEKIA
|
||||
* @license This program is not free software and you can't resell and redistribute it
|
||||
*
|
||||
* CONTACT WITH DEVELOPER http://mypresta.eu
|
||||
* support@mypresta.eu
|
||||
*/
|
||||
|
||||
#send_AAP_form {
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
#send_AAP_form .product {
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #cecece;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#send_AAP_form .pull-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#send_AAP_form #gdpr_checkbox {
|
||||
height: auto !important;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
#send_AAP_form .gdpr_disabled {
|
||||
opacity: .5;
|
||||
background: silver !important;
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
|
||||
#send_AAP_form textarea {
|
||||
height: 260px;
|
||||
}
|
||||
|
||||
.send_AAP_form_content_button {
|
||||
border-top: 1px solid #cecece;
|
||||
padding-top:20px;
|
||||
margin-top:20px;
|
||||
display:block;
|
||||
clear:both;
|
||||
}
|
||||
70
modules/aapfree/views/aapfree.js
Normal file
70
modules/aapfree/views/aapfree.js
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-)
|
||||
*
|
||||
* @author VEKIA https://www.prestashop.com/forums/user/132608-vekia/
|
||||
* @copyright 2010-2021 VEKIA
|
||||
* @license This program is not free software and you can't resell and redistribute it
|
||||
*
|
||||
* CONTACT WITH DEVELOPER http://mypresta.eu
|
||||
* support@mypresta.eu
|
||||
*/
|
||||
|
||||
$('document').ready(function () {
|
||||
$('#send_aap_button').fancybox({
|
||||
'hideOnContentClick': false
|
||||
});
|
||||
|
||||
if (aapfree_aapfree_GDPR != 1) {
|
||||
$('#sendAAPEmail').click(function () {
|
||||
aapfreeEmail();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function aapfreeEmail() {
|
||||
var author = $('#aapfree_author').val();
|
||||
var email = $('#aapfree_email').val();
|
||||
var phone = $('#aapfree_phone').val();
|
||||
var question = $('#aapfree_question').val();
|
||||
var id_product = $('#id_product_send').val();
|
||||
if (email && !isNaN(id_product)) {
|
||||
$.ajax({
|
||||
url: aapfree_frontcontroller+'&'+$('#add-to-cart-or-refresh').serialize(),
|
||||
type: "POST",
|
||||
headers: {"cache-control": "no-cache"},
|
||||
data: {
|
||||
action: 'sendQuestion',
|
||||
secure_key: aapfree_secureKey,
|
||||
author: author,
|
||||
phone: phone,
|
||||
question: question,
|
||||
id_lang: aapfree_id_lang,
|
||||
email: email,
|
||||
id_product: id_product
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (result) {
|
||||
$.fancybox.close();
|
||||
var msg = result ? aapfree_confirmation : aapfree_problem;
|
||||
var title = aapfree_title;
|
||||
fancyMsgBoxaapfree(msg, title);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#send_AAP_form_error').show().text(aapfree_missingFields);
|
||||
}
|
||||
}
|
||||
|
||||
function fancyMsgBoxaapfree(msg, title) {
|
||||
if (title) msg = "<h2 style=\"padding-bottom:10px;\">" + title + "</h2><p>" + msg + "</p>";
|
||||
msg += "<br/><p class=\"submit\" style=\"text-align:right; padding-bottom: 0\"><input class=\" btn btn-primary\" type=\"button\" value=\"OK\" onclick=\"$.fancybox.close();\" /></p>";
|
||||
$.fancybox(msg, {
|
||||
'autoDimensions': false,
|
||||
'width': 500,
|
||||
'height': 'auto',
|
||||
'transitionIn': 'none',
|
||||
'transitionOut': 'none'
|
||||
});
|
||||
}
|
||||
|
||||
35
modules/aapfree/views/index.php
Normal file
35
modules/aapfree/views/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2016 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2016 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
12
modules/appagebuilder/Readme.md
Normal file
12
modules/appagebuilder/Readme.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# 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...
|
||||
|
||||
version 2.3.6
|
||||
#add slick for thumb in mobile
|
||||
#convert cache to default prestashop cache type
|
||||
#fix random in product tab
|
||||
version 2.4.1
|
||||
add breadcrumb and otimization
|
||||
31
modules/appagebuilder/apadminajax.php
Normal file
31
modules/appagebuilder/apadminajax.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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-2019 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);
|
||||
}
|
||||
240
modules/appagebuilder/apajax.php
Normal file
240
modules/appagebuilder/apajax.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<?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-2019 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');
|
||||
$product_attribute_one_img = Tools::getValue('product_attribute_one_img');
|
||||
$product_all_one_img = Tools::getValue('product_all_one_img');
|
||||
$leo_pro_cdown = Tools::getValue('pro_cdown');
|
||||
$leo_pro_color = Tools::getValue('pro_color');
|
||||
$tab_shortcode = Tools::getValue('tabshortcode');
|
||||
$tab_shortcode_key = Tools::getValue('tabshortcodekey');
|
||||
|
||||
// $ap_extra = Tools::getValue('product_apextra');
|
||||
//add function wishlist compare
|
||||
$wishlist_compare = Tools::getValue('wishlist_compare');
|
||||
|
||||
$result = array();
|
||||
if ($tab_shortcode) {
|
||||
$tab_content = explode("@|@", $tab_shortcode);
|
||||
$tab_content_key = explode("@|@", $tab_shortcode_key);
|
||||
$result['ajaxTab'] = array();
|
||||
for ($i = 0; $i < count($tab_content); $i++) {
|
||||
$shortcode = urldecode($tab_content[$i]);
|
||||
if (empty(ApShortCodesBuilder::$shortcode_tags)) {
|
||||
apPageHelper::loadShortCode(apPageHelper::getConfigDir('_PS_THEME_DIR_'));
|
||||
}
|
||||
$content = ApShortCodesBuilder::doShortcode($shortcode);
|
||||
$result['ajaxTab'][$tab_content_key[$i]] = $content;
|
||||
}
|
||||
}
|
||||
//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 ($product_attribute_one_img) {
|
||||
$product_attribute_one_img = explode(',', $product_attribute_one_img);
|
||||
$product_attribute_one_img = array_unique($product_attribute_one_img);
|
||||
$product_attribute_one_img = implode(',', $product_attribute_one_img);
|
||||
|
||||
$result['product_attribute_one_img'] = $module->hookProductAttributeOneImg($product_attribute_one_img);
|
||||
}
|
||||
if ($product_all_one_img) {
|
||||
$product_all_one_img = explode(',', $product_all_one_img);
|
||||
$product_all_one_img = array_unique($product_all_one_img);
|
||||
$product_all_one_img = implode(',', $product_all_one_img);
|
||||
|
||||
$result['product_all_one_img'] = $module->hookProductAllOneImg($product_all_one_img);
|
||||
}
|
||||
if (Tools::getIsset('product_size') || Tools::getIsset('product_attribute')) {
|
||||
$product_size = $product_attribute = array();
|
||||
if (Tools::getIsset('product_size') && Tools::getValue('product_size')) {
|
||||
$product_size = explode(',', Tools::getValue('product_size'));
|
||||
}
|
||||
if (Tools::getIsset('product_attribute') && Tools::getValue('product_attribute')) {
|
||||
$product_attribute = explode(',', Tools::getValue('product_attribute'));
|
||||
}
|
||||
|
||||
$result['product_attribute'] = $module->hookGetProductAttribute($product_attribute, $product_size);
|
||||
}
|
||||
if (Tools::getIsset('product_manufacture')) {
|
||||
$result['product_manufacture'] = $module->hookGetProductManufacture(Tools::getValue('product_manufacture'));
|
||||
}
|
||||
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));
|
||||
}
|
||||
4091
modules/appagebuilder/appagebuilder.php
Normal file
4091
modules/appagebuilder/appagebuilder.php
Normal file
File diff suppressed because it is too large
Load Diff
169
modules/appagebuilder/classes/ApPageBuilderDetailsModel.php
Normal file
169
modules/appagebuilder/classes/ApPageBuilderDetailsModel.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?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-2019 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;
|
||||
public $active_mobile;
|
||||
public $active_tablet;
|
||||
|
||||
/**
|
||||
* @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'),
|
||||
'active_mobile' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
||||
'active_tablet' => 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 function toggleStatusMT($field)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$where = ' WHERE id_shop='.$id_shop." AND id_appagebuilder_details = '".(int)$this->id."'";
|
||||
$where1 = ' WHERE id_appagebuilder_details = "'.(int)$this->id.'"';
|
||||
$result = Db::getInstance()->getRow('SELECT '.$field.' from `'._DB_PREFIX_.'appagebuilder_details_shop` '.$where);
|
||||
$value = $result[$field]==1?0:1;
|
||||
|
||||
if ($value == 1) {
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_details_shop` set '.$field.' = "0" WHERE id_shop="'.$id_shop.'"');
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_details` set '.$field.' = "0"');
|
||||
}
|
||||
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_details_shop` set '.$field.' = "'.$value.'" '.$where);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_details` set '.$field.' = "'.$value.'" '.$where1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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
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-2019 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', 'model');
|
||||
$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
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-2019 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');
|
||||
}
|
||||
$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);
|
||||
|
||||
# FIX - Only get language data valid
|
||||
// $id_langs = Language::getLanguages(true, false, true);
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
148
modules/appagebuilder/classes/ApPageBuilderPositionsModel.php
Normal file
148
modules/appagebuilder/classes/ApPageBuilderPositionsModel.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?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-2019 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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
182
modules/appagebuilder/classes/ApPageBuilderProductsModel.php
Normal file
182
modules/appagebuilder/classes/ApPageBuilderProductsModel.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?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-2019 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;
|
||||
public $active_mobile;
|
||||
public $active_tablet;
|
||||
/**
|
||||
* @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'),
|
||||
'active_mobile' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
|
||||
'active_tablet' => 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 function toggleStatusMT($field)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$where = ' WHERE id_shop='.$id_shop." AND id_appagebuilder_products = '".(int)$this->id."'";
|
||||
$where1 = ' WHERE id_appagebuilder_products = "'.(int)$this->id.'"';
|
||||
$result = Db::getInstance()->getRow('SELECT '.$field.' from `'._DB_PREFIX_.'appagebuilder_products_shop` '.$where);
|
||||
$value = $result[$field]==1?0:1;
|
||||
|
||||
if ($value == 1) {
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_products_shop` set '.$field.' = "0" WHERE id_shop="'.$id_shop.'"');
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_products` set '.$field.' = "0";');
|
||||
}
|
||||
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_products_shop` set '.$field.' = "'.$value.'" '.$where);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_products` set '.$field.' = "'.$value.'" '.$where1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getActive($use_mobile_theme = 0)
|
||||
{
|
||||
$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;
|
||||
if ($use_mobile_theme) {
|
||||
if (Context::getContext()->isMobile()) {
|
||||
$where = ' ps.active_mobile=1 and ps.id_shop='.(int)$id_shop;
|
||||
}
|
||||
if (Context::getContext()->isTablet()) {
|
||||
$where = ' ps.active_tablet=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;
|
||||
$result = Db::getInstance()->getRow($sql);
|
||||
|
||||
if ($use_mobile_theme) {
|
||||
if (!$result && Context::getContext()->isMobile() && Context::getContext()->isTablet()) {
|
||||
$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;
|
||||
$result = Db::getInstance()->getRow($sql);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
523
modules/appagebuilder/classes/ApPageBuilderProfilesModel.php
Normal file
523
modules/appagebuilder/classes/ApPageBuilderProfilesModel.php
Normal file
@@ -0,0 +1,523 @@
|
||||
<?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-2019 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;
|
||||
public $active_mobile;
|
||||
public $active_tablet;
|
||||
/**
|
||||
* @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'),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'shop' => true),
|
||||
'active_mobile' => array('type' => self::TYPE_BOOL, 'shop' => true),
|
||||
'active_tablet' => array('type' => self::TYPE_BOOL, 'shop' => true),
|
||||
'params' => array('type' => self::TYPE_HTML)
|
||||
)
|
||||
);
|
||||
|
||||
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 toggleStatusMT($field)
|
||||
{
|
||||
$id_shop = apPageHelper::getIDShop();
|
||||
$where = ' WHERE id_shop='.$id_shop.' AND id_appagebuilder_profiles = "'.(int)$this->id.'"';
|
||||
$where1 = ' WHERE id_appagebuilder_profiles = "'.(int)$this->id.'"';
|
||||
$result = Db::getInstance()->getRow('SELECT '.$field.' from `'._DB_PREFIX_.'appagebuilder_profiles_shop` '.$where);
|
||||
$value = $result[$field]==1?0:1;
|
||||
|
||||
if ($value == 1) {
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_profiles_shop` set '.$field.' = "0" WHERE id_shop="'.$id_shop.'"');
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_profiles` set '.$field.' = "0"');
|
||||
}
|
||||
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_profiles_shop` set '.$field.' = "'.$value.'" '.$where);
|
||||
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'appagebuilder_profiles` set '.$field.' = "'.$value.'" '.$where1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getAllProfileByShop()
|
||||
{
|
||||
try {
|
||||
$context = Context::getContext();
|
||||
$id_shop = $context->shop->id;
|
||||
$id_lang = $context->language->id;
|
||||
|
||||
$cacheId = 'appagebuilder::getAllProfileByShop_' . md5(
|
||||
(int) $id_shop .
|
||||
(int) $id_lang
|
||||
);
|
||||
|
||||
if (!Cache::isStored($cacheId)) {
|
||||
$sql = 'SELECT p.*, ps.*,pl.*
|
||||
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;
|
||||
$result = Db::getInstance()->executes($sql);
|
||||
Cache::store($cacheId, $result);
|
||||
} else {
|
||||
$result = Cache::retrieve($cacheId);
|
||||
}
|
||||
return $result;
|
||||
} 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 function getProfileById($all_profile, $id_profile)
|
||||
{
|
||||
foreach ($all_profile as $profile) {
|
||||
if ($profile['id_appagebuilder_profiles'] == $id_profile) {
|
||||
return $profile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getActiveProfile($page, $all_profile = array(), $use_mobile_theme = 0)
|
||||
{
|
||||
// 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 = array();
|
||||
|
||||
$context = Context::getContext();
|
||||
$is_use_co = Configuration::get('APPAGEBUILDER_COOKIE_PROFILE');
|
||||
//not apply for mobile view
|
||||
if ($context->isMobile()) {
|
||||
$is_use_co = 0;
|
||||
}
|
||||
|
||||
# ACCESS BY id_appagebuilder_profiles
|
||||
if (Tools::getIsset('id_appagebuilder_profiles') && Tools::getValue('id_appagebuilder_profiles')) {
|
||||
$id_profile = Tools::getValue('id_appagebuilder_profiles');
|
||||
foreach ($all_profile as $profile) {
|
||||
if ($profile['id_appagebuilder_profiles'] == $id_profile) {
|
||||
$result = $profile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# 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)) {
|
||||
foreach ($all_profile as $profile) {
|
||||
if ($profile['friendly_url'] == $linkRewrive) {
|
||||
$result = $profile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//no 1: from cookie
|
||||
if ($is_use_co && $context->cookie->ap_profile) {
|
||||
foreach ($all_profile as $profile) {
|
||||
if ($profile['id_appagebuilder_profiles'] == $context->cookie->ap_profile) {
|
||||
$result = $profile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//no 2: from config in profile by group
|
||||
if (!$result) {
|
||||
# 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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($all_profile 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) {
|
||||
$result = $profile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//no 3 get from active profile and for mobile
|
||||
if (!$result) {
|
||||
$desktop = array();
|
||||
foreach ($all_profile as $profile) {
|
||||
if ($use_mobile_theme && $context->isMobile()) {
|
||||
if ($profile['active_mobile'] == 1) {
|
||||
$result = $profile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($use_mobile_theme && $context->isTablet()) {
|
||||
if ($profile['active_tablet'] == 1) {
|
||||
$result = $profile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($profile['active'] == 1) {
|
||||
$desktop = $profile;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$result) {
|
||||
$result = $desktop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_use_co) {
|
||||
$context->cookie->ap_profile = $result['id_appagebuilder_profiles'];
|
||||
}
|
||||
|
||||
//pass header in url
|
||||
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();
|
||||
}
|
||||
}
|
||||
266
modules/appagebuilder/classes/ApPageBuilderShortcodeModel.php
Normal file
266
modules/appagebuilder/classes/ApPageBuilderShortcodeModel.php
Normal file
@@ -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-2019 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);
|
||||
|
||||
// # FIX - Only get language data valid
|
||||
// $id_langs = Language::getLanguages(true, false, true);
|
||||
// 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();
|
||||
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);
|
||||
}
|
||||
}
|
||||
1405
modules/appagebuilder/classes/ApPageSetting.php
Normal file
1405
modules/appagebuilder/classes/ApPageSetting.php
Normal file
File diff suppressed because it is too large
Load Diff
370
modules/appagebuilder/classes/ApShortCodesBuilder.php
Normal file
370
modules/appagebuilder/classes/ApShortCodesBuilder.php
Normal file
@@ -0,0 +1,370 @@
|
||||
<?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-2019 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\\])?)(\\]?)';
|
||||
}
|
||||
|
||||
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])) {
|
||||
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']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//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 (Language::getLanguages(false) 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
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;
|
||||
635
modules/appagebuilder/classes/shortcodes.php
Normal file
635
modules/appagebuilder/classes/shortcodes.php
Normal file
@@ -0,0 +1,635 @@
|
||||
<?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-2019 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 == 'ApAjaxTabs' || $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
|
||||
// Run at Backend + Frontend. Test with ApGmap Widget
|
||||
$translator = Context::getContext()->getTranslator();
|
||||
}
|
||||
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 {
|
||||
# TRANSLATE FOR MODULE - CALL MODULE
|
||||
// return Module::getInstanceByName('APPageBuilder')->l($string, $specific);
|
||||
|
||||
# TRANSLATE FOR MODULE - CALL CORE
|
||||
// return TranslateCore::getModuleTranslation($this->module_name, $string, ($specific) ? $specific : $this->module_name);
|
||||
|
||||
# TRANSLATE FOR WIDGET
|
||||
$str = TranslateCore::getModuleTranslation($this->module_name, $string, $this->name);
|
||||
|
||||
if (Tools::getIsset('controller') && (Tools::getValue('controller') == 'AdminApPageBuilderHome' || Tools::getValue('controller') == 'AdminApPageBuilderShortcode')) {
|
||||
# FIX TRANSLATE FRANCE HAS ' -> error JS
|
||||
$str = str_replace('\'', ' ', $str);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
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']) {
|
||||
$config_val[$config['name']] = array();
|
||||
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 '';
|
||||
}
|
||||
$device = Context::getContext()->getDevice();
|
||||
if (($device == 1 && isset($atts['active_desktop']) && !$atts['active_desktop']) || ($device == 2 && isset($atts['active_tablet']) && !$atts['active_tablet']) ||($device == 4 && isset($atts['active_mobile']) && !$atts['active_mobile'])) {
|
||||
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 {
|
||||
$ids = explode(',', $atts['controller_id']);
|
||||
$ids = array_map('trim', $ids);
|
||||
|
||||
if ($atts['specific_type'] == 'nocategory') {
|
||||
if ($current_page == 'category') {
|
||||
if (ApPageSetting::getControllerId($current_page, $ids)) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
} elseif ($atts['specific_type'] == 'nocategoryproduct') {
|
||||
if ($current_page == 'category') {
|
||||
if (ApPageSetting::getControllerId($current_page, $ids)) {
|
||||
return '';
|
||||
}
|
||||
} else if ($current_page == 'product') {
|
||||
$procate = Product::getProductCategoriesFull(Tools::getValue('id_product'));
|
||||
$procheck = 0;
|
||||
foreach ($procate as $proc) {
|
||||
if (in_array($proc['id_category'], $ids)) {
|
||||
$procheck = 1;
|
||||
}
|
||||
}
|
||||
if ($procheck == 1) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
} elseif ($atts['specific_type'] == 'categoryproduct') {
|
||||
if ($current_page == 'category') {
|
||||
if (!ApPageSetting::getControllerId($current_page, $ids)) {
|
||||
return '';
|
||||
}
|
||||
} else if ($current_page == 'product') {
|
||||
$procate = Product::getProductCategoriesFull(Tools::getValue('id_product'));
|
||||
$procheck = 0;
|
||||
foreach ($procate as $proc) {
|
||||
if (in_array($proc['id_category'], $ids)) {
|
||||
$procheck = 1;
|
||||
}
|
||||
}
|
||||
if ($procheck == 0) {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} elseif ($atts['specific_type'] == 'categoryproductmain') {
|
||||
if ($current_page == 'category') {
|
||||
if (!ApPageSetting::getControllerId($current_page, $ids)) {
|
||||
return '';
|
||||
}
|
||||
} else if ($current_page == 'product') {
|
||||
$proc = new Product(Tools::getValue('id_product'));
|
||||
if (!in_array($proc->id_category_default, $ids)) {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
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) Context::getContext()->language->id);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
222
modules/appagebuilder/classes/shortcodes/ApAccordions.php
Normal file
222
modules/appagebuilder/classes/shortcodes/ApAccordions.php
Normal file
@@ -0,0 +1,222 @@
|
||||
<?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-2019 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';
|
||||
$assign['isWrapper'] = 0;
|
||||
} 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');
|
||||
}
|
||||
}
|
||||
459
modules/appagebuilder/classes/shortcodes/ApAjaxTabs.php
Normal file
459
modules/appagebuilder/classes/shortcodes/ApAjaxTabs.php
Normal file
@@ -0,0 +1,459 @@
|
||||
<?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-2019 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApAjaxTabs extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApAjaxTabs';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Ajax Tabs'), 'position' => 4,
|
||||
'desc' => $this->l('You can put widget in tab content will load in ajax'),
|
||||
'icon_class' => 'icon-html5', 'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList($sub_tab = 0)
|
||||
{
|
||||
$selected_categories = array();
|
||||
if (Tools::getIsset('categorybox')) {
|
||||
$category_box = Tools::getValue('categorybox');
|
||||
$selected_categories = explode(',', $category_box);
|
||||
}
|
||||
$id_root_category = Context::getContext()->shop->getCategory();
|
||||
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' => 'select',
|
||||
'label' => $this->l('Display Tab Title In Mobile'),
|
||||
'name' => 'tab_mobile_type',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'default',
|
||||
'name' => $this->l('Default Like Desktop'),
|
||||
),
|
||||
array(
|
||||
'id' => 'tabs-dropdown',
|
||||
'name' => $this->l('Dropdown'),
|
||||
),
|
||||
array(
|
||||
'id' => 'tabs-accordion',
|
||||
'name' => $this->l('Accordion'),
|
||||
)
|
||||
),
|
||||
'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(),
|
||||
),
|
||||
array(
|
||||
'type' => 'categories',
|
||||
'label' => $this->l('Select Category to show filter in tab (only run if tab content is product list)'),
|
||||
'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',
|
||||
),
|
||||
);
|
||||
}
|
||||
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 == 'ApAjaxTab') {
|
||||
$assign['tabID'] = $atts['id'];
|
||||
$assign['isSubTab'] = 1;
|
||||
$w_info['name'] = 'ApAjaxTab';
|
||||
} else {
|
||||
preg_match_all('/ApAjaxTab 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 = '/ApAjaxTab 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 = '/ApAjaxTab 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 = isset($matches3[6][$i][0]) ? $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,
|
||||
'count' => $i,
|
||||
);
|
||||
}
|
||||
$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 '';
|
||||
}
|
||||
if (isset($atts['tab_mobile_type']) && $atts['tab_mobile_type'] == 'tabs-accordion') {
|
||||
if (!Configuration::get('APPAGEBUILDER_LOAD_TABCOLLAPSE')) {
|
||||
$atts['lib_has_error'] = true;
|
||||
$atts['lib_error'] = 'You are using function convert Tab to Accordion in Mobile. Please enable to load this Library';
|
||||
}
|
||||
}
|
||||
|
||||
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 == 'ApAjaxTabs') {
|
||||
// ApAjaxTabs
|
||||
$assign['tab_name'] = 'ApAjaxTabs';
|
||||
preg_match_all('/ApAjaxTab 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 = '/ApAjaxTab 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 = '/ApAjaxTab 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 = isset($matches3[6][$i][0]) ? $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,
|
||||
'nghia' => $i
|
||||
);
|
||||
}
|
||||
if (isset($atts['active_tab']) && $atts['active_tab'] != '') {
|
||||
$tab_count = substr_count($content, '[ApAjaxTab');
|
||||
$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'] : '');
|
||||
$module = APPageBuilder::getInstance();
|
||||
|
||||
if (isset($atts['categorybox']) && $atts['categorybox']) {
|
||||
$atts['categorylist'] = $module->getCategories($atts['categorybox']);
|
||||
}
|
||||
$assign['formAtts'] = $atts;
|
||||
$assign['path'] = apPageHelper::getImgThemeUrl();
|
||||
$array = explode('[ApAjaxTab', $content);
|
||||
for ($i=1; $i<count($array); $i++) {
|
||||
if (($i-1) == $atts['active_tab']) {
|
||||
$array[$i] = ' active=1'.$array[$i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$content = implode('[ApAjaxTab', $array);
|
||||
$assign['apContent'] = ApShortCodesBuilder::doShortcode($content);
|
||||
return $module->fontContent($assign, $this->name.'.tpl');
|
||||
} else {
|
||||
// ApAjaxTab
|
||||
$assign['tabID'] = $atts['id'];
|
||||
$assign['tab_name'] = 'ApAjaxTab';
|
||||
$assign['isSubTab'] = 1;
|
||||
|
||||
$assign['formAtts'] = $atts;
|
||||
$assign['formAtts']['content'] = $content;
|
||||
$module = APPageBuilder::getInstance();
|
||||
if (isset($atts['active']) && $atts['active']) {
|
||||
$assign['apshortcode'] = urlencode($content);
|
||||
$assign['path'] = apPageHelper::getImgThemeUrl();
|
||||
$assign['apContent'] = ApShortCodesBuilder::doShortcode($content);
|
||||
} else {
|
||||
$assign['apContent'] = urlencode($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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
99
modules/appagebuilder/classes/shortcodes/ApAlert.php
Normal file
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-2019 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;
|
||||
}
|
||||
}
|
||||
1030
modules/appagebuilder/classes/shortcodes/ApBlockCarousel.php
Normal file
1030
modules/appagebuilder/classes/shortcodes/ApBlockCarousel.php
Normal file
File diff suppressed because it is too large
Load Diff
479
modules/appagebuilder/classes/shortcodes/ApBlockLink.php
Normal file
479
modules/appagebuilder/classes/shortcodes/ApBlockLink.php
Normal file
@@ -0,0 +1,479 @@
|
||||
<?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-2019 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':
|
||||
if (isset($formAtts['category_id'.$index]) && $formAtts['category_id'.$index]) {
|
||||
$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':
|
||||
if (isset($assign['formAtts']['manufacture_id'.$index]) && $assign['formAtts']['manufacture_id'.$index]) {
|
||||
$manufacture = new Manufacturer($assign['formAtts']['manufacture_id'.$index], 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':
|
||||
if (isset($formAtts['cmspage_id'.$index]) && $formAtts['cmspage_id'.$index]) {
|
||||
$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
1158
modules/appagebuilder/classes/shortcodes/ApBlog.php
Normal file
File diff suppressed because it is too large
Load Diff
250
modules/appagebuilder/classes/shortcodes/ApButton.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-2019 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
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'] = ((strpos($images[$current_category[0]['id_category']], '/') !== false)?'':$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'] = ((strpos($images[$item['id_category']], '/') !== false)?'':$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;
|
||||
}
|
||||
}
|
||||
295
modules/appagebuilder/classes/shortcodes/ApColumn.php
Normal file
295
modules/appagebuilder/classes/shortcodes/ApColumn.php
Normal file
@@ -0,0 +1,295 @@
|
||||
<?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-2019 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' => 'nocategory',
|
||||
'name' => $this->l('Category: Not Display In Category list'),
|
||||
),
|
||||
array(
|
||||
'id' => 'nocategoryproduct',
|
||||
'name' => $this->l('Category: Not Display In Category list and product of it'),
|
||||
),
|
||||
array(
|
||||
'id' => 'category',
|
||||
'name' => $this->l('Category: Display only Category list'),
|
||||
),
|
||||
array(
|
||||
'id' => 'categoryproduct',
|
||||
'name' => $this->l('Category: Display only Category list and product of Category'),
|
||||
),
|
||||
array(
|
||||
'id' => 'categoryproductmain',
|
||||
'name' => $this->l('Category: Display only Category list and product of Main 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-nocategory specific_type-nocategoryproduct specific_type-categoryproduct specific_type-categoryproductmain 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
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-2019 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;
|
||||
}
|
||||
}
|
||||
275
modules/appagebuilder/classes/shortcodes/ApCounter.php
Normal file
275
modules/appagebuilder/classes/shortcodes/ApCounter.php
Normal file
@@ -0,0 +1,275 @@
|
||||
<?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-2019 Apollotheme
|
||||
* @license http://apollotheme.com - prestashop template provider
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
# module validation
|
||||
exit;
|
||||
}
|
||||
|
||||
class ApCounter extends ApShortCodeBase
|
||||
{
|
||||
public $name = 'ApCounter';
|
||||
public $for_module = 'manage';
|
||||
|
||||
public function getInfo()
|
||||
{
|
||||
return array('label' => $this->l('Counter'),
|
||||
'position' => 5,
|
||||
'desc' => $this->l('Show Counter Box'),
|
||||
'icon_class' => 'icon icon-list',
|
||||
'tag' => 'content');
|
||||
}
|
||||
|
||||
public function getConfigList()
|
||||
{
|
||||
$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' => 'leoalert',
|
||||
'name' => 'alertloadjs',
|
||||
'html_text' => $this->l('You have to turn on script numscroller-1.0 for Counter in back-office > ApPageBuilder > Ap Module Configuration'),
|
||||
'href' => 'index.php?controller=AdminModules&configure=appagebuilder&token='.Tools::getAdminTokenLite('AdminModules').'#APPAGEBUILDER_LOAD_IMAGEHOTPOT_on',
|
||||
'show' => !Configuration::get('APPAGEBUILDER_LOAD_NUMSCROLLER'),
|
||||
),
|
||||
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 Counter').'";
|
||||
var duplicate_button_text = "'.$this->l('Duplicate Counter').'";
|
||||
</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' => 'counterbox',
|
||||
'name' => 'title',
|
||||
'lang' => 'true',
|
||||
'label' => $this->l('Title'),
|
||||
'default' => '',
|
||||
'form_group_class' => 'hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'widget_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' => 'widget_class',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Title'),
|
||||
'name' => 'link_title',
|
||||
'lang' => true,
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'min',
|
||||
'label' => $this->l('Starting Number'),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => '1',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'max',
|
||||
'label' => $this->l('Ending Number'),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => '10000',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'increment',
|
||||
'label' => $this->l('Increment Number'),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => '50',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'delay',
|
||||
'label' => $this->l('Delay Time'),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => '3',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'number_suffix',
|
||||
'label' => $this->l('Number Suffix'),
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => '+',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'textarea',
|
||||
'name' => 'bootom_html',
|
||||
'label' => $this->l('Counter Bootom Html'),
|
||||
'lang' => true,
|
||||
'values' => '',
|
||||
'autoload_rte' => false,
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'counterclass',
|
||||
'label' => $this->l('CSS Class'),
|
||||
'default' => '',
|
||||
'class' => 'tmp',
|
||||
'form_group_class' => 'parent-tmp hidden',
|
||||
),
|
||||
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 Counte').'</button>',
|
||||
'form_group_class' => 'frm-add-new-link',
|
||||
),
|
||||
);
|
||||
|
||||
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);
|
||||
if (!Configuration::get('APPAGEBUILDER_LOAD_NUMSCROLLER')) {
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Please enable Numscroller-1.0 for Counter.';
|
||||
return $assign;
|
||||
}
|
||||
$formAtts = $assign['formAtts'];
|
||||
$formAtts['links'] = array();
|
||||
|
||||
if (!isset($formAtts['list_id_link'])) {
|
||||
$assign['formAtts']['lib_has_error'] = true;
|
||||
$assign['formAtts']['lib_error'] = 'Dont have any counter. Please create new';
|
||||
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();
|
||||
$link['link_title'] = (isset($formAtts['link_title'.$indexlang]) && $formAtts['link_title'.$indexlang]) ? $formAtts['link_title'.$indexlang] : '';
|
||||
$link['bootom_html'] = (isset($formAtts['bootom_html'.$indexlang]) && $formAtts['bootom_html'.$indexlang]) ? $formAtts['bootom_html'.$indexlang] : '';
|
||||
$link['min'] = $formAtts['min'.$index];
|
||||
$link['max'] = $formAtts['max'.$index];
|
||||
$link['delay'] = $formAtts['delay'.$index];
|
||||
$link['increment'] = $formAtts['increment'.$index];
|
||||
$link['number_suffix'] = str_replace($this->str_search, $this->str_relace_html, $formAtts['number_suffix'.$index]);
|
||||
$link['counterclass'] = isset($formAtts['counterclass'.$index])?$formAtts['counterclass'.$index]:'';
|
||||
$formAtts['links'][] = $link;
|
||||
}
|
||||
$assign['formAtts']['links'] = $formAtts['links'];
|
||||
return $assign;
|
||||
}
|
||||
}
|
||||
183
modules/appagebuilder/classes/shortcodes/ApFacebook.php
Normal file
183
modules/appagebuilder/classes/shortcodes/ApFacebook.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?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-2019 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' => 'text',
|
||||
'name' => 'fb_lang',
|
||||
'label' => $this->l('Facebook_Lang'),
|
||||
'desc' => $this->l('"en_US"'),
|
||||
'lang' => true,
|
||||
'form_group_class' => 'aprow_general',
|
||||
'default' => 'en_US'
|
||||
),
|
||||
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/leotheme',
|
||||
),
|
||||
// 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' => 'text',
|
||||
'label' => $this->l('Tabs'),
|
||||
'name' => 'tabs',
|
||||
'desc' => 'The tabs will display: <b>timeline</b>, <b>events</b>, <b>messages</b>.
|
||||
Use a comma separated list to add multiple tabs, ie: <b>timeline</b>, <b>events</b>.',
|
||||
'default' => 'timeline',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Hide Cover'),
|
||||
'name' => 'hide_cover',
|
||||
'desc' => 'Hide cover photo in title.',
|
||||
'values' => $soption,
|
||||
'default' => '0',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Show Facepile'),
|
||||
'name' => 'show_facepile',
|
||||
'desc' => 'Show avatars when friends like this.',
|
||||
'values' => $soption,
|
||||
'default' => '1',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Hide Cta'),
|
||||
'name' => 'hide_cta',
|
||||
'desc' => 'Hide custom call to action button (if applicable).',
|
||||
'values' => $soption,
|
||||
'default' => '0',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Small Header'),
|
||||
'name' => 'small_header',
|
||||
'desc' => 'Use small titles instead.',
|
||||
'values' => $soption,
|
||||
'default' => '0',
|
||||
),
|
||||
array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->l('Adapt Container Width'),
|
||||
'name' => 'adapt_container_width',
|
||||
'desc' => 'Try to adjust to the container width.',
|
||||
'values' => $soption,
|
||||
'default' => '1',
|
||||
),
|
||||
// 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
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-2019 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;
|
||||
}
|
||||
}
|
||||
268
modules/appagebuilder/classes/shortcodes/ApFullSlider.php
Normal file
268
modules/appagebuilder/classes/shortcodes/ApFullSlider.php
Normal file
@@ -0,0 +1,268 @@
|
||||
<?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-2019 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('Put image link (https)'),
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'temp_image_link',
|
||||
'lang' => true,
|
||||
'desc' => 'If you select image bellow, This field will auto overrired',
|
||||
'form_group_class' => 'apfullslider-row image_link-slide'
|
||||
),
|
||||
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', 'image_link', '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['image_link'] = isset($assign['formAtts']['image_link_'.$temp]) ? $assign['formAtts']['image_link_'.$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
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-2019 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 ".apPageHelper::getThemeName().'/'.$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, apPageHelper::getLicenceTPL().$value);
|
||||
}
|
||||
}
|
||||
289
modules/appagebuilder/classes/shortcodes/ApGmap.php
Normal file
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-2019 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 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
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-2019 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;
|
||||
}
|
||||
}
|
||||
188
modules/appagebuilder/classes/shortcodes/ApImage.php
Normal file
188
modules/appagebuilder/classes/shortcodes/ApImage.php
Normal file
@@ -0,0 +1,188 @@
|
||||
<?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-2019 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('Put image link (https)'),
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'image_link',
|
||||
'lang' => true,
|
||||
'desc' => 'If you select image bellow, This field will auto overrired'
|
||||
),
|
||||
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;
|
||||
}
|
||||
}
|
||||
333
modules/appagebuilder/classes/shortcodes/ApImage360.php
Normal file
333
modules/appagebuilder/classes/shortcodes/ApImage360.php
Normal file
@@ -0,0 +1,333 @@
|
||||
<?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-2019 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' => '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' => '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('Reverse rotation on X-axis'),
|
||||
'name' => 'reverse_column',
|
||||
'is_bool' => true,
|
||||
'values' => ApPageSetting::returnYesNo(),
|
||||
'default' => 0,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'message',
|
||||
'label' => $this->l('Message under image'),
|
||||
'default' => 'Drag image to spin',
|
||||
'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' => 'hidden',
|
||||
'name' => 'total_slider',
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'label' => $this->l('Image Url (not image base 64 code)'),
|
||||
'type' => 'image_url_360',
|
||||
'name' => 'image_url_360',
|
||||
'lang' => false,
|
||||
'class' => 'image_url_360',
|
||||
'show_image' => false,
|
||||
),
|
||||
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 Magic360 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;
|
||||
}
|
||||
}
|
||||
233
modules/appagebuilder/classes/shortcodes/ApImageGallery.php
Normal file
233
modules/appagebuilder/classes/shortcodes/ApImageGallery.php
Normal file
@@ -0,0 +1,233 @@
|
||||
<?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-2019 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/'.apPageHelper::getThemeName().'/assets/img/modules/appagebuilder/images/yourFolderImage';
|
||||
$path = 'themes/'.apPageHelper::getThemeName().'/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('', null, 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-2019 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;
|
||||
}
|
||||
}
|
||||
537
modules/appagebuilder/classes/shortcodes/ApImageHotspot.php
Normal file
537
modules/appagebuilder/classes/shortcodes/ApImageHotspot.php
Normal file
@@ -0,0 +1,537 @@
|
||||
<?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-2019 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_link' , '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('Put image link (https)'),
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'image_link',
|
||||
'lang' => true,
|
||||
'desc' => 'If you select image bellow, This field will auto overrired'
|
||||
),
|
||||
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('Put image link (https)'),
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'name' => 'temp_image_link',
|
||||
'lang' => true,
|
||||
'desc' => 'If you select image bellow, This field will auto overrired',
|
||||
'form_group_class' => 'row-level2 image_link-slide'
|
||||
),
|
||||
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'),
|
||||
),
|
||||
array(
|
||||
'id' => 'normal',
|
||||
'name' => $this->l('Normal'),
|
||||
),
|
||||
),
|
||||
'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' => '10',
|
||||
'class' => 'input-level2 temp_top',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'name' => 'temp_left',
|
||||
'label' => $this->l('Hotpot Left'),
|
||||
'lang' => false,
|
||||
'default' => '10',
|
||||
'class' => 'input-level2 temp_left',
|
||||
'form_group_class' => 'row-level2',
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'name' => 'temp_hpcolor',
|
||||
'label' => $this->l('Hotpot Color'),
|
||||
'lang' => false,
|
||||
'default' => '#000',
|
||||
'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' => '0px',
|
||||
'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;
|
||||
}
|
||||
}
|
||||
576
modules/appagebuilder/classes/shortcodes/ApInstagram.php
Normal file
576
modules/appagebuilder/classes/shortcodes/ApInstagram.php
Normal file
@@ -0,0 +1,576 @@
|
||||
<?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-2019 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' => '150',
|
||||
// 'label' => $this->l('150x150')
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => '200',
|
||||
// 'label' => $this->l('200x200')
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => '306',
|
||||
// 'label' => $this->l('306x306'),
|
||||
// ),
|
||||
// array(
|
||||
// 'id' => '612',
|
||||
// 'label' => $this->l('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(''),
|
||||
'default' => '',
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'default_html',
|
||||
'html_content' => '
|
||||
<a href="javascript:void(0);" id="leotheme_token_demo">Token Leotheme Demo</a>
|
||||
-
|
||||
<a target="_blank" href="https://demo1.leotheme.com/instagram.php?get_token=1&html=1" >Link</a>
|
||||
<br /><a target="_blank" href="https://www.youtube.com/watch?v=rWUcb8jXgVA">Youtube - How to get access token</a>
|
||||
<br /><a target="_blank" href="https://www.instagram.com/developer/">Instagram Developer</a>
|
||||
<br /><a target="_blank" href="https://developers.facebook.com/apps/">Facebook Developer</a>
|
||||
|
||||
',
|
||||
),
|
||||
// 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' => '150',
|
||||
// ),
|
||||
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-2019 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('Number of item per row of page. 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('Number of column when scroll in slide. 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;
|
||||
}
|
||||
}
|
||||
177
modules/appagebuilder/classes/shortcodes/ApMegamenu.php
Normal file
177
modules/appagebuilder/classes/shortcodes/ApMegamenu.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?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-2019 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')) {
|
||||
include_once(_PS_MODULE_DIR_.'leobootstrapmenu/leobootstrapmenu.php');
|
||||
$module = new Leobootstrapmenu();
|
||||
$id_shop = (int)Context::getContext()->shop->id;
|
||||
$assign['formAtts']['isEnabled'] = true;
|
||||
|
||||
$link_array = explode(',', $assign['formAtts']['megamenu_group']);
|
||||
if ($link_array && !is_numeric($link_array['0'])) {
|
||||
if (method_exists("BtmegamenuGroup", "cacheGroupsByFields")) {
|
||||
$result = array();
|
||||
|
||||
foreach ($link_array as $val) {
|
||||
//my module call this function from menu and we import it
|
||||
$temp = BtmegamenuGroup::cacheGroupsByFields(array('randkey' => $val));
|
||||
|
||||
if ($temp) {
|
||||
$result[] = $temp;
|
||||
}
|
||||
}
|
||||
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 $group) {
|
||||
// validate module
|
||||
$where .= ($where == '') ? $group['id_btmegamenu_group'] : ','.$group['id_btmegamenu_group'];
|
||||
$where .= ',0';
|
||||
}
|
||||
$assign['formAtts']['megamenu_group'] = $where;
|
||||
} else {
|
||||
//fix for old version of leo bootrap menu
|
||||
$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
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-2019 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
|
||||
}
|
||||
}
|
||||
1183
modules/appagebuilder/classes/shortcodes/ApProductCarousel.php
Normal file
1183
modules/appagebuilder/classes/shortcodes/ApProductCarousel.php
Normal file
File diff suppressed because it is too large
Load Diff
536
modules/appagebuilder/classes/shortcodes/ApProductList.php
Normal file
536
modules/appagebuilder/classes/shortcodes/ApProductList.php
Normal file
@@ -0,0 +1,536 @@
|
||||
<?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-2019 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;
|
||||
$form_atts['get_total'] = true;
|
||||
$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));
|
||||
|
||||
$products = array();
|
||||
if ($p <= $total_page) {
|
||||
$form_atts['get_total'] = false;
|
||||
$products = $module->getProductsFont($form_atts);
|
||||
$products = $this->loadProductDetail($products, $module);
|
||||
}
|
||||
|
||||
if (isset($assign['formAtts']['use_showmore']) && $assign['formAtts']['use_showmore']) {
|
||||
if ($p < $total_page) {
|
||||
$assign['formAtts']['use_showmore'] = 1;
|
||||
} else {
|
||||
$assign['formAtts']['use_showmore'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$assign['scolumn'] = $form_atts['columns'];
|
||||
$assign['products'] = $products;
|
||||
$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;
|
||||
|
||||
// FIX AJAX SHOW_MORE NOT GET PRODUCT_ID
|
||||
$input2 = Tools::jsonDecode(call_user_func('base64'.'_decode', Tools::getValue('config')), true);
|
||||
if (is_array($input2) && $input2) {
|
||||
$params = array_merge($input2, $params);
|
||||
}
|
||||
|
||||
|
||||
$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 = apPageHelper::getThemeName();
|
||||
$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 = array();
|
||||
$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 (version_compare(_PS_VERSION_, '1.7.7.0', '<') && 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
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-2019 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
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-2019 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
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-2019 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;
|
||||
}
|
||||
}
|
||||
790
modules/appagebuilder/classes/shortcodes/ApRow.php
Normal file
790
modules/appagebuilder/classes/shortcodes/ApRow.php
Normal file
@@ -0,0 +1,790 @@
|
||||
<?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-2019 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 $profile_param = array();
|
||||
|
||||
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',
|
||||
'desc' => $this->l('If your layout is boxed select background is boxed to run parallax.'),
|
||||
),
|
||||
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/',
|
||||
'img_link' => _THEMES_DIR_.apPageHelper::getThemeName().'/assets/img/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' => 'nocategory',
|
||||
'name' => $this->l('Category: Not Display In Category list'),
|
||||
),
|
||||
array(
|
||||
'id' => 'nocategoryproduct',
|
||||
'name' => $this->l('Category: Not Display In Category list and product of it'),
|
||||
),
|
||||
array(
|
||||
'id' => 'category',
|
||||
'name' => $this->l('Category: Display only Category list'),
|
||||
),
|
||||
array(
|
||||
'id' => 'categoryproduct',
|
||||
'name' => $this->l('Category: Display only Category list and product of Category'),
|
||||
),
|
||||
array(
|
||||
'id' => 'categoryproductmain',
|
||||
'name' => $this->l('Category: Display only Category list and product of Main 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-nocategory specific_type-nocategoryproduct specific_type-categoryproduct specific_type-categoryproductmain 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'] = _THEMES_DIR_.apPageHelper::getThemeName().'/assets/img/modules/'.$this->module_name.'/images/'.$form_atts['bg_img'];
|
||||
} else {
|
||||
$form_atts['bg_img'] = str_replace(apPageHelper::getStrSearch(), apPageHelper::getStrReplace(), $form_atts['bg_img']);
|
||||
}
|
||||
$form_atts['bg_img'] = $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_img']) && $form_atts['bg_img'] && 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_img']) && $form_atts['bg_img'] && 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['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);
|
||||
//not call this function in shortcode
|
||||
if ($this->profile_param) {
|
||||
$this->checkFullwidth($assign);
|
||||
}
|
||||
|
||||
|
||||
return $assign;
|
||||
}
|
||||
|
||||
//delete model return already value
|
||||
public function checkFullwidth(&$assign)
|
||||
{
|
||||
$page_name = apPageHelper::getPageName();
|
||||
$hook_name = ApShortCodesBuilder::$hook_name;
|
||||
|
||||
if ($page_name == 'index') {
|
||||
$hooks = $this->profile_param['fullwidth_index_hook'];
|
||||
} else {
|
||||
$hooks = $this->profile_param['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');
|
||||
return isset($this->profile_param['fullwidth_index_hook'][$hook_name]) ? $this->profile_param['fullwidth_index_hook'][$hook_name] : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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') {
|
||||
if (isset($form_atts['bg_img']) && $form_atts['bg_img'] && !Configuration::get('APPAGEBUILDER_LOAD_LAZY')) {
|
||||
$style .= 'background:url('.$form_atts['bg_img'].')'.$form_atts['bg_data'].';';
|
||||
} else {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
183
modules/appagebuilder/classes/shortcodes/ApSlideShow.php
Normal file
183
modules/appagebuilder/classes/shortcodes/ApSlideShow.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?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-2019 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' => 'select',
|
||||
'label' => $this->l('Select a group for slideshow on tablet'),
|
||||
'name' => 'slideshow_group_tablet',
|
||||
'options' => array(
|
||||
'query' => $this->getListGroup($list),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'form_group_class' => 'value_by_categories',
|
||||
'default' => 'all'
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->l('Select a group for slideshow on mobile'),
|
||||
'name' => 'slideshow_group_mobile',
|
||||
'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();
|
||||
|
||||
if (Context::getContext()->isTablet()) {
|
||||
$link_array = explode(',', $assign['formAtts']['slideshow_group_tablet']);
|
||||
} elseif (Context::getContext()->isMobile()) {
|
||||
$link_array = explode(',', $assign['formAtts']['slideshow_group_mobile']);
|
||||
} else {
|
||||
$link_array = explode(',', $assign['formAtts']['slideshow_group']);
|
||||
}
|
||||
if ($link_array[0] == '') {
|
||||
$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'];
|
||||
}
|
||||
if (Context::getContext()->isTablet()) {
|
||||
$assign['formAtts']['slideshow_group_tablet'] = $where;
|
||||
$assign['content_slider'] = $module->processHookCallBack($assign['formAtts']['slideshow_group_tablet']);
|
||||
} elseif (Context::getContext()->isMobile()) {
|
||||
$assign['formAtts']['slideshow_group_mobile'] = $where;
|
||||
$assign['content_slider'] = $module->processHookCallBack($assign['formAtts']['slideshow_group_mobile']);
|
||||
} else {
|
||||
$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
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-2019 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;
|
||||
}
|
||||
}
|
||||
419
modules/appagebuilder/classes/shortcodes/ApTabs.php
Normal file
419
modules/appagebuilder/classes/shortcodes/ApTabs.php
Normal file
@@ -0,0 +1,419 @@
|
||||
<?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-2019 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' => 'select',
|
||||
'label' => $this->l('Display Tab Title In Mobile'),
|
||||
'name' => 'tab_mobile_type',
|
||||
'options' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'default',
|
||||
'name' => $this->l('Default Like Desktop'),
|
||||
),
|
||||
array(
|
||||
'id' => 'tabs-dropdown',
|
||||
'name' => $this->l('Dropdown'),
|
||||
),
|
||||
array(
|
||||
'id' => 'tabs-accordion',
|
||||
'name' => $this->l('Accordion'),
|
||||
)
|
||||
),
|
||||
'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 = isset($matches3[6][$i][0]) ? $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 '';
|
||||
}
|
||||
if (isset($atts['tab_mobile_type']) && $atts['tab_mobile_type'] == 'tabs-accordion') {
|
||||
if (!Configuration::get('APPAGEBUILDER_LOAD_TABCOLLAPSE')) {
|
||||
$atts['lib_has_error'] = true;
|
||||
$atts['lib_error'] = 'You are using function convert Tab to Accordion in Mobile. Please enable to load this Library';
|
||||
}
|
||||
}
|
||||
|
||||
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 = isset($matches3[6][$i][0]) ? $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,
|
||||
'count' => $i,
|
||||
);
|
||||
}
|
||||
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
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-2019 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
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-2019 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;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user