Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function view_tree()
- {
- $tree = $this->display_children(0, 0);
- echo '<pre>'; print_r($tree); echo '<pre>';
- }
- function display_children($parentID, $level)
- {
- $tree[]='heelllooo';
- // get tasks at this level..
- $task = new Task();
- $task->include_related('tasktype', array('id', 'title', 'controller', 'colour'), TRUE, TRUE);
- $task->include_related('flag', array('id', 'title', 'iconFile', 'colour'), TRUE, TRUE);
- $task->where('parentTaskID', $parentID);
- $task->get();
- //$task is a object
- if($task->count() > 0)
- {
- //echo 'im in';
- foreach ($task as $aTask)
- {
- // indent and display the title of this child
- $tree[$aTask->id] = array(
- 'id' => $aTask->id,
- 'title' => $aTask->title,
- 'object' => $aTask
- );
- // call this function again to display this
- // child's children
- $this->display_children($aTask->id, $level+1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement