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


PHP DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay方法代碼示例

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


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

示例1: renderExpirationDateTimeContent

 protected static function renderExpirationDateTimeContent(GameReward $gameReward)
 {
     if (!DateTimeUtil::isDateTimeStringNull($gameReward->expirationDateTime)) {
         $content = Zurmo::t('ZurmoModule', 'Until') . ' ';
         return $content . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($gameReward->expirationDateTime);
     }
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:7,代碼來源:GameRewardRedeemSummaryListViewColumnAdapter.php

示例2: renderControlNonEditable

 /**
  * Renders the attribute from the model.
  * @return The element's content.
  */
 protected function renderControlNonEditable()
 {
     if ($this->model->{$this->attribute} != null) {
         $content = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->{$this->attribute});
         return ZurmoHtml::encode($content);
     }
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:11,代碼來源:DateTimeElement.php

示例3: renderItemAndCommentsContent

 /**
  * Renders and returns string content of summary content for the given model.
  * @param RedBeanModel $model
  * @param mixed $redirectUrl
  * @param string $ownedByFilter
  * @param string $viewModuleClassName
  * @return string content
  */
 public static function renderItemAndCommentsContent(SocialItem $model, $redirectUrl, $renderToUserString)
 {
     assert('is_string($redirectUrl) || $redirectUrl == null');
     $userUrl = Yii::app()->createUrl('/users/default/details', array('id' => $model->owner->id));
     $content = '<div class="social-item">';
     $avatarImage = $model->owner->getAvatarImage(50);
     $content .= '<div class="comment model-details-summary clearfix">';
     $content .= '<span class="user-details">' . ZurmoHtml::link($avatarImage, $userUrl);
     $content .= '</span>';
     $userLink = ZurmoHtml::link(strval($model->owner), $userUrl, array('class' => 'user-link'));
     $content .= '<div class="comment-content"><p>';
     if ($model->toUser->id > 0 && $renderToUserString) {
         $toUserUrl = Yii::app()->createUrl('/users/default/details', array('id' => $model->toUser->id));
         $toUserLink = ZurmoHtml::link(strval($model->toUser), $toUserUrl, array('class' => 'user-link'));
         $content .= Zurmo::t('SocialItemsModule', '{postedFromUser} to {postedToUser}', array('{postedFromUser}' => $userLink, '{postedToUser}' => $toUserLink));
     } else {
         $content .= $userLink;
     }
     $content .= '</p>';
     $content .= self::renderModelDescription($model) . '</div>';
     $content .= self::renderAfterDescriptionContent($model);
     $content .= self::renderItemFileContent($model);
     $content .= '<span class="comment-details"><strong>' . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($model->createdDateTime, 'long', null) . '</strong>';
     if ($model->canUserDelete(Yii::app()->user->userModel)) {
         $content .= ' · <span class="delete-comment">' . self::renderDeleteLinkContent($model) . '</span></span>';
     }
     $content .= '</div>';
     $content .= self::renderCommentsContent($model);
     $content .= self::renderCreateCommentContent($model);
     $content .= '</div>';
     self::registerListColumnScripts();
     return $content;
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:41,代碼來源:SocialItemsUtil.php

示例4: renderDaySummaryContent

 /**
  * @param Meeting $meeting
  * @param string $link
  * @return string
  */
 public static function renderDaySummaryContent(Meeting $meeting, $link)
 {
     $content = null;
     $content .= '<h3>' . $meeting->name . '<span>' . $link . '</span></h3>';
     $content .= DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($meeting->startDateTime);
     $localEndDateTime = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($meeting->endDateTime);
     if ($localEndDateTime != null) {
         $content .= ' - ' . $localEndDateTime;
     }
     $content .= '<br/>';
     $content .= self::renderActivityItemsContentsExcludingContacts($meeting);
     if (count($meeting->activityItems) > 0) {
         $contactsContent = null;
         $contactLabels = self::getExistingContactRelationsLabels($meeting->activityItems);
         foreach ($contactLabels as $label) {
             if ($contactsContent != null) {
                 $contactsContent .= ', ';
             }
             $contactsContent .= $label;
         }
         $content .= $contactsContent . '<br/>';
     }
     if ($meeting->description != null) {
         $content .= '<br/>';
         $content .= Zurmo::t('MeetingsModule', 'Description') . ':<br/>';
         $content .= $meeting->description;
     }
     return $content;
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:34,代碼來源:MeetingsUtil.php

示例5: getData

 /**
  * Runs a query to get all the dates for meetings based on SearchAttributeData.  Then the data is processed
  * and @returns a data array of dates and quantity.  Quantity stands for how many meetings in a given date.
  * (non-PHPdoc)
  * @see CalendarDataProvider::getData()
  */
 public function getData()
 {
     $sql = $this->makeSqlQuery();
     $rows = ZurmoRedBean::getAll($sql);
     $data = array();
     foreach ($rows as $row) {
         $localTimeZoneAdjustedDate = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($row['startdatetime'], 'medium', null);
         if (isset($data[$localTimeZoneAdjustedDate])) {
             $data[$localTimeZoneAdjustedDate]['quantity'] = $data[$localTimeZoneAdjustedDate]['quantity'] + 1;
         } else {
             $data[$localTimeZoneAdjustedDate] = array('date' => $localTimeZoneAdjustedDate, 'quantity' => 1, 'dbDate' => $row['startdatetime']);
         }
     }
     foreach ($data as $key => $item) {
         if ($item['quantity'] == 1) {
             $label = Zurmo::t('MeetingsModule', '{quantity} MeetingsModuleSingularLabel', array_merge(LabelUtil::getTranslationParamsForAllModules(), array('{quantity}' => $item['quantity'])));
         } else {
             $label = Zurmo::t('MeetingsModule', '{quantity} MeetingsModulePluralLabel', array_merge(LabelUtil::getTranslationParamsForAllModules(), array('{quantity}' => $item['quantity'])));
         }
         $data[$key]['label'] = $label;
         if ($item['quantity'] > 5) {
             $quantityClassSuffix = 6;
         } else {
             $quantityClassSuffix = $item['quantity'];
         }
         $data[$key]['className'] = 'calendar-events-' . $quantityClassSuffix;
     }
     return $data;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:35,代碼來源:MeetingsCalendarDataProvider.php

示例6: renderDescriptionContent

 protected function renderDescriptionContent()
 {
     $innerContent = '<b>' . $this->model->getAttributeLabel('sendOnDateTime') . ':</b> ';
     $innerContent .= DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->sendOnDateTime);
     $innerContent .= "</BR><b>" . $this->model->getAttributeLabel('subject') . ':</b> ';
     $innerContent .= $this->model->subject;
     $content = ZurmoHtml::tag('div', array('class' => static::DESCRIPTION_CLASS), $innerContent);
     return $content;
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:9,代碼來源:CampaignDetailsOverlayView.php

示例7: testUpdateDueDateTimeViaAjax

 /**
  * @depends testInlineCreateCommentFromAjax
  */
 public function testUpdateDueDateTimeViaAjax()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $tasks = Task::getByName('aTest');
     $task = $tasks[0];
     $taskId = $task->id;
     $this->setGetArray(array('id' => $task->id, 'dateTime' => '7/23/13 12:00 am'));
     $this->runControllerWithNoExceptionsAndGetContent('tasks/default/updateDueDateTimeViaAjax', true);
     $task = Task::getById($taskId);
     $displayDateTime = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($task->dueDateTime);
     $this->assertEquals('7/23/13 12:00 AM', $displayDateTime);
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:15,代碼來源:TaskAjaxSuperUserWalkthroughTest.php

示例8: renderEditableFirstValueContent

 /**
  * @return string
  */
 protected function renderEditableFirstValueContent()
 {
     $value = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->value);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip("EditableDateTimeElement");
     $cClipWidget->widget('application.core.widgets.ZurmoJuiDateTimePicker', array('value' => $value, 'htmlOptions' => $this->getHtmlOptionsForFirstValue()));
     $cClipWidget->endClip();
     $inputContent = $cClipWidget->getController()->clips['EditableDateTimeElement'];
     $inputContent = ZurmoHtml::tag('div', array('class' => 'has-date-select'), $inputContent);
     $error = $this->form->error($this->model, 'value', array('inputID' => $this->getFirstValueEditableInputId()));
     return $inputContent . $error;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:15,代碼來源:MixedDateTimeTypesForWorkflowActionAttributeElement.php

示例9: testGetImageSummary

 public function testGetImageSummary()
 {
     $imageFileModel = new ImageFileModel();
     $imageFileModel->name = 'test.gif';
     $imageFileModel->width = 100;
     $imageFileModel->height = 300;
     $imageFileModel->type = 'image/gif';
     $imageFileModel->save();
     $createdDateTime = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($imageFileModel->createdDateTime);
     $expectedContent = '<div class="builder-image-details"><strong>test.gif</strong><br />0 · 100 × 300 · Created by (Unnamed) on ' . $createdDateTime . '</div>';
     $this->assertContains($expectedContent, ImageFileModelUtil::getImageSummary($imageFileModel));
     $expectedContent = $createdDateTime . ' by (Unnamed) 100 × 300';
     $this->assertContains($expectedContent, ImageFileModelUtil::getImageSummary($imageFileModel, "{createdTime} by {creator} {dimensions}"));
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:14,代碼來源:ImageFileModelUtilTest.php

示例10: renderNonEditableContent

 /**
  * Combines the 'user' with the 'datetime stamp'
  * into a single string
  * @return The element's content.
  */
 protected function renderNonEditableContent($attributeName)
 {
     assert('$attributeName == "created"  || $attributeName == "modified"');
     $userModelName = $attributeName . 'ByUser';
     $dateTimeAttributeName = $attributeName . 'DateTime';
     assert('$this->model->isAttribute($dateTimeAttributeName)');
     if (empty($this->model->{$dateTimeAttributeName})) {
         return Zurmo::t('Core', 'Unknown');
     }
     $content = ZurmoHtml::encode(DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->{$dateTimeAttributeName}));
     if ($this->model->{$userModelName}->id > 0) {
         $content .= '&#160;' . Zurmo::t('Core', 'by') . '&#160;' . Yii::app()->format->text($this->model->{$userModelName});
     }
     return $content;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:20,代碼來源:DateTimeUserElement.php

示例11: renderMissionContent

 protected function renderMissionContent()
 {
     $userUrl = Yii::app()->createUrl('/users/default/details', array('id' => $this->model->createdByUser->id));
     $content = '<div class="comment model-details-summary">';
     $content .= ZurmoHtml::link($this->model->createdByUser->getAvatarImage(100), $userUrl);
     $content .= '<span class="user-details">';
     $content .= ZurmoHtml::link(strval($this->model->createdByUser), $userUrl, array('class' => 'user-link'));
     $content .= '</span>';
     $element = new TextAreaElement($this->model, 'description');
     $element->nonEditableTemplate = '<div class="comment-content">{content}</div>';
     $content .= $element->render();
     if ($this->model->reward != null) {
         $element = new TextElement($this->model, 'reward');
         $element->nonEditableTemplate = '<div class="comment-content">' . Zurmo::t('MissionsModule', 'Reward') . ': {content}</div>';
         $content .= $element->render();
     }
     if ($this->model->takenByUser->id > 0) {
         $element = new UserElement($this->model, 'takenByUser');
         $element->nonEditableTemplate = '<div class="comment-content">' . Zurmo::t('MissionsModule', 'Taken By') . ': {content}</div>';
         $content .= $element->render();
     }
     if (!DateTimeUtil::isDateTimeValueNull($this->model, 'dueDateTime')) {
         $element = new DateTimeElement($this->model, 'dueDateTime');
         $element->nonEditableTemplate = '<div class="comment-content">' . Zurmo::t('MissionsModule', 'Due') . ': {content}</div>';
         $content .= $element->render();
     }
     $date = '<span class="comment-details"><strong>' . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->createdDateTime, 'long', null) . '</strong></span>';
     $content .= $date;
     if ($this->model->files->count() > 0) {
         $element = new FilesElement($this->model, 'null');
         $element->nonEditableTemplate = '<div>{content}</div>';
         $content .= '<div><strong>' . Zurmo::t('MissionsModule', 'Attachments') . '</strong></div>';
         $content .= $element->render();
     }
     $element = new MissionStatusElement($this->model, 'status');
     $element->nonEditableTemplate = '<div class="comment-content">' . Zurmo::t('MissionsModule', 'Status') . ': {content}</div>';
     $content .= $element->render();
     $content .= '</div>';
     return ZurmoHtml::tag('div', array('id' => 'ModelDetailsSummaryView'), $content);
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:40,代碼來源:MissionDetailsView.php

示例12: renderSummaryContent

 /**
  * Renders and returns string content of summary content for the given model.
  * @param RedBeanModel $model
  * @param mixed $redirectUrl
  * @param string $ownedByFilter
  * @param string $viewModuleClassName
  * @return string content
  */
 public static function renderSummaryContent(RedBeanModel $model, $redirectUrl, $ownedByFilter, $viewModuleClassName)
 {
     assert('is_string($redirectUrl) || $redirectUrl == null');
     assert('is_string($ownedByFilter)');
     assert('is_string($viewModuleClassName)');
     $mashableActivityRules = MashableActivityRulesFactory::createMashableActivityRulesByModel(get_class($model));
     $orderByAttributeName = $mashableActivityRules->getLatestActivitiesOrderByAttributeName();
     $summaryContentTemplate = $mashableActivityRules->getSummaryContentTemplate($ownedByFilter, $viewModuleClassName);
     $content = '<div class="activity-item">';
     //Render icon
     $content .= '<em class="' . get_class($model) . '"></em>';
     //Render date
     $content .= '<strong class="activity-date">' . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($model->{$orderByAttributeName}, 'long', null) . '</strong>';
     $data = array();
     $data['modelStringContent'] = self::renderModelStringContent($model, $redirectUrl);
     $data['ownerStringContent'] = self::renderOwnerStringContent($model);
     $data['relatedModelsByImportanceContent'] = $mashableActivityRules->renderRelatedModelsByImportanceContent($model);
     $data['extraContent'] = self::resolveAndRenderExtraContent($model, $mashableActivityRules);
     //Render display content
     $content .= self::resolveContentTemplate($summaryContentTemplate, $data);
     $content .= '</div>';
     return $content;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:31,代碼來源:ActivitiesUtil.php

示例13: formatValue

 /**
  * @param DisplayAttributeForReportForm $displayAttribute
  * @param mixed $value
  * @return mixed
  * @throws NotSupportedException if the currencyConversionType is invalid or null, when the displayAttribute
  * is a currency type
  */
 protected function formatValue(DisplayAttributeForReportForm $displayAttribute, $value)
 {
     if ($displayAttribute->isATypeOfCurrencyValue()) {
         if ($this->report->getCurrencyConversionType() == Report::CURRENCY_CONVERSION_TYPE_ACTUAL) {
             return Yii::app()->numberFormatter->formatDecimal((double) $value);
         } elseif ($this->report->getCurrencyConversionType() == Report::CURRENCY_CONVERSION_TYPE_BASE) {
             return Yii::app()->numberFormatter->formatCurrency((double) $value, Yii::app()->currencyHelper->getBaseCode());
         } elseif ($this->report->getCurrencyConversionType() == Report::CURRENCY_CONVERSION_TYPE_SPOT) {
             return Yii::app()->numberFormatter->formatCurrency((double) $value * $this->report->getFromBaseToSpotRate(), $this->report->getSpotConversionCurrencyCode());
         } else {
             throw new NotSupportedException();
         }
     } elseif ($displayAttribute->getDisplayElementType() == 'Decimal') {
         return Yii::app()->numberFormatter->formatDecimal((double) $value);
     } elseif ($displayAttribute->getDisplayElementType() == 'Integer') {
         return Yii::app()->numberFormatter->formatDecimal((int) $value);
     } elseif ($displayAttribute->getDisplayElementType() == 'Date') {
         return DateTimeUtil::resolveValueForDateLocaleFormattedDisplay($value);
     } elseif ($displayAttribute->getDisplayElementType() == 'DateTime') {
         return DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($value);
     } else {
         return $value;
     }
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:31,代碼來源:ReportDataProviderToAmChartMakerAdapter.php

示例14: testConvertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero

 public function testConvertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero()
 {
     $timeZone = date_default_timezone_get();
     date_default_timezone_set('GMT');
     $dbValue = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('6/3/80 12:00 AM');
     $this->assertEquals('1980-06-03 00:00:00', $dbValue);
     //other locales
     Yii::app()->setLanguage('de');
     $displayValue = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('03.06.80 00:00');
     $this->assertEquals('1980-06-03 00:00:00', $displayValue);
     Yii::app()->setLanguage('it');
     $displayValue = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('03/06/80 00:00');
     $this->assertEquals('1980-06-03 00:00:00', $displayValue);
     Yii::app()->setLanguage('fr');
     $displayValue = DateTimeUtil::convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero('03/06/80 00:00');
     $this->assertEquals('1980-06-03 00:00:00', $displayValue);
     //test null value returns null.
     $displayValue = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay(null);
     $this->assertEquals(null, $displayValue);
     date_default_timezone_set($timeZone);
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:21,代碼來源:DateTimeUtilTest.php

示例15: renderCommentsContent

 protected function renderCommentsContent()
 {
     $content = null;
     $rows = 0;
     foreach (array_reverse($this->commentsData) as $comment) {
         //Skip the first if the page size is smaller than what is returned.
         if (count($this->commentsData) > $this->pageSize && $this->pageSize != null && $rows == 0) {
             $rows++;
             continue;
         }
         $userUrl = Yii::app()->createUrl('/users/default/details', array('id' => $comment->createdByUser->id));
         $stringContent = ZurmoHtml::link($comment->createdByUser->getAvatarImage(36), $userUrl);
         $userName = ZurmoHtml::link(strval($comment->createdByUser), $userUrl, array('class' => 'user-link'));
         $element = new TextAreaElement($comment, 'description');
         $element->nonEditableTemplate = '<div class="comment-content"><p>' . $userName . ': {content}</p>';
         $stringContent .= $element->render();
         //attachments
         if ($comment->files->count() > 0) {
             $stringContent .= FileModelDisplayUtil::renderFileDataDetailsWithDownloadLinksContent($comment, 'files', true);
         }
         if ($comment->createdByUser == Yii::app()->user->userModel || $this->relatedModel->createdByUser == Yii::app()->user->userModel || $this->relatedModel instanceof OwnedSecurableItem && $this->relatedModel->owner == Yii::app()->user->userModel) {
             $deleteCommentLink = ' · <span class="delete-comment">' . $this->renderDeleteLinkContent($comment) . '</span>';
             $editCommentLink = ' · <span class="edit-comment">' . $this->renderEditLinkContent($comment) . '</span>';
         } else {
             $deleteCommentLink = null;
             $editCommentLink = null;
         }
         $editCommentLink = null;
         //temporary until edit link is added
         $stringContent .= '<span class="comment-details"><strong>' . DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($comment->createdDateTime, 'long', null) . '</strong></span>' . $editCommentLink . $deleteCommentLink;
         $stringContent .= '</div>';
         $content .= '<div class="comment">' . $stringContent . '</div>';
         $rows++;
     }
     return $content;
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:36,代碼來源:CommentsForRelatedModelView.php


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