本文整理汇总了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');