當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Campaign::getByStatus方法代碼示例

本文整理匯總了PHP中Campaign::getByStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP Campaign::getByStatus方法的具體用法?PHP Campaign::getByStatus怎麽用?PHP Campaign::getByStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Campaign的用法示例。


在下文中一共展示了Campaign::getByStatus方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: markProcessedCampaignsAsCompleted

 /**
  * @param null $pageSize | int $pageSize
  * @return bool
  */
 public static function markProcessedCampaignsAsCompleted($pageSize = null)
 {
     if ($pageSize != null) {
         $resolvedPageSize = $pageSize + 1;
     } else {
         $resolvedPageSize = $pageSize;
     }
     $processingCampaigns = Campaign::getByStatus(Campaign::STATUS_PROCESSING, $resolvedPageSize);
     $campaignsProcessed = 0;
     foreach ($processingCampaigns as $processingCampaign) {
         if ($campaignsProcessed < $pageSize || $pageSize == null) {
             if (static::areAllCampaignItemsProcessed($processingCampaign->id)) {
                 $processingCampaign->status = Campaign::STATUS_COMPLETED;
                 if (!$processingCampaign->save()) {
                     return false;
                 }
             }
             $campaignsProcessed++;
         } else {
             Yii::app()->jobQueue->add('CampaignMarkCompleted', 5);
             break;
         }
     }
     return true;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:29,代碼來源:CampaignsUtil.php

示例2: markProcessedCampaignsAsCompleted

 /**
  * @param null $pageSize | int $pageSize
  * @return bool
  */
 public static function markProcessedCampaignsAsCompleted($pageSize = null)
 {
     $processingCampaigns = Campaign::getByStatus(Campaign::STATUS_PROCESSING, $pageSize);
     foreach ($processingCampaigns as $processingCampaign) {
         if (static::areAllCampaignItemsProcessed($processingCampaign->id)) {
             $processingCampaign->status = Campaign::STATUS_COMPLETED;
             if (!$processingCampaign->save()) {
                 return false;
             }
         }
     }
     return true;
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:17,代碼來源:CampaignsUtil.php

示例3: testGetByStatus

 /**
  * @depends testCreateAndGetCampaignListById
  */
 public function testGetByStatus()
 {
     $totalCampaigns = Campaign::getAll();
     $this->assertNotEmpty($totalCampaigns);
     $this->assertCount(4, $totalCampaigns);
     $dueActiveCampaigns = Campaign::getByStatus(Campaign::STATUS_ACTIVE);
     $this->assertNotEmpty($dueActiveCampaigns);
     $this->assertCount(3, $dueActiveCampaigns);
     $campaign = $dueActiveCampaigns[0];
     $this->assertEquals('Test Campaign Name2', $campaign->name);
     $this->assertEquals(0, $campaign->supportsRichText);
     $this->assertEquals('From Name2', $campaign->fromName);
     $this->assertEquals('from2@zurmo.com', $campaign->fromAddress);
     $this->assertEquals('Test Subject2', $campaign->subject);
     $this->assertEquals('Test Html Content2', $campaign->htmlContent);
     $this->assertEquals('Test Text Content2', $campaign->textContent);
     $duePausedCampaigns = Campaign::getByStatus(Campaign::STATUS_PAUSED);
     $this->assertNotEmpty($duePausedCampaigns);
     $this->assertCount(1, $duePausedCampaigns);
     $campaign = $duePausedCampaigns[0];
     $this->assertEquals('Test Campaign Name', $campaign->name);
     $this->assertEquals(1, $campaign->supportsRichText);
     $this->assertEquals(Campaign::STATUS_PAUSED, $campaign->status);
     $this->assertEquals('From Name', $campaign->fromName);
     $this->assertEquals('from@zurmo.com', $campaign->fromAddress);
     $this->assertEquals('Test Subject', $campaign->subject);
     $this->assertEquals('Test Html Content', $campaign->htmlContent);
     $this->assertEquals('Test Text Content', $campaign->textContent);
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:32,代碼來源:CampaignTest.php


注:本文中的Campaign::getByStatus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。