예제 #1
0
 }
 $obj = new CTask();
 foreach ($project_ids as $project_id) {
     $taskTree = $obj->getTaskTree($project_id, 0);
     foreach ($taskTree as $task) {
         $str = '<tr>';
         if (count($project_ids) > 1) {
             $str .= '<td>' . $task['project_name'] . '</td>';
         }
         $str .= '<td>';
         $indent_count = substr_count($task['task_path_enumeration'], '/') * 3;
         $str .= $task['task_id'] == $task['task_parent'] ? '' : str_repeat('&nbsp;', $indent_count) . '<img src="' . w2PfindImage('corner-dots.gif') . '" />';
         $str .= '&nbsp;<a href="?m=tasks&a=view&task_id=' . $task['task_id'] . '">' . $task['task_name'] . '</a></td>';
         $str .= '<td>' . nl2br($task['task_description']) . '</td>';
         $users = array();
         $assignees = $obj->assignees($task['task_id']);
         foreach ($assignees as $assignee) {
             $users[] = $assignee['contact_name'];
         }
         $str .= '<td>' . implode($users, ', ') . '</td>';
         $str .= $htmlHelper->createCell('task_start_date', $task['task_start_date']);
         $str .= $htmlHelper->createCell('task_end_date', $task['task_end_date']);
         $str .= $htmlHelper->createCell('task_percent_complete', $task['task_percent_complete']);
         $str .= '</tr>';
         echo $str;
         if ($project_id == 0) {
             $pdfdata[] = array($task['project_name'], $task['task_name'], $task['task_description'], $users, $start_date != ' ' ? $start_date->format($df) : ' ', $end_date != ' ' ? $end_date->format($df) : ' ', $task['task_percent_complete'] . '%');
         } else {
             $start_date = new w2p_Utilities_Date($task['task_start_date']);
             $end_date = new w2p_Utilities_Date($task['task_end_date']);
             $spacer = str_repeat('  ', $task['depth']);
예제 #2
0
     $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->assignees($task_id);
     $i++;
 }
 $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);
 }
