id = $id; $this->mode = $mode; $this->renderer = $renderer; $this->searchConfig = $searchConfig; $this->data = $searchConfig->getConf(); $this->columns = $searchConfig->getColumns(); $this->result = $this->searchConfig->execute(); $this->resultColumnCount = count($this->columns); $this->resultPIDs = $this->searchConfig->getPids(); } /** * Create the list on the renderer */ public function render() { $nestedResult = new NestedResult($this->result); $root = $nestedResult->getRoot($this->data['nesting']); $this->startScope(); $this->renderNode($root); $this->finishScope(); } /** * Recursively render the result tree * * @param NestedValue $node * @return void */ protected function renderNode(NestedValue $node) { $self = $node->getValueObject(); // null for root node $children = $node->getChildren(); $results = $node->getResultRows(); // all our content is in a listitem, unless we are the root node if ($self) { $this->renderer->listitem_open($node->getDepth() + 1); // levels are 1 based } // render own value if available if ($self) { $this->renderer->listcontent_open(); $this->renderListItem([$self], $node->getDepth()); // zero based depth $this->renderer->listcontent_close(); } // render children or results as sub-list if ($children || $results) { $this->renderer->listu_open(); foreach ($children as $child) { $this->renderNode($child); } foreach ($results as $result) { $this->renderer->listitem_open($node->getDepth() + 2); // levels are 1 based, this is one deeper $this->renderer->listcontent_open(); $this->renderListItem($result, $node->getDepth() + 1); // zero based depth, one deeper $this->renderer->listcontent_close(); $this->renderer->listitem_close(); } $this->renderer->listu_close(); } // close listitem if opened if ($self) { $this->renderer->listitem_close(); } } /** * Adds additional info to document and renderer in XHTML mode * * @see finishScope() */ protected function startScope() { // wrapping div if ($this->mode != 'xhtml') return; $this->renderer->doc .= "