Exemplo n.º 1
0
function findchild(&$tarr, $parent, $level = 0)
{
    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 = !in_array($task['task_id'], $tasks_closed);
            //check for child
            $no_children = empty($children_of[$task['task_id']]);
            showtask($task, $level, $is_opened, false, $no_children);
            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);
            }
        }
    }
}
Exemplo n.º 2
0
                    $shown_tasks[$t1['task_id']] = $t1['task_id'];
                    findchild($p['tasks'], $t1['task_id']);
                }
            }
            reset($p);
            //2nd pass parentless tasks
            foreach ($p['tasks'] as $i => $t1) {
                if (!isset($shown_tasks[$t1['task_id']])) {
                    //Here we are on a parentless task context, this can happen because we are:
                    //1) displaying filtered tasks that could be showing only child tasks and not its parents due to filtering.
                    //2) in a situation where child tasks are active and parent tasks are inactive or vice-versa.
                    //
                    //The IF condition makes sure:
                    //1) The parent task has been displayed and passed through the findchild first, so child tasks are not erroneously displayed as orphan (parentless)
                    //2) Only not displayed yet tasks are shown so we don't show duplicates due to findchild that may cause duplicate showtasks for level 1 (and higher) tasks.
                    showtask($t1, -1, true, false, true);
                    $shown_tasks[] = $t1['task_id'];
                }
            }
        }
        if ($tnums && $w2Pconfig['enable_gantt_charts'] && !$min_view) {
            ?>
					<tr>
					  <td colspan="<?php 
            echo $cols;
            ?>
" align="right">
					  <input type="button" class="button" value="<?php 
            echo $AppUI->_('Reports');
            ?>
" 
Exemplo n.º 3
0
function findchild(&$tarr, $parent, $level = 0)
{
    global $shown_tasks;
    $level = $level + 1;
    $n = count($tarr);
    for ($x = 0; $x < $n; $x++) {
        if ($tarr[$x]['task_parent'] == $parent && $tarr[$x]['task_parent'] != $tarr[$x]['task_id']) {
            showtask($tarr[$x], $level, true);
            $shown_tasks[$tarr[$x]['task_id']] = $tarr[$x]['task_id'];
            findchild($tarr, $tarr[$x]['task_id'], $level);
        }
    }
}
Exemplo n.º 4
0
    for ($j = 0, $j_cmp = count($tasks); $j < $j_cmp; $j++) {
        if ($tasks[$j]['task_end_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_end_date'] == '') {
            if ($tasks[$j]['task_start_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_start_date'] == '') {
                $tasks[$j]['task_start_date'] = '0000-00-00 00:00:00';
                //just to be sure start date is "zeroed"
                $tasks[$j]['task_end_date'] = '0000-00-00 00:00:00';
            } else {
                $tasks[$j]['task_end_date'] = calcEndByStartAndDuration($tasks[$j]);
            }
        }
    }
}
$history_active = false;
// showing tasks
foreach ($tasks as $task) {
    echo showtask($task, 0, false, true);
}
if (w2PgetConfig('direct_edit_assignment')) {
    ?>
        <tr>
            <td colspan="9" align="right" height="30">
                <input type="submit" class="button" value="<?php 
    echo $AppUI->_('update task');
    ?>
" />
            </td>
            <td colspan="3" align="center">
            <?php 
    foreach ($priorities as $k => $v) {
        $options[$k] = $AppUI->_('set priority to ' . $v, UI_OUTPUT_RAW);
    }
                $is_opened = in_array($t["task_id"], $tasks_opened);
                showtask($t, 0, $is_opened, '', $_GET["impr"]);
                if ($is_opened || !$t["task_dynamic"]) {
                    findchild($p['tasks'], $t["task_id"]);
                }
            }
            // else showtask( $t, 0, $is_opened );
        }
        // check that any 'orphaned' user tasks are also display
        for ($i = 0; $i < $tnums; $i++) {
            if (!in_array($p['tasks'][$i]["task_id"], $done)) {
                if ($p['tasks'][$i]["task_dynamic"] && in_array($p['tasks'][$i]["task_parent"], $tasks_closed)) {
                    closeOpenedTask($p['tasks'][$i]["task_id"]);
                }
                if (in_array($p['tasks'][$i]["task_parent"], $tasks_opened)) {
                    showtask($p['tasks'][$i], 1, false, '', $_GET["impr"]);
                }
            }
        }
        if ($tnums && $dPconfig['enable_gantt_charts'] && !$min_view) {
            ?>
		<?php 
            if ($_GET["impr"] != 1) {
                ?>
<tr>
			<td colspan="<?php 
                echo $cols;
                ?>
" align="right">
				<!--<input type="button" class="button" value="<?php 
                echo $AppUI->_('Reports');
Exemplo n.º 6
0
            if ($t["task_parent"] == $t["task_id"] || $p['tasks'][$i]["task_status"] != 0) {
                $is_opened = in_array($t["task_id"], $tasks_opened);
                showtask($t, 0, $is_opened);
                if ($is_opened || !$t["task_dynamic"]) {
                    findchild($p['tasks'], $t["task_id"]);
                }
            }
        }
        // check that any 'orphaned' user tasks are also display
        for ($i = 0; $i < $tnums; $i++) {
            if (!in_array($p['tasks'][$i]["task_id"], $done)) {
                if ($p['tasks'][$i]["task_dynamic"] && in_array($p['tasks'][$i]["task_parent"], $tasks_closed)) {
                    closeOpenedTask($p['tasks'][$i]["task_id"]);
                }
                if (in_array($p['tasks'][$i]["task_parent"], $tasks_opened)) {
                    showtask($p['tasks'][$i], 1, false);
                }
            }
        }
        if ($tnums && $dPconfig['enable_gantt_charts'] && !$min_view) {
            ?>
		<tr>
			<td colspan="<?php 
            echo $cols;
            ?>
" align="right">
				<input type="button" class="button" value="<?php 
            echo $AppUI->_('Reports');
            ?>
" onclick="javascript:window.location='index.php?m=projects&a=reports&project_id=<?php 
            echo $k;
Exemplo n.º 7
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 (in_array($f, $never_show_with_dots)) {
                         showtask($t1, 1, true, false, true);
                     } else {
                         //display as close to "tree-like" as possible
                         $is_opened = !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;
                         showtask($t1, $my_level, $is_opened, false, $no_children);
                         // indeterminate depth for child task
                         if ($is_opened && !$no_children) {
                             findchild($p['tasks'], $t1['task_id']);
                         }
                     }
                 }
             }
             /*
              * MerlinYoda: Not 100% sure if moving code from below to above always puts orphan trees 
              * closer to their ancestors. At worst it just displays orphans a little earlier
              */
         }
     }
 }
 $df = $AppUI->getPref('SHDATEFORMAT');
