Jump to content
Mumble forums

JSON php generator


elithrin
 Share

Recommended Posts

I have modify the script and now it's works !!

 

function mapTree2Model($tree) {

//print_r($tree->users); 

   $channels = array();
   for ($i = 0; $i < count($tree->children); $i++) {
       $channels[] = mapTree2Model($tree->children[$i]);
   }


   $users = array();
$user_detail = array();
   for ($i = 0; $i < count($tree->users); $i++) {
	
	$user_detail = array(
	'channel' => $tree->users[$i]->channel, 
	'deaf' => $tree->users[$i]->deaf,
	'mute' => $tree->users[$i]->mute,
	'name' => $tree->users[$i]->name,
	'selfDeaf' => $tree->users[$i]->selfDeaf,
	'selfMute' => $tree->users[$i]->selfMute,
	'session' => $tree->users[$i]->session,
	'suppress' => $tree->users[$i]->suppress,
	'userid' => $tree->users[$i]->userid
	);
	
	
       $users[] = $user_detail;
   }

   return array(
	'description' => $tree->c->description,
	'id' => $tree->c->id,
	'links' => $tree->c->links,
       'name' => $tree->c->name,
	'parent' => $tree->c->parent,
	'users' => $users,
	'position' => $tree->c->position,
       'channels' => $channels,
	'temporary' => $tree->c->temporary    	
   );

}

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...