<?php
  /**
   * Copyright 2011 Zazavi - http://www.zazavi.com
   * Zazavi is free software released under the terms of the GNU General Public License.
   * You should have received a copy of the license.  If not, see <http://www.gnu.org/licenses/>.
   */
  if (!defined("_VALID_PHP"))
      die('Direct access to this location is not allowed.');
	  
  if(!$user->getAcl("Newsletter")): print $core->msgAlert(_CG_ONLYADMIN, false); return; endif;
?>
<?php $row = (isset($request->get['emailid'])) ? $core->getRowById("email_templates", 12) : $core->getRowById("email_templates", 4);?>
<h1><img src="images/news-sml.png" alt="" /><?php echo _NL_TITLE1;?></h1>
<p class="info"><span><?php echo $core->langIcon();?></span><?php echo _NL_INFO1;?></p>
<h2><?php echo _NL_SUBTITLE1;?></h2>
<form action="" method="post" id="admin_form" name="admin_form">
<table cellspacing="0" cellpadding="0" class="formtable">
  <tr>
    <td><?php echo _NL_RECIPIENTS;?>:</td>
    <td><?php if(isset($request->get['emailid'])):?>
      <input name="recipient" type="text" class="inputbox" size="45" value="<?php echo sanitize($request->get['emailid']);?>"/>
      <?php else:?>
      <select name="recipient" style="width:200px" class="select">
        <option value="all"><?php echo _NL_ALL;?></option>
        <option value="free"><?php echo _NL_REGED;?></option>
        <option value="paid"><?php echo _NL_PAID;?></option>
        <option value="newsletter"><?php echo _NL_SUBSCRIBED;?></option>
      </select>
      <?php endif;?></td>
  </tr>
  <tr>
    <td width="200"><?php echo _NL_SUBJECT;?>: <?php echo required();?></td>
    <td><input name="subject<?php echo $core->dblang;?>" type="text"  class="inputbox required" value="<?php echo $row['subject'.$core->dblang];?>" size="60" title="<?php echo _NL_SUBJECT_R;?>"/></td>
  </tr>
  <tr>
      <td colspan="2" class="editor">
      <textarea id="bodycontent" class="tinymce" name="body<?php echo $core->dblang;?>"><?php echo $row['body'.$core->dblang];?></textarea>
      </td>
  </tr>
  <tr>
    <td colspan="2"><strong><?php echo _ET_VAR_T;?></strong></td>
  </tr>
  <tr>
    <td colspan="2"><input name="submit" type="submit" value="<?php echo _NL_SEND;?>"  class="button"/></td>
  </tr>
</table>
</form>
<?php echo $core->doForm("processNewsletter","controller.php");?>