types) { $this->types = Qs_Array::group($this->getConfigArray('types'), 'id', []); foreach ($this->types as $index => $type) { if (false === ($page = Qs_SiteMap::findFirst(null, ['type' => $type['adminModule']]))) { unset($this->types[$index]); } } } return $this->types; } public function getType($id, $field = null, $default = null) { if (null === $field) { return Qs_Array::get($this->getTypes(), $id, $default); } return Qs_Array::get($this->getTypes(), $id . "[{$field}]", $default); } public function getPages() { if (null === $this->pages) { $this->pages = App_Cms_Obj::getInstance()->getFilteredPages4Select(0, ['`Page`.`showSideBlock` = "y"']); } return $this->pages; } public function getMultiPages() { $siteMap = App_Cms_Obj::getInstance()->getSiteMap(); Qs_Array::treeWalkReverse($siteMap, function (&$page) { $page['itemGroups'] = Qs_Array::filter($page['itemGroups'], ['showSideBlock' => 'y']); if ('y' != $page['showSideBlock'] || empty($page['itemGroups'])) { if (empty($page['sub'])) { return false; } $page['disabled'] = 'y'; } else { $page['disabled'] = 'n'; } $page = Qs_Array::map($page, ['id', 'title', 'itemGroups', 'disabled', 'sub']); return true; }); return $siteMap; } public function getListSelect() { if (null !== $this->_select) { return $this->_select; } $select = parent::getListSelect(); if (($pageId = $this->getFilter('pageId'))) { $select->join( $this->_getSubPair('Page', 'sbp'), '`sbp`.`sideBlockId` = `sb`.`id` ' . 'AND `sbp`.`pageId` = ' . $this->_db->quote($pageId, Qs_Db::INT_TYPE), [] ); $this->_joinItemGroupEnabled($select, ['groupTitle' => 'title', 'groupName' => 'name']); } return $select; } protected function _joinItemGroupEnabled(Zend_Db_Select $select, $columns = []) { $select->join( $this->_getPair('DPageItemGroup', 'g'), '`g`.`id` = `sbp`.`pageItemGroupId` AND `g`.`showSideBlock` = "y"', $columns ); $select->join( $this->_getPair('PageItemGroup', 'pig'), '`pig`.`pageId` = `sbp`.`pageId` AND `pig`.`pageItemGroupId` = `g`.`id`', [] ); return $this; } }