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


PHP DateTimeUtil::getTimeSinceDisplayContent方法代码示例

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


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

示例1: renderSubjectAndLatestForDisplayView

 /**
  * Renders string content for the conversation subject and either the description or latest conversation comment
  * if it exists.
  * @param Conversation $conversation
  * @return string
  */
 public static function renderSubjectAndLatestForDisplayView(Conversation $conversation)
 {
     $url = Yii::app()->createUrl('/conversations/default/details', array('id' => $conversation->id));
     $content = $conversation->subject;
     $details = ZurmoHtml::tag('span', array('class' => 'list-item-details'), DateTimeUtil::getTimeSinceDisplayContent($conversation->latestDateTime));
     $link = ZurmoHtml::link($content, $url);
     return $link . $details;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:14,代码来源:ConversationsUtil.php

示例2: getFeedInformationForDashboard

 /**
  * Get feed information if projects for user
  * @param ProjectAuditEvent $projectAuditEvent
  * @return string
  */
 public static function getFeedInformationForDashboard(ProjectAuditEvent $projectAuditEvent)
 {
     assert('$projectAuditEvent instanceof ProjectAuditEvent');
     $project = Project::getById(intval($projectAuditEvent->project->id));
     $dateTime = DateTimeUtil::getTimeSinceDisplayContent($projectAuditEvent->dateTime);
     $data = array('{timeSpanLabel}' => $dateTime);
     if (ActionSecurityUtil::canCurrentUserPerformAction('Details', $project)) {
         $projectName = static::resolveProjectName($project);
         $data['{projectname}'] = $projectName;
         $user = User::getById($projectAuditEvent->user->id);
         $data['{username}'] = $user->getFullName();
         $unserializedData = unserialize($projectAuditEvent->serializedData);
         if (is_array($unserializedData)) {
             $data = array_merge($unserializedData, $data);
         }
     } else {
         return Zurmo::t('ProjectsModule', '<strong>Activity on a restricted project
                                                </strong> <small>about {timeSpanLabel}</small>', $data);
     }
     return static::getMessageContentByEventAndData($projectAuditEvent->eventName, $data);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:26,代码来源:ProjectFeedListViewColumnAdapter.php

示例3: testTimeDifference

 public function testTimeDifference()
 {
     $time = date("Y-m-d H:i:s", strtotime('-5 hours', time()));
     $timeDiff = DateTimeUtil::getTimeSinceDisplayContent($time);
     $this->assertEquals('5 hours ago', $timeDiff);
     $time = date("Y-m-d H:i:s", strtotime('-5 days', time()));
     $timeDiff = DateTimeUtil::getTimeSinceDisplayContent($time);
     $this->assertEquals('5 days ago', $timeDiff);
     $time = date("Y-m-d H:i:s", strtotime('-5 minutes', time()));
     $timeDiff = DateTimeUtil::getTimeSinceDisplayContent($time);
     $this->assertEquals('5 minutes ago', $timeDiff);
     $time = date("Y-m-d H:i:s", strtotime('-5 seconds', time()));
     $timeDiff = DateTimeUtil::getTimeSinceDisplayContent($time);
     $this->assertEquals('5 seconds ago', $timeDiff);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:15,代码来源:ProjectAuditEventTest.php

示例4: renderListViewContent

 /**
  * @param Notification $notification
  * @return string
  */
 public static function renderListViewContent(Notification $notification)
 {
     $content = strval($notification);
     if ($content != null) {
         $content = '<b>' . $content . '</b>';
     }
     if ($notification->notificationMessage->id > 0) {
         if ($notification->notificationMessage->htmlContent != null) {
             $content .= ZurmoHtml::wrapLabel(Yii::app()->format->raw($notification->notificationMessage->htmlContent), "last-comment");
         } elseif ($notification->notificationMessage->textContent != null) {
             $content .= ZurmoHtml::wrapLabel(Yii::app()->format->text($notification->notificationMessage->textContent), "last-comment");
         }
     }
     $content .= ZurmoHtml::tag('span', array('class' => 'list-item-details'), DateTimeUtil::getTimeSinceDisplayContent($notification->createdDateTime));
     return $content;
 }
开发者ID:spiogit,项目名称:cna-seed-project,代码行数:20,代码来源:NotificationsUtil.php

示例5: testGetTimeSinceDisplayContent

 public function testGetTimeSinceDisplayContent()
 {
     //30 minutes ago
     $timeStampLatestUpdate = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 30 * 60);
     $timeSinceLastestUpdate = DateTimeUtil::getTimeSinceDisplayContent($timeStampLatestUpdate);
     $this->assertEquals($timeSinceLastestUpdate, '0 hours ago');
     //58 minutes ago
     $timeStampLatestUpdate = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 58 * 60);
     $timeSinceLastestUpdate = DateTimeUtil::getTimeSinceDisplayContent($timeStampLatestUpdate);
     $this->assertEquals($timeSinceLastestUpdate, '0 hours ago');
     //61 minutes ago
     $timeStampLatestUpdate = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 61 * 60);
     $timeSinceLastestUpdate = DateTimeUtil::getTimeSinceDisplayContent($timeStampLatestUpdate);
     $this->assertEquals($timeSinceLastestUpdate, '1 hour ago');
     //3 hours ago
     $timeStampLatestUpdate = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 3 * 60 * 60);
     $timeSinceLastestUpdate = DateTimeUtil::getTimeSinceDisplayContent($timeStampLatestUpdate);
     $this->assertEquals($timeSinceLastestUpdate, '3 hours ago');
     //27 hours ago
     $timeStampLatestUpdate = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 27 * 60 * 60);
     $timeSinceLastestUpdate = DateTimeUtil::getTimeSinceDisplayContent($timeStampLatestUpdate);
     $this->assertEquals($timeSinceLastestUpdate, '1 day ago');
     //10 days ago
     $timeStampLatestUpdate = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 10 * 24 * 60 * 60);
     $timeSinceLastestUpdate = DateTimeUtil::getTimeSinceDisplayContent($timeStampLatestUpdate);
     $this->assertEquals($timeSinceLastestUpdate, '10 days ago');
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:27,代码来源:DateTimeUtilTest.php

示例6: getModelCreationTimeContent

 public function getModelCreationTimeContent(RedBeanModel $model)
 {
     return DateTimeUtil::getTimeSinceDisplayContent($model->createdDateTime);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:4,代码来源:NotificationMashableInboxRules.php


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