示例#1
0
        } else {
            if (!in_array($t1['task_parent'], $tasks_filtered)) {
                /*
                 * don't "mess with" display when showing certain views 
                 * (or similiar filters that don't involve "breaking apart" a task tree 
                 * even though they might not use this page ever)
                 */
                if (!$task_id && in_array($f, $never_show_with_dots)) {
                    showtaskToOrganize($t1, 1, true, false, true);
                } else {
                    //display as close to "tree-like" as possible
                    $is_opened = !$t1['task_dynamic'] || !in_array($t1['task_id'], $tasks_closed);
                    //check for child
                    $no_children = empty($children_of[$t1['task_id']]);
                    $my_level = $task_id && $t1['task_parent'] == $task_id ? 0 : -1;
                    showtaskToOrganize($t1, $my_level, $is_opened, false, $no_children);
                    // indeterminate depth for child task
                    if ($is_opened && !$no_children) {
                        findchild($p['tasks'], $t1['task_id'], 0, false, true);
                    }
                }
            }
        }
    }
    echo '</div>';
    if (isset($project_id)) {
        echo '</div>';
    }
    ?>
		<form name="taskOrder" action="?m=tasks&a=do_task_order" method="post">
		<input id="taskList" name="taskList" type="hidden" />
示例#2
0
function findchild(&$tarr, $parent, $level = 0, $toModify = false, $toOrganize = false)
{
    global $tasks_opened, $tasks_closed, $tasks_filtered, $children_of;
    $tasks_closed = $tasks_closed ? $tasks_closed : array();
    $tasks_opened = $tasks_opened ? $tasks_opened : array();
    $level = $level + 1;
    foreach ($tarr as $x => $task) {
        if ($task['task_parent'] == $parent && $task['task_parent'] != $task['task_id']) {
            $is_opened = !$task['task_dynamic'] || !in_array($task['task_id'], $tasks_closed);
            //check for child
            $no_children = empty($children_of[$task['task_id']]);
            if ($toModify) {
                showtaskToModify($task, $level, $is_opened, false, $no_children, false);
            } else {
                if ($toOrganize) {
                    showtaskToOrganize($task, $level, $is_opened, false, $no_children, false);
                } else {
                    showtask($task, $level, $is_opened, false, $no_children, false);
                }
            }
            if ($is_opened && !$no_children) {
                /*
                 * Yes, this is stupid, but there was previously a bug where if you had
                 * two dynamic tasks at the same level and the child of a dynamic task,
                 * they would only both display if the first one was closed.  The moment
                 * you opened the first one, the second would disappear.
                 * 
                 * There is something screwy happening in this function in the pass by
                 * reference.  I suspect it's a PHP4 vs PHP5 oddity.
                 */
                $tmp = $tarr;
                findchild($tmp, $task['task_id'], $level, $toModify, $toOrganize);
            }
        }
    }
}