end_date = fld_task_date; start_date = eval( "document." + frm_name + "." + "add_task_" + f_date.replace("end_date","start_date") ); duration_fld = eval( "document." + frm_name + "." + "add_task_" + f_date.replace("end_date","duration") ); durntype_fld = eval( "document." + frm_name + "." + "add_task_" + f_date.replace("end_date","durntype") ); } calcDuration(document.editFrm, start_date, end_date, duration_fld, durntype_fld); } } } else { fld_task_date.value = ""; } } </script> <?php $priorities = dPgetsysval('TaskPriority'); $types = dPgetsysval('TaskType'); $durntype = dPgetSysVal('TaskDurationType'); include_once $AppUI->getModuleClass('tasks'); global $task_access; $extra = array(0 => '(none)', 1 => 'Milestone', 2 => 'Dynamic Task', 3 => 'Inactive Task'); $sel_priorities = arraySelect($priorities, 'add_task_priority0', 'style="width:80px" class="text"', ''); $sel_types = arraySelect($types, 'add_task_type0', 'style="width:80px" class="text"', ''); $sel_access = arraySelect($task_access, 'add_task_access0', 'style="width:80px" class="text"', ''); $sel_extra = arraySelect($extra, 'add_task_extra0', 'style="width:80px" class="text"', ''); $sel_durntype = arraySelect($durntype, 'add_task_durntype0', 'style="width:80px" class="text"', '', true); ?> <script language="javascript"> var sel_priorities = "<?php echo str_replace(chr(10), '', str_replace('"', "'", $sel_priorities)); ?> ";
<?php include_once $AppUI->getModuleClass('tasks'); global $task_access, $task_priority, $project_id; $type = dPgetsysval('TaskType'); $stype = array('' => '(' . $AppUI->_('Type') . ')') + $type; $priority = dPgetsysval('TaskPriority'); $spriority = array('' => '(' . $AppUI->_('Priority') . ')') + $priority; $stask_access = array('' => '(' . $AppUI->_('Access') . ')') + $task_access; $durntype = dPgetSysval('TaskDurationType'); $sdurntype = array('' => '(' . $AppUI->_('Priority') . 'Duration Type)') + $durntype; $sother = array('' => '(' . $AppUI->_('Other Operations') . ')', '1' => '' . $AppUI->_('Mark Tasks as Finished') . '', '8' => '' . $AppUI->_('Mark Tasks as Active') . '', '9' => '' . $AppUI->_('Mark Tasks as Inactive') . '', '2' => '' . $AppUI->_('Mark Tasks as Milestones') . '', '3' => '' . $AppUI->_('Mark Tasks as Non Milestone') . '', '4' => '' . $AppUI->_('Mark Tasks as Dynamic') . '', '5' => '' . $AppUI->_('Mark Tasks as Non Dynamic') . '', '6' => '' . $AppUI->_('Add Task Reminder') . '', '7' => '' . $AppUI->_('Remove Task Reminder') . '', '99' => '' . $AppUI->_('Delete Tasks') . ''); //Pull all users $q = new DBQuery(); $q->addQuery('user_id, contact_first_name, contact_last_name'); $q->addTable('users'); $q->addTable('contacts'); $q->addWhere('user_contact = contact_id'); $q->addOrder('contact_first_name, contact_last_name'); $q->exec(); $users = array(); while ($row = $q->fetchRow()) { $users[$row['user_id']] = $row['contact_first_name'] . ' ' . $row['contact_last_name']; } $q->clear(); $sowners = array('' => '(' . $AppUI->_('Task Owner') . ')') + $users; $sassign = array('' => '(' . $AppUI->_('Assign User') . ')') + $users; $sunassign = array('' => '(' . $AppUI->_('Unassign User') . ')') + $users; $obj =& new CTask(); $allowedTasks = $obj->getAllowedSQL($AppUI->user_id, 'tasks.task_id'); $obj->load($task_id);
function showtask_pr(&$a, $level = 0, $is_opened = true, $today_view = false) { global $AppUI, $dPconfig, $done, $query_string, $durnTypes, $userAlloc, $showEditCheckbox; global $task_access, $task_priority; $types = dPgetsysval('TaskType'); $now = new CDate(); $tf = $AppUI->getPref('TIMEFORMAT'); $df = $AppUI->getPref('SHDATEFORMAT'); $fdf = $df . " " . $tf; $perms =& $AppUI->acl(); $show_all_assignees = @$dPconfig['show_all_task_assignees'] ? true : false; $done[] = $a['task_id']; $start_date = intval($a["task_start_date"]) ? new CDate($a["task_start_date"]) : null; $end_date = intval($a["task_end_date"]) ? new CDate($a["task_end_date"]) : null; $last_update = isset($a['last_update']) && intval($a['last_update']) ? new CDate($a['last_update']) : 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 CDate('0000-00-00 00:00:00'); } $days = $now->dateDiff($end_date) * $sign; } $s = "\n<tr>"; // dots if ($today_view) { $s .= '<td nowrap>'; } else { $s .= '<td nowrap width="20%">'; } for ($y = 0; $y < $level; $y++) { if ($y + 1 == $level) { $s .= '<img src="./images/corner-dots.gif" width="16" height="12" border="0">'; } else { $s .= '<img src="./images/shim.gif" width="16" height="12" border="0">'; } } // name link $alt = strlen($a['task_description']) > 80 ? substr($a["task_description"], 0, 80) . '...' : $a['task_description']; // instead of the statement below $alt = str_replace("\"", """, $alt); $alt = str_replace("\r", ' ', $alt); $alt = str_replace("\n", ' ', $alt); $open_link = $is_opened ? "<!--<a href='index.php{$query_string}&close_task_id=" . $a["task_id"] . "'>--><img src='images/icons/collapse.gif' border='0' align='center' /><!--</a>-->" : "<!--<a href='index.php{$query_string}&open_task_id=" . $a["task_id"] . "'>--><img src='images/icons/expand.gif' border='0' /><!--</a>-->"; if ($a["task_milestone"] > 0) { $s .= ' <!--<a href="./index.php?m=tasks&a=view&task_id=' . $a["task_id"] . '" title="' . $alt . '">--><b>' . $a["task_name"] . '</b><!--</a>--> <img src="./images/icons/milestone.gif" border="0"></td>'; } else { if ($a["task_dynamic"] == '1') { if (!$today_view) { $s .= $open_link; } $s .= $a["task_name"]; } else { $s .= $a["task_name"]; } } // percent complete $s .= "\n\t<td align=\"right\">" . intval($a["task_percent_complete"]) . '%</td>'; if ($today_view) { // Show the project name $s .= '<td>'; $s .= '<a href="./index.php?m=projects&a=view&project_id=' . $a['task_project'] . '">'; $s .= '<span style="padding:2px;background-color:#' . $a['project_color_identifier'] . ';color:' . bestColor($a['project_color_identifier']) . '">' . $a['project_name'] . '</span>'; $s .= '</a></td>'; } if (!$today_view) { $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($start_date ? $start_date->format($df . ' ' . $tf) : '-') . '</td>'; } $s .= '</td>'; $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($end_date ? $end_date->format($df . ' ' . $tf) : '-') . '</td>'; $s .= '</td>'; $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($last_update ? $last_update->format($df . ' ' . $tf) : '-') . '</td>'; echo $s; }