You are here

function theme_subscriptions_form_table in Subscriptions 2.0.x

Same name and namespace in other branches
  1. 5.2 subscriptions.admin.inc \theme_subscriptions_form_table()
  2. 6 subscriptions.admin.inc \theme_subscriptions_form_table()
  3. 7 subscriptions.admin.inc \theme_subscriptions_form_table()

Theme subscriptions page controls table.

Parameters

array $variables:

Return value

string

5 theme calls to theme_subscriptions_form_table()
subscriptions_og_page in subscriptions_og/subscriptions_og.module
Defines a user's overview of which groups she is subscribed to.
_subscriptions_blog_ui_blog_form in subscriptions_blog_ui/subscriptions_blog_ui.module
Returns the blog subscription form.
_subscriptions_content_node_form in subscriptions_content/subscriptions_content.admin.inc
Build the Thread subscriptions form at user/UID/subscriptions/node.
_subscriptions_content_type_form in subscriptions_content/subscriptions_content.admin.inc
Build the Content Types subscriptions form at user/UID/subscriptions/type.
_subscriptions_taxonomy_taxa_form in subscriptions_taxonomy/subscriptions_taxonomy.admin.inc
Build the Categories subscription form at user/UID/subscriptions/taxa.

File

./subscriptions.admin.old.php, line 106
Subscriptions module (load-on-demand admin functions).

Code

function theme_subscriptions_form_table(array $variables) {
  $element = $variables['element'];
  $output = '';
  $rows = array();
  drupal_add_js(drupal_get_path('module', 'subscriptions') . '/subscriptions_tableselect.js', array(
    'preprocess' => FALSE,
  ));
  $columns['checkboxes'] = array(
    'data' => '',
    'width' => '1%',
    'class' => 'subscriptions-table select-all',
  );
  $columns['labels'] = array(
    'data' => t('Subscription'),
    'width' => '18%',
  );
  if (isset($element['send_interval']) && $element['send_interval']['#access']) {
    $columns['send_interval'] = array(
      'data' => t('Send interval'),
      'width' => '20%',
    );
  }
  if (isset($element['send_updates']) && $element['send_updates']['#access']) {
    $columns['send_updates'] = array(
      'data' => t('On updates'),
      'width' => '10%',
    );
  }
  if (isset($element['send_comments']) && $element['send_comments']['#access'] && module_exists('comment')) {
    $columns['send_comments'] = array(
      'data' => t('On comments'),
      'width' => '10%',
    );
  }

  // check whether we have an Author column
  if (isset($element['author'])) {
    foreach (element_children($element['checkboxes']) as $key) {
      foreach (element_children($element['checkboxes'][$key]) as $key1) {
        if ($key1 != -1) {
          $tr = 't';
          $columns['author'] = array(
            'data' => $tr('Author'),
            'width' => '20%',
          );
        }
      }
    }
  }
  if (isset($element['extra_info'])) {
    $columns['extra_info']['data'] = $element['extra_info']['#title'];
  }
  $column_keys = array_keys($columns);
  unset($columns[end($column_keys)]['width']);

  // let the last column grow
  if (isset($element['checkboxes'])) {
    foreach (element_children($element['checkboxes']) as $key) {
      foreach (element_children($element['checkboxes'][$key]) as $key1) {
        if (empty($element['checkboxes'][$key][$key1]['#disabled'])) {
          $element['checkboxes'][$key][$key1]['#attributes']['class'] = array(
            'select-row',
          );
        }
        $row = array();
        foreach ($column_keys as $colkey) {
          $row[] = drupal_render($element[$colkey][$key][$key1]);
        }
        $rows[] = $row;
      }
    }
  }
  if ($rows) {
    $output .= theme('table', array(
      'header' => array_values($columns),
      'rows' => $rows,
    ));

    //$output .= drupal_render($element);
  }
  return $output;
}