当前位置: 首页>>代码示例>>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;未经允许,请勿转载。