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


PHP BaseElementModel::getStatus方法代碼示例

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


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

示例1: getStatus

 /**
  * @inheritDoc BaseElementModel::getStatus()
  *
  * @return string|null
  */
 public function getStatus()
 {
     $status = parent::getStatus();
     if ($status == static::ENABLED && $this->postDate) {
         $currentTime = DateTimeHelper::currentTimeStamp();
         $postDate = $this->postDate->getTimestamp();
         $expiryDate = $this->expiryDate ? $this->expiryDate->getTimestamp() : null;
         if ($postDate <= $currentTime && (!$expiryDate || $expiryDate > $currentTime)) {
             return static::LIVE;
         } else {
             if ($postDate > $currentTime) {
                 return static::PENDING;
             } else {
                 return static::EXPIRED;
             }
         }
     }
     return $status;
 }
開發者ID:codeforamerica,項目名稱:oakland-beta,代碼行數:24,代碼來源:Venti_OutputModel.php

示例2: routeRequestForMatchedElement

 /**
  * Routes the request when the URI matches an element.
  *
  * @param BaseElementModel $element
  *
  * @return array|bool|mixed
  */
 public function routeRequestForMatchedElement(BaseElementModel $element)
 {
     // Make sure that the entry is actually live
     if ($element->getStatus() == EntryModel::LIVE) {
         $section = $element->getSection();
         // Make sure the section is set to have URLs and is enabled for this locale
         if ($section->hasUrls && array_key_exists(craft()->language, $section->getLocales())) {
             return array('action' => 'templates/render', 'params' => array('template' => $section->template, 'variables' => array('entry' => $element)));
         }
     }
     return false;
 }
開發者ID:paulcarvill,項目名稱:Convergence-craft,代碼行數:19,代碼來源:EntryElementType.php

示例3: getStatus

 /**
  * Pending -  has all required attributes and is disabled or
  *              does not have all required attributes
  * Ready -    has all required attributes, and is enabled
  * Archived - has been sent, or exported and manually marked archived
  */
 public function getStatus()
 {
     $status = parent::getStatus();
     // Required attributes :$campaign->mailer && $campaign->template
     // Enabled : static::ENABLED
     // Disabled : static::DISABLED
     // Archived : static::ARCHIVED
     // Sent (track sent dates in a sent log table)
     //
     // @todo We can make this conditional statement more
     // advanced and check for the Service Provider and determine
     // specific things about each service provider to decide if an
     // email is ready or not.  For now, we'll just check to see if
     // it has a service provider and text template.
     $campaign = sproutEmail()->campaigns->getCampaignById($this->campaignId);
     switch ($status) {
         case BaseElementModel::DISABLED:
             return static::DISABLED;
             break;
         case BaseElementModel::ENABLED:
             if ($this->sent) {
                 return static::ARCHIVED;
             }
             if (empty($campaign->template) or empty($campaign->mailer)) {
                 return static::PENDING;
             }
             return static::READY;
             break;
         case BaseElementModel::ARCHIVED:
             return static::ARCHIVED;
             break;
     }
 }
開發者ID:jackmcgreevy,項目名稱:fast,代碼行數:39,代碼來源:SproutEmail_EntryModel.php

示例4: routeRequestForMatchedElement

 /**
  * Routes the request when the URI matches a product.
  *
  * @param BaseElementModel $element
  *
  * @return array|bool|mixed
  */
 public function routeRequestForMatchedElement(BaseElementModel $element)
 {
     /** @var Market_ProductModel $element */
     if ($element->getStatus() == Market_ProductModel::LIVE) {
         $productType = $element->type;
         if ($productType->hasUrls) {
             return ['action' => 'templates/render', 'params' => ['template' => $productType->template, 'variables' => ['product' => $element]]];
         }
     }
     return false;
 }
開發者ID:aladrach,項目名稱:Bluefoot-Craft-Starter,代碼行數:18,代碼來源:Market_ProductElementType.php

示例5: getStatus

 /**
  * Returns the entry status based on actual values and dynamic checking
  *
  * Disabled - Entry is disabled
  * Archived - Entry has been manually set to archived
  * Pending  - Entry is enabled but some requirements are not yet met
  * Ready    - Entry is enabled and all requirements are met
  *
  * @return string
  */
 public function getStatus()
 {
     $status = parent::getStatus();
     $campaign = sproutEmail()->campaigns->getCampaignById($this->campaignId);
     switch ($status) {
         case BaseElementModel::DISABLED:
             return static::DISABLED;
             break;
         case BaseElementModel::ENABLED:
             if ($this->sent) {
                 return static::ARCHIVED;
             }
             if (empty($campaign->mailer) || empty($campaign->template)) {
                 return static::PENDING;
             }
             return static::READY;
             break;
         case BaseElementModel::ARCHIVED:
             return static::ARCHIVED;
             break;
     }
 }
開發者ID:aladrach,項目名稱:Bluefoot-Craft-Starter,代碼行數:32,代碼來源:SproutEmail_EntryModel.php


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