![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: vw_projecttask.php 196 2008-07-30 23:21:06Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/projectdesigner/vw_projecttask.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 $df = $AppUI->getPref('SHDATEFORMAT'); 6 $start_date = intval($obj->project_start_date) ? new CDate($obj->project_start_date) : null; 7 $end_date = intval($obj->project_end_date) ? new CDate($obj->project_end_date) : null; 8 $actual_end_date = intval($criticalTasks[0]['task_end_date']) ? new CDate($criticalTasks[0]['task_end_date']) : null; 9 $today = new CDate(); 10 $style = (($actual_end_date > $end_date) && !empty($end_date)) ? 'style="color:red; font-weight:bold"' : ''; 11 $style = (($obj->project_percent_complete < 99.99 && $today > $end_date) && !empty($end_date)) ? 'style="color:red; font-weight:bold"' : $style; 12 ?> 13 <table width="100%" border="0" cellpadding="1" cellspacing="3" class="prjprint"> 14 <tr> 15 <td width="50%" valign="top"> 16 <strong><?php echo $AppUI->_('Details'); ?></strong> 17 <table cellspacing="1" cellpadding="2" border="0" width="100%"> 18 <tr> 19 <td align="right" nowrap="nowrap"><strong><?php echo $AppUI->_('Project Name'); ?>: </strong></td> 20 <td class="hilite"><?php echo htmlspecialchars($obj->project_name, ENT_QUOTES); ?></td> 21 </tr> 22 <tr> 23 <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Company'); ?>:</td> 24 <td class="hilite" width="100%"><?php echo htmlspecialchars($obj->company_name, ENT_QUOTES); ?></td> 25 </tr> 26 <tr> 27 <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Short Name'); ?>:</td> 28 <td class="hilite"><?php echo htmlspecialchars($obj->project_short_name, ENT_QUOTES); ?></td> 29 </tr> 30 <tr> 31 <td align="right" nowrap="nowrap"><?php echo $AppUI->_('Start Date'); ?>:</td> 32 <td class="hilite"><?php echo $start_date ? $start_date->format($df) : '-'; ?></td> 33 </tr> 34 <tr> 35 <td align="right" nowrap="nowrap"><strong><?php echo $AppUI->_('Target End Date'); ?>: </strong></td> 36 <td class="hilite"><?php echo $end_date ? $end_date->format($df) : '-'; ?></td> 37 </tr> 38 <tr> 39 <td align="right" nowrap="nowrap"><strong><?php echo $AppUI->_('Status'); ?>: </strong></td> 40 <td class="hilite" width="100%"><?php echo $AppUI->_($pstatus[$obj->project_status]); ?></td> 41 </tr> 42 <tr> 43 <td align="right" nowrap="nowrap"><strong><?php echo $AppUI->_('Progress'); ?>: </strong></td> 44 <td class="hilite" width="100%"><?php printf("%.1f%%", $obj->project_percent_complete); ?></td> 45 </tr> 46 <!-- <tr> 47 <td align="right" nowrap="nowrap"><strong><?php echo $AppUI->_('Active'); ?>: </strong></td> 48 <td class="hilite" width="100%"><?php echo $obj->project_active ? $AppUI->_('Yes') : $AppUI->_('No'); ?></td> 49 </tr>--> 50 <?php /* TASKS $Id: vw_projecttask.php 196 2008-07-30 23:21:06Z pedroix $ */ 51 global $m, $a, $project_id, $f, $task_status, $min_view, $query_string, $durnTypes, $tpl; 52 global $task_sort_item1, $task_sort_type1, $task_sort_order1; 53 global $task_sort_item2, $task_sort_type2, $task_sort_order2; 54 global $user_id, $w2Pconfig, $currentTabId, $currentTabName, $canEdit, $showEditCheckbox; 55 56 if (empty($query_string)) { 57 $query_string = '?m=' . $m . '&a=' . $a; 58 } 59 60 // Number of columns (used to calculate how many columns to span things through) 61 $cols = 13; 62 63 /**** 64 // Let's figure out which tasks are selected 65 */ 66 $q = new DBQuery; 67 $pinned_only = intval(w2PgetParam($_GET, 'pinned', 0)); 68 if (isset($_GET['pin'])) { 69 $pin = intval(w2PgetParam($_GET, 'pin', 0)); 70 $msg = ''; 71 72 // load the record data 73 if ($pin) { 74 $q->addTable('user_task_pin'); 75 $q->addInsert('user_id', $AppUI->user_id); 76 $q->addInsert('task_id', $task_id); 77 } else { 78 $q->setDelete('user_task_pin'); 79 $q->addWhere('user_id = ' . (int)$AppUI->user_id); 80 $q->addWhere('task_id = ' . (int)$task_id); 81 } 82 83 if (!$q->exec()) { 84 $AppUI->setMsg('ins/del err', UI_MSG_ERROR, true); 85 } else { 86 $q->clear(); 87 } 88 89 $AppUI->redirect('', -1); 90 } 91 92 $AppUI->savePlace(); 93 94 $durnTypes = w2PgetSysVal('TaskDurationType'); 95 $taskPriority = w2PgetSysVal('TaskPriority'); 96 97 $task_project = $project_id; 98 99 $task_sort_item1 = w2PgetParam($_GET, 'task_sort_item1', ''); 100 $task_sort_type1 = w2PgetParam($_GET, 'task_sort_type1', ''); 101 $task_sort_item2 = w2PgetParam($_GET, 'task_sort_item2', ''); 102 $task_sort_type2 = w2PgetParam($_GET, 'task_sort_type2', ''); 103 $task_sort_order1 = intval(w2PgetParam($_GET, 'task_sort_order1', 0)); 104 $task_sort_order2 = intval(w2PgetParam($_GET, 'task_sort_order2', 0)); 105 if (isset($_POST['show_task_options'])) { 106 $AppUI->setState('TaskListShowIncomplete', w2PgetParam($_POST, 'show_incomplete', 0)); 107 } 108 $showIncomplete = $AppUI->getState('TaskListShowIncomplete', 0); 109 110 $project = &new CProject; 111 // $allowedProjects = $project->getAllowedRecords($AppUI->user_id, 'project_id, project_name'); 112 $allowedProjects = $project->getAllowedSQL($AppUI->user_id); 113 $working_hours = ($w2Pconfig['daily_working_hours'] ? $w2Pconfig['daily_working_hours'] : 8); 114 115 $q->addQuery('projects.project_id, project_color_identifier, project_name'); 116 $q->addQuery('SUM(task_duration * task_percent_complete * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type)) / SUM(task_duration * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type)) AS project_percent_complete'); 117 $q->addQuery('company_name'); 118 $q->addTable('projects'); 119 $q->leftJoin('tasks', 't1', 'projects.project_id = t1.task_project'); 120 $q->leftJoin('companies', 'c', 'company_id = project_company'); 121 $q->leftJoin('project_departments', 'project_departments', 'projects.project_id = project_departments.project_id OR project_departments.project_id IS NULL'); 122 $q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL'); 123 $q->addWhere('t1.task_id = t1.task_parent'); 124 $q->addWhere('projects.project_id=' . $project_id); 125 if (count($allowedProjects)) { 126 $q->addWhere($allowedProjects); 127 } 128 $q->addGroup('projects.project_id'); 129 130 $q2 = new DBQuery; 131 $q2 = $q; 132 $q2->addQuery('projects.project_id, COUNT(t1.task_id) as total_tasks'); 133 134 $perms = &$AppUI->acl(); 135 $projects = array(); 136 if ($canViewTasks) { 137 $prc = $q->exec(); 138 echo db_error(); 139 while ($row = $q->fetchRow()) { 140 $projects[$row['project_id']] = $row; 141 } 142 143 $prc2 = $q2->exec(); 144 echo db_error(); 145 while ($row2 = $q2->fetchRow()) { 146 $projects[$row2['project_id']] = ((!($projects[$row2['project_id']])) ? array() : $projects[$row2['project_id']]); 147 array_push($projects[$row2['project_id']], $row2); 148 } 149 } 150 $q->clear(); 151 $q2->clear(); 152 153 $q->addQuery('tasks.task_id, task_parent, task_name'); 154 $q->addQuery('task_start_date, task_end_date, task_dynamic'); 155 $q->addQuery('count(tasks.task_parent) as children'); 156 $q->addQuery('task_pinned, pin.user_id as pin_user'); 157 $q->addQuery('task_priority, task_percent_complete'); 158 $q->addQuery('task_duration, task_duration_type'); 159 $q->addQuery('task_project'); 160 $q->addQuery('task_access, task_type'); 161 $q->addQuery('task_description, task_owner, task_status'); 162 $q->addQuery('usernames.user_username, usernames.user_id'); 163 $q->addQuery('assignees.user_username as assignee_username'); 164 $q->addQuery('count(distinct assignees.user_id) as assignee_count'); 165 $q->addQuery('co.contact_first_name, co.contact_last_name'); 166 $q->addQuery('task_milestone'); 167 $q->addQuery('count(distinct f.file_task) as file_count'); 168 $q->addQuery('tlog.task_log_problem'); 169 $q->addQuery('evtq.queue_id'); 170 171 $q->addTable('tasks'); 172 $mods = $AppUI->getActiveModules(); 173 if (!empty($mods['history']) && !getDenyRead('history')) { 174 $q->addQuery('MAX(history_date) as last_update'); 175 $q->leftJoin('history', 'h', 'history_item = tasks.task_id AND history_table=\'tasks\''); 176 } 177 $q->leftJoin('projects', 'projects', 'projects.project_id = task_project'); 178 $q->leftJoin('users', 'usernames', 'task_owner = usernames.user_id'); 179 $q->leftJoin('user_tasks', 'ut', 'ut.task_id = tasks.task_id'); 180 $q->leftJoin('users', 'assignees', 'assignees.user_id = ut.user_id'); 181 $q->leftJoin('contacts', 'co', 'co.contact_id = usernames.user_contact'); 182 $q->leftJoin('task_log', 'tlog', 'tlog.task_log_task = tasks.task_id AND tlog.task_log_problem > 0'); 183 $q->leftJoin('files', 'f', 'tasks.task_id = f.file_task'); 184 $q->leftJoin('user_task_pin', 'pin', 'tasks.task_id = pin.task_id AND pin.user_id = ' . (int)$AppUI->user_id); 185 $q->leftJoin('event_queue', 'evtq', 'tasks.task_id = evtq.queue_origin_id AND evtq.queue_module = "tasks"'); 186 $q->leftJoin('project_departments', 'project_departments', 'projects.project_id = project_departments.project_id OR project_departments.project_id IS NULL'); 187 $q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL'); 188 189 $q->addWhere('task_project = ' . (int)$project_id); 190 191 $allowedProjects = $project->getAllowedSQL($AppUI->user_id, 'task_project'); 192 if (count($allowedProjects)) { 193 $q->addWhere($allowedProjects); 194 } 195 $obj = &new CTask; 196 $allowedTasks = $obj->getAllowedSQL($AppUI->user_id, 'tasks.task_id'); 197 if (count($allowedTasks)) { 198 $q->addWhere($allowedTasks); 199 } 200 $q->addGroup('tasks.task_id'); 201 $q->addOrder('task_start_date'); 202 if ($canViewTasks) { 203 $tasks = $q->loadList(); 204 } 205 // POST PROCESSING TASKS 206 foreach ($tasks as $row) { 207 //add information about assigned users into the page output 208 $q->clear(); 209 $q->addQuery('ut.user_id, u.user_username'); 210 $q->addQuery('contact_email, ut.perc_assignment, SUM(ut.perc_assignment) AS assign_extent'); 211 $q->addQuery('contact_first_name, contact_last_name'); 212 $q->addTable('user_tasks', 'ut'); 213 $q->leftJoin('users', 'u', 'u.user_id = ut.user_id'); 214 $q->leftJoin('contacts', 'c', 'u.user_contact = c.contact_id'); 215 $q->addWhere('ut.task_id = ' . (int)$row['task_id']); 216 $q->addGroup('ut.user_id'); 217 $q->addOrder('perc_assignment desc, user_username'); 218 219 $assigned_users = array(); 220 $row['task_assigned_users'] = $q->loadList(); 221 $q->addQuery('count(task_id) as children'); 222 $q->addTable('tasks'); 223 $q->addWhere('task_parent = ' . (int)$row['task_id']); 224 $q->addWhere('task_id <> task_parent'); 225 $row['children'] = $q->loadResult(); 226 $row['style'] = taskstyle_pd($row); 227 $i = count($projects[$row['task_project']]['tasks']) + 1; 228 $row['task_number'] = $i; 229 $row['node_id'] = 'node_' . $i . '-' . $row['task_id']; 230 if (strpos($row['task_duration'], '.') && $row['task_duration_type'] == 1) { 231 $row['task_duration'] = floor($row['task_duration']) . ':' . round(60 * ($row['task_duration'] - floor($row['task_duration']))); 232 } 233 //pull the final task row into array 234 $projects[$row['task_project']]['tasks'][] = $row; 235 } 236 237 $showEditCheckbox = isset($canEditTasks) && $canEditTasks || $perms->checkModule('admin', 'view'); 238 239 $durnTypes = w2PgetSysVal('TaskDurationType'); 240 $tempoTask = new CTask(); 241 $userAlloc = $tempoTask->getAllocation('user_id'); 242 ?> 243 <table width="100%" border="0" cellpadding="1" cellspacing="3" class="prjprint"> 244 <tr class="prjprint"> 245 <th width="50%"><?php echo $AppUI->_('Task Name'); ?></th> 246 <th width="50" nowrap="nowrap"><?php echo $AppUI->_('Work'); ?></th> 247 <th nowrap="nowrap"><?php echo $AppUI->_('Start'); ?></th> 248 <th nowrap="nowrap"><?php echo $AppUI->_('Finish'); ?></th> 249 <th nowrap="nowrap"><?php echo $AppUI->_('Last Update'); ?></th> 250 </tr> 251 <?php 252 reset($projects); 253 254 foreach ($projects as $k => $p) { 255 $tnums = count($p['tasks']); 256 //echo '<pre>'; print_r($p['tasks']); echo '</pre>'; 257 if ($tnums > 0 || $project_id == $p['project_id']) { 258 if ($task_sort_item1 != '') { 259 if ($task_sort_item2 != '' && $task_sort_item1 != $task_sort_item2) { 260 $p['tasks'] = array_csort($p['tasks'], $task_sort_item1, $task_sort_order1, $task_sort_type1, $task_sort_item2, $task_sort_order2, $task_sort_type2); 261 } else { 262 $p['tasks'] = array_csort($p['tasks'], $task_sort_item1, $task_sort_order1, $task_sort_type1); 263 } 264 } 265 266 for ($i = 0; $i < $tnums; $i++) { 267 $t = $p['tasks'][$i]; 268 269 if ($t['task_parent'] == $t['task_id']) { 270 showtask_pr($t, 0); 271 findchild_pr($p['tasks'], $t['task_id']); 272 } 273 } 274 } 275 } 276 ?> 277 </table > 278 <?php 279 global $project_id, $m; 280 global $st_projects_arr; 281 282 $df = $AppUI->getPref('SHDATEFORMAT'); 283 $projectPriority = w2PgetSysVal('ProjectPriority'); 284 $projectStatus = w2PgetSysVal('ProjectStatus'); 285 ?> 286 <table class="tbl" cellspacing="1" cellpadding="2" border="0" width="100%"> 287 <td align="center"> 288 <?php echo '<strong>Gantt Chart</strong>' ?> 289 </td> 290 <tr> 291 <td align="center" colspan="20"> 292 <?php 293 $src = "?m=projectdesigner&a=gantt&suppressHeaders=1&showLabels=1&proFilter=&showInactive=1showAllGantt=1&project_id=$project_id&width=' + ((navigator.appName=='Netscape'?window.innerWidth:document.body.offsetWidth)*0.90) + '"; 294 echo "<script>document.write('<img src=\"$src\">')</script>"; 295 ?> 296 </td> 297 </table>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 9 03:00:02 2009 | Cross-referenced by PHPXref 0.7 |