You are here

function theme_subscriptions_form_table in Subscriptions 5.2

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

Theme subscriptions page controls table.

4 theme calls to theme_subscriptions_form_table()
subscriptions_blog_ui_blog_form in ./subscriptions_blog_ui.module
Returns the blog subscription form.
subscriptions_content_node_form in ./subscriptions_content.module
Build the Thread subscriptions form at user/UID/subscriptions/node.
subscriptions_content_type_form in ./subscriptions_content.module
Build the Content Types subscriptions form at user/UID/subscriptions/type.
subscriptions_taxonomy_taxa_form in ./subscriptions_taxonomy.module
Build the Categories subscription form at user/UID/subscriptions/taxa.

File

./subscriptions.admin.inc, line 88

Code

function theme_subscriptions_form_table($element) {
  $output = '';
  $rows = array();
  static $first_time = TRUE;
  if ($first_time) {
    $first_time = FALSE;
    drupal_add_js(drupal_get_path('module', 'subscriptions') . '/subscriptions_tableselect.js', 'module');
    drupal_add_js(array(
      'subscriptions_tableSelect' => array(
        'selectAll' => t('Select all rows in this table'),
        'selectNone' => t('Deselect all rows in this table'),
      ),
    ), 'setting');
  }
  $columns['checkboxes'] = array(
    'data' => '',
    'width' => '1%',
    'class' => 'subscriptions-table select-all',
  );
  $columns['labels'] = array(
    'data' => ' ',
    '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%',
          );
        }
      }
    }
  }
  $column_keys = array_keys($columns);
  unset($columns[end($column_keys)]['width']);

  // let the last column grow
  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'] = 'select-row';
      }
      $row = array();
      foreach (array_keys($columns) as $colkey) {
        $row[] = drupal_render($element[$colkey][$key][$key1]);
      }
      $rows[] = $row;
    }
  }
  if ($rows) {
    $output .= theme('table', array_values($columns), $rows);

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