本文整理汇总了PHP中MarketingList类的典型用法代码示例。如果您正苦于以下问题:PHP MarketingList类的具体用法?PHP MarketingList怎么用?PHP MarketingList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MarketingList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: makeAll
public function makeAll(&$demoDataHelper)
{
assert('$demoDataHelper instanceof DemoDataHelper');
assert('$demoDataHelper->isSetRange("MarketingList")');
$autoresponders = array();
if ($this->loadMagnitude >= 100) {
foreach (MarketingList::getAll() as $marketingList) {
for ($this->index = 0; $this->index < 2; $this->index++) {
$autoresponder = new Autoresponder();
$autoresponder->marketingList = $marketingList;
$this->populateModel($autoresponder);
$saved = $autoresponder->save();
assert('$saved');
$autoresponders[] = $autoresponder->id;
}
}
} else {
for ($this->index = 0; $this->index < 4; $this->index++) {
$autoresponder = new Autoresponder();
$autoresponder->marketingList = $demoDataHelper->getRandomByModelName('MarketingList');
$this->populateModel($autoresponder);
$saved = $autoresponder->save();
assert('$saved');
$autoresponders[] = $autoresponder->id;
}
}
$demoDataHelper->setRangeByModelName('Autoresponder', $autoresponders[0], $autoresponders[count($autoresponders) - 1]);
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:28,代码来源:AutorespondersDemoDataMaker.php
示例2: teardown
public function teardown()
{
$marketingLists = MarketingList::getAll();
$this->assertCount(1, $marketingLists);
$marketingLists[0]->delete();
parent::teardown();
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:7,代码来源:MarketingListPerformanceChartDataProviderTest.php
示例3: populateAutoresponder
public static function populateAutoresponder($subject, $textContent, $htmlContent, $fromOperationDurationInterval, $operationType, $enableTracking = false, $marketingList = null)
{
assert('is_string($subject)');
assert('is_string($textContent)');
assert('is_string($htmlContent) || $htmlContent === null');
assert('is_int($fromOperationDurationInterval)');
assert('is_int($operationType)');
assert('is_bool($enableTracking) || is_int($enableTracking)');
assert('is_object($marketingList) || $marketingList === null');
if (empty($marketingList)) {
$marketingLists = MarketingList::getAll();
if (!empty($marketingLists)) {
$marketingList = RandomDataUtil::getRandomValueFromArray($marketingLists);
}
}
$autoresponder = new Autoresponder();
$autoresponder->subject = $subject;
$autoresponder->textContent = $textContent;
$autoresponder->htmlContent = $htmlContent;
$autoresponder->fromOperationDurationInterval = $fromOperationDurationInterval;
$autoresponder->fromOperationDurationType = TimeDurationUtil::DURATION_TYPE_DAY;
$autoresponder->operationType = $operationType;
$autoresponder->enableTracking = $enableTracking;
$autoresponder->marketingList = $marketingList;
return $autoresponder;
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:26,代码来源:AutoresponderTestHelper.php
示例4: getStringifiedModelForValue
public function getStringifiedModelForValue()
{
if ($this->value != null) {
try {
return strval(MarketingList::getById((int) $this->value));
} catch (NotFoundException $e) {
}
}
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:9,代码来源:MarketingListWorkflowActionAttributeForm.php
示例5: setUp
public function setUp()
{
parent::setUp();
$this->user = User::getByUsername('super');
Yii::app()->user->userModel = $this->user;
Campaign::deleteAll();
CampaignItem::deleteAll();
Contact::deleteAll();
MarketingList::deleteAll();
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:10,代码来源:CampaignQueueMessagesInOutboxJobBenchmarkTest.php
示例6: populateCampaign
public static function populateCampaign($name, $subject, $textContent, $htmlContent = null, $fromName = null, $fromAddress = null, $supportsRichText = null, $status = null, $sendOnDateTime = null, $enableTracking = null, $marketingList = null)
{
assert('is_string($name)');
assert('is_string($subject)');
assert('is_string($textContent) || $textContent === null');
assert('is_string($htmlContent) || $htmlContent === null');
assert('is_string($fromName) || $fromName === null');
assert('is_string($fromAddress) || $fromAddress === null');
assert('is_bool($supportsRichText) || is_int($supportsRichText) || $supportsRichText === null');
assert('is_string($status) || is_int($status) || $status === null');
assert('is_string($sendOnDateTime) || is_int($sendOnDateTime) || $sendOnDateTime === null');
assert('is_bool($enableTracking) || is_int($enableTracking) || $enableTracking === null');
assert('is_object($marketingList) || $marketingList === null');
if ($supportsRichText === null) {
$supportsRichText = 1;
if ($htmlContent === null) {
$htmlContent = 'test html content';
}
}
if ($sendOnDateTime === null) {
$sendOnDateTime = '0000-00-00 00:00:00';
}
if ($status === null) {
$status = Campaign::STATUS_ACTIVE;
}
if ($enableTracking === null) {
$enableTracking = 1;
}
if ($fromName === null) {
$fromName = 'Support Team';
}
if ($fromAddress === null) {
$fromAddress = '[email protected]';
}
if (empty($marketingList)) {
$marketingLists = MarketingList::getAll();
if (!empty($marketingLists)) {
$marketingList = RandomDataUtil::getRandomValueFromArray($marketingLists);
}
}
$campaign = new Campaign();
$campaign->name = $name;
$campaign->subject = $subject;
$campaign->textContent = $textContent;
$campaign->htmlContent = $htmlContent;
$campaign->status = $status;
$campaign->fromName = $fromName;
$campaign->fromAddress = $fromAddress;
$campaign->supportsRichText = $supportsRichText;
$campaign->enableTracking = $enableTracking;
$campaign->sendOnDateTime = $sendOnDateTime;
$campaign->marketingList = $marketingList;
return $campaign;
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:54,代码来源:CampaignTestHelper.php
示例7: actionCreate
public function actionCreate($marketingListId, $redirectUrl)
{
$autoresponder = new Autoresponder();
$autoresponder->marketingList = MarketingList::getById(intval($marketingListId));
ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($autoresponder->marketingList);
$model = $this->attemptToSaveModelFromPost($autoresponder, $redirectUrl);
$editAndDetailsView = $this->makeEditAndDetailsView($model, 'Edit');
$breadcrumbLinks = static::getDetailsAndEditBreadcrumbLinks($autoresponder->marketingList);
$breadcrumbLinks[] = Zurmo::t('AutorespondersModule', 'Create');
$view = new AutorespondersPageView(MarketingDefaultViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $editAndDetailsView, $breadcrumbLinks, 'MarketingBreadCrumbView'));
echo $view->render();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:12,代码来源:DefaultController.php
示例8: actionGenerateManageSubscriptionHash
/**
* Method for testing creating a simple notification for the current user.
*/
public function actionGenerateManageSubscriptionHash()
{
if (Yii::app()->user->userModel->username != 'super') {
throw new NotSupportedException();
}
$contact = RandomDataUtil::getRandomValueFromArray(Contact::getAll());
$personId = $contact->getClassId('Person');
$marketingList = RandomDataUtil::getRandomValueFromArray(MarketingList::getAll());
$marketingListId = $marketingList->id;
$model = RandomDataUtil::getRandomValueFromArray(CampaignItem::getAll());
$modelId = $model->id;
$modelType = get_class($model);
$hash = EmailMessageActivityUtil::resolveHashForUnsubscribeAndManageSubscriptionsUrls($personId, $marketingListId, $modelId, $modelType, false);
echo 'index.php/marketingLists/external/manageSubscriptions?hash=' . $hash;
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:18,代码来源:DemoController.php
示例9: actionGenerateManageSubscriptionHash
/**
* Method for testing creating a simple notification for the current user.
*/
public function actionGenerateManageSubscriptionHash()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
$contact = RandomDataUtil::getRandomValueFromArray(Contact::getAll());
$personId = $contact->getClassId('Person');
$marketingList = RandomDataUtil::getRandomValueFromArray(MarketingList::getAll());
$marketingListId = $marketingList->id;
$model = RandomDataUtil::getRandomValueFromArray(CampaignItem::getAll());
$modelId = $model->id;
$modelType = get_class($model);
$hash = GlobalMarketingFooterUtil::resolveHash($personId, $marketingListId, $modelId, $modelType, false);
echo 'index.php/marketingLists/external/manageSubscriptions?hash=' . $hash;
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:DemoController.php
示例10: fillAutoresponder
public static function fillAutoresponder($name, $subject, $textContent, $htmlContent, $secondsFromOperation, $operationType, $marketingList = null)
{
if (empty($marketingList)) {
$marketingLists = MarketingList::getAll();
if (!empty($marketingLists)) {
$marketingList = RandomDataUtil::getRandomValueFromArray($marketingLists);
}
}
$autoresponder = new Autoresponder();
$autoresponder->name = $name;
$autoresponder->subject = $subject;
$autoresponder->textContent = $textContent;
$autoresponder->htmlContent = $htmlContent;
$autoresponder->secondsFromOperation = $secondsFromOperation;
$autoresponder->operationType = $operationType;
$autoresponder->marketingList = $marketingList;
return $autoresponder;
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:18,代码来源:AutoresponderTestHelper.php
示例11: testCreateAndGetMarketingListMemberById
public function testCreateAndGetMarketingListMemberById()
{
$marketingList = RandomDataUtil::getRandomValueFromArray(MarketingList::getAll());
$this->assertNotNull($marketingList);
$contact = RandomDataUtil::getRandomValueFromArray(Contact::getAll());
$this->assertNotNull($contact);
$marketingListMember = new MarketingListMember();
$marketingListMember->unsubscribed = 0;
$marketingListMember->marketingList = $marketingList;
$marketingListMember->contact = $contact;
$this->assertTrue($marketingListMember->unrestrictedSave());
$id = $marketingListMember->id;
$this->assertTrue($id > 0);
unset($marketingListMember);
$marketingListMember = MarketingListMember::getById($id);
$this->assertEquals(0, $marketingListMember->unsubscribed);
$this->assertEquals($contact, $marketingListMember->contact);
$this->assertEquals($marketingList, $marketingListMember->marketingList);
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:19,代码来源:MarketingListMemberTest.php
示例12: makeAll
/**
* @param DemoDataHelper $demoDataHelper
*/
public function makeAll(&$demoDataHelper)
{
assert('$demoDataHelper instanceof DemoDataHelper');
assert('$demoDataHelper->isSetRange("User")');
$marketingLists = array();
for ($this->index = 0; $this->index < 5; $this->index++) {
$marketingList = new MarketingList();
$marketingList->owner = $demoDataHelper->getRandomByModelName('User');
$this->populateModel($marketingList);
$marketingList->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
$saved = $marketingList->save();
assert('$saved');
$marketingList = MarketingList::getById($marketingList->id);
AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($marketingList, Group::getByName(Group::EVERYONE_GROUP_NAME));
$marketingList->save();
$marketingLists[] = $marketingList->id;
}
$demoDataHelper->setRangeByModelName('MarketingList', $marketingLists[0], $marketingLists[count($marketingLists) - 1]);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:22,代码来源:MarketingListsDemoDataMaker.php
示例13: populateMarketingListMember
public static function populateMarketingListMember($unsubscribed = 0, $marketingList = null, $contact = null)
{
if (empty($marketingList)) {
$marketingLists = MarketingList::getAll();
if (!empty($marketingLists)) {
$marketingList = RandomDataUtil::getRandomValueFromArray($marketingLists);
}
}
if (empty($contact)) {
$contacts = Contact::getAll();
if (!empty($contacts)) {
$contact = RandomDataUtil::getRandomValueFromArray($contacts);
}
}
$marketingListMember = new MarketingListMember();
$marketingListMember->unsubscribed = $unsubscribed;
$marketingListMember->contact = $contact;
$marketingListMember->marketingList = $marketingList;
return $marketingListMember;
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:20,代码来源:MarketingListMemberTestHelper.php
示例14: makeAll
/**
* @param DemoDataHelper $demoDataHelper
*/
public function makeAll(&$demoDataHelper)
{
assert('$demoDataHelper instanceof DemoDataHelper');
assert('$demoDataHelper->isSetRange("Contact")');
assert('$demoDataHelper->isSetRange("MarketingList")');
$members = array();
foreach (MarketingList::getAll() as $marketingList) {
foreach (Contact::getAll() as $contact) {
$interval = mt_rand(1, 30) * 86400;
$member = new MarketingListMember();
$member->setScenario('importModel');
$member->createdDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - $interval);
$member->contact = $contact;
$member->marketingList = $marketingList;
$this->populateModel($member);
$saved = $member->unrestrictedSave();
assert('$saved');
$members[] = $member->id;
}
}
$demoDataHelper->setRangeByModelName('MarketingListMember', $members[0], $members[count($members) - 1]);
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:25,代码来源:MarketingListMembersDemoDataMaker.php
示例15: makeColumnSqlQuery
/**
* @param string $beginDateTime
* @param array $searchAttributeData
* @return string
*/
protected static function makeColumnSqlQuery($beginDateTime, $searchAttributeData)
{
assert('is_string($beginDateTime)');
$quote = DatabaseCompatibilityUtil::getQuote();
$where = null;
$selectDistinct = false;
$marketingListTableName = MarketingList::getTableName();
$marketingListMemberTableName = MarketingListMember::getTableName();
$createdDateTimeColumnName = MarketingListMember::getColumnNameByAttribute('createdDateTime');
$unsubscribedColumnName = MarketingListMember::getColumnNameByAttribute('unsubscribed');
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('MarketingList');
$where = RedBeanModelDataProvider::makeWhere('MarketingList', $searchAttributeData, $joinTablesAdapter);
MarketingList::resolveReadPermissionsOptimizationToSqlQuery(Yii::app()->user->userModel, $joinTablesAdapter, $where, $selectDistinct);
$selectQueryAdapter = new RedBeanModelSelectQueryAdapter($selectDistinct);
$newSubscriberSelectPart = "sum(CASE WHEN {$quote}{$marketingListMemberTableName}{$quote}.{$quote}{$createdDateTimeColumnName}" . $quote . " >= '{$beginDateTime}' THEN 1 ELSE 0 END)";
$existingSubscriberSelectPart = "sum(CASE WHEN {$quote}{$marketingListMemberTableName}{$quote}.{$quote}{$createdDateTimeColumnName}" . $quote . " < '{$beginDateTime}' AND " . "{$quote}{$marketingListMemberTableName}{$quote}.{$quote}" . "{$unsubscribedColumnName}{$quote}=0 THEN 1 ELSE 0 END)";
// Not Coding Standard
$selectQueryAdapter->addClauseByQueryString($newSubscriberSelectPart, static::NEW_SUBSCRIBERS_COUNT);
$selectQueryAdapter->addClauseByQueryString($existingSubscriberSelectPart, static::EXISTING_SUBSCRIBERS_COUNT);
$joinTablesAdapter->addLeftTableAndGetAliasName($marketingListMemberTableName, 'id', $marketingListTableName, 'marketinglist_id');
$sql = SQLQueryUtil::makeQuery($marketingListTableName, $selectQueryAdapter, $joinTablesAdapter, null, null, $where);
return $sql;
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:28,代码来源:MarketingListGrowthChartDataProvider.php
示例16: testRunWithCampaignPausedAfterAllItemsGeneratedAndThenUnpaused
public function testRunWithCampaignPausedAfterAllItemsGeneratedAndThenUnpaused()
{
// Cleanup
Campaign::deleteAll();
$this->assertEquals(0, Campaign::getCount());
$this->assertEquals(0, CampaignItem::getCount());
$this->assertEquals(0, CampaignItemActivity::getCount());
MarketingList::deleteAll();
$this->assertEquals(0, MarketingList::getCount());
$this->assertEquals(0, MarketingListMember::getCount());
EmailMessage::deleteAll();
$this->assertEquals(0, EmailMessage::getCount());
$this->assertEquals(0, EmailMessageContent::getCount());
$this->assertEquals(0, EmailMessageSender::getCount());
$this->assertEquals(0, EmailMessageRecipient::getCount());
Contact::deleteAll();
$this->assertEquals(0, Contact::getCount());
// setup an email address for contacts
$email = new Email();
$email->emailAddress = '[email protected]';
// create a marketing list with 5 members
$marketingList = MarketingListTestHelper::createMarketingListByName('marketingList 05');
$marketingListId = $marketingList->id;
for ($i = 1; $i <= 5; $i++) {
$contact = ContactTestHelper::createContactByNameForOwner('campaignContact 0' . $i, $this->user);
$contact->primaryEmail = $email;
$this->assertTrue($contact->save());
MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList, $contact);
}
$marketingList->forgetAll();
// create a due campaign with that marketing list
$campaign = CampaignTestHelper::createCampaign('campaign 04', 'subject', 'text Content', 'Html Content', null, null, null, null, null, null, MarketingList::getById($marketingListId));
$campaignId = $campaign->id;
/*
* Run 1:
* CampaignGenerateDueCampaignItemsJob
* status == processing
* items generated but unprocessed
*
* CampaignQueueMessagesInOutboxJob
* status == processing
* items processed with email messages generated and queued
*
* ProcessOutboundEmailJob
* status == processing
* email items attempted to be sent
*
* Run 2:
* Pause the campaign
* items are processed and still present
*
* Unpause the campaign
* status == active
* items are processed and still present
*
* CampaignGenerateDueCampaignItemsJob
* status == processing
* ensure all items are present and processed
*
* CampaignQueueMessagesInOutboxJob
* status == processing
* ensure all items are present and processed
* ensure all email messages are present with correct folder type
*
* ProcessOutboundEmailJob
* ensure all email messages are present with correct folder type
* status == processing
*
*
* Run 3:
* Mark Campaign as Completed
* status == completed
*/
// we have to do this to ensure when we retrieve the data status is updated from db.
$campaign->forgetAll();
$this->assertEmpty(CampaignItem::getAll());
// Run 1 starts here
// Run CampaignGenerateDueCampaignItemsJob
$job = new CampaignGenerateDueCampaignItemsJob();
$this->assertTrue($job->run());
$campaign = Campaign::getById($campaignId);
// ensure status is processing
$this->assertEquals(Campaign::STATUS_PROCESSING, $campaign->status);
// ensure 5 campaign items have been generated
$this->assertEquals(5, CampaignItem::getCount());
// ensure all 5 campaign items are unprocessed
$campaignItems = CampaignItem::getByProcessedAndCampaignId(0, $campaignId);
$this->assertNotEmpty($campaignItems);
$this->assertCount(5, $campaignItems);
// Run CampaignQueueMessagesInOutboxJob
$job = new CampaignQueueMessagesInOutboxJob();
$this->assertTrue($job->run());
// Ensure campaign status
$campaign = Campaign::getById($campaignId);
$this->assertEquals(Campaign::STATUS_PROCESSING, $campaign->status);
// ensure all 5 campaign items are processed
$campaignItems = CampaignItem::getByProcessedAndCampaignId(1, $campaignId);
$this->assertNotEmpty($campaignItems);
$this->assertCount(5, $campaignItems);
// Ensure 5 new email messages
//.........这里部分代码省略.........
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:101,代码来源:CampaignMarkCompletedJobTest.php
示例17: testGetInfoToCopyToCampaign
public function testGetInfoToCopyToCampaign()
{
$marketingListId = self::getModelIdByModelNameAndName('MarketingList', 'MarketingListName');
$marketingList = MarketingList::getById($marketingListId);
$this->setGetArray(array('id' => $marketingListId));
$content = $this->runControllerWithNoExceptionsAndGetContent('marketingLists/default/getInfoToCopyToCampaign');
$decodedContent = CJSON::decode($content);
$this->assertNotEmpty($decodedContent);
$this->assertArrayHasKey('fromName', $decodedContent);
$this->assertArrayHasKey('fromAddress', $decodedContent);
$this->assertEquals($marketingList->fromName, $decodedContent['fromName']);
$this->assertEquals($marketingList->fromAddress, $decodedContent['fromAddress']);
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:13,代码来源:MarketingListDefaultControllerSuperUserWalkthroughTest.php
示例18: makeAutorespondersSqlQuery
/**
* @param array $searchAttributeData
* @param string $groupBy
* @return string
*/
protected static function makeAutorespondersSqlQuery($searchAttributeData, $groupBy)
{
$quote = DatabaseCompatibilityUtil::getQuote();
$where = null;
$selectDistinct = false;
$itemTableName = Item::getTableName('Item');
$marketingListTableName = Autoresponder::getTableName('MarketingList');
$autoresponderTableName = Autoresponder::getTableName('Autoresponder');
$autoresponderItemTableName = AutoresponderItem::getTableName('AutoresponderItem');
$emailMessageTableName = EmailMessage::getTableName('EmailMessage');
$sentDateTimeColumnName = EmailMessage::getColumnNameByAttribute('sentDateTime');
$createdDateTimeColumnName = Item::getColumnNameByAttribute('createdDateTime');
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('Autoresponder');
MarketingList::resolveReadPermissionsOptimizationToSqlQuery(Yii::app()->user->userModel, $joinTablesAdapter, $where, $selectDistinct);
$selectQueryAdapter = new RedBeanModelSelectQueryAdapter($selectDistinct);
$queuedEmailsSelectPart = "sum(CASE WHEN {$quote}{$emailMessageTableName}{$quote}.{$quote}{$sentDateTimeColumnName}" . $quote . " = '0000-00-00 00:00:00' OR {$quote}{$emailMessageTableName}{$quote}" . ".{$quote}{$sentDateTimeColumnName}{$quote} IS NULL THEN 1 ELSE 0 END)";
// Not Coding Standard
$sentEmailsSelectPart = "sum(CASE WHEN {$quote}{$emailMessageTableName}{$quote}.{$quote}{$sentDateTimeColumnName}" . $quote . " > '0000-00-00 00:00:00' THEN 1 ELSE 0 END)";
$uniqueOpensSelectPart = static::resolveAutoresponderTypeSubQuery(EmailMessageActivity::TYPE_OPEN);
$uniqueClicksSelectPart = static::resolveAutoresponderTypeSubQuery(EmailMessageActivity::TYPE_CLICK);
$bouncedSelectPart = static::resolveAutoresponderTypeSubQuery(EmailMessageActivity::TYPE_BOUNCE);
$optedOutSelectPart = static::resolveAutoresponderTypeSubQuery(EmailMessageActivity::TYPE_UNSUBSCRIBE);
$selectQueryAdapter->addDayDateClause($itemTableName, $createdDateTimeColumnName, static::DAY_DATE);
$selectQueryAdapter->addFirstDayOfWeekDateClause($itemTableName, $createdDateTimeColumnName, static::FIRST_DAY_OF_WEEK_DATE);
$selectQueryAdapter->addFirstDayOfMonthDateClause($itemTableName, $createdDateTimeColumnName, static::FIRST_DAY_OF_MONTH_DATE);
$selectQueryAdapter->addNonSpecificCountClause();
$selectQueryAdapter->addClauseByQueryString($queuedEmailsSelectPart, static::QUEUED);
$selectQueryAdapter->addClauseByQueryString($sentEmailsSelectPart, static::SENT);
$selectQueryAdapter->addClauseByQueryString("count((" . $uniqueOpensSelectPart . "))", static::UNIQUE_OPENS);
$selectQueryAdapter->addClauseByQueryString("count((" . $uniqueClicksSelectPart . "))", static::UNIQUE_CLICKS);
$selectQueryAdapter->addClauseByQueryString("count((" . $bouncedSelectPart . "))", static::BOUNCED);
$selectQueryAdapter->addClauseByQueryString("count((" . $optedOutSelectPart . "))", static::UNSUBSCRIBED);
$joinTablesAdapter->addFromTableAndGetAliasName($marketingListTableName, 'marketinglist_id');
$joinTablesAdapter->addLeftTableAndGetAliasName($autoresponderItemTableName, 'id', $autoresponderTableName, 'autoresponder_id');
$joinTablesAdapter->addLeftTableAndGetAliasName($emailMessageTableName, 'emailmessage_id', $autoresponderItemTableName, 'id');
$where = RedBeanModelDataProvider::makeWhere('Autoresponder', $searchAttributeData, $joinTablesAdapter);
$sql = SQLQueryUtil::makeQuery($autoresponderTableName, $selectQueryAdapter, $joinTablesAdapter, null, null, $where, null, $groupBy);
return $sql;
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:44,代码来源:MarketingEmailsInThisListChartDataProvider.php
示例19: testGenerateCampaignItemsForDueCampaignsWithCustomBatchSize
/**
* @depends testGenerateCampaignItemsForDueCampaigns
*/
public function testGenerateCampaignItemsForDueCampaignsWithCustomBatchSize()
{
$contactIds = array();
$marketingListIds = array();
$campaignIds = array();
for ($index = 6; $index < 9; $index++) {
$contact = ContactTestHelper::createContactByNameForOwner('campaignContact 0' . $index, $this->user);
$contactIds[] = $contact->id;
$contact->forgetAll();
}
for ($index = 8; $index < 12; $index++) {
$suffix = $index;
if ($index < 10) {
$suffix = "0{$suffix}";
}
$marketingList = MarketingListTestHelper::createMarketingListByName('marketingList ' . $suffix);
$marketingListId = $marketingList->id;
$marketingListIds[] = $marketingListId;
foreach ($contactIds as $contactId) {
$contact = Contact::getById($contactId);
$unsubscribed = rand(10, 20) % 2;
MarketingListMemberTestHelper::createMarketingListMember($unsubscribed, $marketingList, $contact);
}
$marketingList->forgetAll();
$marketingList = MarketingList::getById($marketingListId);
$campaignSuffix = substr($marketingList->name, -2);
$campaign = CampaignTestHelper::createCampaign('campaign ' . $campaignSuffix, 'subject ' . $campaignSuffix, 'text ' . $campaignSuffix, 'html ' . $campaignSuffix, null, null, null, null, null, null, $marketingList);
$this->assertNotNull($campaign);
$campaignIds[] = $campaign->id;
$campaign->forgetAll();
}
foreach ($campaignIds as $campaignId) {
$campaignItems = CampaignItem::getByProcessedAndCampaignId(0, $campaignId);
$this->assertEmpty($campaignItems);
}
$this->assertTrue(CampaignItemsUtil::generateCampaignItemsForDueCampaigns(5));
foreach ($campaignIds as $index => $campaignId) {
$campaign = Campaign::getById($campaignId);
$campaignItems = CampaignItem::getByProcessedAndCampaignId(0, $campaignId);
if ($index === 0) {
$expectedCount = AutoresponderOrCampaignBatchSizeConfigUtil::getBatchSize();
$memberCount = count($campaign->marketingList->marketingListMembers);
if ($memberCount < $expectedCount) {
$expectedCount = $memberCount;
}
$this->assertNotEmpty($campaignItems);
$this->assertCount($expectedCount, $campaignItems);
$this->assertEquals(Campaign::STATUS_PROCESSING, $campaign->status);
} else {
$this->assertEmpty($campaignItems);
$this->assertEquals(Campaign::STATUS_ACTIVE, $campaign->status);
}
}
$this->assertTrue(CampaignItemsUtil::generateCampaignItemsForDueCampaigns());
foreach ($campaignIds as $index => $campaignId) {
$campaign = Campaign::getById($campaignId);
$campaignItems = CampaignItem::getByProcessedAndCampaignId(0, $campaignId);
if ($index < 2) {
$expectedCount = AutoresponderOrCampaignBatchSizeConfigUtil::getBatchSize();
$memberCount = count($campaign->marketingList->marketingListMembers);
if ($memberCount < $expectedCount) {
$expectedCount = $memberCount;
}
$this->assertNotEmpty($campaignItems);
$this->assertCount($expectedCount, $campaignItems);
$this->assertEquals(Campaign::STATUS_PROCESSING, $campaign->status);
} else {
$this->assertEmpty($campaignItems);
$this->assertEquals(Campaign::STATUS_ACTIVE, $campaign->status);
}
}
// TODO: @Shoaibi: Medium: Add tests for the other campaign type.
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:76,代码来源:CampaignItemsUtilTest.php
示例20: resolveMembers
protected function resolveMembers($unsubscribed, Contact $contact, $marketingListId, $optOut)
{
if ($optOut) {
$members = MarketingListMember::getByContactIdAndSubscribed($contact->id, $unsubscribed);
} else {
$members = MarketingListMember::getByMarketingListIdContactIdAndUnsubscribed($marketingListId, $contact->id, $unsubscribed);
}
if (!is_array($members) && $members !== false) {
$members = array($members);
}
if (empty($members)) {
$marketingList = MarketingList::getById(intval($marketingListId));
if ($unsubscribed === 1 && !empty($marketingList) && $marketingList->anyoneCanSubscribe && !$marketingList->memberAlreadyExists($contact->id)) {
$members[0] = new MarketingListMember();
$members[0]->contact = $contact;
$members[0]->marketingList = $marketingList;
} else {
return false;
}
}
return $members;
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:22,代码来源:ExternalController.php
注:本文中的MarketingList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论