JSON php generator

Ice/DBus, Web-Interfaces, Management tools

JSON php generator

Postby elithrin » Thu Aug 02, 2012 8:20 pm

Hello everyone

Sorry for my english :/

Is there someone who possesses a php script for generate mumble viewer protocol in JSON (http://mumble.sourceforge.net/Channel_V ... ver_format)?
I have find http://gambler.orchitech.cz/test.htmt, but the code does not seem valid.

Thanks !
elithrin
 
Posts: 7
Joined: Tue Jul 05, 2011 1:52 pm

Re: JSON php generator

Postby elithrin » Thu Aug 02, 2012 9:42 pm

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

Code: Select all
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       
    );
   
}
elithrin
 
Posts: 7
Joined: Tue Jul 05, 2011 1:52 pm

Re: JSON php generator

Postby kissaki » Sat Aug 04, 2012 10:21 am

MumPI: Your Mumble Web Interface in PHP
User avatar
kissaki
Team member
Team member
 
Posts: 1280
Joined: Sat Jan 09, 2010 12:15 pm


Return to Scripting

Who is online

Users browsing this forum: No registered users and 3 guests