本文整理汇总了PHP中Statistics::print_stats方法的典型用法代码示例。如果您正苦于以下问题:PHP Statistics::print_stats方法的具体用法?PHP Statistics::print_stats怎么用?PHP Statistics::print_stats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statistics
的用法示例。
在下文中一共展示了Statistics::print_stats方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_users_not_logged_in_stats
/**
* Print the number of users that didn't login for a certain period of time
*/
static function print_users_not_logged_in_stats()
{
$total_logins = array();
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$current_url_id = api_get_current_access_url_id();
$total = self::count_users();
if (api_is_multiple_url_enabled()) {
$table_url = ", {$access_url_rel_user_table}";
$where_url = " AND login_user_id=user_id AND access_url_id='" . $current_url_id . "'";
} else {
$table_url = '';
$where_url = '';
}
$sql[get_lang('Thisday')] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} " . " WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= NOW() {$where_url}";
$sql[get_lang('Last7days')] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} " . " WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= NOW() {$where_url}";
$sql[get_lang('Last31days')] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} " . " WHERE DATE_ADD(login_date, INTERVAL 31 DAY) >= NOW() {$where_url}";
$sql[sprintf(get_lang('LastXMonths'), 6)] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} " . " WHERE DATE_ADD(login_date, INTERVAL 6 MONTH) >= NOW() {$where_url}";
$sql[get_lang('NeverConnected')] = "SELECT count(distinct(login_user_id)) AS number " . " FROM {$table} {$table_url} WHERE 1=1 {$where_url}";
foreach ($sql as $index => $query) {
$res = Database::query($query);
$obj = Database::fetch_object($res);
$r = $total - $obj->number;
$total_logins[$index] = $r < 0 ? 0 : $r;
}
Statistics::print_stats(get_lang('StatsUsersDidNotLoginInLastPeriods'), $total_logins, false);
}
示例2:
break;
case 'logins':
Statistics::print_login_stats($_GET['type']);
break;
case 'pictures':
Statistics::print_user_pictures_stats();
break;
case 'no_login_users':
Statistics::print_users_not_logged_in_stats();
break;
case 'zombies':
ZombieReport::create(array('report' => 'zombies'))->display();
break;
case 'activities':
Statistics::print_activities_stats();
break;
case 'messagesent':
$messages_sent = Statistics::get_messages('sent');
Statistics::print_stats(get_lang('MessagesSent'), $messages_sent);
break;
case 'messagereceived':
$messages_received = Statistics::get_messages('received');
Statistics::print_stats(get_lang('MessagesReceived'), $messages_received);
break;
case 'friends':
// total amount of friends
$friends = Statistics::get_friends();
Statistics::print_stats(get_lang('CountFriends'), $friends);
break;
}
Display::display_footer();