[*] MO : updated modules blockcms and blocknewsletter for mobile theme

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13651 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mBertholino
2012-02-28 08:52:06 +00:00
parent 3c85a7784b
commit 975f2e2008
4 changed files with 139 additions and 27 deletions

View File

@@ -672,6 +672,31 @@ class BlockCms extends Module
return $this->display(__FILE__, 'blockcms.tpl');
}
private function _prepareHook($params)
{
$block_activation = Configuration::get('FOOTER_BLOCK_ACTIVATION');
if (!$block_activation)
return false;
$cms_titles = BlockCMSModel::getCMSTitlesFooter();
$display_footer = Configuration::get('PS_STORES_DISPLAY_FOOTER');
$display_poweredby = Configuration::get('FOOTER_POWEREDBY');
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id);
$this->smarty->assign(
array(
'block' => 0,
'cmslinks' => $cms_titles,
'display_stores_footer' => $display_footer,
'display_poweredby' => ((int)$display_poweredby === 1 || $display_poweredby === false),
'footer_text' => $footer_text
)
);
return true;
}
public function hookHeader($params)
{
$this->context->controller->addCSS(($this->_path).'blockcms.css', 'all');
@@ -689,27 +714,16 @@ class BlockCms extends Module
public function hookFooter()
{
$block_activation = Configuration::get('FOOTER_BLOCK_ACTIVATION');
if (!$this->_prepareHook($params))
return ;
return $this->display(__FILE__, 'blockcms.tpl');
}
if ($block_activation)
{
$cms_titles = BlockCMSModel::getCMSTitlesFooter();
$display_footer = Configuration::get('PS_STORES_DISPLAY_FOOTER');
$display_poweredby = Configuration::get('FOOTER_POWEREDBY');
$footer_text = Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id);
$this->smarty->assign(
array(
'block' => 0,
'cmslinks' => $cms_titles,
'display_stores_footer' => $display_footer,
'display_poweredby' => ((int)$display_poweredby === 1 || $display_poweredby === false),
'footer_text' => $footer_text
)
);
return $this->display(__FILE__, 'blockcms.tpl');
}
return;
public function hookDisplayMobileFooterCms($params)
{
if (!$this->_prepareHook($params))
return ;
return $this->display(__FILE__, 'blockmobilecms.tpl');
}
}

View File

@@ -0,0 +1,43 @@
{*
* 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: 6594 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="block_various_links" id="block_various_links_footer">
<h4>{l s='Informations' mod='blockcms'}</h4>
<ul>
{if !$PS_CATALOG_MODE}<li class="first_item"><a href="{$link->getPageLink('prices-drop')}" title="{l s='Specials' mod='blockcms'}">{l s='Specials' mod='blockcms'}</a></li>{/if}
<li class="{if $PS_CATALOG_MODE}first_{/if}item"><a href="{$link->getPageLink('new-products')}" title="{l s='New products' mod='blockcms'}">{l s='New products' mod='blockcms'}</a></li>
{if !$PS_CATALOG_MODE}<li class="item"><a href="{$link->getPageLink('best-sales')}" title="{l s='Top sellers' mod='blockcms'}">{l s='Top sellers' mod='blockcms'}</a></li>{/if}
{if $display_stores_footer}<li class="item"><a href="{$link->getPageLink('stores')}" title="{l s='Our stores' mod='blockcms'}">{l s='Our stores' mod='blockcms'}</a></li>{/if}
<li class="item"><a href="{$link->getPageLink($contact_url, true)}" title="{l s='Contact us' mod='blockcms'}">{l s='Contact us' mod='blockcms'}</a></li>
{foreach from=$cmslinks item=cmslink}
{if $cmslink.meta_title != ''}
<li class="item"><a href="{$cmslink.link|addslashes}" title="{$cmslink.meta_title|escape:'htmlall':'UTF-8'}">{$cmslink.meta_title|escape:'htmlall':'UTF-8'}</a></li>
{/if}
{/foreach}
{if $display_poweredby}<li class="last_item">{l s='Powered by' mod='blockcms'} <a href="http://www.prestashop.com">PrestaShop</a>&trade;</li>{/if}
</ul>
{$footer_text}
</div>

View File

@@ -0,0 +1,43 @@
{*
* 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: 6594 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<!-- Block Mobile Newsletter module-->
<div id="newsletter">
<p>Newsletter</p>
<form action="form.php" method="post">
<div data-role="fieldcontain">
<label for="email">Your email:</label>
<input type="text" name="email" size="18"
value="{if isset($value) && $value}{$value}{else}{l s='your e-mail' mod='blocknewsletter'}{/if}"
onfocus="javascript:if(this.value=='{l s='your e-mail' mod='blocknewsletter'}')this.value='';"
onblur="javascript:if(this.value=='')this.value='{l s='your e-mail' mod='blocknewsletter'}';"
class="inputNew" />
<div data-theme="a" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-a" aria-disabled="false">
<span aria-hidden="true" class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">OK</span></span>
</div>
</div>
</form>
</div><!-- /newsletter -->

View File

@@ -462,7 +462,7 @@ class Blocknewsletter extends Module
return $this->hookDisplayLeftColumn($params);
}
public function hookDisplayLeftColumn($params)
private function _prepareHook($params)
{
if (Tools::isSubmit('submitNewsletter'))
{
@@ -470,21 +470,26 @@ class Blocknewsletter extends Module
if ($this->error)
{
$this->smarty->assign(array('color' => 'red',
'msg' => $this->error,
'nw_value' => isset($_POST['email']) ? pSQL($_POST['email']) : false,
'nw_error' => true,
'action' => $_POST['action'])
'msg' => $this->error,
'nw_value' => isset($_POST['email']) ? pSQL($_POST['email']) : false,
'nw_error' => true,
'action' => $_POST['action'])
);
}
else if ($this->valid)
{
$this->smarty->assign(array('color' => 'green',
'msg' => $this->valid,
'nw_error' => false)
'msg' => $this->valid,
'nw_error' => false)
);
}
}
$this->smarty->assign('this_path', $this->_path);
}
public function hookDisplayLeftColumn($params)
{
$this->_prepareHook($params);
return $this->display(__FILE__, 'blocknewsletter.tpl');
}
@@ -492,6 +497,13 @@ class Blocknewsletter extends Module
{
$this->context->controller->addCSS($this->_path.'blocknewsletter.css', 'all');
}
public function hookDisplayMobileIndex()
{
$this->_prepareHook($params);
return $this->display(__FILE__, 'blockmobilenewsletter.tpl');
}
}
}