public function listAction() { $listcount = new LookupType(); $listcount->setName("LIST_ITEM_COUNT_OPTIONS"); $values = $listcount->getOptionValues(); asort($values, SORT_NUMERIC); $session = SessionWrapper::getInstance(); $dropdown = new Zend_Form_Element_Select('itemcountperpage', array('multiOptions' => $values, 'view' => new Zend_View(), 'decorators' => array('ViewHelper'), 'class' => array('form-control', 'width75', 'inline', 'input-sm', 'perpageswitcher'))); if (isEmptyString($this->_getParam('itemcountperpage'))) { if (!isEmptyString($session->getVar('itemcountperpage'))) { $dropdown->setValue($session->getVar('itemcountperpage')); if ($session->getVar('itemcountperpage') == 'ALL') { $session->setVar('itemcountperpage', ''); $dropdown->setValue('50'); } } else { $dropdown->setValue('50'); } } else { $session->setVar('itemcountperpage', $this->_getParam('itemcountperpage')); $dropdown->setValue($session->getVar('itemcountperpage')); } $this->view->listcountdropdown = '<span>Per page: ' . $dropdown->render() . '</span>'; }
/** * @return String */ public function getListCountDropDown() { $listcount = new LookupType(); $listcount->setName("LIST_ITEM_COUNT_OPTIONS"); $values = $listcount->getOptionValues(); asort($values, SORT_NUMERIC); $session = SessionWrapper::getInstance(); $dropdown = new Zend_Form_Element_Select('itemcountperpage', array('multiOptions' => $values, 'view' => new Zend_View(), 'decorators' => array('ViewHelper'), 'class' => array('form-control', 'width75', 'inline', 'input-sm'))); if (isEmptyString($this->getItemCountPerPage())) { $dropdown->setValue($session->getVar('itemcountperpage')); } else { $session->setVar('itemcountperpage', $this->getItemCountPerPage()); $dropdown->setValue($this->getItemCountPerPage()); } $selectobj = '<span>Per page: ' . $dropdown->render() . '</span>'; return $selectobj; }