5 * Copyright 2004 (c) Dominik Haas, GForge Team
6 * http://fusionforge.org
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once $gfwww.'search/include/renderers/HtmlGroupSearchRenderer.class.php';
25 require_once $gfcommon.'search/FrsSearchQuery.class.php';
27 class FrsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
30 * @param string $words words we are searching for
31 * @param int $offset offset
32 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
33 * @param int $groupId group id
34 * @param array|string $sections array of all sections to search in (array of strings)
36 function __construct($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS) {
37 $userIsGroupMember = $this->isGroupMember($groupId);
39 $searchQuery = new FrsSearchQuery($words, $offset, $isExact, $groupId, $sections, $userIsGroupMember);
41 parent::__construct(SEARCH__TYPE_IS_FRS, $words, $isExact, $searchQuery, $groupId, 'frs');
43 $this->tableHeaders = array(
52 * getRows - get the html output for result rows
54 * @return string html output
57 $result = $this->searchQuery->getData($this->searchQuery->getRowsPerPage(),$this->searchQuery->getOffset());
58 $group_id = $this->searchQuery->groupId;
64 foreach ($result as $row) {
66 $currentPackage = $row['package_name'];
67 if ($lastPackage != $currentPackage) {
68 $return .= '<tr><td colspan="4">'.$currentPackage.'</td></tr>';
69 $lastPackage = $currentPackage;
72 $return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
73 . '<td style="width: 5%"> </td>'
74 . '<td>'.util_make_link ('/frs/?view=shownotes&group_id='.$group_id.'&release_id='.$row['release_id'],$row['release_name']).'</td>'
75 . '<td style="width: 15%">'.$row['realname'].'</td>'
76 . '<td style="width: 15%">'.relative_date($row['release_date']).'</td></tr>';
83 * getSections - get the array of possible sections to search in
86 * @return array sections
88 static function getSections($groupId) {
89 $userIsGroupMember = FrsHtmlSearchRenderer::isGroupMember($groupId);
91 return FrsSearchQuery::getSections($groupId, $userIsGroupMember);
97 // c-file-style: "bsd"