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.
11 * FusionForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with FusionForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 require_once $gfwww.'search/include/renderers/HtmlSearchRenderer.class.php';
27 require_once $gfcommon.'search/PeopleSearchQuery.class.php';
29 class PeopleHtmlSearchRenderer extends HtmlSearchRenderer {
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
38 function PeopleHtmlSearchRenderer($words, $offset, $isExact) {
40 $searchQuery = new PeopleSearchQuery($words, $offset, $isExact);
42 $this->HtmlSearchRenderer(SEARCH__TYPE_IS_PEOPLE, $words, $isExact, $searchQuery);
44 $this->tableHeaders = array(
51 * writeHeader - write the header of the output
53 function writeHeader() {
54 $GLOBALS['HTML']->header(array('title'=>_('People Search')));
55 parent::writeHeader();
59 * getRows - get the html output for result rows
61 * @return string html output
64 $rowsCount = $this->searchQuery->getRowsCount();
65 $result =& $this->searchQuery->getResult();
68 for($i = 0; $i < $rowsCount; $i++) {
69 $return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>'.
70 '<td width="40%"><a href="'.util_make_url_u (db_result($result, $i, 'user_name'),db_result($result, $i, 'user_id')).'">'.html_image('ic/msg.png', '10', '12').' '.db_result($result, $i, 'user_name').'</a></td>'.
71 '<td width="60%">'.db_result($result, $i, 'realname').'</td>'.
78 * redirectToResult - redirect the user directly to the result when there is only one matching result
80 function redirectToResult() {
81 session_redirect('/users/'.$this->getResultId('user_name').'/');
87 // c-file-style: "bsd"