芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/portal.pulsehost.co.uk/modules/widgets/ClientActivity.php
(int) Client::where('status', '=', 'Active')->count(), 'onlineCount' => (int) Client::where('lastlogin', '>', Carbon::now()->subHour()->toDateTimeString())->count(), 'recentActiveClients' => Client::orderBy('lastlogin', 'desc')->limit(25) ->get(array('id', 'firstname', 'lastname', 'companyname', 'ip', 'lastlogin'))->toArray(), ); } public function generateOutput($data) { $activeClients = number_format((int) $data['activeCount']); $usersOnline = number_format((int) $data['onlineCount']); $clients = array(); foreach ($data['recentActiveClients'] as $client) { // If there is no lastlogin setting, or its been set to a timestamp like 0000-00-00, we show N/A $clientLastLogin = (empty($client['lastlogin']) || strpos($client['lastlogin'], '0000') === 0) ? "N/A" : Carbon::createFromFormat('Y-m-d H:i:s', $client['lastlogin'])->diffForHumans(); $clients[] = '
' . $clientLastLogin . '
' . $client['firstname'] . ' ' . $client['lastname'] . ($client['companyname'] ? ' (' . $client['companyname'] . ')' : '') . '
' . GeoIp::getLookupHtmlAnchor($client['ip'], 'ip-address') . '
'; } $clientOutput = implode($clients); return <<
Active Clients
{$activeClients}
Active
Users Online
{$usersOnline}
Last Hour
{$clientOutput}
EOF; } }