public function execute(&$param_pool) { $result = new XMLElement($this->dsParamROOTELEMENT); $type_sql = $parent_sql = null; if (trim($this->dsParamFILTERS['type']) != '') { $type_sql = $this->__processNavigationTypeFilter($this->dsParamFILTERS['type'], $this->__determineFilterType($this->dsParamFILTERS['type'])); } if (trim($this->dsParamFILTERS['parent']) != '') { $parent_sql = $this->__processNavigationParentFilter($this->dsParamFILTERS['parent']); } // Build the Query appending the Parent and/or Type WHERE clauses $pages = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\tSELECT DISTINCT p.id, p.title, p.handle, (SELECT COUNT(id) FROM `tbl_pages` WHERE parent = p.id) AS children\n\t\t\t\t\tFROM `tbl_pages` AS p\n\t\t\t\t\tLEFT JOIN `tbl_pages_types` AS pt ON (p.id = pt.page_id)\n\t\t\t\t\tWHERE 1 = 1\n\t\t\t\t\t%s\n\t\t\t\t\t%s\n\t\t\t\t\tORDER BY p.`sortorder` ASC\n\t\t\t\t", !is_null($parent_sql) ? $parent_sql : " AND p.parent IS NULL ", !is_null($type_sql) ? $type_sql : "")); if (!is_array($pages) || empty($pages)) { if ($this->dsParamREDIRECTONEMPTY == 'yes') { throw new FrontendPageNotFoundException(); } $result->appendChild($this->__noRecordsFound()); } else { // Build an array of all the types so that the page's don't have to do // individual lookups. $page_types = PageManager::fetchAllPagesPageTypes(); foreach ($pages as $page) { $result->appendChild($this->__buildPageXML($page, $page_types)); } } return $result; }