6 * Portions Copyright 1999-2001 (c) VA Linux Systems
7 * The rest Copyright 2004 (c) Guillaume Smet / Open Wide
14 require_once('www/search/include/renderers/HtmlGroupSearchRenderer.class');
15 require_once('common/search/ForumSearchQuery.class');
17 class ForumHtmlSearchRenderer extends HtmlGroupSearchRenderer {
29 * @param string $words words we are searching for
30 * @param int $offset offset
31 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
32 * @param int $groupId group id
33 * @param int $forumId forum id
35 function ForumHtmlSearchRenderer($words, $offset, $isExact, $groupId, $forumId) {
36 $this->forumId = $forumId;
38 $searchQuery = new ForumSearchQuery($words, $offset, $isExact, $groupId, $forumId);
40 $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_FORUM, $words, $isExact, $searchQuery, $groupId, 'forums');
42 $this->tableHeaders = array(
50 * getRows - get the html output for result rows
52 * @return string html output
55 $rowsCount = $this->searchQuery->getRowsCount();
56 $result =& $this->searchQuery->getResult();
57 $dateFormat = $GLOBALS['sys_datefmt'];
60 for($i = 0; $i < $rowsCount; $i++) {
61 $return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td width="50%"><a href="'.$GLOBALS['sys_urlprefix'].'/forum/message.php?msg_id='
62 . db_result($result, $i, 'msg_id').'">'
63 . html_image('ic/msg.png', '10', '12', array('border' => '0'))
64 . ' '.db_result($result, $i, 'subject').'</a></td>'
65 . '<td width="30%">'.db_result($result, $i, 'realname').'</td>'
66 . '<td width="20%">'.date($dateFormat, db_result($result, $i, 'post_date')).'</td></tr>';
72 * getPreviousResultsUrl - get the url to go to see the previous results
74 * @return string url to previous results page
76 function getPreviousResultsUrl() {
77 return parent::getPreviousResultsUrl().'&forum_id='.$this->forumId;
81 * getNextResultsUrl - get the url to go to see the next results
83 * @return string url to next results page
85 function getNextResultsUrl() {
86 return parent::getNextResultsUrl().'&forum_id='.$this->forumId;
90 * redirectToResult - redirect the user directly to the result when there is only one matching result
92 function redirectToResult() {
93 header('Location: /forum/message.php?msg_id='.$this->getResultId('msg_id'));