本文整理汇总了PHP中UserList::getCount方法的典型用法代码示例。如果您正苦于以下问题:PHP UserList::getCount方法的具体用法?PHP UserList::getCount怎么用?PHP UserList::getCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserList
的用法示例。
在下文中一共展示了UserList::getCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ahref
<?php
/**
* This is the user manager
*/
//TODO: fix up row coloring with YuiDatatable
namespace cd;
$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>';
示例2:
<?php
/**
* Register user view
*
* DIRECTLY INCLUDED FROM session_login.php
*/
//STATUS: wip
//XXX XHR för att se om användarnamn är ledigt
//XXX js som visuellt visar password strength & "dont match" medans man skriver
//TODO: send account activation mail
//XXX use XhtmlForm class, it needs a way to show the images first. also needs a way to show multiple buttons
namespace cd;
$superadmin_reg = !UserList::getCount();
if (!$superadmin_reg && !$session->allow_registrations) {
return;
}
// Handle new user registrations
if (isset($_POST['register_usr']) && isset($_POST['register_pwd']) && isset($_POST['register_pwd2'])) {
$reg = UserHandler::getInstance();
$user_id = $reg->register($_POST['register_usr'], $_POST['register_pwd'], $_POST['register_pwd2']);
if ($user_id) {
if ($superadmin_reg) {
if (!UserGroup::getAll()) {
// If no UserGroup:s exist, create them
UserGroup::create('Webmasters', 1);
UserGroup::create('Admins', 2);
$sadmin_id = UserGroup::create('Super Admins', 3);
} else {
$grp = UserGroup::getByName('Super Admins');
示例3: ViewModel
/**
* Shows a login form with tabs for Register & Forgot password functions
*/
//STATUS: wip
//TODO: make facebook javascript login code work
//TODO cosmetic: mark input field for username or password with a color if empty in validate_login_form()
namespace cd;
if ($session->id || $session->facebook_id) {
return;
}
$login_div = 'login_div';
$reg_div = 'reg_div';
$recover_div = 'recover_div';
// only show "register user" if initial setup or if config allows it
$show_reg_div = !UserList::getCount() || $session->allow_logins && $session->allow_registrations;
// only show "recover password" if mail server is configured
$show_recover_div = SendMail::getInstance()->getServer() ? true : false;
if ($show_reg_div) {
// this must be included here so registration handling can happen first
echo '<div id="' . $reg_div . '" style="display:none;">';
include 'register.php';
echo '</div>';
}
if ($show_recover_div) {
echo '<div id="' . $recover_div . '" style="display:none;">';
include 'forgot_pwd.php';
echo '</div>';
}
// include js validation snippets
$view = new ViewModel('views/core/js_validation.php');