_tableAlias . '2Page'; $joinCondition = array("`{$block2Page}`.`idSideBlock` = `{$this->_tableAlias}`.`id`"); if (null !== $pageIds) { $joinCondition["`{$block2Page}`.`idPage` " . (is_array($pageIds) ? 'IN(?)' : '= ?')] = $pageIds; } $all = $this->_db->quote(App_SideBlock_Obj::PAGE_ALL); $joinCondition[] = "`{$block2Page}`.`auto` = IF(`{$this->_tableAlias}`.`pageType` = {$all}, 'y', 'n')"; $select = $this->_db->select() ->from($this->_getPair(), $blockCols) ->join($this->_getPair($block2Page), Qs_Db::getWhereSql($joinCondition), $block2PageCols); return $select; } public static function getPages4Select() { $where = array('`Page`.`showSideBlock` = "y"'); return (array) App_Cms_Obj::getInstance()->getFilteredPages4Select(0, $where); } }