You are here

function subscriptions_page in Subscriptions 5.2

Same name and namespace in other branches
  1. 5 subscriptions.module \subscriptions_page()
  2. 6 subscriptions.admin.inc \subscriptions_page()

Display subscribed content data on the user and site subscriptions pages. @ TODO clean up all of these parts

1 string reference to 'subscriptions_page'
_subscriptions_menu in ./subscriptions.module
Given a base url, returns the user menu definition for given user account.

File

./subscriptions.admin.inc, line 210

Code

function subscriptions_page($account, $stype) {
  $stypes = subscriptions_types();
  if (!isset($stypes[$stype])) {
    drupal_not_found();
    return;
  }
  if (arg(0) == 'admin') {
    $form['header'] = array(
      '#type' => 'fieldset',
      '#title' => t('Admin Information'),
      '#attributes' => array(
        'class' => 'error',
      ),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
      '#weight' => -2,
    );
    $form['header'][] = array(
      '#type' => 'item',
      '#value' => t('The selected subscriptions will be given to <b>newly created</b> users.'),
    );
    $tr = 't';
    $form['header']['role'] = array(
      '#type' => 'fieldset',
      '#title' => $tr('Roles'),
      '#collapsible' => TRUE,
      '#collapsed' => !is_numeric(arg(5)),
    );
    $form['header']['role']['header'] = array(
      '#type' => 'markup',
      '#value' => '<div>' . t('If a user has one or more roles assigned at creation time, then she will receive the additional subscriptions defined for these roles.') . '</div>',
      '#weight' => -5,
    );
    $form['header']['role']['roles'] = array(
      '#type' => 'select',
      '#title' => t('Role(s)'),
      '#default_value' => is_numeric(arg(5)) ? arg(5) : DRUPAL_AUTHENTICATED_RID,
      '#options' => user_roles(TRUE),
      '#description' => t('Select the role to load or role(s) to save.'),
      '#multiple' => TRUE,
    );
    $form['header']['role']['load'] = array(
      '#type' => 'submit',
      '#value' => t('Load'),
    );
  }
  else {
    $form['header'][] = array(
      '#value' => t('Current subscriptions:'),
      '#weight' => -2,
    );
  }
  $form['footer'] = array(
    '#type' => 'item',
    '#value' => '',
    '#description' => t('The master checkboxes on the left turn the given subscription on or off. Depending on the setup of the site, you may have additional options for active subscriptions.'),
    '#weight' => 10,
  );
  $callback = $stypes[$stype]['page'];
  $output = function_exists($callback) ? $callback($account, $form) : '';

  //drupal_add_link(array(

  //  'rel' => 'alternate',
  //  'type' => 'application/rss+xml',
  //  'title' => t('!name Subscriptions', array('!name' => $user->name)),
  //  'href' => url('subscriptions/feed'),

  //));
  drupal_set_title(isset($account) ? check_plain($account->name) : t('Subscriptions'));
  return theme('box', '', $output);

  // . theme('xml_icon', url('subscriptions/feed'));
}