function html($sp)
        {
            SendPress_Tracking::event('Overview Tab');
            global $wp_version;
            $classes = 'sp-welcome-panel';
            $option = get_user_meta(get_current_user_id(), 'show_sp_welcome_panel', true);
            // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
            $hide = 0 == $option || 2 == $option && wp_get_current_user()->user_email != get_option('admin_email');
            list($display_version) = explode('-', $wp_version);
            ?>
<br>



<div class="sp-row ">

  <div class="sp-block sp-25 sp-first"> 
    <h2 class="nomargin nopadding"><?php 
            echo SendPress_Data::bd_nice_number(SendPress_Data::get_total_subscribers());
            ?>
</h2> <p class="fwb"><?php 
            _e('Subscribers', 'sendpress');
            ?>
</p>  
  </div>
  <div class="sp-block sp-25">
    <h2 class="nomargin nopadding"><?php 
            $report = SendPress_Data::get_last_report();
            echo SendPress_Data::emails_active_in_queue();
            ?>
</h2> <p class="fwb"><?php 
            _e('Emails Actively Sending', 'sendpress');
            ?>
</small></p>
  </div>
  <div class="sp-block sp-25">
    <h2 class="nomargin nopadding"><?php 
            echo SendPress_Data::emails_maxed_in_queue();
            ?>
</h2> <p class="fwb"><?php 
            _e('Emails Stuck in Queue', 'sendpress');
            ?>
</p>
  </div>
  <div class="sp-block sp-25">
    <h2 class="nomargin nopadding"><?php 
            _e('Autocron last check', 'sendpress');
            ?>
</h2> <p class="fwb">  <?php 
            $autocron = SendPress_Option::get('autocron', 'no');
            //print_r(SendPress_Data::emails_stuck_in_queue());
            if ($autocron == 'yes') {
                $api_info = json_decode(SendPress_Cron::get_info());
                if (isset($api_info->lastcheck)) {
                    echo $api_info->lastcheck . " UTC";
                } else {
                    echo "No Data";
                }
            } else {
                echo "Not Enabled";
            }
            ?>
</p>
  </div>

</div>
<?php 
            if ($report) {
                $rec = get_post_meta($report->ID, '_send_last_count', true);
                $this->panel_start($report->post_title . " <small style='color:#333;'>" . __('This email had', 'sendpress') . " " . $rec . " " . __('Recipients', 'sendpress') . "</small>");
                $stat_type = get_post_meta($report->ID, '_stat_type', true);
                $clicks = SPNL()->db("Subscribers_Url")->clicks_email_id($report->ID);
                $clicks_total = SPNL()->db("Subscribers_Url")->clicks_total_email_id($report->ID);
                ?>

<div class="sp-row">
  <div class="sp-50 sp-first">
    <h4 style="text-align:center;"><?php 
                _e('Opens', 'sendpress');
                ?>
</h4>
      <?php 
                $this->panel_start();
                $open = 0;
                $rec = get_post_meta($report->ID, '_send_last_count', true);
                if ($report) {
                    if ($stat_type == 'new') {
                        $open = SPNL()->db("Subscribers_Tracker")->get_opens_total($report->ID);
                    } else {
                        $open = SendPress_Data::get_opens($report->ID);
                    }
                    $p = $open / $rec * 100;
                }
                ?>
        <div class="sp-row">
        <div class="sp-50 sp-first">
          <div style="float:left;">
          <div id="myStat" class="chartid" data-dimension="150" data-text="<?php 
                echo floor($p);
                ?>
%" data-info="Total Opens" data-width="15" data-fontsize="30" data-percent="<?php 
                echo floor($p);
                ?>
" data-fgcolor="#61a9dc" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php 
                echo $rec;
                ?>
" data-part="<?php 
                echo $open;
                ?>
" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div>
         </div>
         <div style="text-align:center;">
         <h5>Total</h5>
         <?php 
                echo $open;
                ?>
        </div>
        </div>
        <div class="sp-50">
        <?php 
                $ou = 0;
                if ($stat_type == 'new') {
                    $ou = SPNL()->db("Subscribers_Tracker")->get_opens($report->ID);
                } else {
                    $ou = SendPress_Data::get_opens_unique_total($report->ID);
                }
                $px = $ou / $rec * 100;
                ?>
        <div style="float:left;">
          <div id="myStat" class="chartid" data-dimension="150" data-text="<?php 
                echo floor($px);
                ?>
%" data-info="Unique Opens" data-width="15" data-fontsize="30" data-percent="35" data-fgcolor="#85d002" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php 
                echo $rec;
                ?>
" data-part="<?php 
                echo $ou;
                ?>
" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div>
        </div>
          <div style="text-align:center;">
          <h5>Unique</h5>
          <?php 
                echo $ou;
                ?>
          </div>
       </div>
       </div>
        
      <?php 
                $this->panel_end();
                ?>
  </div>
  <div class="sp-50">
  <h4 style="text-align:center;"><?php 
                _e('Clicks', 'sendpress');
                ?>
</h4>
    <?php 
                $this->panel_start();
                $click = 0;
                $rec = get_post_meta($report->ID, '_send_last_count', true);
                if ($report) {
                    if ($stat_type == 'new') {
                        $click = SPNL()->db("Subscribers_Url")->clicks_email_id($report->ID);
                    } else {
                        $click = SendPress_Data::get_clicks($report->ID);
                    }
                    $p = $click / $rec * 100;
                }
                ?>
     <div class="sp-row">
        <div class="sp-50 sp-first">
          <div style="float:left;">
          <div id="myStat" class="chartid" data-dimension="150" data-text="<?php 
                echo floor($p);
                ?>
%" data-info="Total Opens" data-width="15" data-fontsize="30" data-percent="<?php 
                echo floor($p);
                ?>
" data-fgcolor="#61a9dc" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php 
                echo $rec;
                ?>
" data-part="<?php 
                echo $click;
                ?>
" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div>
         </div>
         <div style="text-align:center;">
         <h5><?php 
                _e('Total', 'sendpress');
                ?>
</h5>
         <?php 
                echo $click;
                ?>
         </div>
        </div>
        <div class="sp-50">
        <?php 
                $ou = 0;
                if ($stat_type == 'new') {
                    $ou = SPNL()->db("Subscribers_Url")->clicks_total_email_id($report->ID);
                } else {
                    $ou = SendPress_Data::get_clicks_unique_total($report->ID);
                }
                $px = $ou / $rec * 100;
                ?>
        <div style="float:left;">
          <div id="myStat" class="chartid" data-dimension="150" data-text="<?php 
                echo floor($px);
                ?>
%" data-info="Unique Opens" data-width="15" data-fontsize="30" data-percent="35" data-fgcolor="#85d002" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php 
                echo $rec;
                ?>
" data-part="<?php 
                echo $ou;
                ?>
" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div>
        </div>
        <div style="text-align:center;">
          <h5><?php 
                _e('Unique', 'sendpress');
                ?>
</h5>
          <?php 
                echo $ou;
                ?>
         </div>
       </div>
       </div>
        
     <?php 
                $this->panel_end();
                ?>
  </div>
</div>
<?php 
                $this->panel_end();
            }
            ?>




<div class="sp-row">
<div class="sp-33 sp-first">
<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title"><?php 
            _e('Recent Subscribers', 'sendpress');
            ?>
</h3>
  </div>
  <div class="panel-body">
  	<table class="table table-striped table-condensed">
    <tr>
    <th>Date</th>
    <th>List</th>
    <th><div style="text-align:right;">Email</div></th>
    </tr>
  	<?php 
            $recent = SendPress_Data::get_recent_subscribers();
            foreach ($recent as $item) {
                echo "<tr>";
                echo "<td>";
                if (property_exists($item, 'subscriberID')) {
                    $d = SendPress_Data::get_subscriber($item->subscriberID);
                    if (property_exists($item, 'updated')) {
                        echo date_i18n("m.d.y", strtotime($item->updated));
                    }
                    echo "</td>";
                    echo "<td >";
                    if (property_exists($item, 'listID')) {
                        echo get_the_title($item->listID);
                    }
                    echo "</td>";
                    echo "<td align='right'>";
                    if (is_object($d)) {
                        echo $d->email . "<br>";
                    }
                    echo "</td>";
                    echo "</tr>";
                }
            }
            ?>
  </table>
  </div>
</div>
</div>
<div class="sp-33">
	<div class="panel panel-default">
	  <div class="panel-heading">
	    <h3 class="panel-title"><?php 
            _e('Most Active Subscribers', 'sendpress');
            ?>
</h3>
	  </div>
	  <div class="panel-body">
	  	<ul>
	  	<?php 
            $recent = SPNL()->db("Subscribers_Tracker")->get_most_active();
            // SendPress_Data::get_most_active_subscriber();
            foreach ($recent as $item) {
                if (property_exists($item, 'subscriber_id')) {
                    echo "<li>";
                    $d = SendPress_Data::get_subscriber($item->subscriber_id);
                    if (is_object($d)) {
                        echo $d->email;
                    }
                    echo "</li>";
                }
            }
            ?>
	  	</ul>
	  </div>
	</div>
</div>
<div class="sp-33">
  <?php 
            if (!defined('SENDPRESS_PRO_VERSION')) {
                ?>
	<div class="panel panel-default">
	  <div class="panel-heading">
	    <h3 class="panel-title"><?php 
                _e('Go Pro!', 'sendpress');
                ?>
</h3>
	  </div>
	  <div class="panel-body">
	  	<ul>
	  		<li><a href="http://sendpress.com/purchase-pricing/"><?php 
                _e('Advanced Reports', 'sendpress');
                ?>
</a></li>
	  		<li><a href="http://sendpress.com/purchase-pricing/"><?php 
                _e('Check Spam Scores', 'sendpress');
                ?>
</a></li>
	  		<li><a href="http://sendpress.com/purchase-pricing/"><?php 
                _e('Post Notifications', 'sendpress');
                ?>
</a></li>
	  	</ul>
   
	  </div>
	</div>
  <?php 
            }
            ?>
</div>
</div>

<script>
jQuery( document ).ready(function($) {
        $('.chartid').circliful();
    });
</script>
<!--
<div class="panel panel-default">
  <div class="panel-body">
   <h2>Welcome to SendPress</h2>
  </div>
</div>

-->
<?php 
            if (SendPress_Option::get('feedback') == 'yes' || SendPress_Option::get('allow_tracking') == 'yes') {
                SendPress_Tracking::data();
            }
        }
 /** ************************************************************************
  * REQUIRED! This is where you prepare your data for display. This method will
  * usually be used to query the database, sort and filter the data, and generally
  * get it ready to be displayed. At a minimum, we should set $this->items and
  * $this->set_pagination_args(), although the following properties and methods
  * are frequently interacted with here...
  * 
  * @uses $this->_column_headers
  * @uses $this->items
  * @uses $this->get_columns()
  * @uses $this->get_sortable_columns()
  * @uses $this->get_pagenum()
  * @uses $this->set_pagination_args()
  **************************************************************************/
 function prepare_items()
 {
     global $wpdb, $_wp_column_headers;
     $screen = get_current_screen();
     /*      
             select t1.* from `sp_sendpress_list_subscribers` as t1 , `sp_sendpress_subscribers` as t2
             where t1.subscriberID = t2.subscriberID and t1.listID = 2*/
     $query = "SELECT * FROM " . SendPress_Data::queue_table();
     /* -- Pagination parameters -- */
     //Number of elements in your table?
     $totalitems = SendPress_Data::emails_maxed_in_queue();
     //$wpdb->query($query); //return the total number of affected rows
     //How many to display per page?
     // get the current user ID
     $user = get_current_user_id();
     // get the current admin screen
     $screen = get_current_screen();
     // retrieve the "per_page" option
     $per_page = 10;
     $screen_option = $screen->get_option('per_page', 'option');
     if (!empty($screen_option)) {
         // retrieve the value of the option stored for the current user
         $per_page = get_user_meta($user, $screen_option, true);
         if (empty($per_page) || $per_page < 1) {
             // get the default value if none is set
             $per_page = $screen->get_option('per_page', 'default');
         }
     }
     //Which page is this?
     $paged = !empty($_GET["paged"]) ? esc_sql($_GET["paged"]) : '';
     //Page Number
     if (empty($paged) || !is_numeric($paged) || $paged <= 0) {
         $paged = 1;
     }
     //How many pages do we have in total?
     $totalpages = ceil($totalitems / $per_page);
     $query .= ' WHERE success = 0 AND max_attempts <= attempts ';
     $query .= "AND ( date_sent = '0000-00-00 00:00:00' or date_sent < '" . date_i18n('Y-m-d H:i:s') . "') ";
     if (isset($_GET["listid"]) && $_GET["listid"] > 0) {
         $query .= ' AND listID = ' . $_GET["listid"];
     }
     if (isset($_GET["qs"])) {
         $query .= ' AND to_email LIKE "%' . $_GET["qs"] . '%"';
     }
     /* -- Ordering parameters -- */
     //Parameters that are going to be used to order the result
     $orderby = !empty($_GET["orderby"]) ? esc_sql($_GET["orderby"]) : '';
     $order = !empty($_GET["order"]) ? esc_sql($_GET["order"]) : 'ASC';
     if (!empty($orderby) & !empty($order)) {
         $query .= ' ORDER BY ' . $orderby . ' ' . $order;
     }
     if (empty($orderby)) {
         $query .= ' ORDER BY  attempts ASC, id ASC ';
     }
     //adjust the query to take pagination into account
     if (!empty($paged) && !empty($per_page)) {
         $offset = ($paged - 1) * $per_page;
         $query .= ' LIMIT ' . (int) $offset . ',' . (int) $per_page;
     }
     /* -- Register the pagination -- */
     $this->set_pagination_args(array("total_items" => $totalitems, "total_pages" => $totalpages, "per_page" => $per_page));
     //The pagination links are automatically built according to those parameters
     /* -- Register the Columns -- */
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     /* -- Fetch the items -- */
     $this->items = $wpdb->get_results($query);
 }
    function sub_menu($sp = false)
    {
        ?>
		<div class="navbar navbar-default" >
			<div class="navbar-header">
			  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
      <span class="sr-only">Toggle navigation</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>

    </button>
    <a class="navbar-brand" href="#">Queues</a>
</div>
		 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		<ul class="nav navbar-nav">
					<li <?php 
        if (!isset($_GET['view'])) {
            ?>
class="active"<?php 
        }
        ?>
 >
				    	<a href="<?php 
        echo SendPress_Admin::link('Queue');
        ?>
"><span class="glyphicon glyphicon-open"></span>  <?php 
        _x('Active', 'Active queues', 'sendpress');
        ?>
 (<?php 
        echo SendPress_Data::emails_active_in_queue();
        ?>
)</a>
				  	</li>
				  	<li <?php 
        if (isset($_GET['view']) && $_GET['view'] === 'stuck') {
            ?>
class="active"<?php 
        }
        ?>
 >
				    	<a href="<?php 
        echo SendPress_Admin::link('Queue_Stuck');
        ?>
"><span class="glyphicon glyphicon-exclamation-sign"></span>  <?php 
        _e('Stuck', 'sendpress');
        ?>
 (<?php 
        echo SendPress_Data::emails_maxed_in_queue();
        ?>
)</a>
				  	</li>
				  	<li <?php 
        if (isset($_GET['view']) && $_GET['view'] === 'all') {
            ?>
class="active"<?php 
        }
        ?>
 >
				    	<a href="<?php 
        echo SendPress_Admin::link('Queue_All');
        ?>
"><span class="glyphicon glyphicon-time"></span>  <?php 
        _e('Send History', 'sendpress');
        ?>
</a>
				  	</li>
				  	<li <?php 
        if (isset($_GET['view']) && $_GET['view'] === 'errors') {
            ?>
class="active"<?php 
        }
        ?>
 >
				    	<a href="<?php 
        echo SendPress_Admin::link('Queue_Errors');
        ?>
"><span class="glyphicon glyphicon-warning-sign"></span>  <?php 
        _e('Send Errors', 'sendpress');
        ?>
</a>
				  	</li>
				</ul>
			</div>
		</div>
		
		<?php 
        do_action('sendpress-queue-sub-menu');
    }
        function html($sp)
        {
            //SendPress_Template_Manager::update_template_content();
            SendPress_Tracking::event('Overview Tab');
            //print_r( SendPress_Data::get_subcribers_by_meta('test','test') );
            //echo wp_next_scheduled('wysija_cron_queue') . 'asdf';
            //SPNL()->db->subscribers_tracker->add( array('subscriber_id'=> 101, 'email_id'=> 20 ) );
            //SPNL()->db->subscribers_url->add_update( array('subscriber_id'=> 101, 'email_id'=> 20 , 'url_id' => 123 ) );
            //SPNL()->log->add(  'Email Skiped' , 'Email test',' did not have any Text.', 'sending');
            //print_r(_get_cron_array());
            global $wp_version;
            $classes = 'sp-welcome-panel';
            $option = get_user_meta(get_current_user_id(), 'show_sp_welcome_panel', true);
            // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
            $hide = 0 == $option || 2 == $option && wp_get_current_user()->user_email != get_option('admin_email');
            //if ( $hide )
            //	$classes .= ' hidden';
            /*
            $args = array( 'post_type' => 'sendpress_list','numberposts'     => -1,
            	    'offset'          => 0,
            	    'orderby'         => 'post_title',
            	    'order'           => 'DESC', );
            		$lists = get_posts( $args );
            $sp->send_optin(1,array('1','2','3'),$lists);
            */
            list($display_version) = explode('-', $wp_version);
            //SendPress_Template_Manager::update_template_content();
            /*
            
            
            
            echo spnl_do_email_tags( 'here is some {subscriber_list} content that should run tags' , 0 , 0 );
            
            
            SPNL()->log->add('Bad Email','This email can not be sent');
            echo "<pre>";
            print_r( SPNL()->log->get_logs() );
            echo "</pre>";
            */
            ?>
<br>



<div class="sp-row ">

  <div class="sp-block sp-25 sp-first"> 
    <h2 class="nomargin nopadding"><?php 
            echo SendPress_Data::bd_nice_number(SendPress_Data::get_total_subscribers());
            ?>
</h2> <p class="fwb"><?php 
            _e('Subscribers', 'sendpress');
            ?>
</p>  
  </div>
  <div class="sp-block sp-25">
    <h2 class="nomargin nopadding"><?php 
            $report = SendPress_Data::get_last_report();
            echo SendPress_Data::emails_active_in_queue();
            ?>
</h2> <p class="fwb"><?php 
            _e('Emails Actively Sending', 'sendpress');
            ?>
</small></p>
  </div>
  <div class="sp-block sp-25">
    <h2 class="nomargin nopadding"><?php 
            echo SendPress_Data::emails_maxed_in_queue();
            ?>
</h2> <p class="fwb"><?php 
            _e('Emails Stuck in Queue', 'sendpress');
            ?>
</p>
  </div>
  <div class="sp-block sp-25">
    <h2 class="nomargin nopadding"><?php 
            _e('Autocron last check', 'sendpress');
            ?>
</h2> <p class="fwb">  <?php 
            $autocron = SendPress_Option::get('autocron', 'no');
            //print_r(SendPress_Data::emails_stuck_in_queue());
            if ($autocron == 'yes') {
                $api_info = json_decode(SendPress_Cron::get_info());
                if (isset($api_info->lastcheck)) {
                    echo $api_info->lastcheck . " UTC";
                } else {
                    echo "No Data";
                }
            } else {
                echo "Not Enabled";
            }
            ?>
</p>
  </div>

</div>
<?php 
            if ($report) {
                $rec = get_post_meta($report->ID, '_send_last_count', true);
                $this->panel_start($report->post_title . " <small style='color:#333;'>" . __('This email had', 'sendpress') . " " . $rec . " " . __('Recipients', 'sendpress') . "</small>");
                $stat_type = get_post_meta($report->ID, '_stat_type', true);
                $clicks = SPNL()->db->subscribers_url->clicks_email_id($report->ID);
                $clicks_total = SPNL()->db->subscribers_url->clicks_total_email_id($report->ID);
                ?>

<div class="sp-row">
  <div class="sp-50 sp-first">
    <h4 style="text-align:center;"><?php 
                _e('Opens', 'sendpress');
                ?>
</h4>
      <?php 
                $this->panel_start();
                $open = 0;
                $rec = get_post_meta($report->ID, '_send_last_count', true);
                if ($report) {
                    if ($stat_type == 'new') {
                        $open = SPNL()->db->subscribers_tracker->get_opens_total($report->ID);
                    } else {
                        $open = SendPress_Data::get_opens($report->ID);
                    }
                    $p = $open / $rec * 100;
                }
                ?>
        <div class="sp-row">
        <div class="sp-50 sp-first">
          <div style="float:left;">
          <div id="myStat" class="chartid" data-dimension="150" data-text="<?php 
                echo floor($p);
                ?>
%" data-info="Total Opens" data-width="15" data-fontsize="30" data-percent="<?php 
                echo floor($p);
                ?>
" data-fgcolor="#61a9dc" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php 
                echo $rec;
                ?>
" data-part="<?php 
                echo $open;
                ?>
" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div>
         </div>
         <div style="text-align:center;">
         <h5>Total</h5>
         <?php 
                echo $open;
                ?>
        </div>
        </div>
        <div class="sp-50">
        <?php 
                $ou = 0;
                if ($stat_type == 'new') {
                    $ou = SPNL()->db->subscribers_tracker->get_opens($report->ID);
                } else {
                    $ou = SendPress_Data::get_opens_unique_total($report->ID);
                }
                $px = $ou / $rec * 100;
                ?>
        <div style="float:left;">
          <div id="myStat" class="chartid" data-dimension="150" data-text="<?php 
                echo floor($px);
                ?>
%" data-info="Unique Opens" data-width="15" data-fontsize="30" data-percent="35" data-fgcolor="#85d002" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php 
                echo $rec;
                ?>
" data-part="<?php 
                echo $ou;
                ?>
" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div>
        </div>
          <div style="text-align:center;">
          <h5>Unique</h5>
          <?php 
                echo $ou;
                ?>
          </div>
       </div>
       </div>
        
      <?php 
                $this->panel_end();
                ?>
  </div>
  <div class="sp-50">
  <h4 style="text-align:center;"><?php 
                _e('Clicks', 'sendpress');
                ?>
</h4>
    <?php 
                $this->panel_start();
                $click = 0;
                $rec = get_post_meta($report->ID, '_send_last_count', true);
                if ($report) {
                    if ($stat_type == 'new') {
                        $click = SPNL()->db->subscribers_url->clicks_email_id($report->ID);
                    } else {
                        $click = SendPress_Data::get_clicks($report->ID);
                    }
                    $p = $click / $rec * 100;
                }
                ?>
     <div class="sp-row">
        <div class="sp-50 sp-first">
          <div style="float:left;">
          <div id="myStat" class="chartid" data-dimension="150" data-text="<?php 
                echo floor($p);
                ?>
%" data-info="Total Opens" data-width="15" data-fontsize="30" data-percent="<?php 
                echo floor($p);
                ?>
" data-fgcolor="#61a9dc" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php 
                echo $rec;
                ?>
" data-part="<?php 
                echo $click;
                ?>
" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div>
         </div>
         <div style="text-align:center;">
         <h5><?php 
                _e('Total', 'sendpress');
                ?>
</h5>
         <?php 
                echo $click;
                ?>
         </div>
        </div>
        <div class="sp-50">
        <?php 
                $ou = 0;
                if ($stat_type == 'new') {
                    $ou = SPNL()->db->subscribers_url->clicks_total_email_id($report->ID);
                } else {
                    $ou = SendPress_Data::get_clicks_unique_total($report->ID);
                }
                $px = $ou / $rec * 100;
                ?>
        <div style="float:left;">
          <div id="myStat" class="chartid" data-dimension="150" data-text="<?php 
                echo floor($px);
                ?>
%" data-info="Unique Opens" data-width="15" data-fontsize="30" data-percent="35" data-fgcolor="#85d002" data-bgcolor="#eee" data-fill="#ddd" data-total="<?php 
                echo $rec;
                ?>
" data-part="<?php 
                echo $ou;
                ?>
" data-icon="long-arrow-up" data-icon-size="28" data-icon-color="#fff"></div>
        </div>
        <div style="text-align:center;">
          <h5><?php 
                _e('Unique', 'sendpress');
                ?>
</h5>
          <?php 
                echo $ou;
                ?>
         </div>
       </div>
       </div>
        
     <?php 
                $this->panel_end();
                ?>
  </div>
</div>
<?php 
                $this->panel_end();
            }
            ?>




<div class="sp-row">
<div class="sp-33 sp-first">
<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title"><?php 
            _e('Recent Subscribers', 'sendpress');
            ?>
</h3>
  </div>
  <div class="panel-body">
  	<table class="table table-striped table-condensed">
    <tr>
    <th>Date</th>
    <th>List</th>
    <th><div style="text-align:right;">Email</div></th>
    </tr>
  	<?php 
            $recent = SendPress_Data::get_subscribed_events();
            foreach ($recent as $item) {
                echo "<tr>";
                echo "<td>";
                if (property_exists($item, 'subscriberID')) {
                    $d = SendPress_Data::get_subscriber($item->subscriberID);
                    if (property_exists($item, 'eventdate')) {
                        echo date_i18n("m.d.y", strtotime($item->eventdate));
                    }
                    echo "</td>";
                    echo "<td >";
                    if (property_exists($item, 'listID')) {
                        echo get_the_title($item->listID);
                    }
                    echo "</td>";
                    echo "<td align='right'>";
                    if (is_object($d)) {
                        echo $d->email . "<br>";
                    }
                    echo "</td>";
                    echo "</tr>";
                }
            }
            ?>
  </table>
  </div>
</div>
</div>
<div class="sp-33">
	<div class="panel panel-default">
	  <div class="panel-heading">
	    <h3 class="panel-title"><?php 
            _e('Most Active Subscribers', 'sendpress');
            ?>
</h3>
	  </div>
	  <div class="panel-body">
	  	<ul>
	  	<?php 
            $recent = SendPress_Data::get_most_active_subscriber();
            foreach ($recent as $item) {
                if (property_exists($item, 'subscriberID')) {
                    echo "<li>";
                    $d = SendPress_Data::get_subscriber($item->subscriberID);
                    if (is_object($d)) {
                        echo $d->email;
                    }
                    echo "</li>";
                }
            }
            ?>
	  	</ul>
	  </div>
	</div>
</div>
<div class="sp-33">
	<div class="panel panel-default">
	  <div class="panel-heading">
	    <h3 class="panel-title"><?php 
            _e('Go Pro!', 'sendpress');
            ?>
</h3>
	  </div>
	  <div class="panel-body">
	  	<ul>
	  		<li><a href="http://sendpress.com/purchase-pricing/"><?php 
            _e('Advanced Reports', 'sendpress');
            ?>
</a></li>
	  		<li><a href="http://sendpress.com/purchase-pricing/"><?php 
            _e('Check Spam Scores', 'sendpress');
            ?>
</a></li>
	  		<li><a href="http://sendpress.com/purchase-pricing/"><?php 
            _e('Post Notifications', 'sendpress');
            ?>
</a></li>
	  	</ul>
   
	  </div>
	</div>
</div>
</div>

<script>
jQuery( document ).ready(function($) {
        $('.chartid').circliful();
    });
</script>
<!--
<div class="panel panel-default">
  <div class="panel-body">
   <h2>Welcome to SendPress</h2>
  </div>
</div>

-->
<?php 
            if (SendPress_Option::get('feedback') == 'yes' || SendPress_Option::get('allow_tracking') == 'yes') {
                SendPress_Tracking::data();
            }
        }