Exemplo n.º 8
0
function findchild(&$tarr, $parent, $level = 0)
{
    global $projects;
    global $tasks_opened;
    $level = $level + 1;
    $n = count($tarr);
    for ($x = 0; $x < $n; $x++) {
        if ($tarr[$x]["task_parent"] == $parent && $tarr[$x]["task_parent"] != $tarr[$x]["task_id"]) {
            $is_opened = in_array($tarr[$x]["task_id"], $tasks_opened);
            showtask($tarr[$x], $level, $is_opened);
            if ($is_opened || !$tarr[$x]["task_dynamic"]) {
                findchild($tarr, $tarr[$x]["task_id"], $level);
            }
        }
    }
}
Exemplo n.º 9
0
                 }
             } else {
                 if (!in_array($t1['task_parent'], $tasks_filtered)) {
                     /*
                      * don't "mess with" display when showing "Child tasks" 
                      * (or similiar filters that don't involve "breaking apart" a task tree 
                      * for that matter, even though they might not use this page ever)
                      */
                     if (in_array($f, $never_show_with_dots)) {
                         showtask($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']]);
                         showtask($t1, -1, $is_opened, false, $no_children);
                         // indeterminate depth for child task
                         if ($is_opened && !$no_children) {
                             findchild($p['tasks'], $t1['task_id']);
                         }
                     }
                 }
             }
             /*
              * MerlinYoda: Not 100% sure if moving code from below to above always puts orphan trees 
              * closer to their ancestors. At worst it just displays orphans a little earlier
              */
         }
     }
 }
 if ($tnums && $dPconfig['enable_gantt_charts'] && !$min_view) {