function html($sp)
    {
        global $sendpress_html_templates;
        //print_r($sendpress_html_templates[$_GET['templateID']]);
        $postdata = get_post($_GET['templateID']);
        //print_r( $postdata );
        ?>
    <form method="post" name="post" >
    <input type="hidden" value="<?php 
        echo $_GET['templateID'];
        ?>
" name="templateID" />
     
   	<div class="pull-right">
     <a href="<?php 
        echo SendPress_Admin::link('Emails_Tempstyle', array('templateID' => $_GET['templateID']));
        ?>
"><?php 
        _e('Back to Template', 'sendpress');
        ?>
</a>&nbsp;&nbsp;&nbsp;<button class="btn btn-primary " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php 
        echo __('Save', 'sendpress');
        ?>
</button>
   	</div>
   <h2><?php 
        echo $postdata->post_title;
        ?>
 <?php 
        _e('Template Footer', 'sendpress');
        ?>
</h2><br>
     <div class="tab-pane fade in active" id="home"><?php 
        wp_editor(get_post_meta($postdata->ID, '_footer_content', true), 'footer-content');
        ?>
</div>

		<?php 
        SendPress_Data::nonce_field();
        ?>
     </form><br><br><?php 
        _e('Default Content', 'sendpress');
        ?>
<textarea class="form-control" rows="3">
<?php 
        echo SendPress_Tag_Footer_Content::content();
        ?>
</textarea>
<br>



<?php 
        echo spnl_get_emails_tags_list();
        $this->popup();
        ?>


<?php 
    }
    function html($sp)
    {
        global $post_ID, $post;
        $view = isset($_GET['view']) ? $_GET['view'] : '';
        if (isset($_GET['emailID'])) {
            $emailID = SPNL()->validate->int($_GET['emailID']);
            $post = get_post($emailID);
            $post_ID = $post->ID;
        }
        ?>
<form method="post">
<input type="hidden" id="post_ID" name="post_ID" value="<?php 
        echo $post->ID;
        ?>
" />
<h2><?php 
        _e('Cancel Scheduled Email', 'sendpress');
        ?>
</h2>
<div class='well'>
    <?php 
        $info = get_post_meta($post->ID, '_send_time', true);
        ?>
   <p><?php 
        _e('Subject', 'sendpress');
        ?>
: <?php 
        echo $post->post_title;
        ?>
</p>
   <p><?php 
        _e('Date', 'sendpress');
        ?>
: <?php 
        echo date_i18n('Y/m/d @ h:i A', strtotime($info));
        ?>
</p>
    <?php 
        SendPress_Data::nonce_field();
        ?>
    <button class="btn" value="cancel" name="submit"><?php 
        _e('Cancel', 'sendpress');
        ?>
</button>
    <button class="btn btn-danger" value="delete" name="submit"><?php 
        _e('Delete Scheduled Email', 'sendpress');
        ?>
</button>
</div>
</form>
		<?php 
    }
    function html($sp)
    {
        global $sendpress_html_templates;
        //print_r($sendpress_html_templates[$_GET['templateID']]);
        $templateID = SPNL()->validate->int($_GET['templateID']);
        $postdata = get_post($templateID);
        //print_r( $postdata );
        ?>
    <form method="post" name="post" >
    <input type="hidden" value="<?php 
        echo $templateID;
        ?>
" name="templateID" />
     
   	<div class="pull-right">
     <a href="<?php 
        echo SendPress_Admin::link('Emails_Tempstyle', array('templateID' => $templateID));
        ?>
"><?php 
        _e('Back to Template', 'sendpress');
        ?>
</a>&nbsp;&nbsp;&nbsp;<button class="btn btn-primary " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php 
        echo __('Save', 'sendpress');
        ?>
</button>
   	</div>
   <h2><?php 
        echo $postdata->post_title;
        ?>
 <?php 
        _e('Template Page Header', 'sendpress');
        ?>
</h2><br>
     <div class="tab-pane fade in active" id="home"><?php 
        wp_editor(get_post_meta($postdata->ID, '_header_page', true), 'header-content');
        ?>
</div>

		<?php 
        SendPress_Data::nonce_field();
        ?>
     </form>

<?php 
        $this->popup();
    }
    function html($sp)
    {
        $list_id_clean = SPNL()->validate->int($_GET['listID']);
        ?>
	<div id="taskbar" class="lists-dashboard rounded group"> 
	<h2><?php 
        _e('Import CSV to ', 'sendpress');
        echo get_the_title($list_id_clean);
        ?>
</h2>
	</div>
	<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
	<form method="post" enctype="multipart/form-data" accept-charset="utf-8" >
		<?php 
        $row = 1;
        $header = array();
        $file = trim(SendPress_Data::read_file_to_str(get_post_meta($list_id_clean, 'csv_import', true)));
        $subscribers = SendPress_Data::csv_to_array($file);
        $total = count($subscribers);
        ?>
    <?php 
        _e('We found', 'sendpress');
        ?>
 <?php 
        echo $total;
        ?>
 <?php 
        _e('lines in your csv', 'sendpress');
        ?>
.
    <table cellspacing="0" class="table  table-bordered table-striped table-condensed" >
                    <thead>
                        <tr class="thead">
                            <th><?php 
        _e('Import Fields:', 'sendpress');
        ?>
</th>
                            <?php 
        $columns = array("noimport" => __("Don't Import", 'sendpress'), 'email' => __('Email', 'sendpress'), 'firstname' => __('First name', 'sendpress'), 'lastname' => __('Last name', 'sendpress'), 'ip' => __('IP address', 'sendpress'), 'status' => __('Status', 'sendpress'));
        $i = 0;
        $emailcolumnmatched = false;
        //print_r($subscribers);
        foreach ($subscribers[0] as $key => $val) {
            /* try to automatically match columns */
            $selected = "";
            $value = str_replace(array(" ", "-", "_"), "", strtolower($val));
            echo "<th>" . $this->dropdown($value, $i) . "</th>";
            $i++;
        }
        ?>
                        </tr>
                    </thead>
<?php 
        $placeholder = false;
        if ($total > 5) {
            $loop = 4;
            $placeholder = true;
        } else {
            $loop = 5;
        }
        for ($i = 0; $i < $loop; $i++) {
            $line = '<tr>';
            $line .= "<td>{$i}</td>";
            $cols = 0;
            foreach ($subscribers[$i] as $key => $value) {
                $cols++;
                $line .= "<td>{$value}</td>";
            }
            $line .= "</tr>";
            echo $line;
        }
        if ($placeholder == true) {
            echo "<tr>";
            for ($i = 0; $i <= $cols; $i++) {
                echo "<td>...</td>";
            }
            echo "</tr>";
            $last = end($subscribers);
            if (empty($last[0])) {
                $total--;
                $last = prev($subscribers);
                if (empty($last[0])) {
                    $total--;
                    $last = prev($subscribers);
                }
            }
            $line = '<tr>';
            $line .= "<td>{$total}</td>";
            foreach ($last as $key => $value) {
                $line .= "<td>{$value}</td>";
            }
            $line .= "</tr>";
            echo $line;
        }
        ?>
 	</table>
 <button type="submit" class="btn btn-primary"><?php 
        _e('Start Import', 'sendpress');
        ?>
</button>
    
<?php 
        SendPress_Data::nonce_field();
        ?>
	   </form>

<?php 
    }
    function html($sp)
    {
        ?>
  <?php 
        if (SendPress_Option::get('import_error', false) == true) {
            ?>
	<div class="alert alert-danger">
  <?php 
            _e('We had a problem saving your upload', 'sendpress');
            ?>
.
  </div>
  <?php 
        }
        ?>
  <div id="taskbar" class="lists-dashboard rounded group"> 
	<h2><?php 
        _e('Import CSV to ', 'sendpress');
        echo get_the_title($_GET['listID']);
        ?>
</h2>
	</div>
<div class="boxer">
	<div class="boxer-inner">
	<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
	<form method="post" enctype="multipart/form-data" accept-charset="utf-8" >
		<!-- For plugins, we also need to ensure that the form posts back to our current page -->
	    <input type="hidden" name="listID" value="<?php 
        echo SPNL()->validate->int($_GET['listID']);
        ?>
" />
	   	<table>
	   	<tr>
    <td class="left_label"> <?php 
        echo $label;
        ?>
    </td>
    <td>
        <input type="file" name="uploadfiles[]" id="uploadfiles" size="35" class="uploadfiles" />
        <input class="button-primary" type="submit" name="uploadfile" id="uploadfile_btn" value="Upload"  />
     
    </td>
  </tr> 
 	</table>
   
<?php 
        SendPress_Option::set('import_error', false);
        SendPress_Data::nonce_field();
        ?>
	   </form>
</div>
</div>
<?php 
    }
    function html($sp)
    {
        global $is_IE;
        global $post_ID, $post;
        /*
        if (  wp_is_mobile() &&
        	 ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) ) {
        
        	wp_enqueue_script('editor-expand');
        	$_wp_autoresize_on = true;
        }
        */
        $view = isset($_GET['view']) ? $_GET['view'] : '';
        if (isset($_GET['emailID'])) {
            $emailID = $_GET['emailID'];
            $post = get_post($_GET['emailID']);
            $post_ID = $post->ID;
        }
        if ($post->post_type !== 'sp_newsletters') {
            SendPress_Admin::redirect('Emails');
        }
        $options = SendPress_Option::email_get('autoresponder_' . $post_ID);
        ?>
     <form method="post" id="post" role="form">
        <input type="hidden" name="post_ID" id="post_ID" value="<?php 
        echo $post->ID;
        ?>
" />
        <input type="hidden" name="action" id="action" value="save-email" />
       <div  >
       <div style="float:right;" class="btn-toolbar">
            <div id="sp-cancel-btn" class="btn-group">
               <?php 
        if ($post->post_status != 'sp-autoresponder') {
            ?>
                <a href="?page=<?php 
            echo $_GET['page'];
            ?>
" id="cancel-update" class="btn btn-default"><?php 
            echo __('Cancel', 'sendpress');
            ?>
</a>&nbsp;
            
            <?php 
        } else {
            ?>
     		<a href="<?php 
            echo SendPress_Admin::link('Emails_Autoresponder');
            ?>
" id="cancel-update" class="btn btn-default"><?php 
            echo __('Cancel', 'sendpress');
            ?>
</a>&nbsp;
           
            <?php 
        }
        ?>
            </div>
            <div class="btn-group">
            
            <button class="btn btn-primary " type="submit" value="save-next" name="submit"><i class="icon-envelope icon-white"></i> <?php 
        echo __('Save', 'sendpress');
        ?>
</button>
            </div>
        </div>
	

</div>
        <h2>Autoresponder Settings</h2>
        <br>
        <h4>Subject: <?php 
        echo esc_attr(htmlspecialchars(get_post_meta($post->ID, '_sendpress_subject', true)));
        ?>
</h4>
        
        <div class="sp-row">
<div class="sp-75 sp-first">
<br>
<select name="sp-autoresponder-type" id="params-auto" >
<option value="subscribe"  <?php 
        if ($options['type'] == 'subscribe') {
            echo "selected";
        }
        ?>
 >When someone subscribes to the list...</option>
<!--<option value="user-new" <?php 
        if ($options['type'] == 'user-new') {
            echo "selected";
        }
        ?>
 >When a new WordPress user is added to your site...</option>-->
</select>
<select name="" id="params-list">
<?php 
        $post_args = array('post_type' => 'sendpress_list', 'numberposts' => -1, 'offset' => 0, 'orderby' => 'post_title', 'order' => 'DESC');
        $current_lists = get_posts($post_args);
        foreach ($current_lists as $list) {
            $t = '';
            $tlist = '';
            echo "<option value=" . $list->ID . "> " . $list->post_title . " <small>(" . SendPress_Data::get_count_subscribers($list->ID) . ")</small></option>";
        }
        ?>
</select>
<input type="text"  name="sp-delay" style="width:30px; <?php 
        if ($options['when'] == 'immediate') {
            echo "display:none;";
        }
        ?>
"   class="text" id="timer" value="<?php 
        echo $options['delay'];
        ?>
" />
<select name="sp-timing"  id="when-to-send" >
<option value="immediate" <?php 
        if ($options['when'] == 'immediate') {
            echo "selected";
        }
        ?>
  >immediately.</option>
<option value="hours" <?php 
        if ($options['when'] == 'hours') {
            echo "selected";
        }
        ?>
  >hour(s) after.</option>
<option value="days" <?php 
        if ($options['when'] == 'days') {
            echo "selected";
        }
        ?>
  >day(s) after.</option>
<option value="weeks" <?php 
        if ($options['when'] == 'weeks') {
            echo "selected";
        }
        ?>
  >week(s) after.</option>
</select>

<br><br>
</div>
<div class="sp-25">
<br><br>

</div>
</div>
<script>
(function($){
	$(document).ready(function($){
		$('#params-auto').change(function(){
			var it = $(this);
			var v = it.val();
			
		});


		$('#when-to-send').change(function(){
			var it = $(this);
			var v = it.val();
			if(v !== 'immediate'){
				$('#timer').show();
			} else {
				$('#timer').hide();
			}


		});
	});


}(jQuery));


</script>




	<?php 
        SendPress_Data::nonce_field();
        ?>
        </form>
	<?php 
    }
    function html()
    {
        global $is_IE;
        global $post_ID, $post;
        /*
        if (  wp_is_mobile() &&
        	 ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) ) {
        
        	wp_enqueue_script('editor-expand');
        	$_wp_autoresize_on = true;
        }
        */
        $emailID = SPNL()->validate->_int('emailID');
        if ($emailID > 0) {
            $post = get_post($emailID);
            $post_ID = $post->ID;
        }
        if ($post->post_type !== 'sp_newsletters') {
            SendPress_Admin::redirect('Emails');
        }
        $template_id = get_post_meta($post->ID, '_sendpress_template', true);
        ?>
     <form method="post" id="post" role="form">
        <input type="hidden" name="post_ID" id="post_ID" value="<?php 
        echo $post->ID;
        ?>
" />
        <input type="hidden" name="post_type" id="post_type" value="sp_newsletters" />
        <input type="hidden" name="action" id="action" value="save-email" />
       <div  >
       <div style="float:right;" class="btn-toolbar">
            <div id="sp-cancel-btn" class="btn-group">
               <?php 
        if ($post->post_status != 'sp-autoresponder') {
            ?>
                <a href="?page=<?php 
            echo SPNL()->validate->page();
            ?>
" id="cancel-update" class="btn btn-default"><?php 
            echo __('Cancel', 'sendpress');
            ?>
</a>&nbsp;
            
            <?php 
        } else {
            ?>
     		<a href="<?php 
            echo SendPress_Admin::link('Emails_Autoresponder');
            ?>
" id="cancel-update" class="btn btn-default"><?php 
            echo __('Cancel', 'sendpress');
            ?>
</a>&nbsp;
           
            <?php 
        }
        ?>
            </div>
            <div class="btn-group">
            
             <button class="btn btn-default " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php 
        echo __('Update', 'sendpress');
        ?>
</button>
           
            <?php 
        if (SendPress_Admin::access('Emails_Send') && $post->post_status != 'sp-autoresponder') {
            ?>
            <button class="btn btn-primary " type="submit" value="save-next" name="submit"><i class="icon-envelope icon-white"></i> <?php 
            echo __('Send', 'sendpress');
            ?>
</button>
            <?php 
        }
        ?>
            </div>
        </div>
	

</div>
        <h2><?php 
        _e('Edit Email Content', 'sendpress');
        ?>
</h2>
        <br>
        <?php 
        $this->panel_start('<span class="glyphicon glyphicon-envelope"></span> ' . __('Subject', 'sendpress'));
        ?>
        <input type="text" name="post_subject" size="30" tabindex="1" class="form-control" value="<?php 
        echo esc_attr(htmlspecialchars(get_post_meta($post->ID, '_sendpress_subject', true)));
        ?>
" id="email-subject" autocomplete="off" />
        <?php 
        $this->panel_end();
        ?>
        <div class="sp-row">
<div class="sp-75 sp-first">
<!-- Nav tabs -->
<?php 
        $enable_edits = SendPress_Option::get('enable_email_template_edit');
        ?>
<ul class="nav nav-tabs">
  <li class="active"><a href="#content-area-one-tab" data-toggle="tab"><?php 
        _e('Main Content', 'sendpress');
        ?>
</a></li>
  <?php 
        if ($enable_edits) {
            ?>
  	<li><a href="#header-content" data-toggle="tab"><?php 
            _e('Header', 'sendpress');
            ?>
</a></li>
  	<li><a href="#footer-content" data-toggle="tab"><?php 
            _e('Footer', 'sendpress');
            ?>
</a></li>
  	<?php 
        }
        ?>
 
  <!--
  <li><a href="#messages" data-toggle="tab">Messages</a></li>
  <li><a href="#settings" data-toggle="tab">Settings</a></li>
  -->
</ul>

<div class="tab-content" style="display:block;">
  <div class="tab-pane in active" id="content-area-one-tab">
  <?php 
        wp_editor($post->post_content, 'content_area_one_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false)));
        //wp_editor($post->post_content,'content_area_one_edit');
        ?>
</div>

	<?php 
        if ($enable_edits) {
            ?>
		<div class="tab-pane" id="header-content">
			<?php 
            wp_editor(get_post_meta($post->ID, '_header_content', true), 'header_content_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false)));
            ?>

		</div>
		<div class="tab-pane" id="footer-content">
			<?php 
            wp_editor(get_post_meta($post->ID, '_footer_content', true), 'footer_content_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false)));
            ?>

		</div>
		<?php 
        }
        ?>
   <!--
  <div class="tab-pane fade" id="messages"><?php 
        wp_editor($post->post_content, 'content-3');
        ?>
</div>
  <div class="tab-pane fade" id="settings"><?php 
        wp_editor($post->post_content, 'content-4');
        ?>
</div>
  -->
</div>

</div>
<div class="sp-25">
<br><br>

	<?php 
        $this->panel_start(__('Template', 'sendpress'));
        ?>
	<select name="template" class="form-control">
	<?php 
        $args = array('post_type' => 'sp_template', 'post_status' => array('sp-standard'), 'posts_per_page' => -1);
        $the_query = new WP_Query($args);
        if ($the_query->have_posts()) {
            echo '<optgroup label="SendPress Templates">';
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $temp_id = $the_query->post->ID;
                $s = '';
                if ($temp_id == $template_id) {
                    $s = 'selected';
                }
                echo '<option value="' . $temp_id . '" ' . $s . '>' . get_the_title() . '</option>';
            }
            echo '</optgroup>';
        } else {
            echo '<option value="0" ></option>';
        }
        $args = array('post_type' => 'sp_template', 'post_status' => array('sp-custom'), 'posts_per_page' => -1);
        $the_query = new WP_Query($args);
        if ($the_query->have_posts()) {
            echo '<optgroup label="Custom Templates">';
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $temp_id = $the_query->post->ID;
                $s = '';
                if ($temp_id == $template_id) {
                    $s = 'selected';
                }
                echo '<option value="' . $temp_id . '" ' . $s . '>' . get_the_title() . '</option>';
            }
            echo '</optgroup>';
        }
        ?>
	
	</select>
	<?php 
        $this->panel_end();
        ?>
</div>
</div>
<div class="well clear">
            <h2><?php 
        _e('Test This Email', 'sendpress');
        ?>
</h2>
            <p><input type="text" name="test-email" value="" class="sp-text" placeholder="<?php 
        echo __('Insira um email para o envio de teste.', 'jaiminho');
        ?>
." /></p>
            <button class="btn btn-success" name="submit" type="submit" value="send-test"><i class=" icon-white icon-inbox"></i> <?php 
        _e('Send Test', 'sendpress');
        ?>
</button>
        </div>


<div class="modal fade bs-modal-lg" id="sendpress-helper" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
	<div class="modal-content">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<ul class="nav nav-tabs" id="myTab">
			<li class="active tabs-first"><a href="#posts"><?php 
        _e('Single Post', 'sendpress');
        ?>
</a></li>
		  	<li ><a href="#merge"><?php 
        _e('Personalize', 'sendpress');
        ?>
</a></li>
		 
		  	<!--
		  <li><a href="#messages">Messages</a></li>
		  <li><a href="#settings">Settings</a></li>
			-->
		</ul>
	</div>
	<div class="modal-body">

 
<div class="tab-content">
	 <div class="tab-pane active" id="posts">

  	<div id="search-header"><?php 
        _e('Search Posts', 'sendpress');
        ?>
: <input type="text" name="q" id="sp-single-query"></div>
  	<div  id="sp-post-preview" class="well">
  		<?php 
        _e('No Post Selected', 'sendpress');
        ?>
  	</div>

  	<p><?php 
        _e('Header HTML', 'sendpress');
        ?>
:&nbsp;
	  	<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios1" value="h1" >
		  H1
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h2">
		  H2
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h3" checked>
		  H3
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h4">
		  H4
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h5">
		  H5
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h6">
		  H6
		</label>
	</p>
	<p><?php 
        _e('Header Link', 'sendpress');
        ?>
:&nbsp;
	  	<label class="radio">
		  <input type="radio" name="headerlinkOptions" id="optionsRadios2" value="link" checked>
		  <?php 
        _e('Link Header to Post', 'sendpress');
        ?>
		</label>
		<label class="radio">
		  <input type="radio" name="headerlinkOptions" id="optionsRadios2" value="nolink">
		  <?php 
        _e('Don\'t Link Header to Post', 'sendpress');
        ?>
		</label>
	</p>
  	<p><?php 
        _e('Post Content', 'sendpress');
        ?>
:&nbsp;
	  	<label class="radio">
		  <input type="radio" name="optionsRadios" id="optionsRadios1" value="excerpt" checked>
		  <?php 
        _e('Excerpt', 'sendpress');
        ?>
		</label>
		<label class="radio">
		  <input type="radio" name="optionsRadios" id="optionsRadios2" value="full">
		  <?php 
        _e('Full Post', 'sendpress');
        ?>
		</label>
	</p>
  	<button class="btn btn-mini btn-success sp-insert-code" id="sp-post-preview-insert" data-code=""><?php 
        _e('Insert', 'sendpress');
        ?>
</button>
  </div>
 	<div class="tab-pane " id="merge">
 		<h3><?php 
        _e('Subscriber specific content', 'sendpress');
        ?>
</h3>
  		<table class="table table-condensed table-striped">
  			
  <thead>
    <tr>
      <th><?php 
        _e('Description', 'sendpress');
        ?>
</th>
      <th><?php 
        _e('Code', 'sendpress');
        ?>
</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
    	<td><?php 
        _e('First Name', 'sendpress');
        ?>
</td>
      	<td>*|FNAME|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|FNAME|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Last Name', 'sendpress');
        ?>
</td>
      	<td>*|LNAME|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|LNAME|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Email', 'sendpress');
        ?>
</td>
      	<td>*|EMAIL|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code"  data-code="*|EMAIL|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>

  </tbody>
</table>
	<h3><?php 
        _e('Site specific content', 'sendpress');
        ?>
</h3>
  		<table class="table table-condensed table-striped">
  			
  <thead>
    <tr>
      <th><?php 
        _e('Description', 'sendpress');
        ?>
</th>
      <th><?php 
        _e('Code', 'sendpress');
        ?>
</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
    	<td><?php 
        _e('Website URL', 'sendpress');
        ?>
</td>
      	<td>*|SITE:URL|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|SITE:URL|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Website Title', 'sendpress');
        ?>
</td>
      	<td>*|SITE:TITLE|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|SITE:TITLE|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Website Description', 'sendpress');
        ?>
</td>
      	<td>*|SITE:DECRIPTION|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code"  data-code="*|SITE:DESCRIPTION|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    
  </tbody>
</table>
<h3><?php 
        _e('Date and Time', 'sendpress');
        ?>
</h3>
  		<table class="table table-condensed table-striped">
  			
  <thead>
    <tr>
      <th><?php 
        _e('Description', 'sendpress');
        ?>
</th>
      <th><?php 
        _e('Code', 'sendpress');
        ?>
</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
    	<td><?php 
        _e('Current Date', 'sendpress');
        ?>
<br><small><?php 
        _e('Format based on WordPress settings', 'sendpress');
        ?>
.</small></td>
      	<td>*|DATE|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
     <tr>
    	<td><?php 
        _e('Current Time', 'sendpress');
        ?>
<br><small>5:16 pm</small></td>
      	<td>*|DATE:g:i a|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE:g:i a|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Custom Date', 'sendpress');
        ?>
<br><small>March 10, 2001, 5:16 pm</small></td>
      	<td>*|DATE:F j, Y, g:i a|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE:F j, Y, g:i a|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
  
    
  </tbody>
</table>

  </div>
 
  <div class="tab-pane" id="messages">...</div>
  <div class="tab-pane" id="settings">...</div>
</div>
		
	</div>
	<div class="modal-footer">
	 	<a href="#" class="btn btn-primary" data-dismiss="modal"><?php 
        _e('Close', 'sendpress');
        ?>
</a>
	</div>
</div>
</div>
	<?php 
        SendPress_Data::nonce_field();
        ?>
        </form>
	<?php 
    }
    function html($sp)
    {
        ?>
	<div id="taskbar" class="lists-dashboard rounded group"> 
	<h2><?php 
        _e('Add Subscriber', 'sendpress');
        ?>
</h2>
	</div>
<div class="boxer">
	<div class="boxer-inner">
	<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
	<form id="subscriber-create" method="post">
		<!-- For plugins, we also need to ensure that the form posts back to our current page -->
	    <input type="hidden" name="action" value="create-subscriber" />
	    <input type="hidden" name="listID" value="<?php 
        echo $_GET['listID'];
        ?>
" />
	    <span class="sublabel"><?php 
        _e('Email', 'sendpress');
        ?>
:</span><input type="text" name="email" value="" class="regular-text sp-text" /><br>
	    <span class="sublabel"><?php 
        _e('Firstname', 'sendpress');
        ?>
:</span><input type="text" name="firstname" value="" class="regular-text sp-text" /><br>
	    <span class="sublabel"><?php 
        _e('Lastname', 'sendpress');
        ?>
:</span><input type="text" name="lastname" value="" class="regular-text sp-text" /><br>
	    <span class="sublabel"><?php 
        _e('Status', 'sendpress');
        ?>
:</span><select name="status">
	    			<?php 
        $results = SendPress_Data::get_statuses();
        foreach ($results as $status) {
            $selected = '';
            if ($status->status == 'Active') {
                $selected = 'selected';
            }
            echo "<option value='{$status->statusid}' {$selected}>{$status->status}</option>";
        }
        ?>

	    		</select>
	    		<br>
	  <button type="submit" class="btn btn-primary"><?php 
        _e('Submit', 'sendpress');
        ?>
</button>
	   <?php 
        SendPress_Data::nonce_field();
        ?>

	</form>
	</div>
</div>
	
	<h2><?php 
        _e('Add Subscribers', 'sendpress');
        ?>
</h2>
<div class="boxer">
	<div class="boxer-inner">	

		<div class="subscribers-create-container">

			<form id="subscribers-create" method="post">
					<!-- For plugins, we also need to ensure that the form posts back to our current page -->
				    <input type="hidden" name="action" value="create-subscribers" />
				    <input type="hidden" name="listID" value="<?php 
        echo $_GET['listID'];
        ?>
" />
				   	<textarea name="csv-add"></textarea>
				   	<button type="submit" class="btn btn-primary"><?php 
        _e('Submit', 'sendpress');
        ?>
</button>
				   	<?php 
        SendPress_Data::nonce_field();
        ?>
			</form>

			<div style="width: 25%; padding: 15px;" class="rounded box float-right">
				<?php 
        _e('Emails shoud be written in separate lines. A line could also include a name, which is separated from the email by a comma', 'sendpress');
        ?>
.<br><br>
				<strong><?php 
        _e('Correct formats', 'sendpress');
        ?>
:</strong><br>
				john@gmail.com<br>
				john@gmail.com, John<br>
				john@gmail.com, John, Doe<br>
			</div>
		</div>
</div>
</div>
<?php 
    }
    public function html()
    {
        if (isset($_POST['submit']) && isset($_GET['templateID'])) {
            $this->update_template();
        }
        if (isset($_POST['submit']) && !isset($_GET['templateID'])) {
            $this->save_new_template();
        }
        if (isset($_GET['templateID'])) {
            $templateID = SPNL()->validate->int($_GET['templateID']);
            $post = get_post($templateID);
            $post_ID = $post->ID;
        }
        ?>
			<form method="post" id="post" role="form">
			<input type="hidden" name="action" id="action" value="save" />
			<div  >
			<div style="float:right;" class="btn-toolbar">
			<div id="sp-cancel-btn" class="btn-group">
			<a href="<?php 
        echo SendPress_Admin::link('Emails_Temp');
        ?>
" id="cancel-update" class="btn btn-default"><?php 
        echo __('Cancel', 'sendpress');
        ?>
</a>&nbsp;
		</div>
			<button class="btn btn-primary " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php 
        echo __('Save', 'sendpress');
        ?>
</button>
			</div>


			</div>
			<h2><?php 
        _e('Create Template', 'jaiminho');
        ?>
</h2>
			<br>
			<div class="sp-row">
			<div class="sp-75 sp-first">
			<!-- Nav tabs -->
			<?php 
        $enable_edits = true;
        ?>
			<ul class="nav nav-tabs">
			<li class="active"><a href="#content-area-one-tab" data-toggle="tab"><?php 
        _e('Main Content', 'sendpress');
        ?>
</a></li>
			<?php 
        if ($enable_edits) {
            ?>
					<li><a href="#header-content" data-toggle="tab"><?php 
            _e('Header', 'sendpress');
            ?>
</a></li>
					<li><a href="#footer-content" data-toggle="tab"><?php 
            _e('Footer', 'sendpress');
            ?>
</a></li>
					<?php 
        }
        ?>
			</ul>

			<div class="tab-content" style="display:block;">
			<div class="tab-pane in active" id="content-area-one-tab">
			<?php 
        wp_editor(isset($post) ? $post->post_content : '', 'content_area_one_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false)));
        //wp_editor($post->post_content,'content_area_one_edit');
        ?>
</div>

			<?php 
        if ($enable_edits) {
            ?>
					<div class="tab-pane" id="header-content">
					<?php 
            wp_editor(SendPress_Tag_Header_Content::content(), 'header_content_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false)));
            ?>

					</div>
					<div class="tab-pane" id="footer-content">
					<?php 
            wp_editor(SendPress_Tag_Footer_Page::content(), 'footer_content_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false)));
            ?>

					</div>
					<?php 
        }
        ?>
			<!--
			<div class="tab-pane fade" id="messages"><?php 
        wp_editor($post->post_content, 'content-3');
        ?>
</div>
			<div class="tab-pane fade" id="settings"><?php 
        wp_editor($post->post_content, 'content-4');
        ?>
</div>
			-->
			</div>

			</div>
			<div class="sp-25">
			<br><br>

			<?php 
        $this->panel_start(__('Template Name', 'sendpress'));
        ?>
			<input type="text" name="post_title" value="<?php 
        echo isset($post) ? $post->post_title : '';
        ?>
"/>
			<?php 
        $this->panel_end();
        ?>
			</div>
			</div>


			<div class="modal fade bs-modal-lg" id="sendpress-helper" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
			<div class="modal-content">
			<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal">×</button>
			<ul class="nav nav-tabs" id="myTab">
			<li class="active tabs-first"><a href="#posts"><?php 
        _e('Single Post', 'sendpress');
        ?>
</a></li>
			<li ><a href="#merge"><?php 
        _e('Personalize', 'sendpress');
        ?>
</a></li>

			<!--
			<li><a href="#messages">Messages</a></li>
			<li><a href="#settings">Settings</a></li>
			-->
			</ul>
			</div>
			<div class="modal-body">


			<div class="tab-content">
			<div class="tab-pane active" id="posts">

			<div id="search-header"><?php 
        _e('Search Posts', 'sendpress');
        ?>
: <input type="text" name="q" id="sp-single-query"></div>
			<div  id="sp-post-preview" class="well">
			<?php 
        _e('No Post Selected', 'sendpress');
        ?>
			</div>

			<p><?php 
        _e('Header HTML', 'sendpress');
        ?>
:&nbsp;
		<label class="radio">
			<input type="radio" name="headerOptions" id="optionsRadios1" value="h1" >
			H1
			</label>
			<label class="radio">
			<input type="radio" name="headerOptions" id="optionsRadios2" value="h2">
			H2
			</label>
			<label class="radio">
			<input type="radio" name="headerOptions" id="optionsRadios2" value="h3" checked>
			H3
			</label>
			<label class="radio">
			<input type="radio" name="headerOptions" id="optionsRadios2" value="h4">
			H4
			</label>
			<label class="radio">
			<input type="radio" name="headerOptions" id="optionsRadios2" value="h5">
			H5
			</label>
			<label class="radio">
			<input type="radio" name="headerOptions" id="optionsRadios2" value="h6">
			H6
			</label>
			</p>
			<p><?php 
        _e('Header Link', 'sendpress');
        ?>
:&nbsp;
		<label class="radio">
			<input type="radio" name="headerlinkOptions" id="optionsRadios2" value="link" checked>
			<?php 
        _e('Link Header to Post', 'sendpress');
        ?>
			</label>
			<label class="radio">
			<input type="radio" name="headerlinkOptions" id="optionsRadios2" value="nolink">
			<?php 
        _e('Don\'t Link Header to Post', 'sendpress');
        ?>
			</label>
			</p>
			<p><?php 
        _e('Post Content', 'sendpress');
        ?>
:&nbsp;
		<label class="radio">
			<input type="radio" name="optionsRadios" id="optionsRadios1" value="excerpt" checked>
			<?php 
        _e('Excerpt', 'sendpress');
        ?>
			</label>
			<label class="radio">
			<input type="radio" name="optionsRadios" id="optionsRadios2" value="full">
			<?php 
        _e('Full Post', 'sendpress');
        ?>
			</label>
			</p>
			<button class="btn btn-mini btn-success sp-insert-code" id="sp-post-preview-insert" data-code=""><?php 
        _e('Insert', 'sendpress');
        ?>
</button>
			</div>
			<div class="tab-pane " id="merge">
			<h3><?php 
        _e('Subscriber specific content', 'sendpress');
        ?>
</h3>
			<table class="table table-condensed table-striped">

			<thead>
			<tr>
			<th><?php 
        _e('Description', 'sendpress');
        ?>
</th>
			<th><?php 
        _e('Code', 'sendpress');
        ?>
</th>
			<th></th>
			</tr>
			</thead>
			<tbody>
			<tr>
			<td><?php 
        _e('First Name', 'sendpress');
        ?>
</td>
			<td>*|FNAME|*</td>
			<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|FNAME|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
			</tr>
			<tr>
			<td><?php 
        _e('Last Name', 'sendpress');
        ?>
</td>
			<td>*|LNAME|*</td>
			<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|LNAME|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
			</tr>
			<tr>
			<td><?php 
        _e('Email', 'sendpress');
        ?>
</td>
			<td>*|EMAIL|*</td>
			<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code"  data-code="*|EMAIL|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
			</tr>

			</tbody>
			</table>
			<h3><?php 
        _e('Site specific content', 'sendpress');
        ?>
</h3>
			<table class="table table-condensed table-striped">

			<thead>
			<tr>
			<th><?php 
        _e('Description', 'sendpress');
        ?>
</th>
			<th><?php 
        _e('Code', 'sendpress');
        ?>
</th>
			<th></th>
			</tr>
			</thead>
			<tbody>
			<tr>
			<td><?php 
        _e('Website URL', 'sendpress');
        ?>
</td>
			<td>*|SITE:URL|*</td>
			<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|SITE:URL|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
			</tr>
			<tr>
			<td><?php 
        _e('Website Title', 'sendpress');
        ?>
</td>
			<td>*|SITE:TITLE|*</td>
			<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|SITE:TITLE|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
			</tr>
			<tr>
			<td><?php 
        _e('Website Description', 'sendpress');
        ?>
</td>
			<td>*|SITE:DECRIPTION|*</td>
			<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code"  data-code="*|SITE:DESCRIPTION|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
			</tr>

			</tbody>
			</table>
			<h3><?php 
        _e('Date and Time', 'sendpress');
        ?>
</h3>
			<table class="table table-condensed table-striped">

			<thead>
			<tr>
			<th><?php 
        _e('Description', 'sendpress');
        ?>
</th>
			<th><?php 
        _e('Code', 'sendpress');
        ?>
</th>
			<th></th>
			</tr>
			</thead>
			<tbody>
			<tr>
			<td><?php 
        _e('Current Date', 'sendpress');
        ?>
<br><small><?php 
        _e('Format based on WordPress settings', 'sendpress');
        ?>
.</small></td>
			<td>*|DATE|*</td>
			<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
			</tr>
			<tr>
			<td><?php 
        _e('Current Time', 'sendpress');
        ?>
<br><small>5:16 pm</small></td>
			<td>*|DATE:g:i a|*</td>
			<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE:g:i a|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
			</tr>
			<tr>
			<td><?php 
        _e('Custom Date', 'sendpress');
        ?>
<br><small>March 10, 2001, 5:16 pm</small></td>
			<td>*|DATE:F j, Y, g:i a|*</td>
			<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE:F j, Y, g:i a|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
			</tr>


			</tbody>
			</table>

			</div>

			<div class="tab-pane" id="messages">...</div>
			<div class="tab-pane" id="settings">...</div>
			</div>

			</div>
			<div class="modal-footer">
			<a href="#" class="btn btn-primary" data-dismiss="modal"><?php 
        _e('Close', 'sendpress');
        ?>
</a>
			</div>
			</div>
			</div>
			<?php 
        SendPress_Data::nonce_field();
        ?>
			</form>
			<?php 
    }