array( 'event' => 'change', 'action' => 'changeOrderStatus', 'confirmationOptions' => array( 'confirmation' => 'Do you really want to change order status for selected item(s) ?' ) ), 'paid' => array( 'event' => 'change', 'action' => 'changePaidStatus', 'confirmationOptions' => array( 'confirmation' => 'Do you really want to change paid status for selected item(s) ?' ) ) ); protected function _initActionToolbarForm() { $this->setActionToolbarOption('controllerAction', 'multiAction'); $this->setActionToolbarOption('formActions', array( 'form' => new App_ECommerce_Order_Admin_Form_Tool(), 'options' => array( 'counter' => array( 'updatingTagSelector' => '.tool_checked_count', 'options' => array( 'singular' => $this->getConfig('itemName'), 'plural' => $this->getConfig('itemsName') ) ), 'elementActionsMap' => $this->_elementActionsMap ) )); return $this; } protected function _initColumns() { parent::_initColumns(); $this->addColumn('options', 'options', array('actions' => array( 'view' => array('title' => 'View'), 'delete' => array('title' => 'Delete') ))); return $this; } public function getOptions() { $options = parent::getOptions(); $options['actionToolbarIsForm'] = $this->_actionToolbarIsForm; return $options; } public function toArray() { $item = $this->getOptions(); $item['config'] = $this->getConfig()->toArray(); $item['attribs'] = $this->getAttribs(); $item['sortLink'] = $this->getSortLink(); $item['list'] = $this->getList(); $item['primary'] = $this->getPrimaryKey(); $item['tpl'] = $this->getTemplate($this->_listTemplate); $scriptOptions = $this->getScriptOptions(); $specialColumnsCount = 0; if ($this->_actionToolbar) { $specialColumnsCount += 1; $item['actionToolbar'] = $this->getActionToolbarOptions(); $colName = '_actionToolbar'; if (empty($this->_columns[$colName])) { $columnOptions = $this->_createColumn('checkbox', $colName, array('title' => '')); $this->_columns = array($colName => $columnOptions) + $this->_columns; } if (false === $this->_actionToolbarIsForm) { $this->_actionToolbarOptions['cellClasses'] = explode(' ', $this->_columns[$colName]['attribs']['class']); $scriptOptions['handlers']['actionToolbar'] = array( 'constructor' => 'Qs_ViewController_List_ActionToolbar', 'options' => $this->getActionToolbarOptions(), ); } else { $this->_actionToolbarOptions['formActions']['options']['cellClasses'] = explode(' ', $this->_columns[$colName]['attribs']['class']); $scriptOptions['handlers']['actionToolbar'] = array( 'constructor' => 'App_ECommerce_Order_Admin_List_ActionFormToolbar', 'options' => $this->getActionToolbarFormOptions(), ); } } if ($this->_hasRowPreview) { $specialColumnsCount += 1; $item['hasRowPreview'] = $this->_hasRowPreview; $scriptOptions['handlers']['rowPreview'] = array( 'constructor' => 'Qs_ViewController_List_RowPreview', 'options' => $this->getRowPreviewOptions(), ); } if ($scriptOptions && $scriptOptions['handlers']) { $item['script'] = array(array('js/lib/list.js')); $item['initObject'] = array(array('Qs_ViewController_List', array($scriptOptions))); } $item['columns'] = $this->getColumns(); $item['columnCount'] = ($item['columns']) ? count($item['columns']) + $specialColumnsCount : 0; $item['renderPrimaryKey'] = ($this->_actionToolbar || $this->_hasRowPreview); if (!$this->isDisabledLimit()) { $this->_getPaginator()->setCurrentPageNumber($this->getPageNumber()) ->setItemCountPerPage($this->_getIpp()) ->setCurrentItems($item['list']); $item['paginator'] = get_object_vars($this->_getPaginator()->getPages()); $item['paginator']['url'] = $this->getPaginatorUrl(); $item['paginator']['firstUrl'] = $this->getPaginatorUrl(true); $item['paginator']['pagePlaceholder'] = Qs_ViewController_List::$_paginatorPagePlaceholder; $item['paginator']['ipp'] = $this->_getIpp(); $item['paginator']['changeableIpp'] = $this->getChangeableIpp(); $item['paginator']['ippList'] = $this->getIppList(); if ($item['paginator']['last'] < $this->getPageNumber() && ($item['paginator']['pageCount'] != 0 || $this->getPageNumber() > 1) ) { $this->getEventManager()->trigger( 'redirect', null, ['url' => $this->getPaginatorUrl(true), 'code' => 307] ); } } return $item; } public function getActionToolbarFormOptions() { if (!isset($this->_actionToolbarOptions['formActions']['options']['attribs']['id'])) { $id = str_replace('_', '-', strtolower(get_class($this))) . '-toolbar-' . $this->idItem; $this->_actionToolbarOptions['formActions']['options']['attribs']['id'] = $id; } return $this->_actionToolbarOptions['formActions']['options']; } }