function fp_get_alert_count_by_type
Search API
6.x misc.inc | fp_get_alert_count_by_type($account = NULL) |
Returns back the total, read, and unread numbers previously calculated to see if we need to place a badge next to the bell icon at the top of the screen. If unset, we will call the recalculate function.
3 calls to fp_get_alert_count_by_type()
- alerts_menu_handle_replacement_pattern in modules/
alerts/ alerts.module - implements hook_menu_handle_replacement_pattern
- engagements_menu_handle_replacement_pattern in modules/
engagements/ engagements.module - implements hook_menu_handle_replacement_pattern
- fp_render_top_nav_content in includes/
theme.inc - Returns the HTML for the top navigation content of the screen itself.
File
- includes/
misc.inc, line 2369 - This file contains misc functions for FlightPath
Code
function fp_get_alert_count_by_type($account = NULL) {
global $user;
if ($account === NULL) {
$account = $user;
}
if ($account->id == 0) {
return FALSE;
}
if (!isset($_SESSION ['fp_alert_count_by_type_last_check'])) {
$_SESSION ['fp_alert_count_by_type_last_check'] = 0;
}
// Should we recalculate again?
$test = time() - intval(variable_get('recalculate_alert_badge_seconds', 30));
if ($_SESSION ['fp_alert_count_by_type_last_check'] < $test) {
unset($_SESSION ['fp_alert_count_by_type']); // this will force us to recalculate.
}
if (!isset($_SESSION ['fp_alert_count_by_type'])) {
fp_recalculate_alert_count_by_type($account);
}
return $_SESSION ['fp_alert_count_by_type'];
}