if ($project_id) { $query->addWhere('t.task_project = ' . $project_id); } // Now add the required restrictions. $proj->setAllowedSQL($AppUI->user_id, $query, null, 'p'); $task->setAllowedSQL($AppUI->user_id, $query, null, 't'); $query->addOrder('task_end_date'); $task_list_hash = $query->loadHashList('task_id'); $query->clear(); $task_list = array(); $task_assigned_users = array(); foreach ($task_list_hash as $task_id => $task_data) { $task = new CTask(); $task->bind($task_data); $task_list[$task_id] = $task; $task_assigned_users[$task_id] = $task->getAssignedUsers(); } $user_usage = array(); $task_dates = array(); $actual_date = $start_date; $days_header = ''; // we will save days title here $max_levels = $max_levels == '' || intval($max_levels) < 0 ? -1 : intval($max_levels); $max_levels = $max_levels == 0 ? 1 : $max_levels; if (count($task_list) == 0) { echo '<p>' . $AppUI->_('No data available') . '</p>'; } else { $sss = $ss; $sse = $se; if (!$use_period) { $sss = $sse = 0;
} $allowedChildrenTasks = $task->getAllowedSQL($AppUI->user_id, 't.task_parent'); if (count($allowedChildrenTasks)) { $sql->addWhere(implode(' AND ', $allowedChildrenTasks)); } // Now add the required restrictions. $proj->setAllowedSQL($AppUI->user_id, $sql, null, 'p'); $sql->addOrder('task_project, task_end_date, task_start_date'); $task_list_hash = $sql->loadHashList('task_id'); $task_list = array(); $task_assigned_users = array(); $user_assigned_tasks = array(); foreach ($task_list_hash as $task_id => $task_data) { $task = new CTask(); $task->bind($task_data); $task_users = $task->getAssignedUsers(); foreach (array_keys($task_users) as $uid) { $user_assigned_tasks[$uid][] = $task_id; } $task->task_assigned_users = $task_users; $task_list[$task_id] = $task; } $user_usage = array(); $task_dates = array(); $actual_date = $start_date; $days_header = ''; // we will save days title here $max_levels = $max_levels == '' || intval($max_levels) < 0 ? -1 : intval($max_levels); $max_levels = $max_levels == 0 ? 1 : $max_levels; if (count($task_list) == 0) { echo '<p>' . $AppUI->_('No data available') . '</p>';
$progress = 100; } elseif ($progress < 0) { $progress = 0; } $flags = $a['task_milestone'] ? 'm' : ''; $caption = ''; if (!$start || $start == '0000-00-00') { $start = !$end ? date('Y-m-d') : $end; $caption .= $AppUI->_('(no start date)'); } if (!$end) { $end = $start; $caption .= ' ' . $AppUI->_('(no end date)'); } if ($showLabels == '1') { $res = $task->getAssignedUsers($task_id); foreach ($res as $rw) { switch ($rw['perc_assignment']) { case 100: $caption .= $rw['contact_display_name'] . ';'; break; default: $caption .= $rw['contact_display_name'] . ' [' . $rw['perc_assignment'] . '%];'; break; } } $q->clear(); $caption = mb_substr($caption, 0, mb_strlen($caption) - 1); } if ($flags == 'm') { $start = new w2p_Utilities_Date($start);
$AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else { $AppUI->savePlace(); } if (!$obj->canAccess($AppUI->user_id)) { $AppUI->redirect('m=public&a=access_denied'); } // Clear any reminders if ($reminded) { $obj->clearReminder(); } $tab = $AppUI->processIntState('TaskLogVwTab', $_GET, 'tab', 0); //check permissions for the associated project $canReadProject = canView('projects', $obj->task_project); $users = $obj->getAssignedUsers($task_id); $durnTypes = w2PgetSysVal('TaskDurationType'); $task_types = w2PgetSysVal('TaskType'); $billingCategory = w2PgetSysVal('BudgetCategory'); // setup the title block $titleBlock = new w2p_Theme_TitleBlock('View Task', 'applet-48.png', $m, $m . '.' . $a); $titleBlock->addCell(); if ($canEdit) { $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new task') . '">', '', '<form action="?m=tasks&a=addedit&task_project=' . $obj->task_project . '&task_parent=' . $task_id . '" method="post" accept-charset="utf-8">', '</form>'); $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new file') . '">', '', '<form action="?m=files&a=addedit&project_id=' . $obj->task_project . '&file_task=' . $obj->task_id . '" method="post" accept-charset="utf-8">', '</form>'); } $titleBlock->addCrumb('?m=tasks', 'tasks list'); if ($canReadProject) { $titleBlock->addCrumb('?m=projects&a=view&project_id=' . $obj->task_project, 'view this project'); } if ($canEdit && 0 == $obj->task_represents_project) {
$user_usage = array(); $task_dates = array(); $actual_date = $start_date; $days_header = ''; // we will save days title here $user_tasks_counted_in = array(); $user_names = array(); if (count($task_list) == 0) { echo '<p>' . $AppUI->_('No data available') . '</p>'; } else { foreach ($task_list as $task) { $task_start_date = new w2p_Utilities_Date($task->task_start_date); $task_end_date = new w2p_Utilities_Date($task->task_end_date); $day_difference = $task_end_date->dateDiff($task_start_date); $actual_date = $task_start_date; $users = $task->getAssignedUsers($task->task_id); if ($coarseness == 1) { userUsageDays(); } elseif ($coarseness == 7) { userUsageWeeks(); } } if ($coarseness == 1) { showDays(); } elseif ($coarseness == 7) { showWeeks(); } ?> <center><table class="std"> <?php echo $table_header . $table_rows;
$progress = 0; } $flags = $a['task_milestone'] ? 'm' : ''; $cap = ''; if (!$start || $start == '0000-00-00') { $start = !$end ? date('Y-m-d') : $end; $cap .= '(no start date)'; } if (!$end) { $end = $start; $cap .= ' (no end date)'; } else { $cap = ''; } if ($showLabels == '1') { $res = $task->getAssignedUsers($a['task_id']); foreach ($res as $rw) { switch ($rw['perc_assignment']) { case 100: $caption .= $rw['contact_display_name'] . ';'; break; default: $caption .= $rw['contact_display_name'] . ' [' . $rw['perc_assignment'] . '%];'; break; } } $q->clear(); $caption = mb_substr($caption, 0, mb_strlen($caption) - 1); } if ($flags == 'm') { // if hide milestones is ticked this bit is not processed//////////////////////////////////////////
$q->addWhere(implode(' AND ', $allowedProjects)); } if (count($allowedTasks)) { $q->addWhere(implode(' AND ', $allowedTasks)); } $q->addOrder('task_end_date'); $task_list_hash = $q->loadHashList('task_id'); $q->clear(); $task_list = array(); $task_assigned_users = array(); $i = 0; foreach ($task_list_hash as $task_id => $task_data) { $task = new CTask(); $task->bind($task_data); $task_list[$i] = $task; $task_assigned_users[$i] = $task->getAssignedUsers($task_id); $i += 1; } $Ntasks = $i; $user_usage = array(); $task_dates = array(); $actual_date = $start_date; $days_header = ""; // we will save days title here if (strtolower($max_levels) == 'max') { $max_levels = -1; } elseif ($max_levels == '') { $max_levels = -1; } else { $max_levels = atoi($max_levels); }