Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_nested_projects($Projects, $ParentID = 0, $indent='')
- {
- $Ret = array();
- foreach($Projects as $Project)
- {
- echo '<pre>';print_r($Project);echo '<pre>';
- if(!isset($Project->parent_id))
- {
- echo 'project parent id';
- }
- }
- }
- Output:
- Array
- (
- [0] => stdClass Object
- (
- [p_id] => 1
- [c_id] => 1
- [project_name] => Root Project
- [project_desc] => Root Project
- [date_added] => 2012-01-01 00:00:00
- [parent_id] => 0
- [allocated_hrs] => 100
- [date_from] => 2012-01-01 00:00:00
- [date_to] => 2012-01-01 00:00:00
- [status] => active
- [priority] => 1
- [completed] => 1
- [author] => 1
- [p_date_added] => 1st Jan 2012
- [date_from_formatted] => 2012-01-01
- [date_to_formatted] => 2012-01-01
- [proj_id] => 1
- [cust_name] => Root Customer
- [cust_id] => 1
- [parent_name] =>
- )
- [1] => stdClass Object
- (
- [p_id] => 120
- [c_id] => 2
- [project_name] => Another project
- [project_desc] => another project
- [date_added] => 2012-01-01 00:00:00
- [parent_id] => 2
- [allocated_hrs] => 100
- [date_from] => 2012-01-01 00:00:00
- [date_to] => 2012-01-01 00:00:00
- [status] => active
- [priority] => 1
- [completed] => 1
- [author] => 271
- [p_date_added] => 1st Jan 2012
- [date_from_formatted] => 2012-01-01
- [date_to_formatted] => 2012-01-01
- [proj_id] => 120
- [cust_name] => Customer 2
- [cust_id] => 2
- [parent_name] => Mini project
- )
- [2] => stdClass Object
- (
- [p_id] => 3
- [c_id] => 2
- [project_name] => This is a project
- [project_desc] => This is a projectThis is a projectThis is a projectThis is a projectThis is a projectThis is a projectThis is a projectThis is a projectThis is a project
- [date_added] => 2012-03-28 09:27:16
- [parent_id] => 1
- [allocated_hrs] => 100
- [date_from] => 2012-10-10 00:00:00
- [date_to] => 2012-11-10 00:00:00
- [status] => active
- [priority] => 1
- [completed] => 0
- [author] => 271
- [p_date_added] => 28th Mar 2012
- [date_from_formatted] => 2012-10-10
- [date_to_formatted] => 2012-11-10
- [proj_id] => 3
- [cust_name] => Customer 2
- [cust_id] => 2
- [parent_name] => Root Project
- )
- )
- project parent id
Add Comment
Please, Sign In to add comment