39 protected $pattern =
"<table id='%0' class='%1' summary='%2'><tr class='%3'><td class='%4'>%5</td><td class='%6' title='%7'>%8 %9</td><td class='%10'>%11%12</td></tr></table>\n";
46 protected $currObj = null;
54 protected $currSib = null;
61 protected $currNum = 0;
68 protected $iconpath = null;
75 protected $flagpath = null;
82 protected $ftclient = null;
89 protected $cachedIcons = array(100, 200, 300, 400, 500, 600);
96 protected $remoteIcons = array();
107 public function __construct($iconpath =
"images/viewer/", $flagpath = null, $ftclient = null, $pattern = null)
109 $this->iconpath = $iconpath;
110 $this->flagpath = $flagpath;
111 $this->ftclient = $ftclient;
115 $this->pattern = $pattern;
128 $this->currObj = $node;
129 $this->currSib = $siblings;
158 return $this->currObj->getUniqueId();
169 return "ts3_viewer " . $this->currObj->getClass(null);
180 return $this->currObj->getId();
191 return ++$this->currNum%2 ?
"row1" :
"row2";
202 return "prefix " . $this->currObj->getClass(null);
214 if(count($this->currSib))
216 $last = array_pop($this->currSib);
218 foreach($this->currSib as $sibling)
220 $prefix .= ($sibling) ? $this->
getImage(
"tree_line.gif") : $this->
getImage(
"tree_blank.png");
223 $prefix .= ($last) ? $this->
getImage(
"tree_end.gif") : $this->
getImage(
"tree_mid.gif");
242 switch($this->currObj->spacerGetType())
245 $extras .=
" solidline";
249 $extras .=
" dashline";
253 $extras .=
" dashdotline";
257 $extras .=
" dashdotdotline";
261 $extras .=
" dotline";
265 switch($this->currObj->spacerGetAlign())
268 $extras .=
" center";
281 return "corpus " . $this->currObj->getClass(null) . $extras;
294 return "ID: " . $this->currObj->getId() .
" | Clients: " . $this->currObj->clientCount() .
"/" . $this->currObj[
"virtualserver_maxclients"] .
" | Uptime: " .
TeamSpeak3_Helper_Convert::seconds($this->currObj[
"virtualserver_uptime"]);
298 return "ID: " . $this->currObj->getId() .
" | Codec: " .
TeamSpeak3_Helper_Convert::codec($this->currObj[
"channel_codec"]) .
" | Quality: " . $this->currObj[
"channel_codec_quality"];
302 return "ID: " . $this->currObj->getId() .
" | Version: " .
TeamSpeak3_Helper_Convert::version($this->currObj[
"client_version"]) .
" | Platform: " . $this->currObj[
"client_platform"];
306 return "ID: " . $this->currObj->getId() .
" | Type: " .
TeamSpeak3_Helper_Convert::groupType($this->currObj[
"type"]) .
" (" . ($this->currObj[
"savedb"] ?
"Permanent" :
"Temporary") .
")";
320 return $this->
getImage($this->currObj->getIcon() .
".png");
335 $string = $this->currObj[
"channel_name"]->section(
"]", 1, 99);
339 $string->resize(30, $string);
342 return htmlspecialchars($string);
350 foreach($this->currObj->memberOf() as $group)
354 $before[] =
"[" . htmlspecialchars($group[
"name"]) .
"]";
358 $behind[] =
"[" . htmlspecialchars($group[
"name"]) .
"]";
362 return implode(
"", $before) .
" " . htmlspecialchars($this->currObj) .
" " . implode(
"", $behind);
365 return htmlspecialchars($this->currObj);
376 return "suffix " . $this->currObj->getClass(null);
411 if($this->currObj[
"virtualserver_icon_id"])
413 if(!$this->currObj->iconIsLocal(
"virtualserver_icon_id") && $this->ftclient)
415 if(!isset($this->cacheIcon[$this->currObj[
"virtualserver_icon_id"]]))
417 $download = $this->currObj->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->currObj->iconGetName(
"virtualserver_icon_id"));
419 if($this->ftclient ==
"data:image")
421 $download =
TeamSpeak3::factory(
"filetransfer://" . $download[
"host"] .
":" . $download[
"port"])->download($download[
"ftkey"], $download[
"size"]);
424 $this->cacheIcon[$this->currObj[
"virtualserver_icon_id"]] = $download;
428 $download = $this->cacheIcon[$this->currObj[
"virtualserver_icon_id"]];
431 if($this->ftclient ==
"data:image")
437 $html .= $this->
getImage($this->ftclient .
"?ftdata=" . base64_encode(serialize($download)),
"Server Icon", null, FALSE);
440 elseif(in_array($this->currObj[
"virtualserver_icon_id"], $this->cachedIcons))
442 $html .= $this->
getImage(
"group_icon_" . $this->currObj[
"virtualserver_icon_id"] .
".png",
"Server Icon");
461 if($this->currObj[
"channel_flag_default"])
463 $html .= $this->
getImage(
"channel_flag_default.png",
"Default Channel");
466 if($this->currObj[
"channel_flag_password"])
468 $html .= $this->
getImage(
"channel_flag_password.png",
"Password-protected");
471 if($this->currObj[
"channel_codec"] == 3)
473 $html .= $this->
getImage(
"channel_flag_music.png",
"Music Codec");
476 if($this->currObj[
"channel_needed_talk_power"])
478 $html .= $this->
getImage(
"channel_flag_moderated.png",
"Moderated");
481 if($this->currObj[
"channel_icon_id"])
483 if(!$this->currObj->iconIsLocal(
"channel_icon_id") && $this->ftclient)
485 if(!isset($this->cacheIcon[$this->currObj[
"channel_icon_id"]]))
487 $download = $this->currObj->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->currObj->iconGetName(
"channel_icon_id"));
489 if($this->ftclient ==
"data:image")
491 $download =
TeamSpeak3::factory(
"filetransfer://" . $download[
"host"] .
":" . $download[
"port"])->download($download[
"ftkey"], $download[
"size"]);
494 $this->cacheIcon[$this->currObj[
"channel_icon_id"]] = $download;
498 $download = $this->cacheIcon[$this->currObj[
"channel_icon_id"]];
501 if($this->ftclient ==
"data:image")
507 $html .= $this->
getImage($this->ftclient .
"?ftdata=" . base64_encode(serialize($download)),
"Channel Icon", null, FALSE);
510 elseif(in_array($this->currObj[
"channel_icon_id"], $this->cachedIcons))
512 $html .= $this->
getImage(
"group_icon_" . $this->currObj[
"channel_icon_id"] .
".png",
"Channel Icon");
529 if($this->currObj[
"client_is_priority_speaker"])
531 $html .= $this->
getImage(
"client_priority.png",
"Priority Speaker");
534 if($this->currObj[
"client_is_channel_commander"])
536 $html .= $this->
getImage(
"client_cc.png",
"Channel Commander");
539 if($this->currObj[
"client_is_talker"])
541 $html .= $this->
getImage(
"client_talker.png",
"Talk Power granted");
543 elseif($cntp = $this->currObj->getParent()->channelGetById($this->currObj[
"cid"])->channel_needed_talk_power)
545 if($cntp > $this->currObj[
"client_talk_power"])
547 $html .= $this->
getImage(
"client_mic_muted.png",
"Insufficient Talk Power");
551 foreach($this->currObj->memberOf() as $group)
553 if(!$group[
"iconid"])
continue;
557 if(!$group->iconIsLocal(
"iconid") && $this->ftclient)
559 if(!isset($this->cacheIcon[$group[
"iconid"]]))
561 $download = $group->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $group->iconGetName(
"iconid"));
563 if($this->ftclient ==
"data:image")
565 $download =
TeamSpeak3::factory(
"filetransfer://" . $download[
"host"] .
":" . $download[
"port"])->download($download[
"ftkey"], $download[
"size"]);
568 $this->cacheIcon[$group[
"iconid"]] = $download;
572 $download = $this->cacheIcon[$group[
"iconid"]];
575 if($this->ftclient ==
"data:image")
581 $html .= $this->
getImage($this->ftclient .
"?ftdata=" . base64_encode(serialize($download)), $group .
" [" . $type .
"]", null, FALSE);
584 elseif(in_array($group[
"iconid"], $this->cachedIcons))
586 $html .= $this->
getImage(
"group_icon_" . $group[
"iconid"] .
".png", $group .
" [" . $type .
"]");
590 if($this->currObj[
"client_icon_id"])
592 if(!$this->currObj->iconIsLocal(
"client_icon_id") && $this->ftclient)
594 if(!isset($this->cacheIcon[$this->currObj[
"client_icon_id"]]))
596 $download = $this->currObj->getParent()->transferInitDownload(rand(0x0000, 0xFFFF), 0, $this->currObj->iconGetName(
"client_icon_id"));
598 if($this->ftclient ==
"data:image")
600 $download =
TeamSpeak3::factory(
"filetransfer://" . $download[
"host"] .
":" . $download[
"port"])->download($download[
"ftkey"], $download[
"size"]);
603 $this->cacheIcon[$this->currObj[
"client_icon_id"]] = $download;
607 $download = $this->cacheIcon[$this->currObj[
"client_icon_id"]];
610 if($this->ftclient ==
"data:image")
616 $html .= $this->
getImage($this->ftclient .
"?ftdata=" . base64_encode(serialize($download)),
"Client Icon", null, FALSE);
619 elseif(in_array($this->currObj[
"client_icon_id"], $this->cachedIcons))
621 $html .= $this->
getImage(
"group_icon_" . $this->currObj[
"client_icon_id"] .
".png",
"Client Icon");
638 if($this->flagpath && $this->currObj[
"client_country"])
640 return $this->
getImage($this->currObj[
"client_country"]->toLower() .
".png", $this->currObj[
"client_country"], null, FALSE, TRUE);
654 protected function getImage($name, $text =
"", $class = null, $iconpath = TRUE, $flagpath = FALSE)
660 $src = $this->iconpath;
665 $src = $this->flagpath;
668 return "<img src='" . $src . $name .
"' title='" . $text .
"' alt='' align='top' />";