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


PHP Formatter::formatTimeInterval方法代码示例

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


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

示例1: elseif

        if ($data->completeDate) {
            echo ' - ' . Formatter::formatLongDate($data->completeDate);
        }
    } else {
        echo Formatter::formatLongDateTime($data->dueDate);
        if ($data->completeDate) {
            echo ' - ' . Formatter::formatLongDateTime($data->completeDate);
        }
    }
    echo '</b>';
} elseif ($data->type == 'call') {
    echo Yii::t('actions', 'Call:') . ' ' . ($data->completeDate == $data->dueDate ? Formatter::formatCompleteDate($data->completeDate) : Formatter::formatTimeInterval($data->dueDate, $data->completeDate, '{start}; {decHours} ' . Yii::t('app', 'hours')));
} elseif ($data->type == 'webactivity') {
    echo Yii::t('actions', 'This contact visited your website');
} elseif ($data->type == 'time') {
    echo Formatter::formatTimeInterval($data->dueDate, $data->dueDate + $data->timeSpent);
} else {
    $timeFormat = Formatter::formatCompleteDate($data->getRelevantTimestamp());
    if ($data->type == 'attachment') {
        if ($data->completedBy === 'Email') {
            $label = 'Email Message:';
        } else {
            $label = 'Attachment:';
        }
    } elseif ($data->type == 'quotes') {
        $label = 'Quote:';
    } elseif (in_array($data->type, array('email', 'emailFrom', 'email_quote', 'email_invoice'))) {
        $label = 'Email Message:';
    } elseif (in_array($data->type, array('emailOpened', 'emailOpened_quote', 'email_opened_invoice'))) {
        $label = 'Email Opened:';
    }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:31,代码来源:_view.php

示例2: getText

 public function getText(array $params = array(), array $htmlOptions = array())
 {
     $truncated = array_key_exists('truncated', $params) ? $params['truncated'] : false;
     $requireAbsoluteUrl = array_key_exists('requireAbsoluteUrl', $params) ? $params['requireAbsoluteUrl'] : false;
     $text = "";
     $authorText = "";
     if (Yii::app()->user->getName() == $this->user) {
         $authorText = CHtml::link(Yii::t('app', 'You'), Yii::app()->controller->createAbsoluteUrl('/profile/view', array('id' => Yii::app()->user->getId())), $htmlOptions);
     } else {
         $authorText = User::getUserLinks($this->user);
     }
     if (!empty($authorText)) {
         $authorText .= " ";
     }
     switch ($this->type) {
         case 'notif':
             $parent = X2Model::model('Notification')->findByPk($this->associationId);
             if (isset($parent)) {
                 $text = $parent->getMessage();
             } else {
                 $text = Yii::t('app', "Notification not found");
             }
             break;
         case 'record_create':
             $actionFlag = false;
             if (class_exists($this->associationType)) {
                 if (count(X2Model::model($this->associationType)->findAllByPk($this->associationId)) > 0) {
                     if ($this->associationType == 'Actions') {
                         $action = X2Model::model('Actions')->findByPk($this->associationId);
                         if (isset($action) && (strcasecmp($action->associationType, 'contacts') === 0 || in_array($action->type, array('call', 'note', 'time')))) {
                             // Special considerations for publisher-created actions, i.e. call,
                             // note, time, and anything associated with a contact
                             $actionFlag = true;
                             // Retrieve the assigned user from the related action
                             $relatedAction = Actions::model()->findByPk($this->associationId);
                             if ($authorText) {
                                 $authorText = User::getUserLinks($relatedAction->assignedTo);
                             }
                         }
                     }
                     if ($actionFlag) {
                         $authorText = empty($authorText) ? Yii::t('app', 'Someone') : $authorText;
                         switch ($action->type) {
                             case 'call':
                                 $text = Yii::t('app', '{authorText} logged a call ({duration}) with {modelLink}: "{logAbbrev}"', array('{authorText}' => $authorText, '{duration}' => empty($action->dueDate) || empty($action->completeDate) ? Yii::t('app', 'duration unknown') : Formatter::formatTimeInterval($action->dueDate, $action->completeDate, '{hoursMinutes}'), '{modelLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType), $requireAbsoluteUrl), '{logAbbrev}' => CHtml::encode($action->actionDescription)));
                                 break;
                             case 'note':
                                 $text = Yii::t('app', '{authorText} posted a comment on {modelLink}: "{noteAbbrev}"', array('{authorText}' => $authorText, '{modelLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType), $requireAbsoluteUrl), '{noteAbbrev}' => CHtml::encode($action->actionDescription)));
                                 break;
                             case 'time':
                                 $text = Yii::t('app', '{authorText} logged {time} on {modelLink}: "{noteAbbrev}"', array('{authorText}' => $authorText, '{time}' => Formatter::formatTimeInterval($action->dueDate, $action->dueDate + $action->timeSpent, '{hoursMinutes}'), '{modelLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType)), '{noteAbbrev}' => CHtml::encode($action->actionDescription)));
                                 break;
                             default:
                                 if (!empty($authorText)) {
                                     $text = Yii::t('app', "A new {actionLink} associated with the contact {contactLink} has been assigned to " . $authorText, array('{actionLink}' => CHtml::link(Events::parseModelName($this->associationType), '#', array_merge($htmlOptions, array('class' => 'action-frame-link', 'data-action-id' => $this->associationId))), '{contactLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType), $requireAbsoluteUrl)));
                                 } else {
                                     $text = Yii::t('app', "A new {actionLink} associated with the contact {contactLink} has been created.", array('{actionLink}' => CHtml::link(Events::parseModelName($this->associationType), '#', array_merge($htmlOptions, array('class' => 'action-frame-link', 'data-action-id' => $this->associationId))), '{contactLink}' => X2Model::getModelLink($action->associationId, ucfirst($action->associationType), $requireAbsoluteUrl)));
                                 }
                         }
                     } else {
                         if (!empty($authorText)) {
                             $modelLink = X2Model::getModelLink($this->associationId, $this->associationType, $requireAbsoluteUrl);
                             if (isset($action) && $this->user !== $action->assignedTo) {
                                 // Include the assignee if this is for an action assigned to someone other than the creator
                                 $translateText = "created a new {modelName} for {assignee}, {modelLink}";
                             } elseif ($modelLink !== '') {
                                 $translateText = "created a new {modelName}, {modelLink}";
                             } else {
                                 $translateText = "created a new {modelName}";
                             }
                             $text = $authorText . Yii::t('app', $translateText, array('{modelName}' => Events::parseModelName($this->associationType), '{modelLink}' => $modelLink, '{assignee}' => isset($action) ? User::getUserLinks($action->assignedTo) : null));
                         } else {
                             $text = Yii::t('app', "A new {modelName}, {modelLink}, has been created.", array('{modelName}' => Events::parseModelName($this->associationType), '{modelLink}' => X2Model::getModelLink($this->associationId, $this->associationType, $requireAbsoluteUrl)));
                         }
                     }
                 } else {
                     $deletionEvent = X2Model::model('Events')->findByAttributes(array('type' => 'record_deleted', 'associationType' => $this->associationType, 'associationId' => $this->associationId));
                     if (isset($deletionEvent)) {
                         if (!empty($authorText)) {
                             $text = $authorText . Yii::t('app', "created a new {modelName}, {deletionText}. It has been deleted.", array('{modelName}' => Events::parseModelName($this->associationType), '{deletionText}' => $deletionEvent->text));
                         } else {
                             $text = Yii::t('app', "A {modelName}, {deletionText}, was created. It has been deleted.", array('{modelName}' => Events::parseModelName($this->associationType), '{deletionText}' => $deletionEvent->text));
                         }
                     } else {
                         if (!empty($authorText)) {
                             $text = $authorText . Yii::t('app', "created a new {modelName}, but it could not be found.", array('{modelName}' => Events::parseModelName($this->associationType)));
                         } else {
                             $text = Yii::t('app', "A {modelName} was created, but it could not be found.", array('{modelName}' => Events::parseModelName($this->associationType)));
                         }
                     }
                 }
             }
             break;
         case 'weblead_create':
             if (count(X2Model::model($this->associationType)->findAllByPk($this->associationId)) > 0) {
                 $text = Yii::t('app', "A new web lead has come in: {modelLink}", array('{modelLink}' => X2Model::getModelLink($this->associationId, $this->associationType)));
             } else {
                 $deletionEvent = X2Model::model('Events')->findByAttributes(array('type' => 'record_deleted', 'associationType' => $this->associationType, 'associationId' => $this->associationId));
                 if (isset($deletionEvent)) {
                     $text = Yii::t('app', "A new web lead has come in: {deletionText}. It has been deleted.", array('{deletionText}' => $deletionEvent->text));
//.........这里部分代码省略.........
开发者ID:shuvro35,项目名称:X2CRM,代码行数:101,代码来源:Events.php


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