// Context part 6
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7625 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -93,5 +93,6 @@ $context->employee = $employee;
|
||||
$context->cookie = $cookie;
|
||||
$context->link = $link;
|
||||
$context->language = $language;
|
||||
$context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$context->country = new Country(Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||
$context->shop = new Shop(Shop::getContext('shop', true));
|
||||
@@ -63,13 +63,13 @@ class AdminAccess extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $cookie, $currentIndex;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
$currentProfile = (int)($this->getCurrentProfileId());
|
||||
$tabs = Tab::getTabs($cookie->id_lang);
|
||||
$profiles = Profile::getProfiles((int)($cookie->id_lang));
|
||||
$accesses = Profile::getProfileAccesses((int)($currentProfile));
|
||||
$tabs = Tab::getTabs($context->language->id);
|
||||
$profiles = Profile::getProfiles($context->language->id);
|
||||
$accesses = Profile::getProfileAccesses($context->language->id);
|
||||
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -35,8 +35,7 @@ class AdminAddresses extends AdminTab
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
$this->table = 'address';
|
||||
$this->className = 'Address';
|
||||
$this->lang = false;
|
||||
@@ -49,9 +48,9 @@ class AdminAddresses extends AdminTab
|
||||
$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)($cookie->id_lang).')';
|
||||
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$context->language->id.')';
|
||||
|
||||
$countries = Country::getCountries((int)($cookie->id_lang));
|
||||
$countries = Country::getCountries($context->language->id);
|
||||
foreach ($countries AS $country)
|
||||
$this->countriesArray[$country['id_country']] = $country['name'];
|
||||
|
||||
@@ -162,12 +161,10 @@ 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);
|
||||
|
||||
global $cookie;
|
||||
|
||||
$context = Context::getContext();
|
||||
/* Manage default params values */
|
||||
if (empty($limit))
|
||||
$limit = ((!isset($cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $cookie->{$this->table.'_pagination'});
|
||||
$limit = ((!isset($context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $context->cookie->{$this->table.'_pagination'});
|
||||
|
||||
if (!Validate::isTableOrIdentifier($this->table))
|
||||
die('filter is corrupted');
|
||||
@@ -176,7 +173,7 @@ class AdminAddresses extends AdminTab
|
||||
if (empty($orderWay))
|
||||
$orderWay = Tools::getValue($this->table.'Orderway', 'ASC');
|
||||
$limit = (int)(Tools::getValue('pagination', $limit));
|
||||
$cookie->{$this->table.'_pagination'} = $limit;
|
||||
$context->cookie->{$this->table.'_pagination'} = $limit;
|
||||
|
||||
/* Check params validity */
|
||||
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay)
|
||||
@@ -226,9 +223,8 @@ class AdminAddresses extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
$context = Context::getContext();
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
@@ -260,7 +256,7 @@ class AdminAddresses extends AdminTab
|
||||
if ($obj->id)
|
||||
{
|
||||
$customer = new Customer($obj->id_customer);
|
||||
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee));
|
||||
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$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>
|
||||
|
||||
@@ -73,7 +73,6 @@ class AdminAliases extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
@@ -101,6 +100,4 @@ class AdminAliases extends AdminTab
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -31,8 +31,6 @@ class AdminAttachments extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$this->table = 'attachment';
|
||||
$this->className = 'Attachment';
|
||||
$this->lang = true;
|
||||
@@ -90,7 +88,6 @@ class AdminAttachments extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
|
||||
@@ -71,8 +71,6 @@ class AdminAttributeGenerator extends AdminTab
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
global $currentIndex;
|
||||
|
||||
$this->product = new Product((int)(Tools::getValue('id_product')));
|
||||
|
||||
if (isset($_POST['generate']))
|
||||
@@ -103,9 +101,8 @@ class AdminAttributeGenerator extends AdminTab
|
||||
|
||||
static private function displayAndReturnAttributeJs()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$attributes = Attribute::getAttributes((int)($cookie->id_lang), true);
|
||||
$context = Context::getContext();
|
||||
$attributes = Attribute::getAttributes($context->language->id, true);
|
||||
$attributeJs = array();
|
||||
foreach ($attributes AS $k => $attribute)
|
||||
$attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
|
||||
@@ -178,10 +175,9 @@ class AdminAttributeGenerator extends AdminTab
|
||||
|
||||
private function displayGroupeTable($attributeJs, $attributesGroups)
|
||||
{
|
||||
global $cookie;
|
||||
$context = Context::getContext();
|
||||
|
||||
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
$combinationsGroups = $this->product->getAttributesGroups((int)($cookie->id_lang));
|
||||
$combinationsGroups = $this->product->getAttributesGroups($context->language->id);
|
||||
$attributes = array();
|
||||
$impacts = self::getAttributesImpacts($this->product->id);
|
||||
foreach ($combinationsGroups AS &$combination)
|
||||
@@ -206,7 +202,7 @@ class AdminAttributeGenerator extends AdminTab
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="tab_h1" style="width: 150px">'.htmlspecialchars(stripslashes($attributeGroup['name'])).'</th>
|
||||
<th id="tab_h2" style="width: 350px" colspan="2">'.$this->l('Price impact').' ('.$currency->sign.')'.'</th>
|
||||
<th id="tab_h2" style="width: 350px" colspan="2">'.$this->l('Price impact').' ('.$context->currency->sign.')'.'</th>
|
||||
<th style="width: 150px">'.$this->l('Weight impact').' ('.Configuration::get('PS_WEIGHT_UNIT').')'.'</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -222,11 +218,11 @@ class AdminAttributeGenerator extends AdminTab
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
global $currentIndex, $cookie;
|
||||
$context = Context::getContext();
|
||||
parent::displayForm();
|
||||
|
||||
$jsAttributes = self::displayAndReturnAttributeJs();
|
||||
$attributesGroups = AttributeGroup::getAttributesGroups((int)($cookie->id_lang));
|
||||
$attributesGroups = AttributeGroup::getAttributesGroups($context->language->id);
|
||||
$this->product = new Product((int)(Tools::getValue('id_product')));
|
||||
|
||||
// JS Init
|
||||
@@ -276,7 +272,7 @@ class AdminAttributeGenerator extends AdminTab
|
||||
<script type="text/javascript" src="../js/attributesBack.js"></script>
|
||||
<form enctype="multipart/form-data" method="post" id="generator" action="'.self::$currentIndex.'&&id_product='.(int)(Tools::getValue('id_product')).'&id_category='.(int)(Tools::getValue('id_category')).'&attributegenerator&token='.Tools::getValue('token').'">
|
||||
<fieldset style="margin-bottom: 35px;"><legend><img src="../img/admin/asterisk.gif" />'.$this->l('Attributes generator').'</legend>'.
|
||||
$this->l('Add or modify attributes for product:').' <b>'.$this->product->name[$cookie->id_lang].'</b>
|
||||
$this->l('Add or modify attributes for product:').' <b>'.$this->product->name[$context->language->id].'</b>
|
||||
<br /><br />
|
||||
';
|
||||
echo '
|
||||
|
||||
Reference in New Issue
Block a user