本文整理匯總了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 "";
}