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


PHP Campaign::getAll方法代码示例

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


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

示例1: makeAll

 public function makeAll(&$demoDataHelper)
 {
     assert('$demoDataHelper instanceof DemoDataHelper');
     assert('$demoDataHelper->isSetRange("Contact")');
     assert('$demoDataHelper->isSetRange("Campaign")');
     $items = array();
     if ($this->loadMagnitude >= 100) {
         foreach (Campaign::getAll() as $campaign) {
             foreach ($campaign->marketingList->marketingListMembers as $marketingListMember) {
                 $item = new CampaignItem();
                 $item->campaign = $campaign;
                 $item->contact = $marketingListMember->contact;
                 $this->populateModel($item);
                 $saved = $item->unrestrictedSave();
                 assert('$saved');
                 $items[] = $item->id;
             }
         }
     } else {
         for ($i = 0; $i < $this->resolveQuantityToLoad(); $i++) {
             $item = new CampaignItem();
             $item->campaign = $demoDataHelper->getRandomByModelName('Campaign');
             $item->contact = $demoDataHelper->getRandomByModelName('Contact');
             $this->populateModel($item);
             $saved = $item->unrestrictedSave();
             assert('$saved');
             $items[] = $item->id;
         }
     }
     $demoDataHelper->setRangeByModelName('CampaignItem', $items[0], $items[count($items) - 1]);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:31,代码来源:CampaignItemsDemoDataMaker.php

示例2: testRunWithoutAnyCampaigns

 public function testRunWithoutAnyCampaigns()
 {
     $campaigns = Campaign::getAll();
     $this->assertEmpty($campaigns);
     $job = new CampaignMarkCompletedJob();
     $this->assertTrue($job->run());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:7,代码来源:CampaignMarkCompletedJobTest.php

示例3: testRunWithoutAnyCampaigns

 public function testRunWithoutAnyCampaigns()
 {
     $campaigns = Campaign::getAll();
     $this->assertEmpty($campaigns);
     $job = new CampaignGenerateDueCampaignItemsJob();
     $this->assertTrue($job->run());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:7,代码来源:CampaignGenerateDueCampaignItemsJobTest.php

示例4: teardown

 public function teardown()
 {
     $marketingLists = MarketingList::getAll();
     $this->assertCount(1, $marketingLists);
     $marketingLists[0]->delete();
     $campaigns = Campaign::getAll();
     $this->assertCount(1, $campaigns);
     $campaigns[0]->delete();
     parent::teardown();
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:10,代码来源:MarketingEmailsInThisListChartDataProviderTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $campaigns = Campaign::getAll();
     $contacts = Contact::getByName('test testson');
     $this->contact = $contacts[0];
     $this->campaignItem = $campaigns[0]->campaignItems[0];
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:CampaignItemSummaryListViewColumnAdapterTest.php

示例6: populateCampaignItem

 public static function populateCampaignItem($processed, $campaign = null, $contact = null)
 {
     assert('is_bool($processed)');
     assert('is_object($campaign) || $campaign === null');
     assert('is_object($contact) || $contact === null');
     if (empty($campaign)) {
         $campaigns = Campaign::getAll();
         if (!empty($campaigns)) {
             $campaign = RandomDataUtil::getRandomValueFromArray($campaigns);
         }
     }
     if (empty($contact)) {
         $contacts = Contact::getAll();
         if (!empty($contacts)) {
             $contact = RandomDataUtil::getRandomValueFromArray($contacts);
         }
     }
     $campaignItem = new CampaignItem();
     $campaignItem->processed = $processed;
     $campaignItem->campaign = $campaign;
     $campaignItem->contact = $contact;
     return $campaignItem;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:23,代码来源:CampaignItemTestHelper.php

示例7: purgeAllCampaigns

 protected function purgeAllCampaigns()
 {
     $campaigns = Campaign::getAll();
     foreach ($campaigns as $campaign) {
         $campaign->delete();
     }
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:7,代码来源:CampaignItemsUtilTest.php

示例8: testResolveContactAndMetricsSummary

 public function testResolveContactAndMetricsSummary()
 {
     //Test with super
     $content = CampaignItemSummaryListViewColumnAdapter::resolveContactAndMetricsSummary($this->campaignItem);
     $this->assertContains('test testson', $content);
     //Betty dont have access to contact
     $betty = User::getByUsername('betty');
     Yii::app()->user->userModel = $betty;
     $content = CampaignItemSummaryListViewColumnAdapter::resolveContactAndMetricsSummary($this->campaignItem);
     $this->assertContains('You cannot see this contact due to limited access', $content);
     //Giving betty access to contact
     Yii::app()->user->userModel = User::getByUsername('super');
     $this->contact->addPermissions($betty, Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
     $this->assertTrue($this->contact->save());
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($this->contact, $betty);
     //Forgetting campaignItem is needed because of commit - aeedffa06467
     //Not entirely sure why this is the case though. It only affects tests when securityOptimization is false
     $this->campaignItem->forgetAll();
     $campaigns = Campaign::getAll();
     $this->campaignItem = $campaigns[0]->campaignItems[0];
     //Betty has now access to contact but not the emailMessage
     Yii::app()->user->userModel = $betty;
     $content = CampaignItemSummaryListViewColumnAdapter::resolveContactAndMetricsSummary($this->campaignItem);
     $this->assertContains('You cannot see the performance metrics due to limited access', $content);
     //Giving betty access to emailMessage
     Yii::app()->user->userModel = User::getByUsername('super');
     $emailMessage = $this->campaignItem->emailMessage;
     $emailMessage->addPermissions($betty, Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
     $this->assertTrue($emailMessage->save());
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($emailMessage, $betty);
     //Betty has now access to contact and emailMessage
     Yii::app()->user->userModel = $betty;
     $content = CampaignItemSummaryListViewColumnAdapter::resolveContactAndMetricsSummary($this->campaignItem);
     $this->assertContains('test testson', $content);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:35,代码来源:CampaignItemSummaryListViewColumnAdapterTest.php

示例9: testDeleteCampaign

 /**
  * @depends testRequiredAttributes
  */
 public function testDeleteCampaign()
 {
     $campaigns = Campaign::getAll();
     $this->assertEquals(4, count($campaigns));
     CampaignItemTestHelper::createCampaignItem(0, $campaigns[0]);
     $campaignItems = CampaignItem::getAll();
     $this->assertCount(1, $campaignItems);
     $campaignItemActivity = new CampaignItemActivity();
     $campaignItemActivity->type = CampaignItemActivity::TYPE_CLICK;
     $campaignItemActivity->quantity = 1;
     $campaignItemActivity->campaignItem = $campaignItems[0];
     $campaignItemActivity->latestSourceIP = '121.212.122.112';
     $this->assertTrue($campaignItemActivity->save());
     $emailMessage = EmailMessageTestHelper::createOutboxEmail(Yii::app()->user->userModel, 'subject', 'html', 'text', 'from', 'from@zurmo.com', 'to', 'to@zurmo.com');
     $campaignItems[0]->emailMessage = $emailMessage;
     $this->assertTrue($campaignItems[0]->unrestrictedSave());
     $this->assertEquals(1, CampaignItemActivity::getCount());
     $this->assertEquals(1, EmailMessage::getCount());
     $campaigns[0]->delete();
     $this->assertEquals(3, Campaign::getCount());
     $this->assertEquals(0, CampaignItem::getCount());
     $this->assertEquals(0, CampaignItemActivity::getCount());
     $this->assertEquals(1, EmailMessage::getCount());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:27,代码来源:CampaignTest.php

示例10: campanha_redirect_to_campaign_home

/**
 * Return the link to the campaign admin home page for the user
 * depending whether he has campaigns or not.
 *
 * @param WP_User $user
 * @return string url to list campaigns page or create new campaign page
 */
function campanha_redirect_to_campaign_home($user = null)
{
    if (!$user) {
        $user = wp_get_current_user();
    }
    $campaigns = Campaign::getAll($user->ID);
    if ($campaigns) {
        return admin_url(CAMPAIGN_LIST_URL);
    } else {
        return admin_url(CAMPAIGN_NEW_URL);
    }
}
开发者ID:adenilsonpaiva,项目名称:redelivre,代码行数:19,代码来源:campanha.php

示例11: testSuperUserCreateFromRelationAction

 /**
  * @depends testSuperUserDeleteAction
  */
 public function testSuperUserCreateFromRelationAction()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $campaigns = Campaign::getAll();
     $this->assertEquals(2, count($campaigns));
     $marketingList = MarketingListTestHelper::createMarketingListByName('my list');
     //Create a new campaign from a related marketing list.
     $this->setGetArray(array('relationAttributeName' => 'marketingList', 'relationModelId' => $marketingList->id, 'relationModuleId' => 'marketingLists', 'redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('Campaign' => array('name' => 'New Campaign using Create', 'fromName' => 'Zurmo Sales', 'fromAddress' => 'sales@zurmo.com', 'sendOnDateTime' => '6/13/2013 10:54 AM', 'subject' => 'New Campaign using Create Subject', 'enableTracking' => '1', 'supportsRichText' => '0', 'textContent' => 'Text', 'htmlContent' => 'Html')));
     $this->runControllerWithRedirectExceptionAndGetContent('campaigns/default/createFromRelation');
     $campaigns = Campaign::getByName('New Campaign using Create');
     $this->assertEquals(1, count($campaigns));
     $this->assertTrue($campaigns[0]->id > 0);
     $this->assertTrue($campaigns[0]->owner == $super);
     $this->assertTrue($campaigns[0]->marketingList->id == $marketingList->id);
     $campaigns = Campaign::getAll();
     $this->assertEquals(3, count($campaigns));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:21,代码来源:CampaignDefaultControllerSuperUserWalkthroughTest.php

示例12: testDeleteCampaign

 /**
  * @depends testRequiredAttributes
  */
 public function testDeleteCampaign()
 {
     $campaigns = Campaign::getAll();
     $this->assertEquals(2, count($campaigns));
     $campaigns[0]->delete();
     $campaigns = Campaign::getAll();
     $this->assertEquals(1, count($campaigns));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:11,代码来源:CampaignTest.php

示例13: testSuperUserDeleteAction

 /**
  * @depends testSuperUserEditAction
  */
 public function testSuperUserDeleteAction()
 {
     $campaigns = Campaign::getAll();
     $this->assertEquals(3, count($campaigns));
     $this->setGetArray(array('id' => $campaigns[0]->id));
     $this->resetPostArray();
     $redirectUrl = $this->runControllerWithRedirectExceptionAndGetUrl('campaigns/default/delete');
     $compareRedirectUrl = Yii::app()->createUrl('campaigns/default/index');
     $this->assertEquals($redirectUrl, $compareRedirectUrl);
     $campaigns = Campaign::getAll();
     $this->assertEquals(2, count($campaigns));
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:15,代码来源:CampaignDefaultControllerSuperUserWalkthroughTest.php


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