This is a read-only archive of the Mumble forums.

This website archives and makes accessible historical state. It receives no updates or corrections. It is provided only to keep the information accessible as-is, under their old address.

For up-to-date information please refer to the Mumble website and its linked documentation and other resources. For support please refer to one of our other community/support channels.

Jump to content

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

 Share

×
×
  • Create New...