$rec['task_start_date'] = date('Y-m-d H:i:s'); } $tsd = new w2p_Utilities_Date($rec['task_start_date']); if ($tsd->before(new w2p_Utilities_Date($start_min))) { $start_min = $rec['task_start_date']; } // calculate or set blank task_end_date if unset if ($rec['task_end_date'] == '0000-00-00 00:00:00') { if ($rec['task_duration']) { $rec['task_end_date'] = db_unix2dateTime(db_dateTime2unix($rec['task_start_date']) + SECONDS_PER_DAY * convert2days($rec['task_duration'], $rec['task_duration_type'])); } else { $rec['task_end_date'] = ''; } } $ted = new w2p_Utilities_Date($rec['task_end_date']); if ($ted->after(new w2p_Utilities_Date($end_max))) { $end_max = $rec['task_end_date']; } $projects[$rec['task_project']]['tasks'][] = $rec; } $q->clear(); reset($projects); foreach ($projects as $p) { $tnums = count($p['tasks']); for ($i = 0; $i < $tnums; $i++) { $task = $p['tasks'][$i]; if ($task['task_parent'] == $task['task_id']) { showgtask($task, 0, $p['project_id']); findgchild($p['tasks'], $task['task_id'], 0, $p['project_id']); } }
if ($tsd->before(new w2p_Utilities_Date($start_min))) { $start_min = $row['task_start_date']; } //Check if end date exists, if not try giving it the start date. //If the start date does not exist then set it for today. //This avoids jpgraphs internal errors that render the gantt completely useless if ($row['task_end_date'] == '0000-00-00 00:00:00') { if ($row['task_duration']) { $row['task_end_date'] = db_unix2dateTime(db_dateTime2unix($row['task_start_date']) + SECONDS_PER_DAY * convert2days($row['task_duration'], $row['task_duration_type'])); } else { $todaydate = new w2p_Utilities_Date(); $row['task_end_date'] = $todaydate->format(FMT_TIMESTAMP_DATE); } } $ted = new w2p_Utilities_Date($row['task_end_date']); if ($ted->after(new w2p_Utilities_Date($end_max))) { $end_max = $row['task_end_date']; } if ($ted->after(new w2p_Utilities_Date($projects[$row['task_project']]['project_end_date'])) || $projects[$row['task_project']]['project_end_date'] == '') { $projects[$row['task_project']]['project_end_date'] = $row['task_end_date']; } $projects[$row['task_project']]['tasks'][] = $row; } $width = min(w2PgetParam($_GET, 'width', 600), 1400); $start_date = w2PgetParam($_GET, 'start_date', $start_min); $end_date = w2PgetParam($_GET, 'end_date', $end_max); //consider critical (concerning end date) tasks as well if ($caller != 'todo') { $start_min = $projects[$project_id]['project_start_date']; $end_max = $projects[$project_id]['project_end_date'] > $criticalTasks[0]['task_end_date'] ? $projects[$project_id]['project_end_date'] : $criticalTasks[0]['task_end_date']; }
function taskstyle_pd($task) { $now = new w2p_Utilities_Date(); $start_date = intval($task['task_start_date']) ? new w2p_Utilities_Date($task['task_start_date']) : null; $end_date = intval($task['task_end_date']) ? new w2p_Utilities_Date($task['task_end_date']) : null; if ($start_date && !$end_date) { $end_date = $start_date; $end_date->addSeconds($task['task_duration'] * $task['task_duration_type'] * SEC_HOUR); } else { if (!$start_date) { return ''; } } $style = 'class='; if ($task['task_percent_complete'] == 0) { $style .= $now->before($start_date) ? '"task_future"' : '"task_notstarted"'; } else { if ($task['task_percent_complete'] == 100) { $t = new CTask(); $t->load($task['task_id']); $actual_end_date = new w2p_Utilities_Date(get_actual_end_date_pd($t->task_id, $t)); $style .= $actual_end_date->after($end_date) ? '"task_late"' : '"task_done"'; } else { $style .= $now->after($end_date) ? '"task_overdue"' : '"task_started"'; } } return $style; }
public function remove(CAppUI $AppUI, w2p_Utilities_Date $date) { $perms = $AppUI->acl(); $removed = false; if ($this->holiday_id && $perms->checkModuleItem('holiday', 'edit', $this->holiday_id)) { $holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date); $holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date); if ($holiday_start_date->equals($date->duplicate())) { if ($holiday_end_date->equals($date->duplicate())) { $removed = $this->delete($AppUI); } else { $holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date); $this->holiday_start_date = $holiday_start_date->getNextDay()->getDate(); $removed = $this->store($AppUI); } } elseif ($holiday_end_date->equals($date->duplicate())) { $holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date); $this->holiday_end_date = $holiday_end_date->getPrevDay()->getDate(); $removed = $this->store($AppUI); } elseif ($holiday_start_date->before($date->duplicate()) && $holiday_end_date->after($date->duplicate())) { $holiday_end_date = $this->holiday_end_date; $this->holiday_end_date = $date->getPrevDay()->getDate(); $removed = $this->store($AppUI); $this->holiday_id = 0; // create new record $this->holiday_start_date = $date->getNextDay()->getDate(); $this->holiday_end_date = $holiday_end_date; $removed = $this->store($AppUI); } } return $removed; }
/** * Sub-function to collect tasks within a period * * @param Date the starting date of the period * @param Date the ending date of the period * @param array by-ref an array of links to append new items to * @param int the length to truncate entries by * @param int the company id to filter by * @author Andrew Eddie <*****@*****.**> */ function getTaskLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $company_id = 0, $minical = false) { global $a, $AppUI, $w2Pconfig; $tasks = CTask::getTasksForPeriod($startPeriod, $endPeriod, $company_id, 0); $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); //subtract one second so we don't have to compare the start dates for exact matches with the startPeriod which is 00:00 of a given day. $startPeriod->subtractSeconds(1); $link = array(); $sid = 3600 * 24; // assemble the links for the tasks foreach ($tasks as $row) { // the link $link['task'] = true; if (!$minical) { $link['href'] = '?m=tasks&a=view&task_id=' . $row['task_id']; // the link text if (mb_strlen($row['task_name']) > $strMaxLen) { $row['short_name'] = mb_substr($row['task_name'], 0, $strMaxLen) . '...'; } else { $row['short_name'] = $row['task_name']; } $link['text'] = '<span style="color:' . bestColor($row['color']) . ';background-color:#' . $row['color'] . '">' . $row['short_name'] . ($row['task_milestone'] ? ' ' . w2PshowImage('icons/milestone.gif') : '') . '</span>'; } // determine which day(s) to display the task $start = new w2p_Utilities_Date($AppUI->formatTZAwareTime($row['task_start_date'], '%Y-%m-%d %T')); $end = $row['task_end_date'] ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($row['task_end_date'], '%Y-%m-%d %T')) : null; // First we test if the Tasks Starts and Ends are on the same day, if so we don't need to go any further. if ($start->after($startPeriod) && ($end && $end->after($startPeriod) && $end->before($endPeriod) && !$start->dateDiff($end))) { if ($minical) { $temp = array('task' => true); } else { $temp = $link; if ($a != 'day_view') { $temp['text'] = w2PtoolTip($row['task_name'], getTaskTooltip($row['task_id'], true, true, $tasks), true) . w2PshowImage('block-start-16.png') . $start->format($tf) . ' ' . $temp['text'] . ' ' . $end->format($tf) . w2PshowImage('block-end-16.png') . w2PendTip(); $temp['text'] .= '<a href="?m=tasks&a=view&task_id=' . $row['task_id'] . '&tab=1&date=' . $AppUI->formatTZAwareTime($row['task_end_date'], '%Y%m%d') . '">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>'; } } $links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp; } else { // If they aren't, we will now need to see if the Tasks Start date is between the requested period if ($start->after($startPeriod) && $start->before($endPeriod)) { if ($minical) { $temp = array('task' => true); } else { $temp = $link; if ($a != 'day_view') { $temp['text'] = w2PtoolTip($row['task_name'], getTaskTooltip($row['task_id'], true, false, $tasks), true) . w2PshowImage('block-start-16.png') . $start->format($tf) . ' ' . $temp['text'] . w2PendTip(); $temp['text'] .= '<a href="?m=tasks&a=view&task_id=' . $row['task_id'] . '&tab=1&date=' . $AppUI->formatTZAwareTime($row['task_start_date'], '%Y%m%d') . '">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>'; } } $links[$start->format(FMT_TIMESTAMP_DATE)][] = $temp; } // And now the Tasks End date is checked if it is between the requested period too. if ($end && $end->after($startPeriod) && $end->before($endPeriod) && $start->before($end)) { if ($minical) { $temp = array('task' => true); } else { $temp = $link; if ($a != 'day_view') { $temp['text'] = w2PtoolTip($row['task_name'], getTaskTooltip($row['task_id'], false, true, $tasks), true) . ' ' . $temp['text'] . ' ' . $end->format($tf) . w2PshowImage('block-end-16.png') . w2PendTip(); $temp['text'] .= '<a href="?m=tasks&a=view&task_id=' . $row['task_id'] . '&tab=1&date=' . $AppUI->formatTZAwareTime($row['task_end_date'], '%Y%m%d') . '">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>'; } } $links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp; } } } }
/** * Tests after then the dates are equal */ public function testAfterIsSame() { $date1 = new w2p_Utilities_Date('2010-11-04 11:00:00'); $date2 = new w2p_Utilities_Date('2010-11-04 11:00:00'); $this->assertFalse($date1->after($date2)); }
function showtask(&$arr, $level = 0, $is_opened = true, $today_view = false, $hideOpenCloseLink = false, $allowRepeat = false) { global $AppUI, $query_string, $durnTypes, $userAlloc, $showEditCheckbox; global $m, $a, $history_active, $expanded; //Check for Tasks Access $canAccess = canTaskAccess($arr['task_id'], $arr['task_access'], $arr['task_owner']); if (!$canAccess) { return false; } $now = new w2p_Utilities_Date(); $tf = $AppUI->getPref('TIMEFORMAT'); $df = $AppUI->getPref('SHDATEFORMAT'); $fdf = $df . ' ' . $tf; $show_all_assignees = w2PgetConfig('show_all_task_assignees', false); $start_date = intval($arr['task_start_date']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($arr['task_start_date'], '%Y-%m-%d %T')) : null; $end_date = intval($arr['task_end_date']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($arr['task_end_date'], '%Y-%m-%d %T')) : null; $last_update = isset($arr['last_update']) && intval($arr['last_update']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($arr['last_update'], '%Y-%m-%d %T')) : null; // prepare coloured highlight of task time information $sign = 1; $style = ''; if ($start_date) { if (!$end_date) { /* ** end date calc has been moved to calcEndByStartAndDuration()-function ** called from array_csort and tasks.php ** perhaps this fallback if-clause could be deleted in the future, ** didn't want to remove it shortly before the 2.0.2 */ $end_date = new w2p_Utilities_Date('0000-00-00 00:00:00'); } if ($now->after($start_date) && $arr['task_percent_complete'] == 0) { $style = 'background-color:#ffeebb'; } elseif ($now->after($start_date) && $arr['task_percent_complete'] < 100) { $style = 'background-color:#e6eedd'; } if ($now->after($end_date)) { $sign = -1; $style = 'background-color:#cc6666;color:#ffffff'; } if ($arr['task_percent_complete'] == 100) { $style = 'background-color:#aaddaa; color:#00000'; } $days = $now->dateDiff($end_date) * $sign; } $jsTaskId = 'project_' . $arr['task_project'] . '_level-' . $level . '-task_' . $arr['task_id'] . '_'; if ($expanded) { $s = '<tr id="' . $jsTaskId . '" >'; } else { $s = '<tr id="' . $jsTaskId . '" ' . ($level > 0 && !($m == 'tasks' && $a == 'view') ? 'style="display:none"' : '') . '>'; } // edit icon $s .= '<td align="center">'; $canEdit = $arr['task_represents_project'] ? false : true; $canViewLog = true; if ($canEdit) { $s .= '<a href="?m=tasks&a=addedit&task_id=' . $arr['task_id'] . '">' . w2PtoolTip('edit task', 'click to edit this task') . w2PshowImage('icons/pencil.gif', 12, 12) . w2PendTip() . '</a>'; } $s .= '</td>'; // pinned $pin_prefix = $arr['task_pinned'] ? '' : 'un'; $s .= '<td><a href="?m=tasks&pin=' . ($arr['task_pinned'] ? 0 : 1) . '&task_id=' . $arr['task_id'] . '">' . w2PtoolTip('Pin', 'pin/unpin task') . '<img src="' . w2PfindImage('icons/' . $pin_prefix . 'pin.gif') . '" border="0" alt="" />' . w2PendTip() . '</a></td>'; // New Log if ($arr['task_log_problem'] > 0) { $s .= '<td valign="middle"><a href="?m=tasks&a=view&task_id=' . $arr['task_id'] . '&tab=0&problem=1">' . w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem!') . '</a></td>'; } elseif ($canViewLog && $arr['task_dynamic'] != 1 && 0 == $arr['task_represents_project']) { $s .= '<td align="center"><a href="?m=tasks&a=view&task_id=' . $arr['task_id'] . '&tab=1">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a></td>'; } else { $s .= '<td align="center">' . $AppUI->_('-') . '</td>'; } // percent complete and priority $s .= '<td align="right">' . (int) $arr['task_percent_complete'] . '%</td><td align="center" nowrap="nowrap">'; if ($arr['task_priority'] < 0) { $s .= '<img src="' . w2PfindImage('icons/priority-' . -$arr['task_priority'] . '.gif') . '" alt="" />'; } elseif ($arr['task_priority'] > 0) { $s .= '<img src="' . w2PfindImage('icons/priority+' . $arr['task_priority'] . '.gif') . '" alt="" />'; } $s .= '</td><td align="center" nowrap="nowrap">'; if (isset($arr['user_task_priority'])) { if ($arr['user_task_priority'] < 0) { $s .= '<img src="' . w2PfindImage('icons/priority-' . -$arr['user_task_priority'] . '.gif') . '" alt="" />'; } elseif ($arr['user_task_priority'] > 0) { $s .= '<img src="' . w2PfindImage('icons/priority+' . $arr['user_task_priority'] . '.gif') . '" alt="" />'; } } $s .= '</td>'; // dots $s .= '<td width="' . ($today_view ? '50%' : '90%') . '">'; //level if ($level == -1) { $s .= '...'; } for ($y = 0; $y < $level; $y++) { if ($y + 1 == $level) { $s .= '<img src="' . w2PfindImage('corner-dots.gif') . '" width="16" height="12" border="0" alt="">'; } else { $s .= ''; } } if ($arr['task_description']) { $s .= w2PtoolTip('Task Description', $arr['task_description'], true); } $open_link = '<a href="javascript: void(0);"><img onclick="expand_collapse(\'' . $jsTaskId . '\', \'tblProjects\',\'\',' . ($level + 1) . ');" id="' . $jsTaskId . '_collapse" src="' . w2PfindImage('icons/collapse.gif') . '" border="0" align="center" ' . (!$expanded ? 'style="display:none"' : '') . ' alt="" /><img onclick="expand_collapse(\'' . $jsTaskId . '\', \'tblProjects\',\'\',' . ($level + 1) . ');" id="' . $jsTaskId . '_expand" src="' . w2PfindImage('icons/expand.gif') . '" border="0" align="center" ' . ($expanded ? 'style="display:none"' : '') . ' alt="" /></a>'; if ($arr['task_nr_of_children']) { $is_parent = true; } else { $is_parent = false; } if ($arr['task_milestone'] > 0) { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" ><b>' . $arr['task_name'] . '</b></a> <img src="' . w2PfindImage('icons/milestone.gif') . '" border="0" alt="" /></td>'; } elseif ($arr['task_dynamic'] == '1' || $is_parent) { if (!$today_view) { $s .= $open_link; } if ($arr['task_dynamic'] == '1') { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" ><b><i>' . $arr['task_name'] . '</i></b></a>' . w2PendTip() . '</td>'; } else { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" >' . $arr['task_name'] . '</a>' . w2PendTip() . '</td>'; } } else { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" >' . $arr['task_name'] . '</a></td>'; } if ($arr['task_description']) { $s .= w2PendTip(); } if ($today_view) { // Show the project name $s .= '<td width="50%"><a href="./index.php?m=projects&a=view&project_id=' . $arr['task_project'] . '">' . '<span style="padding:2px;background-color:#' . $arr['project_color_identifier'] . ';color:' . bestColor($arr['project_color_identifier']) . '">' . $arr['project_name'] . '</span>' . '</a></td>'; } else { $s .= '<td nowrap="nowrap" align="center">' . '<a href="?m=admin&a=viewuser&user_id=' . $arr['user_id'] . '">' . $arr['owner'] . '</a>' . '</td>'; } if (count($arr['task_assigned_users'])) { $assigned_users = $arr['task_assigned_users']; $a_u_tmp_array = array(); if ($show_all_assignees) { $s .= '<td align="center" nowrap="nowrap">'; foreach ($assigned_users as $val) { $a_u_tmp_array[] = '<a href="?m=admin&a=viewuser&user_id=' . $val['user_id'] . '"' . 'title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$val['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$val['user_id']]['freeCapacity'] . '%' : '') . '">' . $val['assignee'] . ' (' . $val['perc_assignment'] . '%)</a>'; } $s .= join(', <br />', $a_u_tmp_array) . '</td>'; } else { $s .= '<td align="center" nowrap="nowrap">' . '<a href="?m=admin&a=viewuser&user_id=' . $assigned_users[0]['user_id'] . '" title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[0]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[0]['user_id']]['freeCapacity'] . '%' : '') . '">' . $assigned_users[0]['assignee'] . ' (' . $assigned_users[0]['perc_assignment'] . '%)</a>'; if ($arr['assignee_count'] > 1) { $s .= ' <a href="javascript: void(0);" onclick="toggle_users(' . "'users_" . $arr['task_id'] . "'" . ');" title="' . join(', ', $a_u_tmp_array) . '">(+' . ($arr['assignee_count'] - 1) . ')</a>' . '<span style="display: none" id="users_' . $arr['task_id'] . '">'; $a_u_tmp_array[] = $assigned_users[0]['assignee']; for ($i = 1, $i_cmp = count($assigned_users); $i < $i_cmp; $i++) { $a_u_tmp_array[] = $assigned_users[$i]['assignee']; $s .= '<br /><a href="?m=admin&a=viewuser&user_id=' . $assigned_users[$i]['user_id'] . '" title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['freeCapacity'] . '%' : '') . '">' . $assigned_users[$i]['assignee'] . ' (' . $assigned_users[$i]['perc_assignment'] . '%)</a>'; } $s .= '</span>'; } $s .= '</td>'; } } elseif (!$today_view) { // No users asigned to task $s .= '<td align="center">-</td>'; } // duration or milestone $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($start_date ? $start_date->format($fdf) : '-') . '</td>'; $s .= '<td align="right" nowrap="nowrap" style="' . $style . '">' . $arr['task_duration'] . ' ' . mb_substr($AppUI->_($durnTypes[$arr['task_duration_type']]), 0, 1) . '</td>'; $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($end_date ? $end_date->format($fdf) : '-') . '</td>'; if ($today_view) { $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . $arr['task_due_in'] . '</td>'; } elseif ($history_active) { $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($last_update ? $last_update->format($fdf) : '-') . '</td>'; } // Assignment checkbox if ($showEditCheckbox) { $s .= '<td align="center">' . '<input type="checkbox" name="selected_task[' . $arr['task_id'] . ']" value="' . $arr['task_id'] . '"/></td>'; } $s .= '</tr>' . "\n"; echo $s; }
function showtask_pd(&$a, $level = 0, $today_view = false) { global $AppUI, $w2Pconfig, $done, $query_string, $durnTypes, $userAlloc, $showEditCheckbox; global $task_access, $task_priority, $PROJDESIGN_CONFIG, $m, $expanded; $types = w2Pgetsysval('TaskType'); $now = new w2p_Utilities_Date(); $tf = $AppUI->getPref('TIMEFORMAT'); $df = $AppUI->getPref('SHDATEFORMAT'); $fdf = $df . ' ' . $tf; $perms =& $AppUI->acl(); $show_all_assignees = $w2Pconfig['show_all_task_assignees'] ? true : false; $done[] = $a['task_id']; $start_date = intval($a['task_start_date']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($a['task_start_date'], '%Y-%m-%d %T')) : null; $end_date = intval($a['task_end_date']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($a['task_end_date'], '%Y-%m-%d %T')) : null; $last_update = isset($a['last_update']) && intval($a['last_update']) ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($a['last_update'], '%Y-%m-%d %T')) : null; // prepare coloured highlight of task time information $sign = 1; $style = ''; if ($start_date) { if (!$end_date) { $end_date = new w2p_Utilities_Date('0000-00-00 00:00:00'); } if ($now->after($start_date) && $a['task_percent_complete'] == 0) { $style = 'background-color:#ffeebb'; } elseif ($now->after($start_date) && $a['task_percent_complete'] < 100) { $style = 'background-color:#e6eedd'; } if ($now->after($end_date)) { $sign = -1; $style = 'background-color:#cc6666;color:#ffffff'; } if ($a['task_percent_complete'] == 100) { $style = 'background-color:#aaddaa; color:#00000'; } $days = $now->dateDiff($end_date) * $sign; } $jsTaskId = 'task_proj_' . $a['task_project'] . '_level-' . $level . '-task_' . $a['task_id'] . '_'; if ($expanded) { $s = '<tr id="' . $jsTaskId . '" onmouseover="highlight_tds(this, true, ' . $a['task_id'] . ')" onmouseout="highlight_tds(this, false, ' . $a['task_id'] . ')" onclick="select_box(\'selected_task\', \'' . $a['task_id'] . '\', \'' . $jsTaskId . '\',\'frm_tasks\')">'; // edit icon } else { $s = '<tr id="' . $jsTaskId . '" onmouseover="highlight_tds(this, true, ' . $a['task_id'] . ')" onmouseout="highlight_tds(this, false, ' . $a['task_id'] . ')" onclick="select_box(\'selected_task\', \'' . $a['task_id'] . '\', \'' . $jsTaskId . '\',\'frm_tasks\')" ' . ($level ? 'style="display:none"' : '') . '>'; // edit icon } $s .= '<td>'; $canEdit = $a['task_represents_project'] ? false : true; $canViewLog = true; if ($canEdit) { $s .= '<a href="?m=tasks&a=addedit&task_id=' . $a['task_id'] . '">' . w2PtoolTip('edit tasks panel', 'click to edit this task') . w2PshowImage('icons/pencil.gif', 12, 12) . w2PendTip() . '</a>'; } $s .= '</td>'; // percent complete $s .= '<td align="right">' . (int) $a['task_percent_complete'] . '%</td>'; // priority $s .= '<td align="center" nowrap="nowrap">'; if ($a['task_priority'] < 0) { $s .= '<img src="' . w2PfindImage('icons/priority-' . -$a['task_priority'] . '.gif') . '" width="13" height="16" alt="" />'; } elseif ($a['task_priority'] > 0) { $s .= '<img src="' . w2PfindImage('icons/priority+' . $a['task_priority'] . '.gif') . '" width="13" height="16" alt="" />'; } $s .= '</td><td align="center" nowrap="nowrap">'; if ($a['user_task_priority'] < 0) { $s .= '<img src="' . w2PfindImage('icons/priority-' . -$a['user_task_priority'] . '.gif') . '" alt="" />'; } elseif ($a['user_task_priority'] > 0) { $s .= '<img src="' . w2PfindImage('icons/priority+' . $a['user_task_priority'] . '.gif') . '" alt="" />'; } $s .= '</td>'; // access $s .= '<td nowrap="nowrap">'; $s .= mb_substr($task_access[$a['task_access']], 0, 3); $s .= '</td>'; // type $s .= '<td nowrap="nowrap">'; $s .= mb_substr($types[$a['task_type']], 0, 3); $s .= '</td>'; // type $s .= '<td nowrap="nowrap">'; $s .= $a['queue_id'] ? 'Yes' : ''; $s .= '</td>'; // inactive $s .= '<td nowrap="nowrap">'; $s .= $a['task_status'] == '-1' ? 'Yes' : ''; $s .= '</td>'; // add log $s .= '<td align="center" nowrap="nowrap">'; if ($a['task_dynamic'] != 1 && 0 == $a['task_represents_project']) { $s .= '<a href="?m=tasks&a=view&tab=1&project_id=' . $a['task_project'] . '&task_id=' . $a['task_id'] . '">' . w2PtoolTip('tasks', 'add work log to this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>'; } $s .= '</td>'; // dots if ($today_view) { $s .= '<td>'; } else { $s .= '<td width="20%">'; } for ($y = 0; $y < $level; $y++) { if ($y + 1 == $level) { $s .= '<img src="' . w2PfindImage('corner-dots.gif', $m) . '" width="16" height="12" border="0" alt="" />'; } else { $s .= '<img src="' . w2PfindImage('shim.gif', $m) . '" width="16" height="12" border="0" alt="" />'; } } // name link if ($a['task_description']) { $s .= w2PtoolTip('Task Description', $a['task_description'], true); } $jsTaskId = 'task_proj_' . $a['task_project'] . '_level-' . $level . '-task_' . $a['task_id'] . '_'; $open_link = '<a href="javascript: void(0);"><img onclick="expand_collapse(\'' . $jsTaskId . '\', \'tblProjects\',\'\',' . ($level + 1) . ');" id="' . $jsTaskId . '_collapse" src="' . w2PfindImage('icons/collapse.gif', $m) . '" border="0" align="center" ' . (!$expanded ? 'style="display:none"' : '') . ' alt="" /><img onclick="expand_collapse(\'' . $jsTaskId . '\', \'tblProjects\',\'\',' . ($level + 1) . ');" id="' . $jsTaskId . '_expand" src="' . w2PfindImage('icons/expand.gif', $m) . '" border="0" align="center" ' . ($expanded ? 'style="display:none"' : '') . ' alt="" /></a>'; $taskObj = new CTask(); $taskObj->load($a['task_id']); if (count($taskObj->getChildren())) { $is_parent = true; } else { $is_parent = false; } if ($a['task_milestone'] > 0) { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $a['task_id'] . '" ><b>' . $a['task_name'] . '</b></a> <img src="' . w2PfindImage('icons/milestone.gif', $m) . '" border="0" alt="" /></td>'; } elseif ($a['task_dynamic'] == '1' || $is_parent) { $s .= $open_link; if ($a['task_dynamic'] == '1') { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $a['task_id'] . '" ><b><i>' . $a['task_name'] . '</i></b></a></td>'; } else { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $a['task_id'] . '" >' . $a['task_name'] . '</a></td>'; } } else { $s .= ' <a href="./index.php?m=tasks&a=view&task_id=' . $a['task_id'] . '" >' . $a['task_name'] . '</a></td>'; } if ($a['task_description']) { $s .= w2PendTip(); } // task description if ($PROJDESIGN_CONFIG['show_task_descriptions']) { $s .= '<td align="justified">' . $a['task_description'] . '</td>'; } // task owner $s .= '<td align="left">' . '<a href="?m=admin&a=viewuser&user_id=' . $a['user_id'] . '">' . $a['contact_first_name'] . ' ' . $a['contact_last_name'] . '</a></td>'; $s .= '<td id="ignore_td_' . $a['task_id'] . '" nowrap="nowrap" align="center" style="' . $style . '">' . ($start_date ? $start_date->format($df . ' ' . $tf) : '-') . '</td>'; // duration or milestone $s .= '<td id="ignore_td_' . $a['task_id'] . '" align="right" nowrap="nowrap" style="' . $style . '">'; $s .= $a['task_duration'] . ' ' . mb_substr($AppUI->_($durnTypes[$a['task_duration_type']]), 0, 1); $s .= '</td>'; $s .= '<td id="ignore_td_' . $a['task_id'] . '" nowrap="nowrap" align="center" style="' . $style . '">' . ($end_date ? $end_date->format($df . ' ' . $tf) : '-') . '</td>'; if (isset($a['task_assigned_users']) && ($assigned_users = $a['task_assigned_users'])) { $a_u_tmp_array = array(); if ($show_all_assignees) { $s .= '<td align="left">'; foreach ($assigned_users as $val) { $aInfo = '<a href="?m=admin&a=viewuser&user_id=' . $val['user_id'] . '"'; $aInfo .= 'title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$val['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$val['user_id']]['freeCapacity'] . '%' : '') . '">'; $aInfo .= $val['contact_first_name'] . ' ' . $val['contact_last_name'] . ' (' . $val['perc_assignment'] . '%)</a>'; $a_u_tmp_array[] = $aInfo; } $s .= join(', ', $a_u_tmp_array); $s .= '</td>'; } else { $s .= '<td align="left" nowrap="nowrap">'; $s .= '<a href="?m=admin&a=viewuser&user_id=' . $assigned_users[0]['user_id'] . '"'; $s .= 'title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[0]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[0]['user_id']]['freeCapacity'] . '%' : '') . '">'; $s .= $assigned_users[0]['contact_first_name'] . ' ' . $assigned_users[0]['contact_last_name'] . ' (' . $assigned_users[0]['perc_assignment'] . '%)</a>'; if ($a['assignee_count'] > 1) { $id = $a['task_id']; $s .= '<a href="javascript: void(0);" onclick="toggle_users(\'users_' . $id . '\');" title="' . join(', ', $a_u_tmp_array) . '">(+' . ($a['assignee_count'] - 1) . ')</a>'; $s .= '<span style="display: none" id="users_' . $id . '">'; $a_u_tmp_array[] = $assigned_users[0]['user_username']; for ($i = 1, $i_cmp = count($assigned_users); $i < $i_cmp; $i++) { $a_u_tmp_array[] = $assigned_users[$i]['user_username']; $s .= '<br /><a href="?m=admin&a=viewuser&user_id='; $s .= $assigned_users[$i]['user_id'] . '" title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['freeCapacity'] . '%' : '') . '">'; $s .= $assigned_users[$i]['contact_first_name'] . ' ' . $assigned_users[$i]['contact_last_name'] . ' (' . $assigned_users[$i]['perc_assignment'] . '%)</a>'; } $s .= '</span>'; } $s .= '</td>'; } } else { // No users asigned to task $s .= '<td align="center">-</td>'; } // Assignment checkbox if ($showEditCheckbox && 0 == $a['task_represents_project']) { $s .= '<td align="center"><input type="checkbox" onclick="select_box(\'selected_task\', ' . $a['task_id'] . ',\'project_' . $a['task_project'] . '_level-' . $level . '-task_' . $a['task_id'] . '_\',\'frm_tasks\')" onfocus="is_check=true;" onblur="is_check=false;" id="selected_task_' . $a['task_id'] . '" name="selected_task[' . $a['task_id'] . ']" value="' . $a['task_id'] . '"/></td>'; } $s .= '</tr>'; echo $s; }