function notifications_user_overview in Notifications 6
Same name and namespace in other branches
- 6.4 notifications.pages.inc \notifications_user_overview()
- 6.2 notifications.pages.inc \notifications_user_overview()
- 6.3 notifications.pages.inc \notifications_user_overview()
Menu callback. Overview page for user subscriptions.
We create the page as a form so it can be altered
3 string references to 'notifications_user_overview'
- notifications_custom_form_alter in notifications_custom/
notifications_custom.module - Implementation of hook_form_alter()
- notifications_menu in ./
notifications.module - Implementation of hook_menu().
- notifications_ui_form_alter in notifications_ui/
notifications_ui.module - Implementation of hook_form_alter()
File
- ./
notifications.pages.inc, line 12 - User pages for Notifications
Code
function notifications_user_overview($form_state, $account) {
$form['account'] = array(
'#type' => 'value',
'#value' => $account,
);
$path = 'user/' . $account->uid;
// Status, send method, interval
$count = db_query("SELECT status, COUNT(*) AS num FROM {notifications} WHERE uid = %d GROUP BY status", $account->uid);
$status_list = _notifications_subscription_status();
while ($current = db_fetch_object($count)) {
$status[$current->status] = t('You have %count @status subscriptions.', array(
'%count' => $current->num,
'@status' => $status_list[$current->status],
));
}
if (empty($status)) {
$status['none'] = t('You don\'t have any subscriptions yet.');
}
$send_intervals = _notifications_send_intervals();
$send_methods = _notifications_send_methods($account);
if ($method = notifications_user_setting('send_method', $account)) {
if (isset($send_methods[$method])) {
$status['method'] = t('Your default sending method for new subscriptions is @send_method', array(
'@send_method' => $send_methods[$method],
));
}
}
$interval = notifications_user_setting('send_interval', $account);
if (isset($send_intervals[$interval])) {
$status['interval'] = t('Your default sending interval for new subscriptions is @send_interval', array(
'@send_interval' => $send_intervals[$interval],
));
}
$form['status'] = array(
'#type' => 'item',
'#weight' => 10,
'#title' => t('Current status'),
'#value' => theme('item_list', $status),
);
// Build shortcut tips
if (notifications_access_user($account, 'manage')) {
$tips['admin'] = l(t('Administer your subscriptions'), "{$path}/notifications/subscriptions");
}
$tips['edit'] = l(t('Edit your notifications settings'), "{$path}/edit");
$link = notifications_get_link('unsubscribe', array(
'uid' => $account->uid,
));
$tips['cancel'] = l(t('Cancel all your subscriptions'), $link['href'], $link['options']);
//$output .= theme('item_list', $tips, t('You can'));
$form['tips'] = array(
'#type' => 'item',
'#weight' => 20,
'#title' => t('You can'),
'#value' => theme('item_list', $tips),
);
return $form;
}