5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2004 (c) Guillaume Smet / Open Wide
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 require_once $gfwww.'search/include/renderers/HtmlSearchRenderer.class.php';
30 class HtmlGroupSearchRenderer extends HtmlSearchRenderer {
32 /** TODO: Find what for is $offset, looks like it's not used, added to remove warning
51 * @param string $typeOfSearch type of the search (Software, Forum, People and so on)
52 * @param string $words words we are searching for
53 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
54 * @param object $searchQuery SearchQuery instance
55 * @param int $groupId group id
56 * @param string $topTab
59 function HtmlGroupSearchRenderer($typeOfSearch, $words, $isExact, $searchQuery, $groupId, $topTab = '') {
60 $this->HtmlSearchRenderer($typeOfSearch, $words, $isExact, $searchQuery);
61 $this->groupId = $groupId;
62 $this->topTab = $topTab;
66 * writeHeader - write the header of the output
68 function writeHeader() {
69 $title = sprintf(_('Search results for ā%1$sā'), $this->query['words']);
70 site_project_header(array('title' => $title, 'group' => $this->groupId, 'toptab' => $this->topTab));
72 printf (_('Tip: Use %s to get more precise results.'),
73 util_make_link('/search/advanced_search.php?group_id='.$this->groupId.'&words='.
74 htmlspecialchars_decode($this->query['words']),
75 _('Advanced search')));
79 * getPreviousResultsUrl - get the url to go to see the previous results
81 * @return string url to previous results page
83 function getPreviousResultsUrl() {
84 return parent::getPreviousResultsUrl().'&group_id='.$this->groupId;
88 * getNextResultsUrl - get the url to go to see the next results
90 * @return string url to next results page
92 function getNextResultsUrl() {
93 return parent::getNextResultsUrl().'&group_id='.$this->groupId;
97 * isGroupMember - returns if the logged in user is member of the current group
99 * @param int $groupId group id
102 static function isGroupMember($groupId) {
103 $Group = group_get_object($groupId);
104 if($Group && is_object($Group) && !$Group->isError() && session_loggedin()) {
105 $perm =& $Group->getPermission ();
106 if($perm && is_object($perm) && $perm->isMember()) {