[ Index ]

MailPress 7.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/options/tracking/metaboxes/mail/ -> m007.php (source)

   1  <?php
   2  class MP_Tracking_metabox_m007 extends MP_tracking_metabox_
   3  {
   4      var $id    = 'm007';
   5      var $context= 'normal';
   6      var $file     = __FILE__;
   7  
   8  	function meta_box( $mail )
   9      {
  10          global $wpdb;
  11          $tracks = $wpdb->get_results( $wpdb->prepare( "SELECT DATE( tmstp ) as tmstp, track, count( * ) as count FROM $wpdb->mp_tracks WHERE mail_id = %d GROUP BY 1, 2 ORDER BY 1 DESC, 2 DESC ;", $mail->id ) );
  12          if ( $tracks )
  13          {
  14              $x = array();
  15              foreach( $tracks as $track )
  16              {
  17                  $time = $track->tmstp;
  18                  if ( MailPress_tracking_openedmail == $track->track )
  19                  {
  20                      if ( isset( $x[$track->tmstp]['o'] ) )     $x[$track->tmstp]['o'] += $track->count;
  21                      else                        $x[$track->tmstp]['o']  = $track->count;
  22                  }
  23                  else
  24                  {
  25                      if ( isset( $x[$track->tmstp]['c'] ) )     $x[$track->tmstp]['c'] += $track->count;
  26                      else                        $x[$track->tmstp]['c']  = $track->count;
  27                  }
  28              }
  29  
  30              $out = '<table id="tracking_mp_m007">    <thead><tr><th></th><th>' . __( 'Opened', 'MailPress' ) . '</th><th>' . __( 'Clicks', 'MailPress' ) . '</th></tr></thead><tbody>';
  31  
  32              foreach( $x as $k => $v )
  33              {
  34                  $out .= '<tr><td>' . $k . '</td>';
  35                  $out .= ( isset( $v['o'] ) ) ? '<td class="number">' . $v['o'] . '</td>' : '<td class="number"></td>';
  36                  $out .= ( isset( $v['c'] ) ) ? '<td class="number">' . $v['c'] . '</td>' : '<td class="number"></td>';
  37                  $out .= '</tr>';
  38              }
  39  
  40              $out .= '</tbody></table>';
  41  
  42              echo $out;
  43          }
  44      }
  45  }
  46  new MP_Tracking_metabox_m007( __( 'Opened, Clicks/day', 'MailPress' ) );


Generated: Mon Mar 11 18:33:33 2019 Cross-referenced by PHPXref 0.7.1