5 * Copyright 2004 (c) Dominik Haas, GForge Team
6 * Copyright 2013, French Ministry of National Education
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/HtmlGroupSearchRenderer.class.php';
26 require_once $gfcommon.'search/NewsSearchQuery.class.php';
28 class NewsHtmlSearchRenderer extends HtmlGroupSearchRenderer {
31 * @param string $words words we are searching for
32 * @param int $offset offset
33 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
34 * @param int $groupId group id
36 function __construct($words, $offset, $isExact, $groupId) {
37 $this->groupId = $groupId;
39 $searchQuery = new NewsSearchQuery($words, $offset, $isExact, $groupId);
41 //init the searchrendererr
42 parent::__construct(SEARCH__TYPE_IS_NEWS, $words, $isExact, $searchQuery, $groupId, 'news');
44 $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 $rowsCount = count($result);
61 foreach ($result as $row) {
63 . '<td><a href="'.util_make_url ('/forum/forum.php?forum_id='. $row['forum_id']).'">'
64 . html_image('ic/msg.png', 10, 12)
65 . ' '.$row['summary'].'</a></td>
66 <td style="width: 15%">'.$row['realname'].'</td>
67 <td style="width: 15%">'.relative_date($row['post_date']).'</td></tr>';
73 * getSections - get the array of possible sections to search in
76 * @return array sections
78 static function getSections($groupId) {
79 $userIsGroupMember = NewsHtmlSearchRenderer::isGroupMember($groupId);
81 return NewsSearchQuery::getSections($groupId, $userIsGroupMember);
87 // c-file-style: "bsd"