Exemple #1
0
<?php

$buttonSize = 'extraSmall';
$links = ['editProfile' => ['hover' => 'Edit Profile', 'icon' => 'pencil', 'size' => $buttonSize, 'url' => SteamBrowserProtocol::openSteamPage('SteamIDEditPage')], 'viewSteamProfile' => ['hover' => 'View Steam Profile', 'icon' => 'newWindow', 'size' => $buttonSize, 'url' => 'http://www.steamcommunity.com/profiles/' . $user->steam_id_64], 'deleteAccount' => ['hover' => 'Delete Account', 'icon' => 'trash', 'size' => $buttonSize, 'resource' => 'users', 'item' => $user], 'addFriend' => ['hover' => 'Add Friend', 'icon' => 'plus', 'size' => $buttonSize, 'url' => SteamBrowserProtocol::addFriend($user->steam_id_64)], 'message' => ['hover' => 'Message', 'icon' => 'envelope', 'size' => $buttonSize, 'url' => SteamBrowserProtocol::messageFriend($user->steam_id_64)]];
?>
@if ( Auth::check() AND $user->id == Auth::user()->id )
	@include('buttons.url', $links['editProfile'])
@else
	@include('buttons.url', $links['addFriend'])
	@include('buttons.url', $links['message'])
@endif
	@include('buttons.url', $links['viewSteamProfile'])
	@include('buttons.destroy', $links['deleteAccount'])
		{{ Table::open() }}
		<?php 
foreach ($users as $user) {
    // Reset variables
    $status = NULL;
    $application = NULL;
    $server = NULL;
    // Get user's most recent state
    $state = $user->states()->latest()->first();
    // If user has a state
    if (count($state)) {
        $status = $state->getStatus();
        // If user is running a Steam application
        if (isset($state->application->steam_app_id)) {
            $application = link_to(SteamBrowserProtocol::viewAppInStore($state->application->steam_app_id), $state->application->name);
            // If user is connected to a server
            if (isset($state->server->address)) {
                $server = link_to(SteamBrowserProtocol::connectToServer($state->server->getFullAddress()), $state->server->getFullAddress());
            }
        }
    }
    $tableBody[] = array('user' => '<a class="pull-left" href="' . URL::route('user.show', $user->id) . '">' . HTML::userAvatar($user) . ' ' . e($user->username) . '</a>', 'status' => $status, 'application' => $application, 'server' => $server);
}
?>
		{{ Table::body($tableBody) }}
		{{ Table::close() }}
		{{ $users->links() }}
	@else
		No users found!
	@endif
@endsection
@extends('lanager-core::layouts.default')
@section('content')
	<h2>{{{ $title }}}</h2>
@if(count($itemsInUse))
	
	{{ Table::open(array('class' => 'states-current-usage')) }}

	<?php 
$i = 0;
$totalUsers = 0;
foreach ($itemsInUse as $itemInUse) {
    $users = array();
    foreach ($itemInUse['users'] as $user) {
        $users[] = link_to_route('user.show', $user->username, $user->id);
    }
    $rows[$i]['application'] = '<a href="' . SteamBrowserProtocol::viewAppInStore($itemInUse['application']->steam_app_id) . '"><img src="' . $itemInUse['application']->getLogo() . '" alt="Game Logo" title="' . e($itemInUse['application']->name) . '"></a>';
    $rows[$i]['user-count'] = count($users);
    if (isset($itemInUse['server'])) {
        if ($itemInUse['server']->getUrl()) {
            $rows[$i]['address'] = '<a href="' . $itemInUse['server']->getUrl() . '" title="Connect to server">' . $itemInUse['server']->getFullAddress() . '</a>';
        } else {
            $rows[$i]['address'] = $itemInUse['server']->getFullAddress();
        }
    }
    $rows[$i]['users'] = e(implode(', ', $users));
    $i++;
}
?>
	{{ Table::body($rows) }}

	{{ Table::close() }}