TeamSpeak 3 PHP Framework
Modern use-at-will framework that provides individual components to manage TeamSpeak 3 Server instances
TeamSpeak3_Node_Servergroup Class Reference

Class describing a TeamSpeak 3 server group and all it's parameters. More...

+ Inheritance diagram for TeamSpeak3_Node_Servergroup:

Public Member Functions

 __construct (TeamSpeak3_Node_Server $server, array $info, $index="sgid")
 The TeamSpeak3_Node_Servergroup constructor. More...
 
 __toString ()
 Returns a string representation of this node. More...
 
 clientAdd ($cldbid)
 Adds a client to the server group specified. More...
 
 clientDel ($cldbid)
 Removes a client from the server group. More...
 
 clientList ()
 Returns a list of clients assigned to the server group specified. More...
 
 copy ($name=null, $tsgid=0, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Creates a copy of the server group and returns the new groups ID. More...
 
 delete ($force=FALSE)
 Deletes the server group. More...
 
 getIcon ()
 Returns the name of a possible icon to display the node object. More...
 
 getSymbol ()
 Returns a symbol representing the node. More...
 
 getUniqueId ()
 Returns a unique identifier for the node which can be used as a HTML property. More...
 
 iconDownload ()
 Downloads and returns the server groups icon file content. More...
 
 message ($msg)
 Sends a text message to all clients residing in the server group on the virtual server. More...
 
 permAssign ($permid, $permvalue, $permnegated=FALSE, $permskip=FALSE)
 Adds a set of specified permissions to the server group. More...
 
 permAssignByName ($permname, $permvalue, $permnegated=FALSE, $permskip=FALSE)
 Alias for permAssign(). More...
 
 permList ($permsid=FALSE)
 Returns a list of permissions assigned to the server group. More...
 
 permRemove ($permid)
 Removes a set of specified permissions from the server group. More...
 
 permRemoveByName ($permname)
 Alias for permRemove(). More...
 
 privilegeKeyCreate ($description=null, $customset=null)
 Creates a new privilege key (token) for the server group and returns the key. More...
 
 rename ($name)
 Renames the server group specified. More...
 
 tokenCreate ($description=null, $customset=null)
 Alias for privilegeKeyCreate(). More...
 
- Public Member Functions inherited from TeamSpeak3_Node_Abstract
 __call ($name, array $args)
 Called whenever we're using an unknown method. More...
 
 __get ($offset)
 
 __set ($offset, $value)
 
 __sleep ()
 Commit pending data. More...
 
 __toString ()
 Returns a string representation of this node. More...
 
 count ()
 
 current ()
 
 execute ($cmd, array $params=array())
 Prepares and executes a ServerQuery command and returns the result. More...
 
 getChildren ()
 
 getClass ($prefix="ts3_")
 Returns a possible classname for the node which can be used as a HTML property. More...
 
 getIcon ()
 Returns the name of a possible icon to display the node object. More...
 
 getId ()
 Returns the primary ID of the current node. More...
 
 getInfo ($extend=TRUE, $convert=FALSE)
 Returns all information available on this node. More...
 
 getParent ()
 Returns the parent object of the current node. More...
 
 getProperty ($property, $default=null)
 Returns the specified property or a pre-defined default value from the node info array. More...
 
 getSymbol ()
 Returns a symbol representing the node. More...
 
 getUniqueId ()
 Returns a unique identifier for the node which can be used as a HTML property. More...
 
 getViewer (TeamSpeak3_Viewer_Interface $viewer)
 Returns the HTML code to display a TeamSpeak 3 viewer. More...
 
 hasChildren ()
 
 hasNext ()
 
 iconGetName ($key)
 Returns the internal path of the node icon. More...
 
 iconIsLocal ($key)
 Returns TRUE if the node icon has a local source. More...
 
 key ()
 
 next ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 prepare ($cmd, array $params=array())
 Uses given parameters and returns a prepared ServerQuery command. More...
 
 request ($cmd, $throw=TRUE)
 Sends a prepared command to the server and returns the result. More...
 
 rewind ()
 
 toArray ()
 Returns an assoc array filled with current node info properties. More...
 
 toString ()
 Returns a string representation of this node. More...
 
 valid ()
 

Protected Member Functions

 fetchNodeList ()
 
- Protected Member Functions inherited from TeamSpeak3_Node_Abstract
 delStorage ($key)
 Deletes data from the internal storage array. More...
 
 fetchNodeInfo ()
 
 fetchNodeList ()
 
 filterList (array $nodes=array(), array $rules=array())
 Filters given node list array using specified filter rules. More...
 
 getStorage ($key, $default=null)
 Returns data from the internal storage array. More...
 
 resetNodeInfo ()
 
 resetNodeList ()
 
 setStorage ($key, $val)
 Writes data to the internal storage array. More...
 
 verifyNodeList ()
 

Additional Inherited Members

- Protected Attributes inherited from TeamSpeak3_Node_Abstract
 $nodeId = 0x00
 
 $nodeInfo = array()
 
 $nodeList = null
 
 $parent = null
 
 $server = null
 
 $storage = array()
 

Detailed Description

Class describing a TeamSpeak 3 server group and all it's parameters.

Constructor & Destructor Documentation

◆ __construct()

__construct ( TeamSpeak3_Node_Server  $server,
array  $info,
  $index = "sgid" 
)

The TeamSpeak3_Node_Servergroup constructor.

Parameters
TeamSpeak3_Node_Server$server
array$info
string$index
Exceptions
TeamSpeak3_Node_Exception
Returns
TeamSpeak3_Node_Servergroup
41  {
42  $this->parent = $server;
43  $this->nodeInfo = $info;
44 
45  if(!array_key_exists($index, $this->nodeInfo))
46  {
47  throw new TeamSpeak3_Node_Exception("invalid groupID", 0xA00);
48  }
49 
50  $this->nodeId = $this->nodeInfo[$index];
51  }
$server
Definition: Abstract.php:39
Enhanced exception class for TeamSpeak3_Node_Abstract objects.
Definition: Exception.php:29

Member Function Documentation

◆ __toString()

__toString ( )

Returns a string representation of this node.

Returns
string
291  {
292  return (string) $this["name"];
293  }

◆ clientAdd()

clientAdd (   $cldbid)

Adds a client to the server group specified.

Please note that a client cannot be added to default groups or template groups.

Parameters
integer$cldbid
Returns
void
165  {
166  $this->getParent()->serverGroupClientAdd($this->getId(), $cldbid);
167  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ clientDel()

clientDel (   $cldbid)

Removes a client from the server group.

Parameters
integer$cldbid
Returns
void
176  {
177  $this->getParent()->serverGroupClientDel($this->getId(), $cldbid);
178  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ clientList()

clientList ( )

Returns a list of clients assigned to the server group specified.

Returns
array
153  {
154  return $this->getParent()->serverGroupClientList($this->getId());
155  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ copy()

copy (   $name = null,
  $tsgid = 0,
  $type = TeamSpeak3::GROUP_DBTYPE_REGULAR 
)

Creates a copy of the server group and returns the new groups ID.

Parameters
string$name
integer$tsgid
integer$type
Returns
integer
85  {
86  return $this->getParent()->serverGroupCopy($this->getId(), $name, $tsgid, $type);
87  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ delete()

delete (   $force = FALSE)

Deletes the server group.

If $force is set to 1, the server group will be deleted even if there are clients within.

Parameters
boolean$force
Returns
void
72  {
73  $this->getParent()->serverGroupDelete($this->getId(), $force);
74  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ getIcon()

getIcon ( )

Returns the name of a possible icon to display the node object.

Returns
string
271  {
272  return "group_server";
273  }

◆ getSymbol()

getSymbol ( )

Returns a symbol representing the node.

Returns
string
281  {
282  return "%";
283  }

◆ getUniqueId()

getUniqueId ( )

Returns a unique identifier for the node which can be used as a HTML property.

Returns
string
261  {
262  return $this->getParent()->getUniqueId() . "_sg" . $this->getId();
263  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ iconDownload()

iconDownload ( )

Downloads and returns the server groups icon file content.

Returns
TeamSpeak3_Helper_String
230  {
231  if($this->iconIsLocal("iconid") || $this["iconid"] == 0) return;
232 
233  $download = $this->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->iconGetName("iconid"));
234  $transfer = TeamSpeak3::factory("filetransfer://" . (strstr($download["host"], ":") !== FALSE ? "[" . $download["host"] . "]" : $download["host"]) . ":" . $download["port"]);
235 
236  return $transfer->download($download["ftkey"], $download["size"]);
237  }
iconGetName($key)
Returns the internal path of the node icon.
Definition: Abstract.php:135
iconIsLocal($key)
Returns TRUE if the node icon has a local source.
Definition: Abstract.php:124
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
static factory($uri)
Factory for TeamSpeak3_Adapter_Abstract classes.
Definition: TeamSpeak3.php:316

◆ message()

message (   $msg)

Sends a text message to all clients residing in the server group on the virtual server.

Parameters
string$msg
Returns
void
209  {
210  foreach($this as $client)
211  {
212  try
213  {
214  $this->execute("sendtextmessage", array("msg" => $msg, "target" => $client, "targetmode" => TeamSpeak3::TEXTMSG_CLIENT));
215  }
217  {
218  /* ERROR_client_invalid_id */
219  if($e->getCode() != 0x0200) throw $e;
220  }
221  }
222  }
const TEXTMSG_CLIENT
1: target is a client
Definition: TeamSpeak3.php:121
Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
Definition: Exception.php:29
execute($cmd, array $params=array())
Prepares and executes a ServerQuery command and returns the result.
Definition: Abstract.php:92

◆ permAssign()

permAssign (   $permid,
  $permvalue,
  $permnegated = FALSE,
  $permskip = FALSE 
)

Adds a set of specified permissions to the server group.

Multiple permissions can be added by providing the four parameters of each permission in separate arrays.

Parameters
integer$permid
integer$permvalue
integer$permnegated
integer$permskip
Returns
void
111  {
112  $this->getParent()->serverGroupPermAssign($this->getId(), $permid, $permvalue, $permnegated, $permskip);
113  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ permAssignByName()

permAssignByName (   $permname,
  $permvalue,
  $permnegated = FALSE,
  $permskip = FALSE 
)

Alias for permAssign().

Deprecated:
121  {
122  $this->permAssign($permname, $permvalue, $permnegated, $permskip);
123  }
permAssign($permid, $permvalue, $permnegated=FALSE, $permskip=FALSE)
Adds a set of specified permissions to the server group.
Definition: Servergroup.php:110

◆ permList()

permList (   $permsid = FALSE)

Returns a list of permissions assigned to the server group.

Parameters
boolean$permsid
Returns
array
96  {
97  return $this->getParent()->serverGroupPermList($this->getId(), $permsid);
98  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ permRemove()

permRemove (   $permid)

Removes a set of specified permissions from the server group.

Multiple permissions can be removed at once.

Parameters
integer$permid
Returns
void
133  {
134  $this->getParent()->serverGroupPermRemove($this->getId(), $permid);
135  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ permRemoveByName()

permRemoveByName (   $permname)

Alias for permRemove().

Deprecated:
143  {
144  $this->permRemove($permname);
145  }
permRemove($permid)
Removes a set of specified permissions from the server group.
Definition: Servergroup.php:132

◆ privilegeKeyCreate()

privilegeKeyCreate (   $description = null,
  $customset = null 
)

Creates a new privilege key (token) for the server group and returns the key.

Parameters
string$description
string$customset
Returns
TeamSpeak3_Helper_String
198  {
199  return $this->getParent()->privilegeKeyCreate(TeamSpeak3::TOKEN_SERVERGROUP, $this->getId(), 0, $description, $customset);
200  }
const TOKEN_SERVERGROUP
0: server group token (id1={groupID} id2=0)
Definition: TeamSpeak3.php:92
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ rename()

rename (   $name)

Renames the server group specified.

Parameters
string$name
Returns
void
60  {
61  $this->getParent()->serverGroupRename($this->getId(), $name);
62  }
getParent()
Returns the parent object of the current node.
Definition: Abstract.php:103
getId()
Returns the primary ID of the current node.
Definition: Abstract.php:113

◆ tokenCreate()

tokenCreate (   $description = null,
  $customset = null 
)

Alias for privilegeKeyCreate().

Deprecated:
186  {
187  return $this->privilegeKeyCreate($description, $customset);
188  }
privilegeKeyCreate($description=null, $customset=null)
Creates a new privilege key (token) for the server group and returns the key.
Definition: Servergroup.php:197

The documentation for this class was generated from the following file: