function simplenews_scheduler_node_page in Simplenews Scheduler 6
Same name and namespace in other branches
- 5 simplenews_scheduler.module \simplenews_scheduler_node_page()
- 6.2 simplenews_scheduler.module \simplenews_scheduler_node_page()
- 7 simplenews_scheduler.module \simplenews_scheduler_node_page()
Menu callback to provide an overview page with the scheduled newsletters.
1 string reference to 'simplenews_scheduler_node_page'
- simplenews_scheduler_menu in ./
simplenews_scheduler.module - Implementation of hook_menu().
File
- ./
simplenews_scheduler.module, line 277 - Simplenews Scheduler module allows a schedule to be set for sending (and resending) a Simplenews item.
Code
function simplenews_scheduler_node_page($node) {
drupal_set_title(t('Scheduled newsletter editions'));
$nid = _simplenews_scheduler_get_pid($node);
// This is the original newsletter.
if ($nid == $node->nid) {
$output .= '<p>' . t('This is the original newsletter of which all editions are based on.') . '</p>';
}
else {
$output .= '<p>' . t('This node is part of a scheduled newsletter configuration. View the original newsletter <a href="@parent">here</a>.', array(
'@parent' => url('node/' . $nid),
)) . '</p>';
}
// Load the corresponding editions from the database to further process.
$result = pager_query("SELECT * FROM {simplenews_scheduler_editions} sse LEFT JOIN {node} n ON n.nid = sse.pid WHERE sse.pid = %d", 20, 0, NULL, $nid);
while ($row = db_fetch_object($result)) {
$node = node_load($row->eid);
$rows[] = array(
format_date($row->date_issued, 'custom', 'Y-m-d H:i'),
l($node->title, 'node/' . $row->eid),
);
}
// Display a table with all editions.
if (!empty($rows)) {
$output .= theme('table', array(
t('Date sent'),
t('Node'),
), $rows, array(
'class' => 'schedule_history',
));
$output .= theme('pager', 20);
}
else {
$output .= '<p>' . t('No scheduled newsletters have been sent.') . '</p>';
}
return $output;
}