4 * Wiki Search Engine for Fusionforge
6 * Copyright 2006 (c) Alain Peyrat
8 * This file is part of Fusionforge.
10 * Fusionforge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
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 this program; 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 'WikiSearchQuery.class.php';
28 class WikiHtmlSearchRenderer extends HtmlGroupSearchRenderer {
34 * @param string $words words we are searching for
35 * @param int $offset offset
36 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
37 * @param int $groupId group id
38 * @param array $sections array of all sections to search in (array of strings)
41 function WikiHtmlSearchRenderer($words, $offset, $isExact, $groupId) {
42 $this->groupId = $groupId;
44 $searchQuery = new WikiSearchQuery($words, $offset, $isExact, $groupId);
46 //init the searchrendererr
47 $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_WIKI, $words, $isExact,
48 $searchQuery, $groupId, 'wiki');
50 $this->tableHeaders = array(_('Page'),_('Author'), _('Date'));
54 * getRows - get the html output for result rows
56 * @return string html output
59 $rowsCount = $this->searchQuery->getRowsCount();
60 $result =& $this->searchQuery->getResult();
61 $dateFormat = _('Y-m-d H:i');
63 $group = group_get_object($this->groupId);
64 $group_name = $group->getUnixName();
67 for($i = 0; $i < $rowsCount; $i++) {
68 $data = unserialize(db_result($result, $i, 'versiondata'));
69 $return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>'
70 . '<td><a href="/wiki/g/'. $group_name.'/'.db_result($result, $i, 'pagename').'">'
71 . html_image('ic/msg.png', '10', '12')
72 . ' '.db_result($result, $i, 'pagename').'</a></td>
73 <td width="15%">'.$data['author'].'</td>
74 <td width="15%">'.date($dateFormat, db_result($result, $i, 'mtime')).'</td></tr>';