// Rename fieldsDisplay to fields_list part1 (timeout)

This commit is contained in:
tDidierjean
2012-03-29 16:26:54 +00:00
parent 35667bb439
commit 215ca93f95
13 changed files with 36 additions and 36 deletions
+8 -8
View File
@@ -94,7 +94,7 @@ class AdminControllerCore extends Controller
protected $list_simple_header; protected $list_simple_header;
/** @var array list to be generated */ /** @var array list to be generated */
protected $fieldsDisplay; protected $fields_list;
/** @var array edit form to be generated */ /** @var array edit form to be generated */
protected $fields_form; protected $fields_form;
@@ -803,7 +803,7 @@ class AdminControllerCore extends Controller
$tmp_tab = explode('!', $key); $tmp_tab = explode('!', $key);
$key = (count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0]); $key = (count($tmp_tab) > 1 ? $tmp_tab[1] : $tmp_tab[0]);
if (array_key_exists($key, $this->fieldsDisplay)) if (array_key_exists($key, $this->fields_list))
unset($this->context->cookie->$cookie_key); unset($this->context->cookie->$cookie_key);
} }
@@ -1045,11 +1045,11 @@ class AdminControllerCore extends Controller
protected function filterToField($key, $filter) protected function filterToField($key, $filter)
{ {
foreach ($this->fieldsDisplay as $field) foreach ($this->fields_list as $field)
if (array_key_exists('filter_key', $field) && $field['filter_key'] == $key) if (array_key_exists('filter_key', $field) && $field['filter_key'] == $key)
return $field; return $field;
if (array_key_exists($filter, $this->fieldsDisplay)) if (array_key_exists($filter, $this->fields_list))
return $this->fieldsDisplay[$filter]; return $this->fields_list[$filter];
return false; return false;
} }
@@ -1379,7 +1379,7 @@ class AdminControllerCore extends Controller
*/ */
public function renderList() public function renderList()
{ {
if (!($this->fieldsDisplay && is_array($this->fieldsDisplay))) if (!($this->fields_list && is_array($this->fields_list)))
return false; return false;
$this->getList($this->context->language->id); $this->getList($this->context->language->id);
@@ -1400,7 +1400,7 @@ class AdminControllerCore extends Controller
$this->actions[] = $action; $this->actions[] = $action;
} }
$list = $helper->generateList($this->_list, $this->fieldsDisplay); $list = $helper->generateList($this->_list, $this->fields_list);
return $list; return $list;
} }
@@ -1849,7 +1849,7 @@ class AdminControllerCore extends Controller
break; break;
} }
} }
elseif (!empty($this->fields_options) && empty($this->fieldsDisplay)) elseif (!empty($this->fields_options) && empty($this->fields_list))
$this->display = 'options'; $this->display = 'options';
} }
+11 -11
View File
@@ -78,7 +78,7 @@ class HelperListCore extends Helper
* icon : icon determined by values * icon : icon determined by values
* active : allow to toggle status * active : allow to toggle status
*/ */
protected $fieldsDisplay; protected $fields_list;
/** @var boolean Content line is clickable if true */ /** @var boolean Content line is clickable if true */
public $no_link = false; public $no_link = false;
@@ -138,7 +138,7 @@ class HelperListCore extends Helper
$this->footer_tpl = $this->createTemplate($this->footer_tpl); $this->footer_tpl = $this->createTemplate($this->footer_tpl);
$this->_list = $list; $this->_list = $list;
$this->fieldsDisplay = $fields_display; $this->fields_list = $fields_display;
// Display list header (filtering, pagination and column names) // Display list header (filtering, pagination and column names)
$tpl_vars['header'] = $this->displayListHeader(); $tpl_vars['header'] = $this->displayListHeader();
@@ -182,7 +182,7 @@ class HelperListCore extends Helper
else else
$id_category = Category::getRootCategory()->id; $id_category = Category::getRootCategory()->id;
if (isset($this->fieldsDisplay['position'])) if (isset($this->fields_list['position']))
{ {
$positions = array_map(create_function('$elem', 'return (int)($elem[\'position\']);'), $this->_list); $positions = array_map(create_function('$elem', 'return (int)($elem[\'position\']);'), $this->_list);
sort($positions); sort($positions);
@@ -217,7 +217,7 @@ class HelperListCore extends Helper
// @todo skip action for bulk actions // @todo skip action for bulk actions
// $this->_list[$index]['has_bulk_actions'] = true; // $this->_list[$index]['has_bulk_actions'] = true;
foreach ($this->fieldsDisplay as $key => $params) foreach ($this->fields_list as $key => $params)
{ {
$tmp = explode('!', $key); $tmp = explode('!', $key);
$key = isset($tmp[1]) ? $tmp[1] : $tmp[0]; $key = isset($tmp[1]) ? $tmp[1] : $tmp[0];
@@ -321,7 +321,7 @@ class HelperListCore extends Helper
'order_by' => $this->orderBy, 'order_by' => $this->orderBy,
'order_way' => $this->orderWay, 'order_way' => $this->orderWay,
'is_cms' => $this->is_cms, 'is_cms' => $this->is_cms,
'fields_display' => $this->fieldsDisplay, 'fields_display' => $this->fields_list,
'list' => $this->_list, 'list' => $this->_list,
'actions' => $this->actions, 'actions' => $this->actions,
'no_link' => $this->no_link, 'no_link' => $this->no_link,
@@ -371,14 +371,14 @@ class HelperListCore extends Helper
* [ * [
* {field_name: 'value'} * {field_name: 'value'}
* ], * ],
* fields_display: // attribute $fieldsDisplay of the admin controller * fields_display: // attribute $fields_list of the admin controller
* } * }
* or somethins like this: * or somethins like this:
* { * {
* use_parent_structure: false // If false, data need to be an html * use_parent_structure: false // If false, data need to be an html
* data: * data:
* '<p>My html content</p>', * '<p>My html content</p>',
* fields_display: // attribute $fieldsDisplay of the admin controller * fields_display: // attribute $fields_list of the admin controller
* } * }
*/ */
protected function displayDetailsLink($token = null, $id, $name = null) protected function displayDetailsLink($token = null, $id, $name = null)
@@ -537,7 +537,7 @@ class HelperListCore extends Helper
if ($this->position_identifier && ($this->orderBy == 'position' && $this->orderWay != 'DESC')) if ($this->position_identifier && ($this->orderBy == 'position' && $this->orderWay != 'DESC'))
$table_dnd = true; $table_dnd = true;
foreach ($this->fieldsDisplay as $key => $params) foreach ($this->fields_list as $key => $params)
{ {
if (!isset($params['type'])) if (!isset($params['type']))
$params['type'] = 'text'; $params['type'] = 'text';
@@ -570,7 +570,7 @@ class HelperListCore extends Helper
if (isset($_POST[$this->table.'Filter_'.$params['filter_key']]) if (isset($_POST[$this->table.'Filter_'.$params['filter_key']])
&& Tools::getValue($this->table.'Filter_'.$params['filter_key']) == $option_value && Tools::getValue($this->table.'Filter_'.$params['filter_key']) == $option_value
&& Tools::getValue($this->table.'Filter_'.$params['filter_key']) != '') && Tools::getValue($this->table.'Filter_'.$params['filter_key']) != '')
$this->fieldsDisplay[$key]['select'][$option_value]['selected'] = 'selected'; $this->fields_list[$key]['select'][$option_value]['selected'] = 'selected';
} }
break; break;
@@ -579,7 +579,7 @@ class HelperListCore extends Helper
$value = ''; $value = '';
} }
$params['value'] = $value; $params['value'] = $value;
$this->fieldsDisplay[$key] = $params; $this->fields_list[$key] = $params;
} }
$this->header_tpl->assign(array_merge($this->tpl_vars, array( $this->header_tpl->assign(array_merge($this->tpl_vars, array(
@@ -600,7 +600,7 @@ class HelperListCore extends Helper
'order_way' => $this->orderWay, 'order_way' => $this->orderWay,
'order_by' => $this->orderBy, 'order_by' => $this->orderBy,
'token' => $this->token, 'token' => $this->token,
'fields_display' => $this->fieldsDisplay, 'fields_display' => $this->fields_list,
'delete' => in_array('delete', $this->actions), 'delete' => in_array('delete', $this->actions),
'identifier' => $this->identifier, 'identifier' => $this->identifier,
'id_cat' => $id_cat, 'id_cat' => $id_cat,
@@ -52,7 +52,7 @@ class AdminAddressesControllerCore extends AdminController
foreach ($countries as $country) foreach ($countries as $country)
$this->countries_array[$country['id_country']] = $country['name']; $this->countries_array[$country['id_country']] = $country['name'];
$this->fieldsDisplay = array( $this->fields_list = array(
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'firstname' => array('title' => $this->l('First name'), 'width' => 120, 'filter_key' => 'a!firstname'), 'firstname' => array('title' => $this->l('First name'), 'width' => 120, 'filter_key' => 'a!firstname'),
'lastname' => array('title' => $this->l('Last name'), 'width' => 140, 'filter_key' => 'a!lastname'), 'lastname' => array('title' => $this->l('Last name'), 'width' => 140, 'filter_key' => 'a!lastname'),
@@ -39,7 +39,7 @@ class AdminAttachmentsControllerCore extends AdminController
$this->addRowAction('edit'); $this->addRowAction('edit');
$this->addRowAction('delete'); $this->addRowAction('delete');
$this->fieldsDisplay = array( $this->fields_list = array(
'id_attachment' => array( 'id_attachment' => array(
'title' => $this->l('ID'), 'title' => $this->l('ID'),
'align' => 'center', 'align' => 'center',
@@ -39,7 +39,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
$this->lang = true; $this->lang = true;
$this->_defaultOrderBy = 'position'; $this->_defaultOrderBy = 'position';
$this->fieldsDisplay = array( $this->fields_list = array(
'id_attribute_group' => array( 'id_attribute_group' => array(
'title' => $this->l('ID'), 'title' => $this->l('ID'),
'width' => 25, 'width' => 25,
@@ -101,7 +101,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
if (!Validate::isLoadedObject($obj = new AttributeGroup((int)$id))) if (!Validate::isLoadedObject($obj = new AttributeGroup((int)$id)))
$this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)'); $this->errors[] = Tools::displayError('An error occurred while updating status for object.').' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
$this->fieldsDisplay = array( $this->fields_list = array(
'id_attribute' => array( 'id_attribute' => array(
'title' => $this->l('ID'), 'title' => $this->l('ID'),
'width' => 40, 'width' => 40,
@@ -115,13 +115,13 @@ class AdminAttributesGroupsControllerCore extends AdminController
); );
if ($obj->group_type == 'color') if ($obj->group_type == 'color')
$this->fieldsDisplay['color'] = array( $this->fields_list['color'] = array(
'title' => $this->l('Color'), 'title' => $this->l('Color'),
'width' => 40, 'width' => 40,
'filter_key' => 'b!color' 'filter_key' => 'b!color'
); );
$this->fieldsDisplay['position'] = array( $this->fields_list['position'] = array(
'title' => $this->l('Position'), 'title' => $this->l('Position'),
'width' => 40, 'width' => 40,
'filter_key' => 'cp!position', 'filter_key' => 'cp!position',
@@ -159,7 +159,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
$helper->show_toolbar = false; $helper->show_toolbar = false;
$helper->bulk_actions = $this->bulk_actions; $helper->bulk_actions = $this->bulk_actions;
$helper->position_identifier = 'id_attribute'; $helper->position_identifier = 'id_attribute';
$content = $helper->generateList($this->_list, $this->fieldsDisplay); $content = $helper->generateList($this->_list, $this->fields_list);
die (Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content))); die (Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content)));
} }
+1 -1
View File
@@ -37,7 +37,7 @@ class AdminBackupControllerCore extends AdminController
$this->identifier = 'filename'; $this->identifier = 'filename';
parent::__construct(); parent::__construct();
$this->fieldsDisplay = array ( $this->fields_list = array (
'date' => array('title' => $this->l('Date'), 'type' => 'datetime', 'width' => 120, 'align' => 'right'), 'date' => array('title' => $this->l('Date'), 'type' => 'datetime', 'width' => 120, 'align' => 'right'),
'age' => array('title' => $this->l('Age')), 'age' => array('title' => $this->l('Age')),
'filename' => array('title' => $this->l('File name'), 'width' => 200), 'filename' => array('title' => $this->l('File name'), 'width' => 200),
@@ -51,7 +51,7 @@ class AdminCarriersControllerCore extends AdminController
'dir' => 's' 'dir' => 's'
); );
$this->fieldsDisplay = array( $this->fields_list = array(
'id_carrier' => array( 'id_carrier' => array(
'title' => $this->l('ID'), 'title' => $this->l('ID'),
'align' => 'center', 'align' => 'center',
@@ -36,7 +36,7 @@ class AdminCartRulesControllerCore extends AdminController
$this->addRowAction('edit'); $this->addRowAction('edit');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->fieldsDisplay = array( $this->fields_list = array(
'id_cart_rule' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_cart_rule' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Code')), 'name' => array('title' => $this->l('Code')),
'priority' => array('title' => $this->l('Priority')), 'priority' => array('title' => $this->l('Priority')),
+1 -1
View File
@@ -44,7 +44,7 @@ class AdminCartsControllerCore extends AdminController
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_cart = a.id_cart) LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_cart = a.id_cart)
LEFT JOIN `'._DB_PREFIX_.'connections` co ON (a.id_guest = co.id_guest AND TIME_TO_SEC(TIMEDIFF(NOW(), co.`date_add`)) < 1800)'; LEFT JOIN `'._DB_PREFIX_.'connections` co ON (a.id_guest = co.id_guest AND TIME_TO_SEC(TIMEDIFF(NOW(), co.`date_add`)) < 1800)';
$this->fieldsDisplay = array( $this->fields_list = array(
'id_cart' => array( 'id_cart' => array(
'title' => $this->l('ID'), 'title' => $this->l('ID'),
'align' => 'center', 'align' => 'center',
@@ -47,7 +47,7 @@ class AdminCategoriesControllerCore extends AdminController
'dir' => 'c' 'dir' => 'c'
); );
$this->fieldsDisplay = array( $this->fields_list = array(
'id_category' => array( 'id_category' => array(
'title' => $this->l('ID'), 'title' => $this->l('ID'),
'align' => 'center', 'align' => 'center',
@@ -104,7 +104,7 @@ class AdminCategoriesControllerCore extends AdminController
// if we are not in a shop context, we remove the position column // if we are not in a shop context, we remove the position column
if (Shop::getContext() != Shop::CONTEXT_SHOP) if (Shop::getContext() != Shop::CONTEXT_SHOP)
unset($this->fieldsDisplay['position']); unset($this->fields_list['position']);
// shop restriction : if category is not available for current shop, we redirect to the list from default category // shop restriction : if category is not available for current shop, we redirect to the list from default category
if (!Shop::isCategoryAvailable($this->_category->id)) if (!Shop::isCategoryAvailable($this->_category->id))
{ {
@@ -42,7 +42,7 @@ class AdminCmsCategoriesControllerCore extends AdminController
$this->addRowAction('delete'); $this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->fieldsDisplay = array( $this->fields_list = array(
'id_cms_category' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30), 'id_cms_category' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30),
'name' => array('title' => $this->l('Name'), 'width' => 'auto', 'callback' => 'hideCMSCategoryPosition', 'callback_object' => 'CMSCategory'), 'name' => array('title' => $this->l('Name'), 'width' => 'auto', 'callback' => 'hideCMSCategoryPosition', 'callback_object' => 'CMSCategory'),
'description' => array('title' => $this->l('Description'), 'width' => 500, 'maxlength' => 90, 'orderby' => false), 'description' => array('title' => $this->l('Description'), 'width' => 500, 'maxlength' => 90, 'orderby' => false),
+2 -2
View File
@@ -43,7 +43,7 @@ class AdminCmsControllerCore extends AdminController
$this->addRowAction('delete'); $this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->fieldsDisplay = array( $this->fields_list = array(
'id_cms' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_cms' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'link_rewrite' => array('title' => $this->l('URL'), 'width' => 'auto'), 'link_rewrite' => array('title' => $this->l('URL'), 'width' => 'auto'),
'meta_title' => array('title' => $this->l('Title'), 'width' => '300', 'filter_key' => 'b!meta_title'), 'meta_title' => array('title' => $this->l('Title'), 'width' => '300', 'filter_key' => 'b!meta_title'),
@@ -194,7 +194,7 @@ class AdminCmsControllerCore extends AdminController
/* Display list header (filtering, pagination and column names) */ /* Display list header (filtering, pagination and column names) */
$this->displayListHeader($token); $this->displayListHeader($token);
if (!count($this->_list)) if (!count($this->_list))
echo '<tr><td class="center" colspan="'.(count($this->fieldsDisplay) + 2).'">'.$this->l('No items found').'</td></tr>'; echo '<tr><td class="center" colspan="'.(count($this->fields_list) + 2).'">'.$this->l('No items found').'</td></tr>';
/* Show the content of the table */ /* Show the content of the table */
$this->displayListContent($token); $this->displayListContent($token);
@@ -36,7 +36,7 @@ class AdminContactsControllerCore extends AdminController
$this->addRowAction('delete'); $this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
$this->fieldsDisplay = array( $this->fields_list = array(
'id_contact' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_contact' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Title'), 'width' => 130), 'name' => array('title' => $this->l('Title'), 'width' => 130),
'email' => array('title' => $this->l('E-mail address'), 'width' => 130), 'email' => array('title' => $this->l('E-mail address'), 'width' => 130),