I have coded a simple admin module with ability to paginate records and sort them by some column. And when I sort and then call some other action on the records it should redirect the user back to index page with the same sort parameters as there were before. But after I call the indexAction() with parameters like this /admin/users/index/column/num_orders/order/ASC and then call the toggleActiveAction() I am redirected to page /admin/users/index/column/num_orders/order/CSS. The same story with .../index/page/2 => .../index/page/css.
Why "CSS"? My session data never used in other context than you see below.
In my bootstrap I have the following:
protected function _initSession()
{
Zend_Session::start();
}
Controller init():
...
$this->_session = new Zend_Session_Namespace('Admin_Users');
...
I have a following function in my controller:
public function redirectToIndex()
{
$options = array();
if (isset($this->_session->curPage) && $this->_session->curPage != 1)
$options['page'] = $this->_session->curPage;
if (isset($this->_session->curColumn) && $this->_session->curColumn)
$options['column'] = $this->_session->curColumn;
if (isset($this->_session->curOrder) && $this->_session->curOrder)
$options['order'] = $this->_session->curOrder;
$this->_helper->redirector('index', 'users', 'admin', $options);
}
In index action:
$curColumn = $this->_getParam('column', '');
$curOrder = strtoupper($this->_getParam('order', ''));
$page = $this->_getParam('page', 1);
...
$this->_session->curPage = $page;
$this->_session->curColumn = $curColumn;
$this->_session->curOrder = $curOrder;
Then in toggleActiveAction() I call
$this->redirectToIndex();