Example #1
0
function show_task_tree(&$table, $id_project, $level, $id_parent_task, $users)
{
    global $config;
    $sql = sprintf('SELECT * FROM ttask
		WHERE id_project = %d
		AND id_parent_task = %d
		ORDER BY name', $id_project, $id_parent_task);
    $new = true;
    while ($task = get_db_all_row_by_steps_sql($new, $result, $sql)) {
        $new = false;
        //If user belong to task then create a new row in the table
        $task_access = get_project_access($config['id_user'], $id_project, $task['id'], false, true);
        if ($task_access['manage']) {
            //Each tr has the task id as the html id object!
            //Check completion for tr background color
            if ($task['completion'] < 40) {
                $color = "#FFFFFF";
            } else {
                if ($task['completion'] < 90) {
                    $color = "#FFE599";
                } else {
                    if ($task['completion'] < 100) {
                        $color = "#A4BCFA";
                    } else {
                        if ($task['completion'] == 100) {
                            $color = "#B6D7A8";
                        }
                    }
                }
            }
            echo "<tr id=" . $task['id'] . " bgcolor='{$color}'>";
            show_task_row($table, $id_project, $task, $level, $users);
            echo "</tr>";
        }
        show_task_tree($table, $id_project, $level + 1, $task['id'], $users);
    }
}
Example #2
0
function show_task_tree (&$table, $id_project, $level, $id_parent_task, $where_clause) {
	global $config;
	
	$sql = sprintf ('SELECT * FROM ttask
		WHERE %s
		AND id_project = %d
		AND id_parent_task = %d
		ORDER BY name',
		$where_clause, $id_project, $id_parent_task);
	$tasks = get_db_all_rows_sql ($sql);
	if ($tasks === false)
		return;
	foreach ($tasks as $task) {
		if (user_belong_task ($config['id_user'], $task['id']))
			show_task_row ($table, $id_project, $task, $level);
		show_task_tree ($table, $id_project, $level + 1, $task['id'], $where_clause);
	}
}