planetteamspeak / ts3phpframework

Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
https://www.planetteamspeak.com
GNU General Public License v3.0
211 stars 59 forks source link

Customized TSViewer #111

Closed Sebbo94BY closed 6 years ago

Sebbo94BY commented 6 years ago

Hey,

Integrated full featured and customizable TSViewer interfaces

Is there any documentation with examples, what you can build and which options are available?

ronindesign commented 6 years ago

Only examples are found in the documentation:

// load framework files
require_once("libraries/TeamSpeak3/TeamSpeak3.php");

// connect to local server, authenticate and spawn an object for the virtual server on port 9987
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://username:password@127.0.0.1:10011/?server_port=9987");

// build and display HTML treeview using custom image paths (remote icons will be embedded using data URI sheme)
echo $ts3_VirtualServer->getViewer(new TeamSpeak3_Viewer_Html("images/viewericons/", "images/countryflags/", "data:image"));

Unfortunately, there's not much in way of examples of viewer options. I would advise checking the TeamSpeak3_Viewer_Html class. Sorry there's not better documentation for this!

svenpaulsen commented 6 years ago

Basically, all you need to do is create your own custom class that implements TeamSpeak3_Viewer_Interface. The fetchObject() method is called once for every item in the server tree. Sorting and gathering the object information is done automatically by the framework.

Your code can then look like this:

echo $server->getViewer(new YourCustomViewerClass($arg1, $arg2, $arg3));