Beispiel #1
0
 /**
  * Load the confirmation dialog
  */
 private function loadConfirmationDialog()
 {
     // load statistics
     $groups = BackendMailmotorModel::getGroupsByIds($this->record['groups']);
     // fetch the campaign
     $campaign = BackendMailmotorModel::getCampaign($this->record['campaign_id']);
     // fetch the template
     $template = BackendMailmotorModel::getTemplate($this->record['language'], $this->record['template']);
     // declare stats array
     $stats['recipients'] = count($this->record['recipients']);
     $stats['mailing'] = $this->record['name'];
     $stats['label_persons'] = $stats['recipients'] > 1 ? BL::lbl('Persons', 'core') : BL::lbl('Person', 'core');
     // campaign was set
     if (!empty($campaign)) {
         // set data
         $stats['message'] = BL::msg('RecipientStatisticsCampaign', $this->getModule());
         $stats['campaign'] = $campaign['name'];
         // assign the recipient statistics variable
         $this->tpl->assign('recipientStatistics', sprintf($stats['message'], $stats['mailing'], $stats['campaign'], $stats['recipients'], $stats['label_persons']));
     } else {
         // set data
         $stats['message'] = BL::msg('RecipientStatisticsNoCampaign', $this->getModule());
         // assign the recipient statistics variable
         $this->tpl->assign('recipientStatistics', sprintf($stats['message'], $stats['mailing'], $stats['recipients'], $stats['label_persons']));
     }
     // add comma separator to groups
     if (!empty($groups)) {
         // fetch the last key in this array
         $lastRecord = end($groups);
         // loop the groups
         foreach ($groups as $key => &$group) {
             // add comma field to the groups if this is not the last item
             if ($lastRecord['id'] != $key) {
                 $group['comma'] = true;
             }
         }
     }
     // assign the groups to the template
     $this->tpl->assign('groups', $groups);
     // assign the template language
     $this->tpl->assign('templateLanguage', SpoonFilter::ucfirst(BL::lbl(strtoupper($template['language']))));
     // get the price settings
     $pricePerEmail = BackendModel::getModuleSetting($this->getModule(), 'price_per_email');
     $pricePerCampaign = BackendModel::getModuleSetting($this->getModule(), 'price_per_campaign');
     // parse the price total
     $this->tpl->assign('price', $stats['recipients'] * $pricePerEmail + $pricePerCampaign);
 }