/** * @return string * @throws PopupException */ public function renderAjaxPopup() { //TODO: check if request is an ajax call? if (!$this->popupInitiator->hasInitiatedAjaxPopup()) { throw new PopupException('Rendering of the popup via Ajax is not allowed. The PopupInitiator generated a script without an Ajax call.'); } $campaign = $this->campaignLoader->getTracked(); return $this->popupPresenter->render($campaign); }
/** * */ public function subscribeEmail() { $email = $this->dataResolver->getEmail(); $campaign = $this->campaignLoader->getTracked(); $listId = $campaign->getListId(); if ($this->newsletterSubscriber->subscribe($email, $listId)) { echo sprintf('Email "%s" subscribed successfully through campaign %s', $email, $campaign->getTrackingId()); $this->impressionsOperator->disableFutureImpressions(); } else { header("HTTP/1.0 400 " . $this->newsletterSubscriber->getErrorMessage()); } }