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

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

+ Inheritance diagram for TeamSpeak3_Node_Channelgroup:

Public Member Functions

 __construct (TeamSpeak3_Node_Server $server, array $info, $index="cgid")
 The TeamSpeak3_Node_Channelgroup constructor. More...
 
 __toString ()
 Returns a string representation of this node. More...
 
 clientList ($cid=null, $cldbid=null, $resolve=FALSE)
 Returns a list of clients assigned to the channel group specified. More...
 
 copy ($name=null, $tcgid=0, $type=TeamSpeak3::GROUP_DBTYPE_REGULAR)
 Creates a copy of the channel group and returns the new groups ID. More...
 
 delete ($force=FALSE)
 Deletes the channel 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 channel groups icon file content. More...
 
 message ($msg)
 Sends a text message to all clients residing in the channel group on the virtual server. More...
 
 permAssign ($permid, $permvalue)
 Adds a set of specified permissions to the channel group. More...
 
 permAssignByName ($permname, $permvalue)
 Alias for permAssign(). More...
 
 permList ($permsid=FALSE)
 Returns a list of permissions assigned to the channel group. More...
 
 permRemove ($permid)
 Removes a set of specified permissions from the channel group. More...
 
 permRemoveByName ($permname)
 Alias for permAssign(). More...
 
 privilegeKeyCreate ($cid, $description=null, $customset=null)
 Creates a new privilege key (token) for the channel group and returns the key. More...
 
 rename ($name)
 Renames the channel group specified. More...
 
 tokenCreate ($cid, $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 channel group and all it's parameters.

Constructor & Destructor Documentation

◆ __construct()

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

The TeamSpeak3_Node_Channelgroup constructor.

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

Member Function Documentation

◆ __toString()

__toString ( )

Returns a string representation of this node.

Returns
string
270  {
271  return (string) $this["name"];
272  }

◆ clientList()

clientList (   $cid = null,
  $cldbid = null,
  $resolve = FALSE 
)

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

Parameters
integer$cid
integer$cldbid
boolean$resolve
Returns
array
154  {
155  return $this->getParent()->channelGroupClientList($this->getId(), $cid, $cldbid, $resolve);
156  }
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,
  $tcgid = 0,
  $type = TeamSpeak3::GROUP_DBTYPE_REGULAR 
)

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

Parameters
string$name
integer$tcgid
integer$type
Returns
integer
85  {
86  return $this->getParent()->channelGroupCopy($this->getId(), $name, $tcgid, $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 channel group.

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

Parameters
boolean$force
Returns
void
72  {
73  $this->getParent()->channelGroupDelete($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
250  {
251  return "group_channel";
252  }

◆ getSymbol()

getSymbol ( )

Returns a symbol representing the node.

Returns
string
260  {
261  return "%";
262  }

◆ getUniqueId()

getUniqueId ( )

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

Returns
string
240  {
241  return $this->getParent()->getUniqueId() . "_cg" . $this->getId();
242  }
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 channel groups icon file content.

Returns
TeamSpeak3_Helper_String
209  {
210  if($this->iconIsLocal("iconid") || $this["iconid"] == 0) return;
211 
212  $download = $this->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->iconGetName("iconid"));
213  $transfer = TeamSpeak3::factory("filetransfer://" . (strstr($download["host"], ":") !== FALSE ? "[" . $download["host"] . "]" : $download["host"]) . ":" . $download["port"]);
214 
215  return $transfer->download($download["ftkey"], $download["size"]);
216  }
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 channel group on the virtual server.

Parameters
string$msg
Returns
void
188  {
189  foreach($this as $client)
190  {
191  try
192  {
193  $this->execute("sendtextmessage", array("msg" => $msg, "target" => $client, "targetmode" => TeamSpeak3::TEXTMSG_CLIENT));
194  }
196  {
197  /* ERROR_client_invalid_id */
198  if($e->getCode() != 0x0200) throw $e;
199  }
200  }
201  }
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 
)

Adds a set of specified permissions to the channel group.

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

Parameters
integer$permid
integer$permvalue
Returns
void
109  {
110  $this->getParent()->channelGroupPermAssign($this->getId(), $permid, $permvalue);
111  }
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 
)

Alias for permAssign().

Deprecated:
119  {
120  $this->permAssign($permname, $permvalue);
121  }
permAssign($permid, $permvalue)
Adds a set of specified permissions to the channel group.
Definition: Channelgroup.php:108

◆ permList()

permList (   $permsid = FALSE)

Returns a list of permissions assigned to the channel group.

Parameters
boolean$permsid
Returns
array
96  {
97  return $this->getParent()->channelGroupPermList($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 channel group.

Multiple permissions can be removed at once.

Parameters
integer$permid
Returns
void
131  {
132  $this->getParent()->channelGroupPermRemove($this->getId(), $permid);
133  }
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 permAssign().

Deprecated:
141  {
142  $this->permRemove($permname);
143  }
permRemove($permid)
Removes a set of specified permissions from the channel group.
Definition: Channelgroup.php:130

◆ privilegeKeyCreate()

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

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

Parameters
integer$cid
string$description
string$customset
Returns
TeamSpeak3_Helper_String
177  {
178  return $this->getParent()->privilegeKeyCreate(TeamSpeak3::TOKEN_CHANNELGROUP, $this->getId(), $cid, $description, $customset);
179  }
const TOKEN_CHANNELGROUP
1: channel group token (id1={groupID} id2={channelID})
Definition: TeamSpeak3.php:93
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 channel group specified.

Parameters
string$name
Returns
void
60  {
61  $this->getParent()->channelGroupRename($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 (   $cid,
  $description = null,
  $customset = null 
)

Alias for privilegeKeyCreate().

Deprecated:
164  {
165  return $this->privilegeKeyCreate($cid, $description, $customset);
166  }
privilegeKeyCreate($cid, $description=null, $customset=null)
Creates a new privilege key (token) for the channel group and returns the key.
Definition: Channelgroup.php:176

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