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() { $this->startScope(); $this->renderer->listu_open(); foreach ($this->result as $result) { $this->renderer->listitem_open(1); $this->renderer->listcontent_open(); $this->renderListItem($result); $this->renderer->listcontent_close(); $this->renderer->listitem_close(); } $this->renderer->listu_close(); $this->finishScope(); return; } /** * 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 .= "
"; } /** * Closes anything opened in startScope() * * @see startScope() */ protected function finishScope() { // wrapping div if ($this->mode != 'xhtml') return; $this->renderer->doc .= '
'; } /** * @param $resultrow */ protected function renderListItem($resultrow) { $sepbyheaders = $this->searchConfig->getConf()['sepbyheaders']; $headers = $this->searchConfig->getConf()['headers']; /** * @var Value $value */ foreach ($resultrow as $column => $value) { if ($value->isEmpty()) { continue; } if ($sepbyheaders && !empty($headers[$column])) { if ($this->mode == 'xhtml') { $this->renderer->doc .= '' . hsc($headers[$column]) . ''; } else { $this->renderer->cdata($headers[$column]); } } if ($this->mode == 'xhtml') { $type = 'struct_' . strtolower($value->getColumn()->getType()->getClass()); $this->renderer->doc .= '
'; } $value->render($this->renderer, $this->mode); if ($column < $this->resultColumnCount) { $this->renderer->cdata(' '); } if ($this->mode == 'xhtml') { $this->renderer->doc .= '
'; } } } }