// Fix CMS filter, reset and sort
This commit is contained in:
@@ -36,13 +36,16 @@ class AdminCmsCategoriesControllerCore extends AdminController
|
||||
$this->bootstrap = true;
|
||||
$this->is_cms = true;
|
||||
$this->table = 'cms_category';
|
||||
$this->list_id = 'cms_category';
|
||||
$this->className = 'CMSCategory';
|
||||
$this->lang = true;
|
||||
$this->addRowAction('view');
|
||||
$this->addRowAction('edit');
|
||||
$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?'), 'icon' => 'icon-trash'));
|
||||
|
||||
$this->tpl_list_vars['icon'] = 'icon-folder-close';
|
||||
$this->tpl_list_vars['title'] = $this->l('Categories');
|
||||
$this->fields_list = array(
|
||||
'id_cms_category' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 'auto', 'callback' => 'hideCMSCategoryPosition', 'callback_object' => 'CMSCategory'),
|
||||
@@ -62,7 +65,7 @@ class AdminCmsCategoriesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$this->cms_category = AdminCmsContentController::getCurrentCMSCategory();
|
||||
$this->_filter = 'AND `id_parent` = '.(int)$this->cms_category->id;
|
||||
$this->_where = ' AND `id_parent` = '.(int)$this->cms_category->id;
|
||||
$this->_select = 'position ';
|
||||
|
||||
parent::__construct();
|
||||
@@ -71,23 +74,11 @@ class AdminCmsCategoriesControllerCore extends AdminController
|
||||
public function renderList()
|
||||
{
|
||||
$this->initToolbar();
|
||||
$this->toolbar_btn['new']['href'] .= '&id_parent='.(int)Tools::getValue('id_cms_category');
|
||||
if (isset($this->toolbar_btn['new']))
|
||||
$this->toolbar_btn['new']['href'] .= '&id_parent='.(int)Tools::getValue('id_cms_category');
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifying initial getList method to display position feature (drag and drop)
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
if ($order_by && $this->context->cookie->__get($this->table.'Orderby'))
|
||||
$order_by = $this->context->cookie->__get($this->table.'Orderby');
|
||||
else
|
||||
$order_by = 'position';
|
||||
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
|
||||
|
||||
@@ -46,9 +46,11 @@ class AdminCmsContentControllerCore extends AdminController
|
||||
|
||||
$this->table = 'cms';
|
||||
$this->className = 'CMS';
|
||||
$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?'), 'icon' => 'icon-trash'));
|
||||
$this->admin_cms_categories = new AdminCmsCategoriesController();
|
||||
$this->admin_cms_categories->init();
|
||||
$this->admin_cms = new AdminCmsController();
|
||||
$this->admin_cms->init();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -161,25 +163,33 @@ class AdminCmsContentControllerCore extends AdminController
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitDelcms')
|
||||
/*if (Tools::isSubmit('submitDelcms')
|
||||
|| Tools::isSubmit('previewSubmitAddcmsAndPreview')
|
||||
|| Tools::isSubmit('submitAddcms')
|
||||
|| Tools::isSubmit('submitBulkdeletecms')
|
||||
|| Tools::isSubmit('deletecms')
|
||||
|| Tools::isSubmit('viewcms')
|
||||
|| (Tools::isSubmit('statuscms') && Tools::isSubmit('id_cms'))
|
||||
|| (Tools::isSubmit('way') && Tools::isSubmit('id_cms')) && (Tools::isSubmit('position')))
|
||||
|| (Tools::isSubmit('way') && Tools::isSubmit('id_cms')) && (Tools::isSubmit('position'))
|
||||
|| Tools::isSubmit('submitFiltercms')
|
||||
|| $this->context->cookie->{'submitFiltercms'} !== false
|
||||
|| Tools::getValue('cmsOrderby')
|
||||
|| Tools::getValue('cmsOrderway'))*/
|
||||
$this->admin_cms->postProcess();
|
||||
elseif (Tools::isSubmit('submitDelcms_category')
|
||||
/*elseif (Tools::isSubmit('submitDelcms_category')
|
||||
|| Tools::isSubmit('submitAddcms_categoryAndBackToParent')
|
||||
|| Tools::isSubmit('submitBulkdeletecms_category')
|
||||
|| Tools::isSubmit('submitAddcms_category')
|
||||
|| Tools::isSubmit('deletecms_category')
|
||||
|| (Tools::isSubmit('statuscms_category') && Tools::isSubmit('id_cms_category'))
|
||||
|| (Tools::isSubmit('position') && Tools::isSubmit('id_cms_category_to_move')))
|
||||
|| (Tools::isSubmit('position') && Tools::isSubmit('id_cms_category_to_move'))
|
||||
|| Tools::isSubmit('submitFiltercms_category')
|
||||
|| $this->context->cookie->{'submitFiltercms_category'} !== false
|
||||
|| Tools::getValue('cms_categoryOrderby')
|
||||
|| Tools::getValue('cms_categoryOrderway'))*/
|
||||
$this->admin_cms_categories->postProcess();
|
||||
else
|
||||
parent::postProcess();
|
||||
//else
|
||||
parent::postProcess();
|
||||
|
||||
if (((Tools::isSubmit('submitAddcms_category') || Tools::isSubmit('submitAddcms_categoryAndStay')) && count($this->admin_cms_categories->errors))
|
||||
|| Tools::isSubmit('updatecms_category')
|
||||
|
||||
@@ -36,12 +36,12 @@ class AdminCmsControllerCore extends AdminController
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'cms';
|
||||
$this->list_id = 'cms';
|
||||
$this->className = 'CMS';
|
||||
$this->lang = true;
|
||||
$this->addRowAction('edit');
|
||||
$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?'), 'icon' => 'icon-trash'));
|
||||
$this->fields_list = array(
|
||||
'id_cms' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'),
|
||||
'link_rewrite' => array('title' => $this->l('URL')),
|
||||
@@ -59,10 +59,13 @@ class AdminCmsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$this->_category = AdminCmsContentController::getCurrentCMSCategory();
|
||||
$this->tpl_list_vars['icon'] = 'icon-folder-close';
|
||||
$this->tpl_list_vars['title'] = sprintf($this->l('Pages in category "%s"'),
|
||||
$this->_category->name[Context::getContext()->employee->id_lang]);
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'cms_category` c ON (c.`id_cms_category` = a.`id_cms_category`)';
|
||||
$this->_select = 'a.position ';
|
||||
$this->_filter = 'AND c.id_cms_category = '.(int)$this->_category->id;
|
||||
$this->_where = ' AND c.id_cms_category = '.(int)$this->_category->id;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -196,6 +199,7 @@ class AdminCmsControllerCore extends AdminController
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
//self::$currentIndex = self::$currentIndex.'&cms';
|
||||
$this->toolbar_title = $this->l('Pages in this category');
|
||||
$this->toolbar_btn['new'] = array(
|
||||
'href' => self::$currentIndex.'&add'.$this->table.'&id_cms_category='.(int)$this->id_cms_category.'&token='.$this->token,
|
||||
@@ -219,28 +223,8 @@ class AdminCmsControllerCore extends AdminController
|
||||
$this->displayListFooter($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifying initial getList method to display position feature (drag and drop)
|
||||
*/
|
||||
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
|
||||
{
|
||||
if (Tools::isSubmit($this->table.'Orderby') || Tools::isSubmit($this->table.'Orderway'))
|
||||
$this->filter = true;
|
||||
|
||||
if ($order_by && $this->context->cookie->__get($this->table.'Orderby'))
|
||||
$order_by = $this->context->cookie->__get($this->table.'Orderby');
|
||||
else
|
||||
$order_by = 'position';
|
||||
|
||||
if (is_null($order_way))
|
||||
$order_way = Tools::getValue($this->table.'Orderway', 'ASC');
|
||||
|
||||
parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
|
||||
{
|
||||
if (Tools::isSubmit('viewcms') && ($id_cms = (int)Tools::getValue('id_cms')) && ($cms = new CMS($id_cms, $this->context->language->id)) && Validate::isLoadedObject($cms))
|
||||
{
|
||||
$redir = $this->context->link->getCMSLink($cms);
|
||||
|
||||
Reference in New Issue
Block a user