3 * FusionForge Project Management Facility
5 * Copyright 1999/2000, Tim Perdue - Sourceforge
6 * Copyright 2002 GForge, LLC
7 * Copyright 2010, FusionForge Team
8 * http://fusionforge.org
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the License, or (at your option)
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 along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 require_once $gfcommon.'include/Error.class.php';
27 require_once $gfcommon.'pm/ProjectTask.class.php';
29 class ProjectTaskHTML extends ProjectTask {
31 function ProjectTaskHTML(&$ProjectGroup, $project_task_id=false, $arr=false) {
32 return $this->ProjectTask($ProjectGroup,$project_task_id,$arr);
35 function multipleDependBox ($name='dependent_on[]') {
36 $result=$this->getOtherTasks();
37 //get the data so we can mark items as SELECTED
38 $arr2 = array_keys($this->getDependentOn());
39 return html_build_multiple_select_box ($result,$name,$arr2);
42 function multipleAssignedBox ($name='assigned_to[]') {
43 $engine = RBACEngine::getInstance () ;
44 $techs = $engine->getUsersByAllowedAction ('pm', $this->ProjectGroup->getID(), 'tech') ;
46 $tech_id_arr = array () ;
47 $tech_name_arr = array () ;
49 foreach ($techs as $tech) {
50 $tech_id_arr[] = $tech->getID() ;
51 $tech_name_arr[] = $tech->getRealName() ;
54 //get the data so we can mark items as SELECTED
55 $arr2 = $this->getAssignedTo();
56 return html_build_multiple_select_box_from_arrays ($tech_id_arr,$tech_name_arr,$name,$arr2);
60 function showDependentTasks () {
62 $result=db_query_params ('SELECT project_task.project_task_id,project_task.summary
63 FROM project_task,project_dependencies
64 WHERE project_task.project_task_id=project_dependencies.project_task_id
65 AND project_dependencies.is_dependent_on_task_id=$1',
66 array($this->getID() ));
67 $rows=db_numrows($result);
70 echo '<h3>'._('Tasks That Depend on This Task').'</h3>';
73 $title_arr[]=_('Task Id');
74 $title_arr[]=_('Task Summary');
76 echo $GLOBALS['HTML']->listTableTop ($title_arr);
78 for ($i=0; $i < $rows; $i++) {
80 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>
82 .util_make_link ('/pm/task.php?func=detailtask&project_task_id='. db_result($result, $i, 'project_task_id'). '&group_id='. $this->ProjectGroup->Group->getID() . '&group_project_id='. $this->ProjectGroup->getID(), db_result($result, $i, 'project_task_id')).'</td>
83 <td>'.db_result($result, $i, 'summary').'</td></tr>';
86 echo $GLOBALS['HTML']->listTableBottom();
89 echo '<h3>'._('No Tasks are Dependent on This Task').'</h3>';
94 function showRelatedArtifacts() {
95 $res=$this->getRelatedArtifacts();
97 $rows=db_numrows($res);
99 if (forge_check_perm ('pm_admin', $this->ProjectGroup->Group->getID())) {
105 echo '<h3>'._('Related Tracker Items').'</h3>';
108 $title_arr[]=_('Artifact Summary');
109 $title_arr[]=_('Tracker');
110 $title_arr[]=_('Status');
111 $title_arr[]=_('Open Date');
112 (($is_admin) ? $title_arr[]=_('Remove Relation') : '');
114 echo $GLOBALS['HTML']->listTableTop ($title_arr);
116 for ($i=0; $i < $rows; $i++) {
118 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>
119 <td>'.util_make_link ('/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')).'</td>
120 <td>'. db_result($res,$i,'name') .'</td>
121 + <td>'. db_result($res,$i,'status_name') . '</td>
122 <td>'. date(_('Y-m-d H:i'),db_result($res,$i,'open_date')) .'</td>'.
123 (($is_admin) ? '<td><input type="checkbox" name="rem_artifact_id[]" value="'.db_result($res,$i,'artifact_id').'" /></td>' : '').
127 echo $GLOBALS['HTML']->listTableBottom();
130 <h3>'._('No Related Tracker Items Have Been Added').'</h3>';
134 function showMessages($asc=true,$whereto='/') {
136 Show the details rows from task_history
138 $result=$this->getMessages($asc);
139 $rows=db_numrows($result);
142 echo '<h3>'._('Followups: ');
146 util_make_url($whereto . '&commentsort=anti') .
147 '">' . _('Sort comments antichronologically') . '</a>';
150 util_make_url($whereto . '&commentsort=chrono') .
151 '">' . _('Sort comments chronologically') . '</a>';
156 $title_arr[]=_('Comment');
157 $title_arr[]=_('Date');
158 $title_arr[]=_('By');
160 echo $GLOBALS['HTML']->listTableTop ($title_arr);
162 for ($i=0; $i < $rows; $i++) {
164 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'>
166 $sanitizer = new TextSanitizer();
167 $body = $sanitizer->SanitizeHtml(db_result($result, $i, 'body'));
168 if (strpos($body,'<') === false) {
169 echo nl2br(db_result($result, $i, 'body'));
175 <td valign="top">'.date(_('Y-m-d H:i'),db_result($result, $i, 'postdate')).'</td>
176 <td valign="top">'.db_result($result, $i, 'user_name').'</td></tr>';
179 echo $GLOBALS['HTML']->listTableBottom();
183 <h3>'._('No Comments Have Been Added').'</h3>';
188 function showHistory() {
190 show the project_history rows that are
191 relevant to this project_task_id, excluding details
193 $result=$this->getHistory();
194 $rows=db_numrows($result);
198 echo '<h3>'._('Task Change History').'</h3>';
201 $title_arr[]=_('Field');
202 $title_arr[]=_('Old Value');
203 $title_arr[]=_('Date');
204 $title_arr[]=_('By');
206 echo $GLOBALS['HTML']->listTableTop ($title_arr);
208 for ($i=0; $i < $rows; $i++) {
209 $field=db_result($result, $i, 'field_name');
212 <tr class="mod_task_field" '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'.$field.'</td><td>';
214 if ($field == 'status_id') {
215 //tdP - convert to actual status name
216 echo db_result($result, $i, 'old_value');
218 } else if ($field == 'category_id') {
219 //tdP convert to actual category_name
220 echo db_result($result, $i, 'old_value');
222 } else if ($field == 'start_date') {
224 echo date('Y-m-d',db_result($result, $i, 'old_value'));
226 } else if ($field == 'end_date') {
228 echo date('Y-m-d',db_result($result, $i, 'old_value'));
232 echo db_result($result, $i, 'old_value');
236 <td>'. date(_('Y-m-d H:i'),db_result($result, $i, 'mod_date')) .'</td>
237 <td>'.db_result($result, $i, 'user_name').'</td></tr>';
240 echo $GLOBALS['HTML']->listTableBottom();
244 <h3>'._('No Changes Have Been Made').'</h3>';
252 // c-file-style: "bsd"