$t['task_end_date'] = $todaydate->format(FMT_TIMESTAMP_DATE); } } $tStart = intval($t['task_start_date']) ? $t['task_start_date'] : $start; $tEnd = intval($t['task_end_date']) ? $t['task_end_date'] : $end; $tStartObj = new w2p_Utilities_Date($t['task_start_date']); $tEndObj = new w2p_Utilities_Date($t['task_end_date']); if ($t['task_milestone'] != 1) { $columnValues = array('task_name' => $name, 'start_date' => $tStart, 'end_date' => $tEnd, 'actual_end' => ''); $height = $t['task_dynamic'] == 1 ? 0.1 : 0.6; $gantt->addBar($columnValues, $t['task_percent_complete'] . '% ' . $AppUI->_('Complete'), $height, $p['project_color_identifier'], $p['project_active'], $t['task_percent_complete'], $t['task_id']); } else { $gantt->addMilestone(array('-- ' . $name), $t['task_start_date']); } $task->task_id = $t['task_id']; $workers = $task->getAssigned(); foreach ($workers as $w) { $columnValues = array('user_name' => ' * ' . $w['user_name'], 'start_date' => $tStart, 'end_date' => $tEnd, 'actual_end' => ''); $height = $t['task_dynamic'] == 1 ? 0.1 : 0.6; $gantt->addBar($columnValues, $w['user_name'], 0.6, $p['project_color_identifier'], true, $t['task_percent_complete'], $t['task_id']); } // End of insert workers for each task into Gantt Chart } unset($tasks); // End of insert tasks into Gantt Chart } // End of if showAllGant checkbox is checked } } // End of check for valid projects array. unset($projects);
function getTaskTooltip($task_id, $starts = false, $ends = false, $tasks_tips) { global $AppUI; if (!$task_id) { return ''; } $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); $task = new CTask(); // load the record data $task->loadFull($AppUI, $task_id); // load the event types $types = w2PgetSysVal('TaskType'); $assigned = $task->getAssigned(); $start_date = (int) $task->task_start_date ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($task->task_start_date, '%Y-%m-%d %T')) : null; $end_date = (int) $task->task_end_date ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($task->task_end_date, '%Y-%m-%d %T')) : null; // load the record data $task_project = $task->project_name; $task_company = $task->company_name; $tt = '<table border="0" cellpadding="0" cellspacing="0" width="96%">'; $tt .= '<tr>'; $tt .= ' <td valign="top" width="40%">'; $tt .= ' <strong>' . $AppUI->_('Details') . '</strong>'; $tt .= ' <table cellspacing="3" cellpadding="2" width="100%">'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Company') . '</td>'; $tt .= ' <td width="100%">' . $task_company . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Project') . '</td>'; $tt .= ' <td width="100%">' . $task_project . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Type') . '</td>'; $tt .= ' <td width="100%" nowrap="nowrap">' . $AppUI->_($types[$task->task_type]) . '</td>'; $tt .= ' </tr> '; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Progress') . '</td>'; $tt .= ' <td width="100%" nowrap="nowrap"><strong>' . sprintf("%.1f%%", $task->task_percent_complete) . '</strong></td>'; $tt .= ' </tr> '; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Starts') . '</td>'; $tt .= ' <td nowrap="nowrap">' . ($starts ? '<strong>' : '') . ($start_date ? $start_date->format($df . ' ' . $tf) : '-') . ($starts ? '</strong>' : '') . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Ends') . '</td>'; $tt .= ' <td nowrap="nowrap">' . ($ends ? '<strong>' : '') . ($end_date ? $end_date->format($df . ' ' . $tf) : '-') . ($ends ? '</strong>' : '') . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Assignees') . '</td>'; $tt .= ' <td nowrap="nowrap">'; if (is_array($assigned)) { $start = false; foreach ($assigned as $user) { if ($start) { $tt .= '<br/>'; } else { $start = true; } $tt .= $user['user_name'] . ' ' . $user['perc_assignment'] . '%'; } } $tt .= ' </tr>'; $tt .= ' </table>'; $tt .= ' </td>'; $tt .= ' <td width="60%" valign="top">'; $tt .= ' <strong>' . $AppUI->_('Description') . '</strong>'; $tt .= ' <table cellspacing="0" cellpadding="2" border="0" width="100%">'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;">'; $tt .= ' ' . $task->task_description; $tt .= ' </td>'; $tt .= ' </tr>'; $tt .= ' </table>'; $tt .= ' </td>'; $tt .= '</tr>'; $tt .= '</table>'; return $tt; }