本文整理匯總了PHP中UserList::getUsersOnline方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserList::getUsersOnline方法的具體用法?PHP UserList::getUsersOnline怎麽用?PHP UserList::getUsersOnline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserList
的用法示例。
在下文中一共展示了UserList::getUsersOnline方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: switch
<?php
namespace cd;
switch ($this->owner) {
case 'online':
$list = UserList::getUsersOnline();
echo '<h2>Showing all users online';
echo ' (' . count($list) . ' hits)</h2>';
$dt = new YuiDatatable();
$dt->addColumn('id', 'Username', 'link', 'u/profile/', 'name');
$dt->addColumn('time_last_active', 'Last active');
$dt->addColumn('type', 'Type', 'array', getSessionTypes());
$dt->setDataSource($list);
//$dt->setRowsPerPage(10);
echo $dt->render();
break;
case 'newest':
// shows the newest registered users on the site
echo '<h2>Showing newest members</h2>';
$list = UserList::getNewUsers(5);
$dt = new YuiDatatable();
$dt->addColumn('id', 'Username', 'link', 'u/profile/', 'name');
$dt->addColumn('time_created', 'Time created');
$dt->addColumn('type', 'Type', 'array', getSessionTypes());
$dt->setDataSource($list);
//$dt->setRowsPerPage(10);
echo $dt->render();
break;
default:
throw new \Exception('no such view: ' . $this->owner);
示例2: ahref
$session->requireAdmin();
echo '<h1>Manage users</h1>';
echo 'All users: ' . ahref('a/users/', UserList::getCount()) . '<br/>';
echo 'Users online: ' . ahref('a/users/?online', UserList::onlineCount()) . '<br/>';
$filter = '';
if (!empty($_POST['usearch'])) {
$filter = $_POST['usearch'];
}
echo '<br/>';
echo xhtmlForm('usearch_frm');
echo 'Username filter: ' . xhtmlInput('usearch');
echo xhtmlSubmit('Search');
echo xhtmlFormClose();
echo '<br/>';
if (isset($_GET['online'])) {
$list = UserList::getUsersOnline($filter);
echo '<h2>Showing all users online';
} else {
$list = UserList::getUsers($filter);
echo '<h2>Showing all users';
}
if ($filter) {
echo ', matching <u>' . $filter . '</u>';
}
echo ' (' . count($list) . ' hits)</h2>';
$dt = new YuiDatatable();
$dt->addColumn('id', 'Username', 'link', 'a/user/', 'name');
$dt->addColumn('email', 'E-mail');
$dt->addColumn('time_last_active', 'Last active');
$dt->addColumn('last_ip', 'Last IP');
$dt->addColumn('time_created', 'Created');