groupId = $groupId; $this->words = $words; $this->isExact = $isExact; $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_ADVANCED, $words, $isExact, '', $groupId); } /** * flush - overwrites the flush method from htmlrenderer */ function flush() { $this->writeBody(); $this->writeFooter(); } /** * writeBody - write the Body of the output */ function writeBody() { $title = _('Entire project search'); site_project_header(array('title' => $title, 'group' => $this->groupId, 'toptab' => 'home')); echo $this->getResult(); } /** * getResult - returns the Body of the output * * @return string result of all selected searches */ function getResult() { $html = ''; $group = group_get_object($this->groupId); if ($group->usesForum()) { $forumsRenderer = new ForumsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); } if ($group->usesTracker()) { $trackersRenderer = new TrackersHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); } if ($group->usesPM()) { $tasksRenderer = new TasksHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); } if ($group->usesDocman()) { $docsRenderer = new DocsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); } if ($group->usesFRS()) { $frsRenderer = new FrsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); } if ($group->usesNews()) { $newsRenderer = new NewsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); } $validLength = (strlen($this->words) >= 3); if (isset($trackersRenderer) && ($validLength || (is_numeric($this->words) && $trackersRenderer->searchQuery->implementsSearchById()))) { $html .= $this->getPartResult($trackersRenderer, 'short_tracker', _('Tracker Search Results')); } if (isset($forumsRenderer) && ($validLength || (is_numeric($this->words) && $forumsRenderer->searchQuery->implementsSearchById()))) { $html .= $this->getPartResult($forumsRenderer, 'short_forum', _('Forum Search Results')); } if (isset($tasksRenderer) && ($validLength || (is_numeric($this->words) && $tasksRenderer->searchQuery->implementsSearchById()))) { $html .= $this->getPartResult($tasksRenderer, 'short_pm', _('Task Search Results')); } if (isset($docsRenderer) && ($validLength || (is_numeric($this->words) && $docsRenderer->searchQuery->implementsSearchById()))) { $html .= $this->getPartResult($docsRenderer, 'short_docman', _('Documentation Search Results')); } if (isset($frsRenderer) && ($validLength || (is_numeric($this->words) && $frsRenderer->searchQuery->implementsSearchById()))) { $html .= $this->getPartResult($frsRenderer, 'short_files', _('Files Search Results')); } if (isset($newsRenderer) && ($validLength || (is_numeric($this->words) && $newsRenderer->searchQuery->implementsSearchById()))) { $html .= $this->getPartResult($newsRenderer, 'short_news', _('News Search Results')); } if (! $html && ! $validLength) { $html .= '

'._('Error: search query too short').'

'; } // This is quite complex but the goal is to extract all the // registered plugins to the hook 'search_engines' and call // them. $pluginManager = plugin_manager_get_object(); $searchManager = getSearchManager(); $engines = $searchManager->getAvailableSearchEngines(); if (isset($pluginManager->hooks_to_plugins['full_search_engines'])) { $p_list = $pluginManager->hooks_to_plugins['full_search_engines']; foreach ($p_list as $p_name) { $p_obj = $pluginManager->GetPluginObject($p_name); $name = $p_obj->text; reset($engines); foreach($engines as $e) { if ($e->type == $p_name) { $renderer = $e->getSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); $html .= $this->getPartResult($renderer, 'short_'.$p_name, sprintf(_("%s Search Results"), $name)); } } } } /* $renderer = new ForumsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); $html .= $this->getPartResult($renderer, 'short_forum', _('Forum Search Results')); $renderer = new TrackersHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); $html .= $this->getPartResult($renderer, 'short_tracker', _('Tracker Search Results')); $renderer = new TasksHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); $html .= $this->getPartResult($renderer, 'short_pm', _('Task Search Results')); $renderer = new DocsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); $html .= $this->getPartResult($renderer, 'short_docman', _('Documentation Search Results')); $renderer = new FrsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); $html .= $this->getPartResult($renderer, 'short_files', _('Files Search Results')); $renderer = new NewsHtmlSearchRenderer($this->words, $this->offset, $this->isExact, $this->groupId); $html .= $this->getPartResult($renderer, 'short_news', _('News Search Results')); */ return $html.'
'; } /** * getPartResult - returns the result of the given renderer * * @return string result of the renderer */ function getPartResult($renderer, $section, $title='') { $result = ''; $renderer->searchQuery->executeQuery(); if ($title === '') $title = $section; $result .= '

'.$title.'

'; if ($renderer->searchQuery->getRowsCount() > 0) { $result .= $GLOBALS['HTML']->listTabletop($renderer->tableHeaders); $result .= $renderer->getRows(); $result .= $GLOBALS['HTML']->listTableBottom(); } elseif(method_exists($renderer, 'getSections') && (count($renderer->getSections($this->groupId)) == 0)) { $result .= '

'.sprintf(_('No matches found for %s - No sections available (check your permissions)'), $this->words).'

'; } else { $result .= '

'.sprintf(_('No matches found for %s'), $this->words).'

'; } return $result; } } // Local Variables: // mode: php // c-file-style: "bsd" // End: ?>