10); protected $_listTemplate = 'searchList.tpl'; private $_pageHandler = 'site'; protected function _init() { parent::_init(); $page = Qs_SiteMap::getPage(CURRENT_PAGE); $this->_pageHandler = empty($page['handler']) ? 'site' : $page['handler']; return $this; } protected function _doList() { $this->_saveBackUrl(); $this->_addFilterItem(); if (array_key_exists('query', $_REQUEST) && $_REQUEST['query']) { $this->_addListItem(); } } protected function _addListItem($list = null, $template = 'searchList.tpl') { if (null == $list) { $list = $this->list; } $this->_bindListColumns($list); $item = $list->toArray(); if($item['paginator']['last'] < $list->getPageNumber() && $item['paginator']['pageCount'] != 0) { $redirectUrl = str_replace($list->getPaginatorPagePlaceholder(), 1, $list->getPaginatorUrl()); $this->redirect($redirectUrl, 307); } elseif ($item['paginator']['last'] < $list->getPageNumber() && $list->getPageNumber() > 1) { $redirectUrl = str_replace($list->getPaginatorPagePlaceholder(), 1, $list->getPaginatorUrl()); $this->redirect($redirectUrl, 307); } $item['tpl'] = ($this->_pageHandler == 'site') ? $this->getTemplate('userList.tpl') : $this->getTemplate($template); $item['filter'] = array('query' => $_REQUEST['query']); $this->_addItem($item); return $this; } protected function _bindFilterButtons($form) { $form->addElement( 'submit', 'btnSearch', array( 'label' => 'Search', 'ignore' => true, 'attribs' => array('class' => 'btn'), 'decorators' => array('ViewHelper') ) ); $onClick = ($this->_pageHandler == 'site') ? 'parent.history.back();' : "document.location='" . BASE_URL . "/admin/cms" . "';"; $form->addElement( 'button', 'btnCancel', array( 'label' => 'Cancel', 'ignore' => true, 'decorators' => array('ViewHelper'), 'attribs' => array( 'class' => 'btn', 'onclick' => $onClick, ) ) ); $decorators = array('FormElements'); $decorators[] = array('decorator' => 'HtmlTag', 'options' => array('tag' => 'dl')); $decorators[] = 'Fieldset'; $form->addDisplayGroup(array('btnSearch', 'btnCancel'), 'submitSearchGroup', array('decorators' => $decorators)); } protected function _bindFilterFields($form) { $form->addElement('text', 'query', array('label' => 'Search', 'size' => 50)); return $this; } }