Example #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // action to execute
     $id = \SpoonFilter::getGetValue('id', null, 0);
     // no id's provided
     if (empty($id)) {
         $this->redirect(BackendModel::createURLForAction('Groups') . '&error=no-items-selected');
     } else {
         // at least one id
         // export all addresses
         if ($id == 'all') {
             // fetch records
             $records = BackendMailmotorModel::getAddresses();
             // export records
             BackendMailmotorModel::exportAddresses($records);
         } else {
             // export addresses by group ID
             BackendMailmotorModel::exportAddressesByGroupID($id);
         }
     }
     // redirect
     $this->redirect(BackendModel::createURLForAction('Groups') . '&report=export-failed');
 }