[+] Classes: Add ObjectModel::hydrateCollection() in order to transform arrays from sql queries return in list of objects

This commit is contained in:
rMalie
2011-09-29 13:23:54 +00:00
parent 6ab8f22725
commit ce866fa68a
11 changed files with 160 additions and 44 deletions
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -39,7 +39,7 @@ class BlockPaymentLogo extends Module
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('Block payment logo');
$this->description = $this->l('Adds a block to display all payment logos.');
}
@@ -55,7 +55,7 @@ class BlockPaymentLogo extends Module
return false;
return true;
}
public function uninstall()
{
Configuration::deleteByName('PS_PAYMENT_LOGO_CMS_ID');
@@ -67,16 +67,16 @@ class BlockPaymentLogo extends Module
$html = '
<h2>'.$this->l('Payment logo').'</h2>
';
if (Tools::isSubmit('submitConfiguration'))
if (Validate::isUnsignedInt(Tools::getValue('id_cms')))
{
Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', (int)(Tools::getValue('id_cms')));
$html .= $this->displayConfirmation($this->l('Settings are updated'));
}
$cmss = CMS::listCms($this->context->language->id);
if (!sizeof($cmss))
$html .= $this->displayError($this->l('No CMS page is available'));
else
@@ -110,8 +110,8 @@ class BlockPaymentLogo extends Module
{
if (Configuration::get('PS_CATALOG_MODE'))
return ;
if (!Configuration::get('PS_PAYMENT_LOGO_CMS_ID'))
return;
$cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $this->context->language->id);
@@ -120,7 +120,7 @@ class BlockPaymentLogo extends Module
$this->context->smarty->assign('cms_payement_logo', $cms);
return $this->display(__FILE__, 'blockpaymentlogo.tpl');
}
public function hookRightColumn($params)
{
return $this->hookLeftColumn($params);
+2 -2
View File
@@ -52,8 +52,8 @@ countries = new Array();
<p class="radio required">
<span>{l s='Title'}</span>
{foreach from=$genders key=k item=gender}
<input type="radio" name="id_gender" id="id_gender{$gender.id_gender}" value="{$gender.id_gender}" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == $gender.id_gender}checked="checked"{/if} />
<label for="id_gender{$gender.id_gender}" class="top">{$gender.name}</label>
<input type="radio" name="id_gender" id="id_gender{$gender->id}" value="{$gender->id}" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == $gender->id}checked="checked"{/if} />
<label for="id_gender{$gender->id}" class="top">{$gender->name}</label>
{/foreach}
</p>
<p class="required text">