You are here

function theme_scs_node_selection in Simplenews Content Selection 6.2

Same name and namespace in other branches
  1. 6 scs.theme.inc \theme_scs_node_selection()

Theme the node selection form

File

./scs.theme.inc, line 11
Select Drupal content to create a newsletter

Code

function theme_scs_node_selection($form) {
  if ($form['step']['#value'] == 1) {
    $headers = array(
      '',
      t('Nid'),
      t('Title'),
      t('Created'),
    );

    //Headers
    $headers = array(
      '',
      array(
        'data' => t('Nid'),
        'field' => 'nid',
        'sort' => 'asc',
      ),
      array(
        'data' => t('Title'),
        'field' => 'title',
      ),
      array(
        'data' => t('Created'),
        'field' => 'created',
      ),
    );
    $return = _scs_get_nodes($headers);
    $nodes = $return['nodes'];
    $data = array();
    $explain = '';
    if (user_access('administer scs')) {
      $explain = '<div class="form-item">' . t('Want to select more nodes? Add more content types ') . l('here', 'admin/settings/simplenews/scs') . '.' . '</div>';
    }
    foreach ($nodes as $node) {
      if (array_key_exists('nid_' . $node->nid, $form)) {
        $nodearray = array();
        $nodearray[] = drupal_render($form['nid_' . $node->nid]);
        $nodearray[] = $node->nid;
        $nodearray[] = $node->title;
        $nodearray[] = $node->created;
        $data[] = $nodearray;
      }
    }
    return drupal_render($form['newsletter_title']) . drupal_render($form['newsletter_toc']) . drupal_render($form['newsletter_type']) . drupal_render($form['newsletter_content_type']) . $explain . drupal_render($form['filters']) . theme('table', $headers, $data) . $return['pager'] . drupal_render($form);
  }
  else {
    return theme('scs_sort_nodes', $form);
  }
}