/** * Format a table cell for table() method. * * @param mixed $cellData * @param string $type * @return mixed */ public function formatTableCellData($cellData, $type, $typeDetails = false) { if ($type != "") { switch (strtolower($type)) { case "date": $cellData = Format::date($cellData); break; case "datetime": $cellData = Format::dateTime($cellData); break; case "timestamp": $cellData = Format::dateTime($cellData); break; case "money": $cellData = Format::money($cellData); break; case "phone": $cellData = Format::phone($cellData); break; case "boolean": if (!$typeDetails) { $typeDetails = "Yes/No"; } if (!is_array($typeDetails)) { $typeDetails = explode('/', $typeDetails); } if ((bool) $cellData) { $cellData = '<span class="boolean-true">' . $typeDetails[0] . '</span>'; } else { $cellData = '<span class="boolean-false">' . $typeDetails[1] . '</span>'; } break; } } return $cellData; }
/** * Format a money value. This is superior to PHP's number_format() because it will but * the dollar symbol to the right of the minus for a negative value ("-$33.00"). * * @param float $value * @param string $prefix * @param boolean $allowNegative * @param string $thousandsSeparator * @return string */ function money($value, $prefix = '$', $allowNegative = true, $thousandsSeparator = ',') { return Format::money($value, $prefix, $allowNegative, $thousandsSeparator); }