本文整理汇总了PHP中ProjectSettings::isDecimalDigits方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectSettings::isDecimalDigits方法的具体用法?PHP ProjectSettings::isDecimalDigits怎么用?PHP ProjectSettings::isDecimalDigits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectSettings
的用法示例。
在下文中一共展示了ProjectSettings::isDecimalDigits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetTotals
function GetTotals($field, $value, $stype, $iNumberOfRows, $sFormat, $ptype)
{
global $strTableName;
$pSet = new ProjectSettings($strTableName, $ptype);
$days = 0;
if ($stype == "AVERAGE") {
if ($iNumberOfRows) {
if ($sFormat == FORMAT_TIME) {
if ($value) {
$value = round($value / $iNumberOfRows, 0);
$s = $value % 60;
$value -= $s;
$value /= 60;
$m = $value % 60;
$value -= $m;
$value /= 60;
$h = $value % 24;
$value -= $h;
$value /= 24;
$d = $value;
$value = ($d != 0 ? $d . 'd ' : '') . mysprintf("%02d:%02d:%02d", array($h, $m, $s));
}
} else {
$value = round($value / $iNumberOfRows, 2);
}
} else {
return "";
}
}
if ($stype == "TOTAL") {
if ($sFormat == FORMAT_TIME) {
if ($value) {
$s = $value % 60;
$value -= $s;
$value /= 60;
$m = $value % 60;
$value -= $m;
$value /= 60;
$h = $value % 24;
$value -= $h;
$value /= 24;
$d = $value;
$value = ($d != 0 ? $d . 'd ' : '') . mysprintf("%02d:%02d:%02d", array($h, $m, $s));
}
}
}
$sValue = "";
$data = array($field => $value);
if ($sFormat == FORMAT_CURRENCY) {
$sValue = str_format_currency($value);
} else {
if ($sFormat == FORMAT_PERCENT) {
$sValue = str_format_number($value * 100) . "%";
} else {
if ($sFormat == FORMAT_NUMBER) {
$sValue = str_format_number($value, $pSet->isDecimalDigits($field));
} else {
if ($sFormat == FORMAT_CUSTOM && $stype != "COUNT") {
include_once getabspath('classes/controls/ViewControlsContainer.php');
$viewControls = new ViewControlsContainer($pSet, $ptype);
$sValue = $viewControls->showDBValue($field, $data);
} else {
$sValue = $value;
}
}
}
}
if ($stype == "COUNT") {
return $value;
}
if ($stype == "TOTAL") {
return $sValue;
}
if ($stype == "AVERAGE") {
return $sValue;
}
return "";
}