/** * Export Mailing List Task * * @return void */ public function exportTask() { // get request vars $ids = Request::getVar('id', array()); $id = isset($ids[0]) ? $ids[0] : null; // instantiate mailing list object $newsletterMailinglist = new MailList($this->database); $newsletterMailinglist->load($id); // get list of emails $emails = $newsletterMailinglist->getListEmails($id, null, array('status' => 'all')); // file name $filename = Lang::txt('COM_NEWSLETTER_MAILINGLIST_EXPORT_FILENAME', $newsletterMailinglist->name, Date::of('now')->format('m-d-Y')); $filename .= '.csv'; // file contents $content = 'Email, Status' . PHP_EOL; foreach ($emails as $email) { $content .= $email->email . ", " . $email->status . PHP_EOL; } // set the headers for output header("Content-type: text/csv"); header("Content-Disposition: attachment; filename={$filename}"); header("Pragma: no-cache"); header("Expires: 0"); echo $content; exit; }
/** * Resend Newsletter Confirmation * * @return [type] [description] */ public function resendConfirmationTask() { //get request vars $mid = Request::getInt('mid', 0); //instantiate mailing list object $newsletterMailinglist = new MailList($this->database); $newsletterMailinglist->load($mid); //send confirmation email Helper::sendMailinglistConfirmationEmail(User::get('email'), $newsletterMailinglist, false); //inform user and redirect App::redirect(Route::url('index.php?option=com_newsletter&task=subscribe'), Lang::txt('COM_NEWSLETTER_MAILINGLISTS_CONFIRM_SENT', User::get('email'))); return; }