5 * Copyright 2004 (c) Dominik Haas, GForge Team
12 require_once('www/search/include/renderers/HtmlGroupSearchRenderer.class.php');
13 require_once('common/search/TasksSearchQuery.class.php');
15 class TasksHtmlSearchRenderer extends HtmlGroupSearchRenderer {
20 * @param string $words words we are searching for
21 * @param int $offset offset
22 * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
23 * @param int $groupId group id
24 * @param array $sections array of all sections to search in (array of strings)
27 function TasksHtmlSearchRenderer($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS) {
28 $userIsGroupMember = $this->isGroupMember($groupId);
30 $searchQuery = new TasksSearchQuery($words, $offset, $isExact, $groupId, $sections, $userIsGroupMember);
32 $this->HtmlGroupSearchRenderer(SEARCH__TYPE_IS_TASKS, $words, $isExact, $searchQuery, $groupId, 'pm');
34 $this->tableHeaders = array(
46 * getRows - get the html output for result rows
48 * @return string html output
51 $rowsCount = $this->searchQuery->getRowsCount();
52 $result =& $this->searchQuery->getResult();
53 $dateFormat = _('Y-m-d H:i');
57 $lastProjectName = null;
59 for($i = 0; $i < $rowsCount; $i++) {
61 $currentProjectName = db_result($result, $i, 'project_name');
62 if ($lastProjectName != $currentProjectName) {
63 $return .= '<tr><td colspan="7">'.$currentProjectName.'</td></tr>';
64 $lastProjectName = $currentProjectName;
67 $return .= '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($rowColor) .'>'
68 . ' <td width="5%"> </td>'
69 . ' <td>'.db_result($result, $i, 'project_task_id').'</td>'
71 . '<a href="'.util_make_url ('/pm/task.php?func=detailtask&project_task_id=' . db_result($result, $i, 'project_task_id').'&group_id='.$this->groupId . '&group_project_id='.db_result($result, $i, 'group_project_id')).'">'
72 . html_image('ic/msg.png', '10', '12', array('border'=>'0')).' '
73 . db_result($result, $i, 'summary').'</a></td>'
74 . ' <td width="15%">'.date($dateFormat, db_result($result, $i, 'start_date')).'</td>'
75 . ' <td width="15%">'.date($dateFormat, db_result($result, $i, 'end_date')).'</td>'
76 . ' <td width="15%">'.db_result($result, $i, 'realname').'</td>'
77 . ' <td width="8%">'.db_result($result, $i, 'percent_complete').' %</td></tr>';
84 * getSections - get the array of possible sections to search in
86 * @return array sections
88 function getSections($groupId) {
89 $userIsGroupMember = $this->isGroupMember($groupId);
91 return TasksSearchQuery::getSections($groupId, $userIsGroupMember);