[ 'event' => 'change', 'action' => 'changeOrderStatus', 'confirmationOptions' => [ 'confirmation' => 'Do you really want to change order status for selected item(s) ?', ], ], 'paid' => [ 'event' => 'change', 'action' => 'changePaidStatus', 'confirmationOptions' => [ 'confirmation' => 'Do you really want to change paid status for selected item(s) ?', ], ], ]; protected function _init() { $this->_initActionToolbarForm(); return parent::_init(); } protected function _initActionToolbarForm() { $this->setActionToolbarOption('controllerAction', 'multiAction'); $this->setActionToolbarOption('formActions', [ 'form' => new App_ECommerce_Order_Admin_Form_Tool(), 'options' => [ 'counter' => [ 'updatingTagSelector' => '.tool_checked_count', 'options' => [ 'singular' => $this->getConfig('itemName'), 'plural' => $this->getConfig('itemsName'), ], ], 'elementActionsMap' => $this->_elementActionsMap, ], ]); return $this; } protected function _initColumns() { parent::_initColumns(); $this->addColumn('options', 'options', ['actions' => [ 'view' => ['title' => 'View'], 'edit' => [ 'title' => 'Edit', 'excluding4Statuses' => [ 'status' => App_ECommerce_Order_Admin_Obj::STATUS_ORDER_CLOSED, ], ], 'delete' => ['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, ['title' => '']); $this->_columns = [$colName => $columnOptions] + $this->_columns; } if (false === $this->_actionToolbarIsForm) { $this->_actionToolbarOptions['cellClasses'] = explode(' ', $this->_columns[$colName]['attribs']['class']); $scriptOptions['handlers']['actionToolbar'] = [ 'constructor' => 'Qs_ViewController_List_ActionToolbar', 'options' => $this->getActionToolbarOptions(), ]; } else { $this->_actionToolbarOptions['formActions']['options']['cellClasses'] = explode(' ', $this->_columns[$colName]['attribs']['class']); $scriptOptions['handlers']['actionToolbar'] = [ 'constructor' => 'App_ECommerce_Order_Admin_List_ActionFormToolbar', 'options' => $this->getActionToolbarFormOptions(), ]; } } if ($this->_hasRowPreview) { $specialColumnsCount += 1; $item['hasRowPreview'] = $this->_hasRowPreview; $scriptOptions['handlers']['rowPreview'] = [ 'constructor' => 'Qs_ViewController_List_RowPreview', 'options' => $this->getRowPreviewOptions(), ]; } if ($scriptOptions && $scriptOptions['handlers']) { $item['script'] = [['js/lib/list.js']]; $item['initObject'] = [['Qs_ViewController_List', [$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']; } }