当前位置: 首页>>代码示例>>PHP>>正文


PHP MarketingList::addNewMember方法代码示例

本文整理汇总了PHP中MarketingList::addNewMember方法的典型用法代码示例。如果您正苦于以下问题:PHP MarketingList::addNewMember方法的具体用法?PHP MarketingList::addNewMember怎么用?PHP MarketingList::addNewMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MarketingList的用法示例。


在下文中一共展示了MarketingList::addNewMember方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionLoadCampaignWithAllItemActivityTypes

 /**
  * Special method to load a campaign with all types of campaignItemActivity
  */
 public function actionLoadCampaignWithAllItemActivityTypes()
 {
     if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
         throw new NotSupportedException();
     }
     $emailBox = EmailBoxUtil::getDefaultEmailBoxByUser(Yii::app()->user->userModel);
     $marketingList = new MarketingList();
     $marketingList->name = 'Demo Marketing List';
     $marketingList->save();
     $campaign = new Campaign();
     $campaign->marketingList = $marketingList;
     $campaign->name = 'Campaign with all campaignItemActivity';
     $campaign->subject = 'Demo for all types of campaignItemActivities';
     $campaign->status = Campaign::STATUS_COMPLETED;
     $campaign->sendOnDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $campaign->supportsRichText = true;
     $campaign->htmlContent = 'Demo content';
     $campaign->fromName = 'Zurmo';
     $campaign->fromAddress = 'zurmo@zurmo.org';
     $campaign->enableTracking = true;
     $saved = $campaign->save();
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     $contacts = Contact::getAll();
     //Awaiting queue
     $contact = $contacts[0];
     $campaignItem = new CampaignItem();
     $campaignItem->processed = true;
     $campaignItem->campaign = $campaign;
     $campaignItem->contact = $contact;
     $campaignItem->unrestrictedSave();
     //Contact is not subscribed
     $contact = $contacts[1];
     $marketingList->addNewMember($contact->id, true);
     $campaignItem = new CampaignItem();
     $campaignItem->processed = true;
     $campaignItem->campaign = $campaign;
     $campaignItem->contact = $contact;
     $activity = new CampaignItemActivity();
     $activity->person = $contact;
     $activity->campaignItem = $campaignItem;
     $activity->quantity = 1;
     $activity->type = CampaignItemActivity::TYPE_SKIP;
     $activity->save();
     $campaignItem->unrestrictedSave();
     //Skipped, both primary and secondary are opted out
     $contact = $contacts[2];
     $contact->primaryEmail->emailAddress = $contact->firstName . '1@zurmo.org';
     $contact->primaryEmail->optOut = true;
     $contact->secondaryEmail->emailAddress = $contact->firstName . '2@zurmo.org';
     $contact->secondaryEmail->optOut = true;
     $contact->save();
     $marketingList->addNewMember($contact->id);
     $campaignItem = new CampaignItem();
     $campaignItem->processed = true;
     $campaignItem->campaign = $campaign;
     $campaignItem->contact = $contact;
     $activity = new CampaignItemActivity();
     $activity->person = $contact;
     $activity->campaignItem = $campaignItem;
     $activity->quantity = 1;
     $activity->type = CampaignItemActivity::TYPE_SKIP;
     $activity->save();
     $campaignItem->unrestrictedSave();
     //Skipped, primary is opted out but secondary is not
     $contact = $contacts[3];
     $contact->primaryEmail->emailAddress = $contact->firstName . '1@zurmo.org';
     $contact->primaryEmail->optOut = true;
     $contact->secondaryEmail->emailAddress = $contact->firstName . '2@zurmo.org';
     $contact->secondaryEmail->optOut = false;
     $contact->save();
     $marketingList->addNewMember($contact->id);
     $campaignItem = new CampaignItem();
     $campaignItem->processed = true;
     $campaignItem->campaign = $campaign;
     $campaignItem->contact = $contact;
     $activity = new CampaignItemActivity();
     $activity->person = $contact;
     $activity->campaignItem = $campaignItem;
     $activity->quantity = 1;
     $activity->type = CampaignItemActivity::TYPE_SKIP;
     $activity->save();
     $campaignItem->unrestrictedSave();
     //Skipped, primary and secondary not set
     $contact = $contacts[4];
     $contact->primaryEmail = null;
     $contact->secondaryEmail = null;
     $contact->save();
     $marketingList->addNewMember($contact->id);
     $campaignItem = new CampaignItem();
     $campaignItem->processed = true;
     $campaignItem->campaign = $campaign;
     $campaignItem->contact = $contact;
     $activity = new CampaignItemActivity();
     $activity->person = $contact;
     $activity->campaignItem = $campaignItem;
//.........这里部分代码省略.........
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:101,代码来源:DemoController.php


注:本文中的MarketingList::addNewMember方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。