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


PHP CurrencyField::getDisplayValueWithSymbol方法代碼示例

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


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

示例1: vttooltip_processResult

/**
 * this function processes the given result and returns the value :: for now we are getting the values for the
 * reference, owner fields, booleans and currency fields; other processing might be added later if required
 * @param array $result - the webservices result object
 * @param array $descObj - the webservices describe object
 * @return array $result - the processes webservices result object
 */
function vttooltip_processResult($result, $descObj)
{
    global $current_user;
    foreach ($descObj['fields'] as $field) {
        $name = $field['name'];
        $value = $result[0][$name];
        if ($field['type']['name'] == 'reference') {
            $name = $field['name'];
            if (!empty($value)) {
                $result[0][$name] = vtws_getName($value, $current_user);
            } else {
                $result[0][$name] = '';
            }
        } elseif ($field['type']['name'] == 'owner') {
            list($info, $id) = explode("x", $value);
            $result[0][$name] = getOwnerName($id);
        } elseif ($field['type']['name'] == 'boolean') {
            if ($result[0][$name] == 1) {
                $result[0][$name] = "on";
            } else {
                $result[0][$name] = "off";
            }
        } elseif ($field['type']['name'] == 'picklist') {
            $temp = '';
            foreach ($field['type']['picklistValues'] as $value) {
                if (strcmp($value['value'], $result[0][$name]) == 0) {
                    $temp = $value['value'];
                }
            }
            $result[0][$name] = $temp;
        } elseif ($field['type']['name'] == 'date') {
            $result[0][$name] = DateTimeField::convertToUserFormat($value);
        } elseif ($field['type']['name'] == 'datetime') {
            $date = new DateTimeField($value);
            $result[0][$name] = $date->getDisplayDateTimeValue();
        } elseif ($field['type']['name'] == 'time') {
            $date = new DateTimeField($value);
            $result[0][$name] = $date->getDisplayTime();
        } elseif ($field['type']['name'] == 'currency') {
            $currencyField = new CurrencyField($value);
            $result[0][$name] = $currencyField->getDisplayValueWithSymbol();
        }
    }
    return $result;
}
開發者ID:cannking,項目名稱:vtigercrm-debug,代碼行數:52,代碼來源:TooltipUtils.php

示例2: getFieldDisplayValue

 function getFieldDisplayValue($moduleName, $recordId, $fieldInstance, $value)
 {
     global $current_user;
     $adb = PearDatabase::getInstance();
     $fieldName = $fieldInstance->getFieldName();
     $uitype = $fieldInstance->getUIType();
     if ($moduleName == 'Documents') {
         if ($fieldName == 'filesize') {
             $filesize = $value;
             if (empty($fieldsize)) {
                 $value = '--';
             } elseif ($filesize < 1024) {
                 $value = $filesize . ' B';
             } elseif ($filesize > 1024 && $filesize < 1048576) {
                 $value = round($filesize / 1024, 2) . ' KB';
             } else {
                 if ($filesize > 1048576) {
                     $value = round($filesize / (1024 * 1024), 2) . ' MB';
                 }
             }
         }
         if ($fieldName == 'filestatus') {
             if ($value == 1) {
                 $value = getTranslatedString('yes', $moduleName);
             } elseif ($value == 0) {
                 $value = getTranslatedString('no', $moduleName);
             } else {
                 $value = '--';
             }
         }
         if ($fieldName == 'filetype') {
             if ($value == 1) {
                 $value = getTranslatedString('yes', $moduleName);
             } elseif ($value == 0) {
                 $value = getTranslatedString('no', $moduleName);
             } else {
                 $value = '--';
             }
         }
     }
     if ($fieldInstance->getUIType() == '27') {
         if ($value == 'I') {
             $value = getTranslatedString('LBL_INTERNAL', $moduleName);
         } elseif ($value == 'E') {
             $value = getTranslatedString('LBL_EXTERNAL', $moduleName);
         } else {
             $value = ' --';
         }
     }
     if ($fieldInstance->getFieldDataType() == 'picklist') {
         $isRoleBased = vtws_isRoleBasedPicklist($fieldName);
         if ($isRoleBased && ($fieldName != 'activitytype' || $value != 'Task')) {
             $accessiblePicklistValues = getAssignedPicklistValues($fieldName, $current_user->roleid, $adb);
             if (!empty($value) && !is_admin($current_user) && !in_array($value, $accessiblePicklistValues)) {
                 $value = "<font color='red'>" . getTranslatedString('LBL_NOT_ACCESSIBLE', $moduleName) . "</font>";
             } else {
                 $value = getTranslatedString($value, $moduleName);
             }
         } else {
             $value = getTranslatedString($value, $moduleName);
         }
     }
     if ($fieldInstance->getFieldDataType() == 'date' || $fieldInstance->getFieldDataType() == 'datetime' || $fieldInstance->getFieldDataType() == 'time') {
         if ($value != '' && $value != '0000-00-00') {
             $date = new DateTimeField($value);
             if ($fieldInstance->getFieldDataType() == 'date') {
                 $value = $date->getDisplayDate();
             }
             if ($fieldInstance->getFieldDataType() == 'datetime') {
                 $value = $date->getDisplayDateTimeValue();
             }
             if ($fieldInstance->getFieldDataType() == 'time') {
                 $value = $date->getDisplayTime();
             }
         } else {
             $value = '';
         }
     }
     if ($fieldInstance->getFieldDataType() == 'currency') {
         if ($value != '' && $value != 0) {
             if ($fieldInstance->getUIType() == 72) {
                 if ($fieldName == 'unit_price') {
                     $currencyId = getProductBaseCurrency($recordId, $moduleName);
                     $cursym_convrate = getCurrencySymbolandCRate($currencyId);
                     $currencySymbol = $cursym_convrate['symbol'];
                 } else {
                     $currencyInfo = getInventoryCurrencyInfo($moduleName, $recordId);
                     $currencySymbol = $currencyInfo['currency_symbol'];
                 }
                 $currencyValue = CurrencyField::convertToUserFormat($value, null, true);
                 $value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
             } else {
                 $currencyField = new CurrencyField($value);
                 $value = $currencyField->getDisplayValueWithSymbol();
             }
         }
     }
     if ($fieldInstance->getFieldDataType() == 'url') {
         $matchPattern = "^[\\w]+:\\/\\/^";
         preg_match($matchPattern, $value, $matches);
//.........這裏部分代碼省略.........
開發者ID:casati-dolibarr,項目名稱:corebos,代碼行數:101,代碼來源:ModTracker_Field.php


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