Archived
1
0
Fork 0
This repository has been archived on 2023-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
ts3web/src/Control/Actions/OnlineInfoAction.php

35 lines
1.1 KiB
PHP
Raw Normal View History

2018-04-03 11:56:20 +00:00
<?php
use Slim\Http\Request;
use Slim\Http\Response;
final class OnlineInfoAction extends AbstractAction
{
public function __invoke(Request $request, Response $response, $args)
{
$sid = $args['sid'];
$clid = $args['clid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->clientInfo($clid);
2018-04-06 13:12:52 +00:00
$channelsResult = $this->ts->getInstance()->channelList();
$channelsResult = $this->ts->getInstance()->getElement('data', $channelsResult);
$channels = [];
foreach ($channelsResult as $channel) {
$channels[$channel['channel_name']] = $channel['cid'];
}
2018-04-03 11:56:20 +00:00
// render GET
$this->view->render($response, 'online_info.twig', [
'title' => $this->translator->trans('online_info.title') . ' ' . $clid,
'data' => $this->ts->getInstance()->getElement('data', $dataResult),
2018-04-06 13:12:52 +00:00
'channels' => $channels,
2018-04-03 11:56:20 +00:00
'sid' => $sid,
'clid' => $clid,
]);
}
}