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->resultCount = $this->searchConfig->getCount();
$this->helper = plugin_load('helper', 'struct_config');
}
/**
* Create the table on the renderer
*/
public function render() {
$this->startScope();
$this->renderer->doc .= '
';
foreach ($this->result as $result) {
$this->renderResult($result);
}
$this->renderer->doc .= '
';
$this->finishScope();
return;
}
/**
* Adds additional info to document and renderer in XHTML mode
*
* @see finishScope()
*/
protected function startScope() {
// unique identifier for this aggregation
$this->renderer->info['struct_cloud_hash'] = md5(var_export($this->data, true));
// wrapping div
if($this->mode != 'xhtml') return;
$this->renderer->doc .= "";
}
/**
* Closes the table and anything opened in startScope()
*
* @see startScope()
*/
protected function finishScope() {
// remove identifier from renderer again
if(isset($this->renderer->info['struct_cloud_hash'])) {
unset($this->renderer->info['struct_cloud_hash']);
}
// wrapping div
if($this->mode != 'xhtml') return;
$this->renderer->doc .= '
';
}
protected function renderResult($result) {
/**
* @var Value $value
*/
$value = $result['tag'];
$count = $result['count'];
if ($value->isEmpty()) {
return;
}
$raw = $value->getRawValue();
if (is_array($raw)) {
$raw = $raw[0];
}
$schema = $this->data['schemas'][0][0];
$col = $value->getColumn()->getLabel();
$this->renderer->doc .= '';
$this->renderer->doc .= '
';
//$value->render($this->renderer, $this->mode);
$this->renderer->internallink("?flt[$schema.$col*~]=" . urlencode($raw),$raw);
if ($column < $this->resultCount) {
$this->renderer->doc .= ' ';
}
$this->renderer->doc .= '
';
$this->renderer->doc .= '
';
}
}