Example #1
0
 /**
  * Load the datagrid for statistics
  */
 private function loadStatistics()
 {
     // fetch the latest mailing
     $mailing = BackendMailmotorModel::getSentMailings(1);
     // check if a mailing was found
     if (empty($mailing)) {
         return false;
     }
     // check if a mailing was set
     if (!isset($mailing[0])) {
         return false;
     }
     // show the sent mailings block
     $this->tpl->assign('oSentMailings', true);
     // fetch the statistics for this mailing
     $stats = BackendMailmotorCMHelper::getStatistics($mailing[0]['id'], true);
     // reformat the send date
     $mailing[0]['sent'] = \SpoonDate::getDate('d-m-Y', $mailing[0]['sent']) . ' ' . BL::lbl('At') . ' ' . \SpoonDate::getDate('H:i', $mailing);
     // get results
     $results[] = array('label' => BL::lbl('MailmotorLatestMailing'), 'value' => $mailing[0]['name']);
     $results[] = array('label' => BL::lbl('MailmotorSendDate'), 'value' => $mailing[0]['sent']);
     $results[] = array('label' => BL::lbl('MailmotorSent'), 'value' => $stats['recipients'] . ' (' . $stats['recipients_percentage'] . ')');
     $results[] = array('label' => BL::lbl('MailmotorOpened'), 'value' => $stats['unique_opens'] . ' (' . $stats['unique_opens_percentage'] . ')');
     $results[] = array('label' => BL::lbl('MailmotorClicks'), 'value' => $stats['clicks_total'] . ' (' . $stats['clicks_percentage'] . ')');
     // there are some results
     if (!empty($results)) {
         // get the datagrid
         $dataGrid = new BackendDataGridArray($results);
         // no pagination
         $dataGrid->setPaging(false);
         // parse the datagrid
         $this->tpl->assign('dgMailmotorStatistics', $dataGrid->getContent());
     }
 }