function execute($process, $event)
 {
     $parameters = $process->attribute('parameter_list');
     $co = eZContentObject::fetch($parameters['object_id']);
     $parent = eZContentObjectTreeNode::fetch($co->attribute('main_parent_node_id'));
     $parentco = $parent->attribute('object');
     $newslettertype = eZPersistentObject::fetchObject(eZNewsletterType::definition(), null, array('article_pool_object_id' => $parentco->attribute('id'), 'status' => eZNewsletterType_StatusPublished));
     $list = eZNewsletter::fetchByContentObject($parameters['object_id']);
     if (empty($list) and is_object($newslettertype)) {
         $newsletter = eZNewsletter::create($co->attribute('name'), $co->attribute('owner_id'), $newslettertype->attribute('id'));
         $newsletter->setAttribute('contentobject_id', $parameters['object_id']);
         $newsletter->setAttribute('template_to_use', 'mobotixnewsletter');
         $newsletter->setAttribute('contentobject_version', $parameters['version']);
         $newsletter->store();
         $newsletter->publish();
     }
     return eZWorkflowType::STATUS_ACCEPTED;
 }
                    } catch (Exception $e) {
                        eZDebug::writeError("Invalid XML input data.", 'view_newslettertype');
                        $input = "";
                    }
                } else {
                    $input = $newsletterType->attribute($typeSource);
                }
                $attribute->setAttribute('data_text', $input);
                $attribute->store();
            }
        }
        $contentObject->store();
    }
    $nodeAssignment = eZNodeAssignment::create(array('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => $contentObject->attribute('current_version'), 'parent_node' => $parentNode->attribute('node_id'), 'is_main' => 1));
    $nodeAssignment->store();
    $newsletter = eZNewsletter::create('New "' . $class->attribute('name') . '" newsletter.', $userID, $newsletterType->attribute('id'));
    $newsletter->setAttribute('contentobject_id', $contentObject->attribute('id'));
    $newsletter->setAttribute('contentobject_version', $contentObject->attribute('current_version'));
    $newsletter->setAttribute('design_to_use', strtok($newsletterType->attribute('allowed_designs'), ','));
    $newsletter->store();
    $db->commit();
    return $Module->redirectTo('content/edit/' . $contentObject->attribute('id') . '/' . $contentObject->attribute('current_version'));
}
$userParameters = $Params['UserParameters'];
$offset = isset($userParameters['offset']) ? $userParameters['offset'] : 0;
$limitKey = isset($userParameters['limit']) ? $userParameters['limit'] : '1';
$limitList = array('1' => 10, '2' => 25, '3' => 50);
$limit = $limitList[(string) $limitKey];
$viewParameters = array('offset' => $offset, 'limitkey' => isset($userParameters['limitkey']) ? $userParameters['limitkey'] : 1);
$tpl = eZNewsletterTemplateWrapper::templateInit();
$tpl->setVariable('limit', $limit);
Пример #3
0
 function copy($frontendcopy = false)
 {
     $userID = eZUser::currentUserID();
     if (!$userID) {
         $userID = $this->attribute('creator_id');
     }
     $newNewsletter = eZNewsletter::create($this->attribute('name'), $userID, $this->attribute('newslettertype_id'));
     $newNewsletter->setAttribute('output_format', $this->attribute('output_format'));
     $newNewsletter->setAttribute('design_to_use', $this->attribute('design_to_use'));
     $newNewsletter->setAttribute('send_date', $this->attribute('send_date'));
     $newNewsletter->setAttribute('newslettertype_id', $this->attribute('newslettertype_id'));
     $newNewsletter->setAttribute('category', $this->attribute('category'));
     $newNewsletter->setAttribute('pretext', $this->attribute('pretext'));
     $newNewsletter->setAttribute('posttext', $this->attribute('posttext'));
     $newNewsletter->setAttribute('object_relations', $this->attribute('object_relations'));
     $newNewsletter->setAttribute('preview_email', $this->attribute('preview_email'));
     $newNewsletter->setAttribute('recurrence_type', $this->attribute('recurrence_type'));
     $newNewsletter->setAttribute('recurrence_value', $this->attribute('recurrence_value'));
     $newNewsletter->setAttribute('creator_id', $this->attribute('creator_id'));
     $newNewsletter->setAttribute('status', eZNewsletter::StatusPublished);
     if ($frontendcopy == true) {
         $newNewsletter->setAttribute('send_status', eZNewsletter::SendStatusNone);
         $newNewsletter->setAttribute('status', eZNewsletter::StatusDraft);
     } else {
         $newNewsletter->setAttribute('send_status', $this->attribute('send_status'));
     }
     $objectID = $this->attribute('contentobject_id');
     $objectVersion = $this->attribute('contentobject_version');
     $object = eZContentObject::fetch($objectID);
     if (is_object($object)) {
         $newObject = $object->copy($objectVersion);
         $newNewsletter->setAttribute('contentobject_id', $newObject->attribute('id'));
         $newNewsletter->setAttribute('contentobject_version', $newObject->attribute('current_version'));
         $newNewsletter->store();
         return $newObject;
     }
 }