6 * Portions Copyright 1999-2001 (c) VA Linux Systems
7 * The rest Copyright 2004 (c) Guillaume Smet / Open Wide
14 require_once $gfwww.'search/include/renderers/HtmlGroupSearchRenderer.class.php';
15 require_once $gfcommon.'search/ArtifactSearchQuery.class.php';
17 class ArtifactHtmlSearchRenderer extends HtmlGroupSearchRenderer {
22 * @var int $artifactId
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 $artifactId artifact id
35 function ArtifactHtmlSearchRenderer($words, $offset, $isExact, $groupId, $artifactId) {
36 $this->groupId = $groupId;
37 $this->artifactId = $artifactId;
39 $searchQuery = new ArtifactSearchQuery($words, $offset, $isExact, $groupId, $artifactId);
41 $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_ARTIFACT, $words, $isExact, $searchQuery, $groupId, 'tracker');
43 $this->tableHeaders = array(
52 * getRows - get the html output for result rows
54 * @return string html output
57 $rowsCount = $this->searchQuery->getRowsCount();
58 $result =& $this->searchQuery->getResult();
59 $groupId = $this->groupId;
60 $dateFormat = _('Y-m-d H:i');
63 for($i = 0; $i < $rowsCount; $i++) {
64 $return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>'
65 .'<td>'.db_result($result, $i, 'artifact_id').'</td>'
66 .'<td><a href="'.util_make_url ('/tracker/?group_id='.$groupId.'&atid=' . db_result($result, $i, 'group_artifact_id') . '&func=detail&aid=' . db_result($result, $i, 'artifact_id')).'"> '
67 . html_image('ic/msg.png', '10', '12', array('border'=>'0'))
68 . ' '.db_result($result, $i, 'summary').'</a></td>'
69 . '<td>'.db_result($result, $i, 'realname')."</td>"
70 . '<td>'.date($dateFormat, db_result($result, $i, 'open_date')).'</td></tr>';
76 * getPreviousResultsUrl - get the url to go to see the previous results
78 * @return string url to previous results page
80 function getPreviousResultsUrl() {
81 return parent::getPreviousResultsUrl().'&atid='.$this->artifactId;
85 * getNextResultsUrl - get the url to go to see the next results
87 * @return string url to next results page
89 function getNextResultsUrl() {
90 return parent::getNextResultsUrl().'&atid='.$this->artifactId;
94 * redirectToResult - redirect the user directly to the result when there is only one matching result
96 function redirectToResult() {
97 header('Location: /tracker/?group_id='.$this->groupId.'&atid='.$this->artifactId.'&func=detail&aid='.$this->getResultId('artifact_id'));
105 // c-file-style: "bsd"