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


PHP DateTimeUtil::getMonthName方法代碼示例

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


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

示例1: resolveData

 public function resolveData(&$data)
 {
     $dateTime = $this->model->{$this->attribute};
     $data[] = DateTimeUtil::getMonthName($dateTime);
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:5,代碼來源:GroupByModifierMonthForReportToExportValueAdapter.php

示例2: resolveValueAsLabelForHeaderCell

 /**
  * Raw values such as those used by the header x-axis or y-axis rows/columns need to be translated. An example
  * is a dropdown where the value is the raw database value and needs to be properly translated for display.
  * Another example is dynamic __User, where the value is the user id, and needs to be stringified to the User
  * model.
  * @param $value
  * @return string
  */
 public function resolveValueAsLabelForHeaderCell($value, $forExport = false)
 {
     $tContent = null;
     $translatedValue = $value;
     $resolvedAttribute = $this->getResolvedAttribute();
     $displayElementType = $this->getDisplayElementType();
     $modelToReportAdapter = $this->makeResolvedAttributeModelRelationsAndAttributesToReportAdapter();
     if ($modelToReportAdapter->getModel()->isAttribute($resolvedAttribute) && $modelToReportAdapter->getModel()->isRelation($resolvedAttribute) && !$modelToReportAdapter->getModel()->isOwnedRelation($resolvedAttribute)) {
         $relationModelClassName = $modelToReportAdapter->getModel()->getRelationModelClassName($resolvedAttribute);
         $relatedModel = $relationModelClassName::getById((int) $value);
         if ($relatedModel->isAttribute('serializedLabels')) {
             $translatedValue = $relatedModel->resolveTranslatedNameByLanguage(Yii::app()->language);
         }
     } elseif ($displayElementType == 'User') {
         $user = User::getById((int) $value);
         $translatedValue = strval($user);
     } elseif ($displayElementType == 'DropDown') {
         $customFieldData = CustomFieldDataModelUtil::getDataByModelClassNameAndAttributeName($this->getResolvedAttributeModelClassName(), $this->getResolvedAttribute());
         $dataAndLabels = CustomFieldDataUtil::getDataIndexedByDataAndTranslatedLabelsByLanguage($customFieldData, Yii::app()->language);
         if (isset($dataAndLabels[$value])) {
             $translatedValue = $dataAndLabels[$value];
         }
     } elseif ($displayElementType == 'CheckBox') {
         if ($value) {
             $translatedValue = Zurmo::t('Core', 'Yes');
         } elseif ($value == false && $value != '') {
             $translatedValue = Zurmo::t('Core', 'No');
         }
     } elseif ($displayElementType == 'GroupByModifierMonth') {
         $translatedValue = DateTimeUtil::getMonthName($value);
     }
     if ($translatedValue === null) {
         $translatedValue = '';
     }
     if ($this->isALinkableAttribute() && !$forExport) {
         $modelClassName = get_class($modelToReportAdapter->getModel());
         $moduleClassName = $modelToReportAdapter->getModuleClassName();
         if (isset($relationModelClassName)) {
             $modelClassName = $relationModelClassName;
         }
         return ReportResultsGridUtil::makeStringForMultipleLinks($value, $modelClassName, $moduleClassName);
     }
     return $translatedValue;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:52,代碼來源:DisplayAttributeForReportForm.php


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