本文整理汇总了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;
}
示例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);
//.........这里部分代码省略.........