3 * GForge Project Management Facility
5 * Copyright 2002 GForge, LLC
13 By Tim Perdue, Sourceforge, 11/99
14 Heavy rewrite by Tim Perdue April 2000
16 Total rewrite in OO and GForge coding guidelines 12/2002 by Tim Perdue
19 require_once('common/include/Error.class.php');
20 require_once('common/pm/ProjectTask.class.php');
22 class ProjectTaskHTML extends ProjectTask {
24 function ProjectTaskHTML(&$ProjectGroup, $project_task_id=false, $arr=false) {
25 return $this->ProjectTask($ProjectGroup,$project_task_id,$arr);
28 function multipleDependBox ($name='dependent_on[]') {
29 $result=$this->getOtherTasks();
30 //get the data so we can mark items as SELECTED
31 $arr2 =& array_keys($this->getDependentOn());
32 return html_build_multiple_select_box ($result,$name,$arr2);
35 function multipleAssignedBox ($name='assigned_to[]') {
36 $result = $this->ProjectGroup->getTechnicians ();
37 //get the data so we can mark items as SELECTED
38 $arr2 =& $this->getAssignedTo();
39 return html_build_multiple_select_box ($result,$name,$arr2);
43 function showDependentTasks () {
44 $sql="SELECT project_task.project_task_id,project_task.summary
45 FROM project_task,project_dependencies
46 WHERE project_task.project_task_id=project_dependencies.project_task_id
47 AND project_dependencies.is_dependent_on_task_id='". $this->getID() ."'";
48 $result=db_query($sql);
49 $rows=db_numrows($result);
53 <h3>'._('Tasks That Depend on This Task').'</h3>
57 $title_arr[]=_('Task Id');
58 $title_arr[]=_('Task Summary');
60 echo $GLOBALS['HTML']->listTableTop ($title_arr);
62 for ($i=0; $i < $rows; $i++) {
64 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>
65 <td><a href="'.$GLOBALS['sys_urlprefix'].'/pm/task.php?func=detailtask&project_task_id='.
66 db_result($result, $i, 'project_task_id').
67 '&group_id='. $this->ProjectGroup->Group->getID() .
68 '&group_project_id='. $this->ProjectGroup->getID() .'">'.
69 db_result($result, $i, 'project_task_id').'</td>
70 <td>'.db_result($result, $i, 'summary').'</td></tr>';
73 echo $GLOBALS['HTML']->listTableBottom();
77 <h3>'._('No Tasks are Dependent on This Task').'</h3>';
82 function showRelatedArtifacts() {
83 $res=$this->getRelatedArtifacts();
85 $rows=db_numrows($res);
87 $perm =& $this->ProjectGroup->Group->getPermission( session_get_user() );
89 if (!$perm || !is_object($perm) || !$perm->isPMAdmin()) {
96 <h3>'._('Related Tracker Items').'</h3>
100 $title_arr[]=_('Task Summary');
101 $title_arr[]=_('Tracker');
102 $title_arr[]=_('Open Date');
103 (($is_admin) ? $title_arr[]=_('Remove Relation') : '');
105 echo $GLOBALS['HTML']->listTableTop ($title_arr);
107 for ($i=0; $i < $rows; $i++) {
109 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>
110 <td><a href="'.$GLOBALS['sys_urlprefix'].'/tracker/?func=detail&aid='.db_result($res,$i,'artifact_id').'&group_id='.db_result($res,$i,'group_id').'&atid='.db_result($res,$i,'group_artifact_id').'">'.db_result($res,$i,'summary').'</a></td>
111 <td>'. db_result($res,$i,'name') .'</td>
112 <td>'. date(_('Y-m-d H:i'),db_result($res,$i,'open_date')) .'</td>'.
113 (($is_admin) ? '<td><input type="checkbox" name="rem_artifact_id[]" value="'.db_result($res,$i,'artifact_id').'"></td>' : '').
117 echo $GLOBALS['HTML']->listTableBottom();
120 <h3>'._('No Related Tracker Items Have Been Added').'</h3>';
124 function showMessages() {
126 Show the details rows from task_history
128 $result=$this->getMessages();
129 $rows=db_numrows($result);
133 <h3>'._('Followups').'</h3>
137 $title_arr[]=_('Comment');
138 $title_arr[]=_('Date');
139 $title_arr[]=_('By');
141 echo $GLOBALS['HTML']->listTableTop ($title_arr);
143 for ($i=0; $i < $rows; $i++) {
145 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>
146 <td>'. nl2br(db_result($result, $i, 'body')).'</td>
147 <td valign="TOP">'.date(_('Y-m-d H:i'),db_result($result, $i, 'postdate')).'</td>
148 <td valign="TOP">'.db_result($result, $i, 'user_name').'</td></tr>';
151 echo $GLOBALS['HTML']->listTableBottom();
155 <h3>'._('No Comments Have Been Added').'</h3>';
160 function showHistory() {
162 show the project_history rows that are
163 relevant to this project_task_id, excluding details
165 $result=$this->getHistory();
166 $rows=db_numrows($result);
171 <h3>'._('Task Change History').'</h3>
175 $title_arr[]=_('Field');
176 $title_arr[]=_('Old Value');
177 $title_arr[]=_('Date');
178 $title_arr[]=_('By');
180 echo $GLOBALS['HTML']->listTableTop ($title_arr);
182 for ($i=0; $i < $rows; $i++) {
183 $field=db_result($result, $i, 'field_name');
186 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';
188 if ($field == 'status_id') {
189 //tdP - convert to actual status name
190 echo db_result($result, $i, 'old_value');
192 } else if ($field == 'category_id') {
193 //tdP convert to actual category_name
194 echo db_result($result, $i, 'old_value');
196 } else if ($field == 'start_date') {
198 echo date('Y-m-d',db_result($result, $i, 'old_value'));
200 } else if ($field == 'end_date') {
202 echo date('Y-m-d',db_result($result, $i, 'old_value'));
206 echo db_result($result, $i, 'old_value');
210 <td>'. date(_('Y-m-d H:i'),db_result($result, $i, 'mod_date')) .'</td>
211 <td>'.db_result($result, $i, 'user_name').'</td></tr>';
214 echo $GLOBALS['HTML']->listTableBottom();
218 <h3>'._('No Changes Have Been Made').'</h3>';
226 // c-file-style: "bsd"