[ Index ]

MailPress 544

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

title

Body

[close]

/mp-includes/class/options/dashboard/widgets/ -> mails_activity.php (source)

   1  <?php
   2  class MP_Dashboard_mails_activity extends MP_dashboard_widget_
   3  {
   4      var $id = 'mp_mails_activity';
   5  
   6  	function widget()
   7      {
   8          global $wpdb, $wp_locale;
   9  
  10          ob_start();
  11              include(MP_CONTENT_DIR . 'advanced/dashboard/mails_activity.xml');
  12              $xml = trim(ob_get_contents());
  13          ob_end_clean();
  14          $xml = '<?xml version="1.0" ?>' . $xml;
  15          $xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
  16  
  17          $MASS = array();
  18          foreach ($xml->group as $group)
  19          {
  20              $a = array();
  21              foreach($group->templates->children() as $templates) $a[] = (string) $templates;
  22              $MASS[(string) $group->desc] = $a;
  23          }
  24  
  25          $chd_m = $chl_m = array();
  26          $out = '';
  27          foreach ($MASS as $k => $MAS)
  28          {
  29              $in   = join("','",$MAS);
  30              $out .= (empty($out)) ? $in : "','" . $in;
  31              $x  = $wpdb->get_var("SELECT sum(scount) FROM $wpdb->mp_stats WHERE stype = 't' AND slib IN ('$in') ;");
  32              if ($x) 
  33              {
  34                  $chd_m[] = $x;
  35                  $chl_m[] = $k;
  36              }
  37          }    
  38          $x  = $wpdb->get_var("SELECT sum(scount) FROM $wpdb->mp_stats WHERE stype = 't' AND slib NOT IN ('$out') ;");
  39          if ($x) 
  40          {
  41              $chd_m[] = $x;
  42              $chl_m[] = __('Misc.', MP_TXTDOM);
  43          }
  44  
  45          if (empty($chd_m)) return;
  46  
  47          $args = array();
  48          $args['cht']  = 'p3';
  49          $args['chs']  = $this->widget_size('475x215');
  50          $args['chl']  = join('|', $chl_m);
  51          $args['chco'] = '0000ff';
  52  
  53          $sum = array_sum($chd_m);
  54          foreach($chd_m as $k => $v) $chd_m[$k] = round(100 * $v/$sum);
  55  
  56          $args['chd']  = 't:' . join(',', $chd_m);
  57          $url = esc_url(add_query_arg($args, $this->url));
  58  
  59  ?>
  60  <div style='text-align:center;'>
  61  <img style='width:100%;' src="<?php echo $url; ?>" alt="<?php _e( 'Mails - Activity', MP_TXTDOM ); ?>" />
  62  </div>
  63  <?php
  64      }
  65  }
  66  new MP_Dashboard_mails_activity(__( 'MailPress - Mails activity', MP_TXTDOM ));


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