function findchild_pd(&$tarr, $parent, $level = 0) { global $projects; $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']) { echo showtask_pd($tarr[$x], $level); findchild_pd($tarr, $tarr[$x]['task_id'], $level); } } }
reset($projects); foreach ($projects as $k => $p) { $tnums = count($p['tasks']); if ($tnums > 0 || $project_id == $p['project_id']) { if ($task_sort_item1 != '') { if ($task_sort_item2 != '' && $task_sort_item1 != $task_sort_item2) { $p['tasks'] = array_csort($p['tasks'], $task_sort_item1, $task_sort_order1, $task_sort_type1, $task_sort_item2, $task_sort_order2, $task_sort_type2); } else { $p['tasks'] = array_csort($p['tasks'], $task_sort_item1, $task_sort_order1, $task_sort_type1); } } for ($i = 0; $i < $tnums; $i++) { $t = $p['tasks'][$i]; if ($t['task_parent'] == $t['task_id']) { showtask_pd($t, 0); findchild_pd($p['tasks'], $t['task_id']); } } } } ?> </table> </form> <table> <tr> <td><?php echo $AppUI->_('Key'); ?> :</td> <th> P </th> <td>=<?php
function findchild_pd(&$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_pd($tarr[$x], $level, $is_opened); if ($is_opened || !$tarr[$x]["task_dynamic"]) { findchild_pd($tarr, $tarr[$x]["task_id"], $level); } } } }
** as it is normally done in array_csort function in order to economise ** cpu time as we have to go through the array there anyway */ for ($j = 0; $j < count($p['tasks']); $j++) { if ($p['tasks'][$j]['task_end_date'] == '0000-00-00 00:00:00') { $p['tasks'][$j]['task_end_date'] = calcEndByStartAndDuration($p['tasks'][$j]); } } } for ($i = 0; $i < $tnums; $i++) { $t = $p['tasks'][$i]; if ($t["task_parent"] == $t["task_id"]) { $is_opened = in_array($t["task_id"], $tasks_opened); showtask_pd($t, 0, $is_opened); if ($is_opened || $t["task_dynamic"] == 0) { findchild_pd($p['tasks'], $t["task_id"]); } } if ($search_text) { if (strpos($t['task_name'], $search_text) !== false || strpos($t['task_description'], $search_text) !== false) { showtask_pd($t, 1, false); } } } // 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)) {
function findchild_pr(&$tarr, $parent, $level = 0) { trigger_error("The findchild_pr function has been deprecated and will be removed in v4.0. Please use findchild_pd instead.", E_USER_NOTICE); findchild_pd($tarr, $parent, $level = 0); }