/** * Remove the recipient */ protected function removeSubscriber() { $varInput = Idna::encodeEmail(Input::get('email', true)); // Validate e-mail address if (!Validator::isEmail($varInput)) { $_SESSION['UNSUBSCRIBE_ERROR'] = $GLOBALS['TL_LANG']['ERR']['email']; $this->redirect($this->generateFrontendUrl($this->objModel->getRelated('jumpTo')->row())); } $objCleverReach = new CleverReach(); switch ($this->clr_unsubscribe) { case 'inactive': foreach ($this->clr_groups as $strGroupId) { $objCleverReach->receiverSetInactive($varInput, $strGroupId); } break; case 'delete': foreach ($this->clr_groups as $strGroupId) { $objCleverReach->receiverDelete($varInput, $strGroupId); } break; case 'email': default: $objCleverReach->sendUnsubscribeMail($varInput, $this->clr_form); break; } $this->redirect($this->generateFrontendUrl($this->objModel->getRelated('jumpTo')->row())); }
/** * Get all forms and return them as array * * @return array */ public function getForms() { $arrResult = array(); $arrGroups = $this->getGroups(); foreach ($arrGroups as $strId => $strName) { $objCleverReach = new CleverReach(); $arrGroups = $objCleverReach->getFormList($strId); foreach ($arrGroups as $objGroup) { $arrResult[$objGroup->id] = sprintf('<span style="color:#b3b3b3">[%s]</span> %s', $objGroup->name, $strName); } } return $arrResult; }
protected function addSubscriber() { $varInput = Idna::encodeEmail(Input::post('email', true)); // Validate the e-mail address if (!Validator::isEmail($varInput)) { $_SESSION['SUBSCRIBE_ERROR'] = $GLOBALS['TL_LANG']['ERR']['email']; $this->reload(); } $objCleverReach = new CleverReach(); foreach ($this->clr_groups as $strGroupId) { $objCleverReach->addReceiver($varInput, $strGroupId); } $objCleverReach->sendActivationMail($varInput, $this->clr_form); // Redirect to the jumpTo page if ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null) { $this->redirect($this->generateFrontendUrl($objTarget->row())); } $_SESSION['SUBSCRIBE_CONFIRM'] = $GLOBALS['TL_LANG']['MSC']['nl_confirm']; $this->reload(); }