예제 #3
0
            $tasks = $task->getAllowedTaskList(null, $p['project_id'], $orderBy);
            $bestColor = bestColor('#ffffff', '#' . $p['project_color_identifier'], '#000000');
            foreach ($tasks as $t) {
                $name = $t['task_name'];
                $name = mb_strlen($name) > 34 ? mb_substr($name, 0, 30) . '...' : $name;
                $t['task_start_date'] = __extract_from_projects_gantt3($t);
                $t['task_end_date'] = __extract_from_projects_gantt4($t);
                if ($t['task_milestone'] != 1) {
                    $columnValues = array('task_name' => $name, 'start_date' => $t['task_start_date'], 'end_date' => $t['task_end_date'], '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->assignees($task->task_id);
                foreach ($workers as $w) {
                    $columnValues = array('user_name' => '    * ' . $w['contact_display_name'], 'start_date' => $t['task_start_date'], 'end_date' => $t['task_end_date'], '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);
예제 #4
0
if ($do_report) {
    // Let's figure out which users we have
    $user_list = $active_users;
    $ss = '\'' . $start_date->format(FMT_DATETIME_MYSQL) . '\'';
    $se = '\'' . $end_date->format(FMT_DATETIME_MYSQL) . '\'';
    $and = false;
    $where = false;
    $task_list_hash = __extract_from_tasksperuser($use_period, $ss, $se, $log_userfilter, $project_id, $company_id, $proj, $AppUI, $all_proj_status);
    $task_list = array();
    $task_assigned_users = array();
    $user_assigned_tasks = array();
    $i = 0;
    foreach ($task_list_hash as $task_id => $task_data) {
        $task = new CTask();
        $task->load($task_id);
        $task_users = $task->assignees($task_id);
        foreach (array_keys($task_users) as $key => $uid) {
            $user_assigned_tasks[$uid][] = $task_id;
        }
        $task->task_assigned_users = $task_users;
        $task_list[$i] = $task;
        $i++;
    }
    $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;
예제 #5
0
function getTaskTooltip($task_id)
{
    global $AppUI;
    if (!$task_id) {
        return '';
    }
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    $task = new CTask();
    // load the record data
    $task->load($task_id);
    // load the event types
    $types = w2PgetSysVal('TaskType');
    $assignees = $task->assignees($task_id);
    $assigned = array();
    foreach ($assignees as $user) {
        $assigned[] = $user['contact_name'] . ' ' . $user['perc_assignment'] . '%';
    }
    $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
    $project = new CProject();
    $project->load($task->task_project);
    $task_project = $project->project_name;
    $company = new CCompany();
    $company->load($project->project_company);
    $task_company = $company->company_name;
    $tt = '<table class="tool-tip">';
    $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 class="tip-label">' . $AppUI->_('Company') . '</td>';
    $tt .= '			<td>' . $task_company . '</td>';
    $tt .= '		</tr>';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Project') . '</td>';
    $tt .= '			<td>' . $task_project . '</td>';
    $tt .= '		</tr>';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Type') . '</td>';
    $tt .= '			<td>' . $AppUI->_($types[$task->task_type]) . '</td>';
    $tt .= '		</tr>	';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Progress') . '</td>';
    $tt .= '			<td>' . sprintf("%.1f%%", $task->task_percent_complete) . '</td>';
    $tt .= '		</tr>	';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Starts') . '</td>';
    $tt .= '			<td>' . ($start_date ? $start_date->format($df . ' ' . $tf) : '-') . '</td>';
    $tt .= '		</tr>';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Ends') . '</td>';
    $tt .= '			<td>' . ($end_date ? $end_date->format($df . ' ' . $tf) : '-') . '</td>';
    $tt .= '		</tr>';
    $tt .= '		<tr>';
    $tt .= '			<td class="tip-label">' . $AppUI->_('Assignees') . '</td>';
    $tt .= '			<td>';
    $tt .= implode('<br />', $assigned);
    $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 class="tip-label description">';
    $tt .= '				' . $task->task_description;
    $tt .= '			</td>';
    $tt .= '		</tr>';
    $tt .= '		</table>';
    $tt .= '	</td>';
    $tt .= '</tr>';
    $tt .= '</table>';
    return $tt;
}
예제 #6
0
if (!$obj->load($task_id)) {
    $AppUI->redirect(ACCESS_DENIED);
}
$canEdit = $obj->canEdit();
$canDelete = $obj->canDelete();
/**
 * Clear any reminders
 * @todo THIS SHOULD NOT HAPPEN HERE.. VIEWING SHOULD BE IDEMPOTENT
 */
$reminded = (int) w2PgetParam($_GET, 'reminded', 0);
if ($reminded) {
    $obj->clearReminder();
}
//check permissions for the associated project
$canReadProject = canView('projects', $obj->task_project);
$users = $obj->assignees($task_id);
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('View Task', 'icon.png', $m);
$titleBlock->addCell();
if ($canReadProject) {
    $titleBlock->addCrumb('?m=projects&a=view&project_id=' . $obj->task_project, 'view this project');
}
if ($canEdit) {
    $titleBlock->addButton('new log', '?m=tasks&a=view&task_id=' . $task_id . '&tab=1');
    $titleBlock->addButton('new link', '?m=links&a=addedit&task_id=' . $task_id . '&project_id=' . $obj->task_project);
    $titleBlock->addButton('new file', '?m=files&a=addedit&project_id=' . $obj->task_project . '&file_task=' . $obj->task_id);
    $titleBlock->addButton('new task', '?m=tasks&a=addedit&task_project=' . $obj->task_project . '&task_parent=' . $task_id);
    if (!$obj->task_represents_project) {
        $titleBlock->addCrumb('?m=tasks&a=addedit&task_id=' . $task_id, 'edit this task');
    }
}
예제 #7
0
 }
 // Action: Allow user to add task logs for others
 if (isset($_POST['bulk_task_allow_other_user_tasklogs']) && $bulk_task_allow_other_user_tasklogs != '') {
     $upd_task = new CTask();
     $upd_task->load($val);
     if ($upd_task->task_id) {
         $upd_task->task_allow_other_user_tasklogs = $bulk_task_allow_other_user_tasklogs;
         $result = $upd_task->store();
         if (!$result) {
             break;
         }
     }
 }
 //Action: Set user task priority for current user ($APPUI->userid)
 if ($upd_task->task_id && $bulk_task_user_priority != "") {
     $assigned_users = $upd_task->assignees($upd_task->task_id);
     if (array_key_exists("{$AppUI->user_id}", $assigned_users)) {
         $upd_task->updateUserSpecificTaskPriority($bulk_task_user_priority, $AppUI->user_id);
     }
 }
 //Action: Other Actions
 if (isset($_POST['bulk_task_other']) && $bulk_task_other != '') {
     if ($upd_task->task_id) {
         //Option 1 - Mark as finished
         if ($bulk_task_other == '1') {
             $upd_task->task_percent_complete = 100;
             if (!$upd_task->task_end_date || $upd_task->task_end_date == '0000-00-00 00:00:00') {
                 $end_date = null;
                 $end_date = new w2p_Utilities_Date();
                 $upd_task->task_end_date = $end_date->format(FMT_DATETIME_MYSQL);
             }