<?php // no direct access
defined('_JEXEC') or die('Restricted access');

?>
<div class="nspro componentheading"><?php print JText::_('Newsletter Archive'); ?></div><br/>
<?php

$db =& JFactory::getDBO();

$db->setQuery('SELECT * FROM `#__nspro_newsletters` WHERE `sent` = "1"');
$mNewsletters = $db->loadObjectList();

if (count($mNewsletters) > 0) {
  print '<table cellpadding="2" class="nspro nsprotable"><tr><th>'. JText::_('ID') . '</th><th>'. JText::_('Subject') . '</th><th>'. JText::_('Date and Time Sent') . '</th><th>'. JText::_('View') .'</th></tr>';
  foreach ($mNewsletters as $mnl) {
    $myLink = 'index.php?option=com_nspro&amp;layout=newsletterview&amp;nid=' . $mnl->id;
    print '<tr><td>' . $mnl->id . '</td><td>' . $mnl->subject . '</td><td>' . date('r', $mnl->datetime) . '</td><td><a href="' . $myLink . '">' . JText::_('View') . '</a></td></tr>';
  }
  print '</table>';
}
else {
  print JText::_('No Newsletters found.');
}

?>

