本文整理汇总了PHP中cmsUser::getOnlineCount方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::getOnlineCount方法的具体用法?PHP cmsUser::getOnlineCount怎么用?PHP cmsUser::getOnlineCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsUser
的用法示例。
在下文中一共展示了cmsUser::getOnlineCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mod_whoonline
function mod_whoonline($module_id, $cfg)
{
$inDB = cmsDatabase::getInstance();
if (!isset($cfg['color_admin'])) {
$cfg['color_admin'] = '#FF0000';
}
if (!isset($cfg['color_editor'])) {
$cfg['color_editor'] = '#009900';
}
$online_count = cmsUser::getOnlineCount();
$users = array();
$today_users = array();
if ($online_count['users']) {
$sql = "SELECT\n o.user_id as id,\n u.login,\n u.nickname,\n p.gender as gender\n FROM cms_online o\n LEFT JOIN cms_users u ON u.id = o.user_id\n LEFT JOIN cms_user_profiles p ON p.user_id = u.id\n WHERE u.is_locked = 0 AND u.is_deleted = 0\n GROUP BY o.user_id";
$result = $inDB->query($sql);
$users = getUsersArray($result, $cfg, $inDB);
}
if ($cfg['show_today']) {
$today = date("Y-m-d");
$sql = "SELECT u.id as id, u.nickname as nickname, u.login as login, p.gender as gender\n FROM cms_users u\n LEFT JOIN cms_user_profiles p ON p.user_id = u.id\n WHERE u.is_locked = 0 AND u.is_deleted = 0 AND DATE_FORMAT(u.logdate, '%Y-%m-%d')='{$today}'\n ORDER BY u.logdate DESC";
$result = $inDB->query($sql);
if ($inDB->num_rows($result)) {
$today_users = getUsersArray($result, $cfg, $inDB);
}
}
cmsPage::initTemplate('modules', 'mod_whoonline')->assign('cfg', $cfg)->assign('users', $users)->assign('guests', $online_count['guests'])->assign('today_users', $today_users)->display('mod_whoonline.tpl');
return true;
}
示例2: mod_user_stats
function mod_user_stats($module_id, $cfg)
{
$inDB = cmsDatabase::getInstance();
cmsCore::loadLanguage('components/users');
global $_LANG;
if (!isset($cfg['show_total'])) {
$cfg['show_total'] = 1;
}
if (!isset($cfg['show_online'])) {
$cfg['show_online'] = 1;
}
if (!isset($cfg['show_gender'])) {
$cfg['show_gender'] = 1;
}
if (!isset($cfg['show_city'])) {
$cfg['show_city'] = 1;
}
$total_usr = cmsUser::getCountAllUsers();
if ($cfg['show_gender']) {
$gender_stats = array();
//male
$gender_stats['male'] = $inDB->rows_count('cms_users u INNER JOIN cms_user_profiles p ON p.user_id = u.id', "u.is_locked = 0 AND u.is_deleted = 0 AND p.gender = 'm'");
//female
$gender_stats['female'] = $inDB->rows_count('cms_users u INNER JOIN cms_user_profiles p ON p.user_id = u.id', "u.is_locked = 0 AND u.is_deleted = 0 AND p.gender = 'f'");
//unknown
$gender_stats['unknown'] = $total_usr - $gender_stats['male'] - $gender_stats['female'];
}
if ($cfg['show_city']) {
$sql = "SELECT IF (p.city != '', p.city, '{$_LANG['NOT_DECIDE']}') city, COUNT( p.user_id ) count\n FROM cms_users u\n LEFT JOIN cms_user_profiles p ON p.user_id = u.id\n WHERE u.is_locked =0 AND u.is_deleted =0\n GROUP BY p.city";
$rs = $inDB->query($sql);
$city_stats = array();
if ($inDB->num_rows($rs)) {
while ($row = $inDB->fetch_assoc($rs)) {
if ($row['city'] != $_LANG['NOT_DECIDE']) {
$row['href'] = '/users/city/' . urlencode($row['city']);
} else {
$row['href'] = '';
}
$row['city'] = icms_ucfirst(mb_strtolower($row['city']));
$city_stats[] = $row;
}
}
}
if ($cfg['show_online']) {
$people = cmsUser::getOnlineCount();
}
if ($cfg['show_bday']) {
$bday = cmsUser::getBirthdayUsers();
}
cmsPage::initTemplate('modules', 'mod_user_stats')->assign('cfg', $cfg)->assign('total_usr', $total_usr)->assign('gender_stats', $gender_stats)->assign('city_stats', $city_stats)->assign('usr_online', cmsUser::sessionGet('usr_online'))->assign('people', $people)->assign('bday', $bday)->display('mod_user_stats.tpl');
return true;
}
示例3: mod_whoonline
function mod_whoonline($mod, $cfg) {
$cfg = array_merge(array(
'color_admin' => '#FF0000',
'color_editor' => '#009900'
), $cfg);
$online_count = cmsUser::getOnlineCount();
$users = array();
$today_users = array();
if ($online_count['users']) {
$sql = "SELECT
o.user_id as id,
u.login,
u.nickname,
p.gender as gender
FROM cms_online o
LEFT JOIN cms_users u ON u.id = o.user_id
LEFT JOIN cms_user_profiles p ON p.user_id = u.id
WHERE u.is_locked = 0 AND u.is_deleted = 0
GROUP BY o.user_id";
$result = cmsCore::c('db')->query($sql);
$users = getUsersArray($result, $cfg);
}
if ($cfg['show_today']) {
$sql = "SELECT u.id as id, u.nickname as nickname, u.login as login, p.gender as gender
FROM cms_users u
LEFT JOIN cms_user_profiles p ON p.user_id = u.id
WHERE u.is_locked = 0 AND u.is_deleted = 0 AND DATE_FORMAT(u.logdate, '%Y-%m-%d')='". date('Y-m-d') ."'
ORDER BY u.logdate DESC";
$result = cmsCore::c('db')->query($sql);
if (cmsCore::c('db')->num_rows($result)) {
$today_users = getUsersArray($result, $cfg);
}
}
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('cfg', $cfg)->
assign('users', $users)->
assign('guests', $online_count['guests'])->
assign('today_users', $today_users)->
display();
return true;
}
示例4: cpWhoOnline
function cpWhoOnline()
{
global $_LANG;
$people = cmsUser::getOnlineCount();
$html .= '<div>';
$html .= '<table width="100%" cellpadding="2" cellspacing="2"><tr>';
$html .= '<td width="24" valign="top">';
$html .= '<img src="images/user.gif"/>';
$html .= '</td>';
$html .= '<td width="" valign="top">';
$html .= '<div><strong>' . $_LANG['AD_FROM_USERS'] . ': </strong>' . $people['users'] . '</div>';
$html .= '<div><strong>' . $_LANG['AD_FROM_GUESTS'] . ': </strong>' . $people['guests'] . '</div>';
$html .= '</td>';
$html .= '</tr></table>';
$html .= '</div>';
return $html;
}
示例5: applet_main
function applet_main()
{
$inCore = cmsCore::getInstance();
global $_LANG;
cmsCore::c('page')->setTitle($_LANG['PATH_HOME']);
$new = array();
$tpl = cmsCore::c('page')->initTemplate('applets', 'main')->assign('users_count', cmsCore::c('db')->rows_count('cms_users', 'is_deleted=0'))->assign('today_users_count', (int) cmsCore::c('db')->get_field('cms_users', "DATE_FORMAT(regdate, '%d-%m-%Y') = DATE_FORMAT(NOW(), '%d-%m-%Y') AND is_deleted = 0", 'COUNT(id)'))->assign('week_users_count', (int) cmsCore::c('db')->get_field('cms_users', "regdate >= DATE_SUB(NOW(), INTERVAL 7 DAY)", 'COUNT(id)'))->assign('month_users_count', (int) cmsCore::c('db')->get_field('cms_users', "regdate >= DATE_SUB(NOW(), INTERVAL 1 MONTH)", 'COUNT(id)'))->assign('people', cmsUser::getOnlineCount());
if ($inCore->isComponentEnable('content')) {
$tpl->assign('content_enable', true);
$new['content'] = (int) newContent('cms_content');
}
if ($inCore->isComponentEnable('photos')) {
$tpl->assign('photos_enable', true);
$new['photos'] = (int) newContent('cms_photo_files');
}
if ($inCore->isComponentEnable('video')) {
$tpl->assign('video_enable', true);
$new['video'] = (int) newContent('cms_video_movie');
}
if ($inCore->isComponentEnable('maps')) {
$tpl->assign('maps_enable', true);
$new['maps'] = (int) newContent('cms_map_items');
}
if ($inCore->isComponentEnable('faq')) {
$tpl->assign('faq_enable', true);
$new['faq'] = (int) newContent('cms_faq_quests');
}
if ($inCore->isComponentEnable('board')) {
$tpl->assign('board_enable', true);
$new['board'] = (int) newContent('cms_board_items');
}
if ($inCore->isComponentEnable('catalog')) {
$tpl->assign('catalog_enable', true);
$new['catalog'] = (int) newContent('cms_uc_items');
}
if ($inCore->isComponentEnable('forum')) {
$tpl->assign('forum_enable', true);
$new['forum'] = (int) newContent('cms_forum_posts');
}
cmsCore::c('actions')->showTargets(true);
$total = cmsCore::c('actions')->getCountActions();
cmsCore::c('db')->limitPage(1, 10);
$actions_html = cmsCore::c('page')->initTemplate('components', 'actions_list')->assign('actions', cmsCore::c('actions')->getActionsLog())->assign('pagebar', cmsPage::getPagebar($total, 1, 10, '#" onclick="$.post(\'/admin/ajax/getActions.php\', \'page=%page%\', function(m){ $(\'#actions\').html(m); }); return false'))->fetch();
$tpl->assign('new', $new)->assign('rssfeed_installed', $inCore->isComponentInstalled('rssfeed'))->assign('actions_html', $actions_html)->assign('new_quests', cmsCore::c('db')->rows_count('cms_faq_quests', 'published = 0'))->assign('new_content', cmsCore::c('db')->rows_count('cms_content', 'published = 0 AND is_arhive = 0'))->assign('new_catalog', cmsCore::c('db')->rows_count('cms_uc_items', 'on_moderate = 1'))->display();
}
示例6: applet_main
//.........这里部分代码省略.........
<?php if($inCore->isComponentEnable('forum')) {
$new['forum'] = (int)newContent('cms_forum_posts'); ?>
<li class="list-group-item">
<a href="index.php?view=components&do=config&link=forum&opt=list_forums"><?php echo $_LANG['AD_FORUMS']; ?></a> <?php if($new['forum']) { ?><span class="new_content">+<?php echo $new['forum']?></span><?php } ?>
<a class="fa fa-plus right" href="index.php?view=components&do=config&link=forum&opt=add_forum" title="<?php echo $_LANG['AD_CREATE_FORUM']; ?>"></a>
<a class="fa fa-plus-square right" href="index.php?view=components&do=config&link=forum&opt=add_cat" title="<?php echo $_LANG['AD_CREATE_CATEGORY']; ?>"></a>
</li>
<?php } ?>
</ul>
</div>
<div class="panel panel-default">
<div class="panel-heading"><?php echo $_LANG['AD_USERS']; ?></div>
<ul class="list-group">
<li class="list-group-item fa fa-users">
<a href="index.php?view=users"><?php echo $_LANG['AD_FROM_USERS']; ?></a> — <?php echo cmsCore::c('db')->rows_count('cms_users', 'is_deleted=0'); ?>
</li>
<li class="list-group-item fa fa-users">
<?php echo $_LANG['AD_NEW_USERS_TODAY']; ?> — <?php echo (int)cmsCore::c('db')->get_field('cms_users', "DATE_FORMAT(regdate, '%d-%m-%Y') = DATE_FORMAT(NOW(), '%d-%m-%Y') AND is_deleted = 0", 'COUNT(id)'); ?>
</li>
<li class="list-group-item fa fa-users">
<?php echo $_LANG['AD_NEW_USERS_THEES_WEEK']; ?> — <?php echo (int)cmsCore::c('db')->get_field('cms_users', "regdate >= DATE_SUB(NOW(), INTERVAL 7 DAY)", 'COUNT(id)'); ?>
</li>
<li class="list-group-item fa fa-users">
<?php echo $_LANG['AD_NEW_USERS_THEES_MONTH']; ?> — <?php echo (int)cmsCore::c('db')->get_field('cms_users', "regdate >= DATE_SUB(NOW(), INTERVAL 1 MONTH)", 'COUNT(id)'); ?>
</li>
</ul>
</div>
<div class="panel panel-default">
<div class="panel-heading"><?php echo $_LANG['AD_USERS_ONLINE']; ?></div>
<?php $people = cmsUser::getOnlineCount(); ?>
<ul class="list-group">
<li class="list-group-item fa fa-user">
<?php echo $_LANG['AD_FROM_USERS'] .': '. $people['users']; ?>
</li>
<li class="list-group-item">
<?php echo $_LANG['AD_FROM_GUESTS'] .': '. $people['guests']; ?>
</li>
</ul>
</div>
</td>
<td width="" valign="top" style="">
<div class="panel panel-default">
<div class="panel-heading"><?php echo $_LANG['AD_LATEST_EVENTS']; ?></div>
<div class="panel-body" id="actions_box">
<div id="actions">
<?php
cmsCore::c('actions')->showTargets(true);
$total = cmsCore::c('actions')->getCountActions();
cmsCore::c('db')->limitPage(1, 10);
$actions = cmsCore::c('actions')->getActionsLog();
$pagebar = cmsPage::getPagebar($total, 1, 10, '#" onclick="$.post(\'/admin/ajax/getActions.php\', \'page=%page%\', function(m){ $(\'#actions\').html(m); }); return false');
$tpl_file = 'admin/actions.php';
$tpl_dir = file_exists(TEMPLATE_DIR . $tpl_file) ? TEMPLATE_DIR : DEFAULT_TEMPLATE_DIR;
include($tpl_dir . $tpl_file);
?>