You are here

function notifications_manage_subscriptions_filters in Notifications 7

List node administration filters that can be applied.

Parameters

$admin: Whether this is for the site admin page, will display more options

3 calls to notifications_manage_subscriptions_filters()
notifications_manage_subscriptions_build_filter_query in ./notifications.manage.inc
Build query for node administration filters based on session.
notifications_manage_subscriptions_filter_form in ./notifications.manage.inc
Return form for node administration filters.
notifications_manage_subscriptions_filter_form_submit in ./notifications.manage.inc
Process result from node administration filter form.

File

./notifications.manage.inc, line 199
Common functions for bulk management of subscriptions

Code

function notifications_manage_subscriptions_filters($admin = FALSE) {
  global $user;
  $filters['status'] = array(
    'title' => t('Status'),
    'options' => Notifications_Subscription::status_list(),
  );
  $filters['type'] = array(
    'title' => t('Type'),
    // If not admin page, check access to each type
    'options' => notifications_subscription_type(NULL, 'title'),
  );
  $filters['send_method'] = array(
    'title' => t('Method'),
    // If not admin mode, filter for current user
    'options' => _notifications_send_methods($admin ? NULL : $user),
  );
  $filters['send_interval'] = array(
    'title' => t('Interval'),
    'options' => notifications_send_intervals(),
  );

  // Take out the filters when only one option
  foreach ($filters as $key => $data) {
    if (empty($data['options']) || count($data['options']) == 1) {
      unset($filters[$key]);
    }
    else {
      $filters[$key]['options'] = array(
        '[any]' => t('any'),
      ) + $data['options'];
    }
  }
  return $filters;
}