// Context part 25

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7794 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-07-28 14:17:58 +00:00
parent a1a32714ab
commit d3b2ff2664
55 changed files with 432 additions and 535 deletions
+6 -8
View File
@@ -35,7 +35,6 @@ class AdminAddresses extends AdminTab
public function __construct()
{
$context = Context::getContext();
$this->table = 'address';
$this->className = 'Address';
$this->lang = false;
@@ -43,14 +42,15 @@ class AdminAddresses extends AdminTab
$this->delete = true;
$this->requiredDatabase = true;
$this->addressType = 'customer';
$this->context = Context::getContext();
if (!Tools::getValue('realedit'))
$this->deleted = true;
$this->_select = 'cl.`name` as country';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.')';
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')';
$countries = Country::getCountries($context->language->id);
$countries = Country::getCountries($this->context->language->id);
foreach ($countries AS $country)
$this->countriesArray[$country['id_country']] = $country['name'];
@@ -161,10 +161,9 @@ class AdminAddresses extends AdminTab
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
{
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit);
$context = Context::getContext();
/* Manage default params values */
if (empty($limit))
$limit = ((!isset($context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $context->cookie->{$this->table.'_pagination'});
$limit = ((!isset($this->context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $this->context->cookie->{$this->table.'_pagination'});
if (!Validate::isTableOrIdentifier($this->table))
die('filter is corrupted');
@@ -173,7 +172,7 @@ class AdminAddresses extends AdminTab
if (empty($orderWay))
$orderWay = Tools::getValue($this->table.'Orderway', 'ASC');
$limit = (int)(Tools::getValue('pagination', $limit));
$context->cookie->{$this->table.'_pagination'} = $limit;
$this->context->cookie->{$this->table.'_pagination'} = $limit;
/* Check params validity */
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay)
@@ -224,7 +223,6 @@ class AdminAddresses extends AdminTab
public function displayForm($isMainTab = true)
{
parent::displayForm();
$context = Context::getContext();
if (!($obj = $this->loadObject(true)))
return;
@@ -256,7 +254,7 @@ class AdminAddresses extends AdminTab
if ($obj->id)
{
$customer = new Customer($obj->id_customer);
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$context->employee->id);
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id);
echo '
<label>'.$this->l('Customer').'</label>
<div class="margin-form"><a style="display: block; padding-top: 4px;" href="?tab=AdminCustomers&id_customer='.$customer->id.'&viewcustomer&token='.$tokenCustomer.'">'.$customer->lastname.' '.$customer->firstname.' ('.$customer->email.')</a></div>