diff --git a/config/config.template.php b/config/config.template.php index 50a41ce..c640a20 100644 --- a/config/config.template.php +++ b/config/config.template.php @@ -47,5 +47,5 @@ $config["navlinks"] = array( /************* Konfiguracja listy administratorow *************/ -// ID grup wyświetlanych na liście administracji +// ID grup wyświetlanych na liście administracji. Kolejność grup decyduje o kolejności wyświetlania na stronie $config["adminlist"] = array(6, 17, 19); diff --git a/css/style.css b/css/style.css index ad31e97..0115749 100644 --- a/css/style.css +++ b/css/style.css @@ -27,6 +27,7 @@ a { float: right } + /* ****** */ /* STATUS */ /* ****** */ @@ -43,6 +44,7 @@ a { float: right } + /* ********* */ /* ADMINLIST */ /* ********* */ diff --git a/include/adminlist.php b/include/adminlist.php index 8ee636d..047fb87 100644 --- a/include/adminlist.php +++ b/include/adminlist.php @@ -20,24 +20,51 @@ if (is_null($adminlist)) { $cache->set('adminlist', $adminlist, 30); } + // FUNCTIONS function getAdminList() { + global $config; + + $admingroups = $config["adminlist"]; + $localIcons = array(100, 200, 300, 400, 500, 600); try { $tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients"); - $serverGroupList = $tsAdmin->serverGroupList(); $output = ""; - foreach ($serverGroupList as $group) { + foreach ($admingroups as $group) { - if(!isAdminGroup($group->getId())) + if(!array_key_exists((string) $group, $tsAdmin->serverGroupList())) continue; - $output .= "
$group
"; + $group = $tsAdmin->serverGroupGetById($group); - foreach ($group->clientList() as $userInfo) { + $icon = ''; + + if($group["iconid"]) { + if(!$group->iconIsLocal("iconid")) { + $groupicon = getGroupIcon($tsAdmin, $group); + + if($groupicon) { + $icon = ' '; + } + } elseif(in_array($group["iconid"], $localIcons)) { + $icon = ' '; + } + } + + $output .= "$icon$group
"; + + $clients = $group->clientList(); + + if(empty($clients)) { + $output .= 'Ta grupa jest pusta
'; + continue; + } + + foreach ($clients as $userInfo) { $user = getClientByDbid($tsAdmin, $userInfo['cldbid']); if(!$user) { @@ -45,7 +72,7 @@ function getAdminList() { continue; } - $output .= '' . '' . '' . $user . '' . ($user['client_away'] ? 'Away' : 'Online') . '
'; + $output .= '' . '' . $user . '' . ($user['client_away'] ? 'Away' : 'Online') . '
'; } } @@ -56,13 +83,6 @@ function getAdminList() { } -function isAdminGroup($groupid) { - global $config; - $admingroups = $config["adminlist"]; - - return in_array($groupid, $admingroups); -} - function getClientByDbid($tsAdmin, $cldbid) { try { return $tsAdmin->clientGetByDbid($cldbid); @@ -71,4 +91,12 @@ function getClientByDbid($tsAdmin, $cldbid) { } } +function getGroupIcon($tsAdmin, $group) { + try { + return $group->iconDownload(); + } catch(TeamSpeak3_Exception $e) { + return false; + } +} + // echo getAdminList(); diff --git a/include/footer.php b/include/footer.php index 14d383f..7d256ae 100644 --- a/include/footer.php +++ b/include/footer.php @@ -7,7 +7,7 @@© 2016