Added changes from eb94b51 TMMeilleur/PrestaShop
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 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 Blockfacebook extends Module
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'blockfacebook';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.0';
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
$this->displayName = $this->l('Block Facebook');
|
||||
$this->description = $this->l('Display block facebook on the home page');
|
||||
}
|
||||
|
||||
|
||||
public function install()
|
||||
{
|
||||
return parent::install()
|
||||
&& Configuration::updateValue('blockfacebook_url', 'prestashop')
|
||||
&& $this->registerHook('displayHome')
|
||||
&& $this->registerHook('displayHeader');
|
||||
}
|
||||
|
||||
public function uninstall()
|
||||
{
|
||||
// Delete configuration
|
||||
return Configuration::deleteByName('blockfacebook_url') && parent::uninstall();
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$html = '';
|
||||
// If we try to update the settings
|
||||
if (Tools::isSubmit('submitModule'))
|
||||
{
|
||||
Configuration::updateValue('blockfacebook_url', Tools::getValue('blockfacebook_url'));
|
||||
$this->_clearCache('blockfacebook.tpl');
|
||||
$html .= $this->displayConfirmation($this->l('Configuration updated'));
|
||||
}
|
||||
|
||||
$html .= $this->renderForm();
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function hookDisplayHeader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function hookDisplayHome()
|
||||
{
|
||||
global $smarty;
|
||||
if (!$this->isCached('blockfacebook.tpl', $this->getCacheId()))
|
||||
$smarty->assign(array(
|
||||
'facebookurl' => Configuration::get('blockfacebook_url'),
|
||||
));
|
||||
return $this->display(__FILE__, 'blockfacebook.tpl', $this->getCacheId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Settings'),
|
||||
'icon' => 'icon-cogs'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Facebook name'),
|
||||
'name' => 'blockfacebook_url',
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'class' => 'btn btn-default')
|
||||
),
|
||||
);
|
||||
|
||||
$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->identifier = $this->identifier;
|
||||
$helper->submit_action = 'submitModule';
|
||||
$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(
|
||||
'blockfacebook_url' => Tools::getValue('blockfacebook_url', Configuration::get('blockfacebook_url')),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{if $facebookurl != ''}
|
||||
<div id="facebook_block" class="col-xs-4">
|
||||
<h4 >{l s='Follow us on facebook' mod='blockfacebook'}</h4>
|
||||
<div class="facebook-fanbox">
|
||||
<iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2F{$facebookurl|escape:'htmlall':'UTF-8'}&width=235&height=290&colorscheme=light&show_faces=true&header=false&stream=false&show_border=false" scrolling="no" frameborder="0" style="border:none; width:100%; height:200px;" allowTransparency="true"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>blockfacebook</name>
|
||||
<displayName><![CDATA[Block Facebook]]></displayName>
|
||||
<version><![CDATA[1.0]]></version>
|
||||
<description><![CDATA[Display block facebook on the home page]]></description>
|
||||
<author><![CDATA[]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2013 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-2013 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;
|
||||
Reference in New Issue
Block a user