當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。