function subscriptionList()
 {
     if (isset($this->SubscriptionListID) and $this->SubscriptionListID) {
         return jajNewsletterSubscriptionList::fetch($this->SubscriptionListID);
     }
     return null;
 }
Ejemplo n.º 2
0
<?php

$Module = $Params['Module'];
if ($Params['ListID']) {
    $ListID = $Params['ListID'];
    $template = 'design:jaj_newsletter/subscription/new.tpl';
} else {
    if ($Module->actionParameter('SubscriptionListID')) {
        $ListID = $Module->actionParameter('SubscriptionListID');
        $template = 'design:jaj_newsletter/subscription/new_from_list.tpl';
    } else {
        $template = 'design:jaj_newsletter/subscription/new_from_list.tpl';
    }
}
$list = jajNewsletterSubscriptionList::fetch($ListID);
$tpl = eZTemplate::factory();
//    return $Module->handleError( eZError::KERNEL_NOT_FOUND, 'kernel' );
if ($Module->isCurrentAction('Subscribe') && is_object($list)) {
    $name = trim($Module->actionParameter('SubscriptionName'));
    $email = trim($Module->actionParameter('SubscriptionEmail'));
    $messages = array();
    $subscription = jajNewsletterSubscription::addSubscription($email, $name, $list);
    if ($subscription->attribute('state') == 'deleted') {
        $template = 'design:jaj_newsletter/subscription/deny.tpl';
    } else {
        if (!$subscription->isValid($messages)) {
            $tpl->setVariable('is_valid', false);
            $tpl->setVariable('validation_messages', $messages);
        } else {
            try {
                if ($subscription->State == 'unconfirmed') {
Ejemplo n.º 3
0
<?php

$Module = $Params['Module'];
if ($Module->isCurrentAction('NewList')) {
    $Module->redirectTo($Module->functionURI("list_edit"));
    return;
}
$tpl = eZTemplate::factory();
$lists = jajNewsletterSubscriptionList::fetchByOffset();
$tpl->setVariable('lists', $lists);
$Result = array('content' => $tpl->fetch('design:jaj_newsletter/lists/index.tpl'), 'path' => array(array('url' => 'jaj_newsletter/index', 'text' => ezpI18n::tr('jaj_newsletter/navigation', 'Newsletter')), array('url' => false, 'text' => ezpI18n::tr('jaj_newsletter/navigation', 'Subscription Lists'))));
 public function fetchHTTPPersistentVariables()
 {
     $http = eZHTTPTool::instance();
     eZHTTPPersistence::fetch('ContentObjectNewsletterSubscriptionList', jajNewsletterSubscriptionList::definition(), $this, $http, false);
 }
Ejemplo n.º 5
0
<?php

$ListID = $Params['ListID'];
$Module = $Params['Module'];
$user = eZUser::currentUser();
$user_id = $user->attribute("contentobject_id");
$list = $ListID === null ? jajNewsletterSubscriptionList::create($user_id) : jajNewsletterSubscriptionList::fetch($ListID);
if (!is_object($list)) {
    return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
$tpl = eZTemplate::factory();
if ($Module->isCurrentAction('Cancel')) {
    return $Module->redirectTo($Module->functionURI("lists"));
} else {
    if ($Module->isCurrentAction('Store')) {
        $list->fetchHTTPPersistentVariables();
        $messages = array();
        $list->setAttribute("modified", time());
        $list->setAttribute("modifier_id", $user_id);
        $isValid = $list->isValid($messages);
        if ($isValid) {
            $list->store();
            if ($ListID === null) {
                return $Module->redirectTo($Module->functionURI("list") . '/' . $list->attribute('id'));
            } else {
                return $Module->redirectTo($Module->functionURI("lists"));
            }
        }
        $tpl->setVariable('is_valid', $isValid);
        $tpl->setVariable('validation_messages', $messages);
    }