Continuation of previous commit

pull/13/head
Wruczek 9 years ago
parent 9ae4d75264
commit 047b2bd0fb

@ -21,21 +21,16 @@ if (is_null($banlist)) {
$cache->set('banlist', $banlist, 600); $cache->set('banlist', $banlist, 600);
} }
$total = "";
if(isset($banlist[0][0])) {
$total = " (" . $banlist[0][0] . " łącznie)";
}
?> ?>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-ban" aria-hidden="true"></i> Lista banów<?php echo $total; ?></h3> <h3 class="panel-title"><i class="fa fa-ban" aria-hidden="true"></i> Lista banów</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<?php if(!$banlist[0]) { ?> <?php if(empty($banlist[0])) { ?>
<div class="alert alert-success"> <div class="alert alert-success">
<p class="text-center">BRAK ZBANOWANYCH UŻYTKOWNIKÓW</p> <p class="text-center">BRAK ZBANOWANYCH UŻYTKOWNIKÓW</p>
</div> </div>
@ -52,7 +47,7 @@ if(isset($banlist[0][0])) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php echo $banlist[0][1]; ?> <?php echo $banlist[0]; ?>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -74,15 +69,12 @@ function getBanlist() {
$bany = $tsAdmin->banList(); $bany = $tsAdmin->banList();
$output = ""; $output = "";
$total = 0;
foreach ($bany as $ban) { foreach ($bany as $ban) {
if(!isset($ban['lastnickname'])) if(!isset($ban['lastnickname']))
continue; continue;
$total++;
$lastnickname = $ban['lastnickname']->toString(); $lastnickname = $ban['lastnickname']->toString();
$reason = $ban['reason']; $reason = $ban['reason'];
$invokername = $ban['invokername']->toString(); $invokername = $ban['invokername']->toString();
@ -100,12 +92,12 @@ function getBanlist() {
$output .= "<tr><td>$lastnickname</td><td>$reason</td><td>$invokername</td><td>$created</td><td>$expires</td></tr>"; $output .= "<tr><td>$lastnickname</td><td>$reason</td><td>$invokername</td><td>$created</td><td>$expires</td></tr>";
} }
return array($total, $output); return $output;
} catch(TeamSpeak3_Exception $e) { } catch(TeamSpeak3_Exception $e) {
if($e->getCode() == 1281) { if($e->getCode() == 1281) {
return false; return '';
} else { } else {
return array(null, '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '</p></div>'); return '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '</p></div>';
} }
} }

Loading…
Cancel
Save