You are here

scs.theme.inc in Simplenews Content Selection 6

Same filename and directory in other branches
  1. 8 scs.theme.inc
  2. 6.2 scs.theme.inc
  3. 7.2 scs.theme.inc
  4. 7 scs.theme.inc

File

scs.theme.inc
View source
<?php

/*
 * @file
 * Select Drupal content to create a newsletter
 */

/*
 * Theme the node selection form
 */
function theme_scs_node_selection($form) {
  $nodes = _scs_get_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) {
    $nodearray = array();
    $nodearray[] = drupal_render($form['nid_' . $node->nid]);
    $nodearray[] = $node->nid;
    $nodearray[] = $node->title;
    $nodearray[] = $node->created;
    $data[] = $nodearray;
  }
  $headers = array(
    '',
    t('Nid'),
    t('Title'),
    t('Created'),
  );
  return drupal_render($form['newsletter_title']) . $explain . theme('table', $headers, $data) . drupal_render($form);
}

/*
 * Each selected node goes true this function to create a nice body
 */
function theme_scs_node_output($node) {
  $output = '';
  $output = '<div id="node_' . $node->nid . '">';
  $output .= '<h1>' . $node->title . '</h1>';
  $output .= '<p>' . node_teaser($node->body) . '</p>';
  $output .= '<p>' . l(t('Read more'), 'node/' . $node->nid) . '</p>';
  $output .= '</div>';
  return $output;
}