add module test
This commit is contained in:
parent
3027ce71f1
commit
2f9c8bc908
@ -1 +0,0 @@
|
||||
Subproject commit f19b15ea286e226363eadcbffac244b2125346ca
|
4
modules/blockadvertising/CHANGELOG.txt
Normal file
4
modules/blockadvertising/CHANGELOG.txt
Normal file
@ -0,0 +1,4 @@
|
||||
2014-04-22 18:56:48 +0200 // Changelog updated
|
||||
2014-04-15 17:23:48 +0200 [*] MO : blockadvertising - Changed the way images are stocked to avoid overwrite on update
|
||||
2014-03-24 10:44:25 +0100 // MO BlockAdvertising : ps_versions_compliancy added
|
||||
2014-03-20 14:19:12 +0100 Initial commit
|
37
modules/blockadvertising/Readme.md
Normal file
37
modules/blockadvertising/Readme.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Advertising block
|
||||
|
||||
## About
|
||||
|
||||
Adds an advertisement block to selected sections of your e-commerce website.
|
||||
|
||||
## Contributing
|
||||
|
||||
PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
|
||||
|
||||
### Requirements
|
||||
|
||||
Contributors **must** follow the following rules:
|
||||
|
||||
* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
|
||||
* Do not update the module's version number.
|
||||
* Follow [the coding standards][1].
|
||||
|
||||
### Process in details
|
||||
|
||||
Contributors wishing to edit a module's files should follow the following process:
|
||||
|
||||
1. Create your GitHub account, if you do not have one already.
|
||||
2. Fork the blockadvertising project to your GitHub account.
|
||||
3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
|
||||
4. Create a branch in your local clone of the module for your changes.
|
||||
5. Change the files in your branch. Be sure to follow [the coding standards][1]!
|
||||
6. Push your changed branch to your fork in your GitHub account.
|
||||
7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
|
||||
8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
|
||||
|
||||
That's it: you have contributed to this open-source project! Congratulations!
|
||||
|
||||
[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
|
||||
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
|
||||
[3]: https://help.github.com/articles/using-pull-requests
|
||||
|
292
modules/blockadvertising/blockadvertising.php
Normal file
292
modules/blockadvertising/blockadvertising.php
Normal file
@ -0,0 +1,292 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 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-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class BlockAdvertising extends Module
|
||||
{
|
||||
/* Title associated to the image */
|
||||
public $adv_title;
|
||||
|
||||
/* Link associated to the image */
|
||||
public $adv_link;
|
||||
|
||||
/* Name of the image without extension */
|
||||
public $adv_imgname;
|
||||
|
||||
/* Image path with extension */
|
||||
public $adv_img;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'blockadvertising';
|
||||
$this->tab = 'advertising_marketing';
|
||||
$this->version = '0.9.3';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Advertising block');
|
||||
$this->description = $this->l('Adds an advertisement block to selected sections of your e-commerce website.');
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
|
||||
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the properties of the module, like the link to the image and the title (contextual to the current shop context)
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
$this->adv_imgname = 'advertising';
|
||||
if ((Shop::getContext() == Shop::CONTEXT_GROUP || Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
&& file_exists(_PS_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'-g'.$this->context->shop->getContextShopGroupID().'.'.Configuration::get('BLOCKADVERT_IMG_EXT'))
|
||||
)
|
||||
$this->adv_imgname .= '-g'.$this->context->shop->getContextShopGroupID();
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP
|
||||
&& file_exists(_PS_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'-s'.$this->context->shop->getContextShopID().'.'.Configuration::get('BLOCKADVERT_IMG_EXT'))
|
||||
)
|
||||
$this->adv_imgname .= '-s'.$this->context->shop->getContextShopID();
|
||||
|
||||
// If none of them available go default
|
||||
if ($this->adv_imgname == 'advertising')
|
||||
$this->adv_img = Tools::getMediaServer($this->name)._MODULE_DIR_.$this->name.'/img/fixtures/'.$this->adv_imgname.'.jpg';
|
||||
else
|
||||
$this->adv_img = Tools::getMediaServer($this->name)._MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT');
|
||||
$this->adv_link = htmlentities(Configuration::get('BLOCKADVERT_LINK'), ENT_QUOTES, 'UTF-8');
|
||||
$this->adv_title = htmlentities(Configuration::get('BLOCKADVERT_TITLE'), ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install())
|
||||
return false;
|
||||
|
||||
// Hook the module either on the left or right column
|
||||
$theme = new Theme(Context::getContext()->shop->id_theme);
|
||||
if ((!$theme->default_left_column || !$this->registerHook('leftColumn'))
|
||||
&& (!$theme->default_right_column || !$this->registerHook('rightColumn'))
|
||||
)
|
||||
{
|
||||
// If there are no colums implemented by the template, throw an error and uninstall the module
|
||||
$this->_errors[] = $this->l('This module needs to be hooked to a column, but your theme does not implement one');
|
||||
parent::uninstall();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Configuration::updateGlobalValue('BLOCKADVERT_LINK', 'http://www.prestashop.com/');
|
||||
Configuration::updateGlobalValue('BLOCKADVERT_TITLE', 'PrestaShop');
|
||||
// Try to update with the extension of the image that exists in the module directory
|
||||
foreach (scandir(_PS_MODULE_DIR_.$this->name) as $file)
|
||||
if (in_array($file, array('advertising.jpg', 'advertising.gif', 'advertising.png')))
|
||||
Configuration::updateGlobalValue('BLOCKADVERT_IMG_EXT', substr($file, strrpos($file, '.') + 1));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
Configuration::deleteByName('BLOCKADVERT_LINK');
|
||||
Configuration::deleteByName('BLOCKADVERT_TITLE');
|
||||
Configuration::deleteByName('BLOCKADVERT_IMG_EXT');
|
||||
|
||||
return (parent::uninstall());
|
||||
}
|
||||
|
||||
/**
|
||||
* delete the contextual image (it is not allowed to delete the default image)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _deleteCurrentImg()
|
||||
{
|
||||
// Delete the image file
|
||||
if ($this->adv_imgname != 'advertising' && file_exists(_PS_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT')))
|
||||
unlink(_PS_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT'));
|
||||
|
||||
// Update the extension to the global value or the shop group value if available
|
||||
Configuration::deleteFromContext('BLOCKADVERT_IMG_EXT');
|
||||
Configuration::updateValue('BLOCKADVERT_IMG_EXT', Configuration::get('BLOCKADVERT_IMG_EXT'));
|
||||
|
||||
// Reset the properties of the module
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitDeleteImgConf'))
|
||||
$this->_deleteCurrentImg();
|
||||
|
||||
$errors = '';
|
||||
if (Tools::isSubmit('submitAdvConf'))
|
||||
{
|
||||
if (isset($_FILES['adv_img']) && isset($_FILES['adv_img']['tmp_name']) && !empty($_FILES['adv_img']['tmp_name']))
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['adv_img'], Tools::convertBytes(ini_get('upload_max_filesize'))))
|
||||
$errors .= $error;
|
||||
else
|
||||
{
|
||||
Configuration::updateValue('BLOCKADVERT_IMG_EXT', substr($_FILES['adv_img']['name'], strrpos($_FILES['adv_img']['name'], '.') + 1));
|
||||
|
||||
// Set the image name with a name contextual to the shop context
|
||||
$this->adv_imgname = 'advertising';
|
||||
if (Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
$this->adv_imgname = 'advertising-g'.(int)$this->context->shop->getContextShopGroupID();
|
||||
elseif (Shop::getContext() == Shop::CONTEXT_SHOP)
|
||||
$this->adv_imgname = 'advertising-s'.(int)$this->context->shop->getContextShopID();
|
||||
|
||||
// Copy the image in the module directory with its new name
|
||||
if (!move_uploaded_file($_FILES['adv_img']['tmp_name'], _PS_MODULE_DIR_.$this->name.'/img/'.$this->adv_imgname.'.'.Configuration::get('BLOCKADVERT_IMG_EXT')))
|
||||
$errors .= $this->l('File upload error.');
|
||||
}
|
||||
}
|
||||
|
||||
// If the link is not set, then delete it in order to use the next default value (either the global value or the group value)
|
||||
if ($link = Tools::getValue('adv_link'))
|
||||
Configuration::updateValue('BLOCKADVERT_LINK', $link);
|
||||
elseif (Shop::getContext() == Shop::CONTEXT_SHOP || Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
Configuration::deleteFromContext('BLOCKADVERT_LINK');
|
||||
|
||||
// If the title is not set, then delete it in order to use the next default value (either the global value or the group value)
|
||||
if ($title = Tools::getValue('adv_title'))
|
||||
Configuration::updateValue('BLOCKADVERT_TITLE', $title);
|
||||
elseif (Shop::getContext() == Shop::CONTEXT_SHOP || Shop::getContext() == Shop::CONTEXT_GROUP)
|
||||
Configuration::deleteFromContext('BLOCKADVERT_TITLE');
|
||||
|
||||
// Reset the module properties
|
||||
$this->initialize();
|
||||
$this->_clearCache('blockadvertising.tpl');
|
||||
|
||||
if (!$errors)
|
||||
Tools::redirectAdmin(AdminController::$currentIndex.'&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&conf=6');
|
||||
echo $this->displayError($errors);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* getContent used to display admin module form
|
||||
*
|
||||
* @return string content
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
$this->postProcess();
|
||||
|
||||
return $this->renderForm();
|
||||
}
|
||||
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
if (!$this->isCached('blockadvertising.tpl', $this->getCacheId()))
|
||||
$this->smarty->assign(
|
||||
array(
|
||||
'image' => $this->context->link->protocol_content.$this->adv_img,
|
||||
'adv_link' => $this->adv_link,
|
||||
'adv_title' => $this->adv_title,
|
||||
)
|
||||
);
|
||||
|
||||
return $this->display(__FILE__, 'blockadvertising.tpl', $this->getCacheId());
|
||||
}
|
||||
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
return $this->hookRightColumn($params);
|
||||
}
|
||||
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$this->context->controller->addCSS($this->_path.'blockadvertising.css', 'all');
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Configuration'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Image for the advertisement'),
|
||||
'name' => 'adv_img',
|
||||
'desc' => $this->l('By default the image will appear in the left column. The recommended dimensions are 155 x 163px.'),
|
||||
'thumb' => $this->context->link->protocol_content.$this->adv_img,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Target link for the image'),
|
||||
'name' => 'adv_link',
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Title of the target link'),
|
||||
'name' => 'adv_title',
|
||||
'desc' => $this->l('This title will be displayed when you mouse over the advertisement block in your shop.')
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->id;
|
||||
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
$this->fields_form = array();
|
||||
$helper->id = (int)Tools::getValue('id_carrier');
|
||||
$helper->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitAdvConf';
|
||||
$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));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
return array(
|
||||
'adv_link' => Tools::getValue('adv_link', Configuration::get('BLOCKADVERT_LINK')),
|
||||
'adv_title' => Tools::getValue('adv_title', Configuration::get('BLOCKADVERT_TITLE')),
|
||||
);
|
||||
}
|
||||
}
|
30
modules/blockadvertising/blockadvertising.tpl
Normal file
30
modules/blockadvertising/blockadvertising.tpl
Normal file
@ -0,0 +1,30 @@
|
||||
{*
|
||||
* 2007-2015 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-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<!-- MODULE Block advertising -->
|
||||
<div class="advertising_block">
|
||||
<a href="{$adv_link}" title="{$adv_title}"><img src="{$image}" alt="{$adv_title}" title="{$adv_title}" width="155" height="163" /></a>
|
||||
</div>
|
||||
<!-- /MODULE Block advertising -->
|
12
modules/blockadvertising/config.xml
Normal file
12
modules/blockadvertising/config.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>blockadvertising</name>
|
||||
<displayName><![CDATA[Advertising block]]></displayName>
|
||||
<version><![CDATA[0.9.3]]></version>
|
||||
<description><![CDATA[Adds an advertisement block to selected sections of your e-commerce website.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[advertising_marketing]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
12
modules/blockadvertising/config_fr.xml
Normal file
12
modules/blockadvertising/config_fr.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>blockadvertising</name>
|
||||
<displayName><![CDATA[Bloc publicités]]></displayName>
|
||||
<version><![CDATA[0.9.3]]></version>
|
||||
<description><![CDATA[Ajoute un bloc affichant une publicité.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[advertising_marketing]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
BIN
modules/blockadvertising/img/fixtures/advertising.jpg
Normal file
BIN
modules/blockadvertising/img/fixtures/advertising.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
35
modules/blockadvertising/index.php
Normal file
35
modules/blockadvertising/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 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-2015 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/blockadvertising/logo.gif
Normal file
BIN
modules/blockadvertising/logo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
modules/blockadvertising/logo.png
Normal file
BIN
modules/blockadvertising/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
19
modules/blockadvertising/translations/fr.php
Normal file
19
modules/blockadvertising/translations/fr.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_bedd646b07e65f588b06f275bd47be07'] = 'Bloc publicités';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_dc23a0e1424eda56d0700f7ebe628c78'] = 'Ajoute un bloc affichant une publicité.';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_33476c93475bba83cdcaac18e09b95ec'] = 'Ce module nécessite d\'être greffé sur une colonne, mais votre thème n\'a pas de colonne';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_070e16b4f77b90e802f789b5be583cfa'] = 'Erreur de déplacement du fichier mis en ligne';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_254f642527b45bc260048e30704edb39'] = 'Paramètres';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_a15e4232c6c1fc1e67816dd517e0e966'] = 'Image pour la publicité';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_351ec5e81711303a312e244ec952f8e9'] = 'Par défaut, l\'image s\'affichera dans la colonne de gauche. Les dimensions recommandées sont 155 x 163px.';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_4163f94824da4886254e88de13fbb863'] = 'Lien vers lequel l\'image renvoie';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_24c28ef67324898298e45026d8efabaf'] = 'Titre du lien cible';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_78315dd2b27ef8037115b9f66351c155'] = 'Ce titre apparaît quand vous survolez le bloc publicités dans votre boutique.';
|
||||
$_MODULE['<{blockadvertising}prestashop>blockadvertising_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
|
||||
|
||||
|
||||
return $_MODULE;
|
35
modules/blockadvertising/translations/index.php
Normal file
35
modules/blockadvertising/translations/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 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-2015 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;
|
36
modules/blockadvertising/upgrade/install-0.9.php
Normal file
36
modules/blockadvertising/upgrade/install-0.9.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_0_9($module)
|
||||
{
|
||||
$module_path = $module->getLocalPath();
|
||||
$img_folder_path = $module->getLocalPath().'img';
|
||||
$fixture_img_path = $module->getLocalPath().'img'.DIRECTORY_SEPARATOR.'fixtures';
|
||||
|
||||
if (!Tools::file_exists_cache($img_folder_path))
|
||||
mkdir($img_folder_path);
|
||||
|
||||
if (!Tools::file_exists_cache($fixture_img_path))
|
||||
mkdir($fixture_img_path);
|
||||
|
||||
$files = scandir($module->getLocalPath());
|
||||
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if (strncmp($file, 'advertising', 11) == 0)
|
||||
{
|
||||
if ($file == 'advertising.jpg')
|
||||
copy($module_path.$file, $fixture_img_path.DIRECTORY_SEPARATOR.$file);
|
||||
else
|
||||
copy($module_path.$file, $img_folder_path.DIRECTORY_SEPARATOR.$file);
|
||||
|
||||
unlink($module_path.$file);
|
||||
}
|
||||
}
|
||||
|
||||
Tools::clearCache(Context::getContext()->smarty, $module->getTemplatePath('blockadvertising.tpl'));
|
||||
|
||||
return true;
|
||||
}
|
@ -1 +0,0 @@
|
||||
Subproject commit 3115a84b3488ef75975e5d214877f66cc7334783
|
4
modules/blockbanner/CHANGELOG.txt
Normal file
4
modules/blockbanner/CHANGELOG.txt
Normal file
@ -0,0 +1,4 @@
|
||||
2014-04-22 18:56:51 +0200 // Changelog updated
|
||||
2014-03-24 11:43:28 +0100 / MO blockbanner : ps_versions_compliancy modified (1.5.6.1 => 1.6)
|
||||
2014-03-24 10:55:56 +0100 / MO blockbanner : ps_versions_compliancy added
|
||||
2014-03-20 14:19:15 +0100 Initial commit
|
37
modules/blockbanner/Readme.md
Normal file
37
modules/blockbanner/Readme.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Banner block
|
||||
|
||||
## About
|
||||
|
||||
Displays a banner at the top of the store.
|
||||
|
||||
## Contributing
|
||||
|
||||
PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
|
||||
|
||||
### Requirements
|
||||
|
||||
Contributors **must** follow the following rules:
|
||||
|
||||
* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
|
||||
* Do not update the module's version number.
|
||||
* Follow [the coding standards][1].
|
||||
|
||||
### Process in details
|
||||
|
||||
Contributors wishing to edit a module's files should follow the following process:
|
||||
|
||||
1. Create your GitHub account, if you do not have one already.
|
||||
2. Fork the blockbanner project to your GitHub account.
|
||||
3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
|
||||
4. Create a branch in your local clone of the module for your changes.
|
||||
5. Change the files in your branch. Be sure to follow [the coding standards][1]!
|
||||
6. Push your changed branch to your fork in your GitHub account.
|
||||
7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
|
||||
8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
|
||||
|
||||
That's it: you have contributed to this open-source project! Congratulations!
|
||||
|
||||
[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
|
||||
[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
|
||||
[3]: https://help.github.com/articles/using-pull-requests
|
||||
|
0
modules/blockbanner/blockbanner.css
Normal file
0
modules/blockbanner/blockbanner.css
Normal file
253
modules/blockbanner/blockbanner.php
Normal file
253
modules/blockbanner/blockbanner.php
Normal file
@ -0,0 +1,253 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 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-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
class BlockBanner extends Module
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'blockbanner';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.3.5';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Banner block');
|
||||
$this->description = $this->l('Displays a banner at the top of the shop.');
|
||||
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
return
|
||||
parent::install() &&
|
||||
$this->registerHook('displayBanner') &&
|
||||
$this->registerHook('displayHeader') &&
|
||||
$this->registerHook('actionObjectLanguageAddAfter') &&
|
||||
$this->installFixtures() &&
|
||||
$this->disableDevice(Context::DEVICE_MOBILE);
|
||||
}
|
||||
|
||||
public function hookActionObjectLanguageAddAfter($params)
|
||||
{
|
||||
return $this->installFixture((int)$params['object']->id, Configuration::get('BLOCKBANNER_IMG', (int)Configuration::get('PS_LANG_DEFAULT')));
|
||||
}
|
||||
|
||||
protected function installFixtures()
|
||||
{
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages as $lang)
|
||||
$this->installFixture((int)$lang['id_lang'], 'sale70.png');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function installFixture($id_lang, $image = null)
|
||||
{
|
||||
$values['BLOCKBANNER_IMG'][(int)$id_lang] = $image;
|
||||
$values['BLOCKBANNER_LINK'][(int)$id_lang] = '';
|
||||
$values['BLOCKBANNER_DESC'][(int)$id_lang] = '';
|
||||
Configuration::updateValue('BLOCKBANNER_IMG', $values['BLOCKBANNER_IMG']);
|
||||
Configuration::updateValue('BLOCKBANNER_LINK', $values['BLOCKBANNER_LINK']);
|
||||
Configuration::updateValue('BLOCKBANNER_DESC', $values['BLOCKBANNER_DESC']);
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
Configuration::deleteByName('BLOCKBANNER_IMG');
|
||||
Configuration::deleteByName('BLOCKBANNER_LINK');
|
||||
Configuration::deleteByName('BLOCKBANNER_DESC');
|
||||
return parent::uninstall();
|
||||
}
|
||||
|
||||
public function hookDisplayTop($params)
|
||||
{
|
||||
if (!$this->isCached('blockbanner.tpl', $this->getCacheId()))
|
||||
{
|
||||
$imgname = Configuration::get('BLOCKBANNER_IMG', $this->context->language->id);
|
||||
|
||||
if ($imgname && file_exists(_PS_MODULE_DIR_.$this->name.DIRECTORY_SEPARATOR.'img'.DIRECTORY_SEPARATOR.$imgname))
|
||||
$this->smarty->assign('banner_img', $this->context->link->protocol_content.Tools::getMediaServer($imgname).$this->_path.'img/'.$imgname);
|
||||
|
||||
$this->smarty->assign(array(
|
||||
'banner_link' => Configuration::get('BLOCKBANNER_LINK', $this->context->language->id),
|
||||
'banner_desc' => Configuration::get('BLOCKBANNER_DESC', $this->context->language->id)
|
||||
));
|
||||
}
|
||||
|
||||
return $this->display(__FILE__, 'blockbanner.tpl', $this->getCacheId());
|
||||
}
|
||||
|
||||
public function hookDisplayBanner($params)
|
||||
{
|
||||
return $this->hookDisplayTop($params);
|
||||
}
|
||||
|
||||
public function hookDisplayFooter($params)
|
||||
{
|
||||
return $this->hookDisplayTop($params);
|
||||
}
|
||||
|
||||
public function hookDisplayHeader($params)
|
||||
{
|
||||
$this->context->controller->addCSS($this->_path.'blockbanner.css', 'all');
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitStoreConf'))
|
||||
{
|
||||
$languages = Language::getLanguages(false);
|
||||
$values = array();
|
||||
$update_images_values = false;
|
||||
|
||||
foreach ($languages as $lang)
|
||||
{
|
||||
if (isset($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']])
|
||||
&& isset($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['tmp_name'])
|
||||
&& !empty($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['tmp_name']))
|
||||
{
|
||||
if ($error = ImageManager::validateUpload($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']], 4000000))
|
||||
return $error;
|
||||
else
|
||||
{
|
||||
$ext = substr($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['name'], strrpos($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['name'], '.') + 1);
|
||||
$file_name = md5($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['name']).'.'.$ext;
|
||||
|
||||
if (!move_uploaded_file($_FILES['BLOCKBANNER_IMG_'.$lang['id_lang']]['tmp_name'], dirname(__FILE__).DIRECTORY_SEPARATOR.'img'.DIRECTORY_SEPARATOR.$file_name))
|
||||
return $this->displayError($this->l('An error occurred while attempting to upload the file.'));
|
||||
else
|
||||
{
|
||||
if (Configuration::hasContext('BLOCKBANNER_IMG', $lang['id_lang'], Shop::getContext())
|
||||
&& Configuration::get('BLOCKBANNER_IMG', $lang['id_lang']) != $file_name)
|
||||
@unlink(dirname(__FILE__).DIRECTORY_SEPARATOR.'img'.DIRECTORY_SEPARATOR.Configuration::get('BLOCKBANNER_IMG', $lang['id_lang']));
|
||||
|
||||
$values['BLOCKBANNER_IMG'][$lang['id_lang']] = $file_name;
|
||||
}
|
||||
}
|
||||
|
||||
$update_images_values = true;
|
||||
}
|
||||
|
||||
$values['BLOCKBANNER_LINK'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_LINK_'.$lang['id_lang']);
|
||||
$values['BLOCKBANNER_DESC'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_DESC_'.$lang['id_lang']);
|
||||
}
|
||||
|
||||
if ($update_images_values)
|
||||
Configuration::updateValue('BLOCKBANNER_IMG', $values['BLOCKBANNER_IMG']);
|
||||
|
||||
Configuration::updateValue('BLOCKBANNER_LINK', $values['BLOCKBANNER_LINK']);
|
||||
Configuration::updateValue('BLOCKBANNER_DESC', $values['BLOCKBANNER_DESC']);
|
||||
|
||||
$this->_clearCache('blockbanner.tpl');
|
||||
return $this->displayConfirmation($this->l('The settings have been updated.'));
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
return $this->postProcess().$this->renderForm();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Settings'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'file_lang',
|
||||
'label' => $this->l('Top banner image'),
|
||||
'name' => 'BLOCKBANNER_IMG',
|
||||
'desc' => $this->l('Upload an image for your top banner. The recommended dimensions are 1170 x 65px if you are using the default theme.'),
|
||||
'lang' => true,
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'lang' => true,
|
||||
'label' => $this->l('Banner Link'),
|
||||
'name' => 'BLOCKBANNER_LINK',
|
||||
'desc' => $this->l('Enter the link associated to your banner. When clicking on the banner, the link opens in the same window. If no link is entered, it redirects to the homepage.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'lang' => true,
|
||||
'label' => $this->l('Banner description'),
|
||||
'name' => 'BLOCKBANNER_DESC',
|
||||
'desc' => $this->l('Please enter a short but meaningful description for the banner.')
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save')
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = $this->table;
|
||||
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$helper->default_form_language = $lang->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->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitStoreConf';
|
||||
$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(
|
||||
'uri' => $this->getPathUri(),
|
||||
'fields_value' => $this->getConfigFieldsValues(),
|
||||
'languages' => $this->context->controller->getLanguages(),
|
||||
'id_language' => $this->context->language->id
|
||||
);
|
||||
|
||||
return $helper->generateForm(array($fields_form));
|
||||
}
|
||||
|
||||
public function getConfigFieldsValues()
|
||||
{
|
||||
$languages = Language::getLanguages(false);
|
||||
$fields = array();
|
||||
|
||||
foreach ($languages as $lang)
|
||||
{
|
||||
$fields['BLOCKBANNER_IMG'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_IMG_'.$lang['id_lang'], Configuration::get('BLOCKBANNER_IMG', $lang['id_lang']));
|
||||
$fields['BLOCKBANNER_LINK'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_LINK_'.$lang['id_lang'], Configuration::get('BLOCKBANNER_LINK', $lang['id_lang']));
|
||||
$fields['BLOCKBANNER_DESC'][$lang['id_lang']] = Tools::getValue('BLOCKBANNER_DESC_'.$lang['id_lang'], Configuration::get('BLOCKBANNER_DESC', $lang['id_lang']));
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
}
|
31
modules/blockbanner/blockbanner.tpl
Normal file
31
modules/blockbanner/blockbanner.tpl
Normal file
@ -0,0 +1,31 @@
|
||||
{*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<a href="{if $banner_link}{$banner_link|escape:'htmlall':'UTF-8'}{else}{if isset($force_ssl) && $force_ssl}{$base_dir_ssl}{else}{$base_dir}{/if}{/if}" title="{$banner_desc|escape:'htmlall':'UTF-8'}">
|
||||
{if isset($banner_img)}
|
||||
<img class="img-responsive" src="{$banner_img|escape:'htmlall':'UTF-8'}" alt="{$banner_desc|escape:'htmlall':'UTF-8'}" title="{$banner_desc|escape:'htmlall':'UTF-8'}" width="1170" height="65" />
|
||||
{else}
|
||||
{$banner_desc|escape:'htmlall':'UTF-8'}
|
||||
{/if}
|
||||
</a>
|
12
modules/blockbanner/config.xml
Normal file
12
modules/blockbanner/config.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>blockbanner</name>
|
||||
<displayName><![CDATA[Banner block]]></displayName>
|
||||
<version><![CDATA[1.3.5]]></version>
|
||||
<description><![CDATA[Displays a banner at the top of the store.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
12
modules/blockbanner/config_fr.xml
Normal file
12
modules/blockbanner/config_fr.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>blockbanner</name>
|
||||
<displayName><![CDATA[Bloc bannière]]></displayName>
|
||||
<version><![CDATA[1.3.5]]></version>
|
||||
<description><![CDATA[Permet d'afficher une bannière dans l'en-tête du site.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>0</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
BIN
modules/blockbanner/img/sale70.png
Normal file
BIN
modules/blockbanner/img/sale70.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
35
modules/blockbanner/index.php
Normal file
35
modules/blockbanner/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
BIN
modules/blockbanner/logo.gif
Normal file
BIN
modules/blockbanner/logo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 280 B |
BIN
modules/blockbanner/logo.png
Normal file
BIN
modules/blockbanner/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
21
modules/blockbanner/translations/fr.php
Normal file
21
modules/blockbanner/translations/fr.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
global $_MODULE;
|
||||
$_MODULE = array();
|
||||
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_4b92fcfe6f0ec26909935aa960b7b81f'] = 'Bloc bannière';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_9ec3d0f07db2d25a37ec4b7a21c788f8'] = 'Permet d\'afficher une bannière dans l\'en-tête du site.';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_df7859ac16e724c9b1fba0a364503d72'] = 'une erreur s\'est produite lors de l\'envoi';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_efc226b17e0532afff43be870bff0de7'] = 'Paramètres mis à jour';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_f4f70727dc34561dfde1a3c529b6205c'] = 'Paramètres';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_9edcdbdff24876b0dac92f97397ae497'] = 'Image de la bannière d\'en-tête';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_e90797453e35e4017b82e54e2b216290'] = 'Choisissez l\'image à mettre en ligne pour votre bannière. Si vous utilisez le thème par défaut, les dimensions recommandées sont 1170 x 65 px.';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_46fae48f998058600248a16100acfb7e'] = 'Lien de la bannière';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_084fa1da897dfe3717efa184616ff91c'] = 'Entrez le lien associé à votre bannière. Quand un visiteur clique sur la bannière, le lien s\'ouvre dans la même fenêtre. Si aucun lien n\'est entré, il redirige vers la page d\'accueil.';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_ff09729bee8a82c374f6b61e14a4af76'] = 'Description pour la bannière';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_112f6f9a1026d85f440e5ca68d8e2ec5'] = 'Veuillez saisir une description courte mais précise pour votre bannière.';
|
||||
$_MODULE['<{blockbanner}prestashop>blockbanner_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
|
||||
$_MODULE['<{blockbanner}prestashop>form_92fbf0e5d97b8afd7e73126b52bdc4bb'] = 'Choisissez un fichier';
|
||||
|
||||
|
||||
return $_MODULE;
|
35
modules/blockbanner/translations/index.php
Normal file
35
modules/blockbanner/translations/index.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
9
modules/blockbanner/upgrade/install-1.1.php
Normal file
9
modules/blockbanner/upgrade/install-1.1.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_1_1($object)
|
||||
{
|
||||
return ($object->registerHook('displayBanner') && $object->unregisterHook('displayTop'));
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
{*
|
||||
* 2007-2015 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-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
{block name="field"}
|
||||
{if $input.type == 'file_lang'}
|
||||
<div class="col-lg-9">
|
||||
{foreach from=$languages item=language}
|
||||
{if $languages|count > 1}
|
||||
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<div class="col-lg-6">
|
||||
<input id="{$input.name}_{$language.id_lang}" type="file" name="{$input.name}_{$language.id_lang}" class="hide" />
|
||||
<div class="dummyfile input-group">
|
||||
<span class="input-group-addon"><i class="icon-file"></i></span>
|
||||
<input id="{$input.name}_{$language.id_lang}-name" type="text" class="disabled" name="filename" readonly />
|
||||
<span class="input-group-btn">
|
||||
<button id="{$input.name}_{$language.id_lang}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default">
|
||||
<i class="icon-folder-open"></i> {l s='Choose a file' mod='blockbanner'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{if $languages|count > 1}
|
||||
<div class="col-lg-2">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
|
||||
{$language.iso_code}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach from=$languages item=lang}
|
||||
<li><a href="javascript:hideOtherLanguage({$lang.id_lang});" tabindex="-1">{$lang.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{if isset($fields_value[$input.name][$language.id_lang]) && $fields_value[$input.name][$language.id_lang] != ''}
|
||||
<div id="{$input.name}-{$language.id_lang}-images-thumbnails" class="col-lg-12">
|
||||
<img src="{$uri}img/{$fields_value[$input.name][$language.id_lang]}" class="img-thumbnail"/>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
{/if}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#{$input.name}_{$language.id_lang}-selectbutton').click(function(e){
|
||||
$('#{$input.name}_{$language.id_lang}').trigger('click');
|
||||
});
|
||||
$('#{$input.name}_{$language.id_lang}').change(function(e){
|
||||
var val = $(this).val();
|
||||
var file = val.split(/[\\/]/);
|
||||
$('#{$input.name}_{$language.id_lang}-name').val(file[file.length-1]);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/foreach}
|
||||
{if isset($input.desc) && !empty($input.desc)}
|
||||
<p class="help-block">
|
||||
{$input.desc}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
Loading…
Reference in New Issue
Block a user