[ Index ]

MailPress 544

[ 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  <table id='tracking_mp_m007'>
  31      <thead>
  32          <tr>
  33              <th></th>
  34              <th><?php _e('Opened', MP_TXTDOM); ?></th>
  35              <th><?php _e('Clicks', MP_TXTDOM); ?></th>
  36          </tr>
  37      </thead>
  38      <tbody>
  39  <?php
  40              foreach($x as $k => $v)
  41              {
  42                  echo "<tr><td>$k</td>";
  43                  echo (isset($v['o'])) ? '<td class="number">' . $v['o'] . '</td>' : '<td class="number"></td>';
  44                  echo (isset($v['c'])) ? '<td class="number">' . $v['c'] . '</td>' : '<td class="number"></td>';
  45                  echo "</tr>";
  46              }
  47  ?>
  48      </tbody>
  49  </table>
  50  <?php
  51          }
  52      }
  53  }
  54  new MP_Tracking_metabox_m007(__('Opened, Clicks/day', MP_TXTDOM));


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1