ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFormat Class Reference
+ Collaboration diagram for ilFormat:

Public Member Functions

 ilFormat ()
 getDateDE ()
 input2date ($AInputDate)
 Prft eingegebes Datum und wandelt es in DB-konformen Syntax um Eingabe: TT.MM.JJJJ oder T.M.JJ oder TT.MM.JJJJ HH:MM:SS oder T.M.JJ HH:MM:SS Bei zweistelliger Jahresangabe wird bei YY > 70 19, bei YY < 70 20 vorgestellt Ausgabe: YYYY-MM-DD oder YYYY-MM-DD HH:MM:SS OPTIONAL wird die aktuelle Systemzeit hinzugefgt (Ausgabe: YYYY-MM-DD hh:mm:ss)
 dateDB2timestamp ($ADatumSQL)
 db-datetime to timestamp
 dateDE2timestamp ($ADatum)
 German datetime to timestamp.
 fdateDB2dateDE ($t)
 formats db-datetime to german date
 ftimestamp2dateDE ($t)
 formats timestamp to german date
 ftimestamp2datetimeDE ($t)
 formats timestamp to german datetime
 ftimestamp2dateDB ($t)
 formats timestamp to db-date
 ftimestamp2datetimeDB ($aTimestamp)
 Timestamp to database datetime.
 compareDates ($ADate1, $ADate2)
 Datum vergleichen Erwartet timestamps Liefert das aktuellere Datum als Timestamp zurck.
 checkDecimal ($var)
 Prft Zahlen mit Nachkommastellen und erlaubt ein Komma als Nachstellentrenner.
 fGeld ()
 formatiert Geldwerte (Format: 00,00 + Eurosymbol).
 fProzent ()
 formatiert Prozentzahlen (Format: 00,00%).
 runden ($value)
 Floats auf 2 Nachkommastellen runden.
 fmtFloat ($a_float, $a_decimals=0, $a_dec_point=null, $a_thousands_sep=null, $a_suppress_dot_zero=false)
 format a float
 unixtimestamp2datetime ($a_unix_timestamp="")
 formatDate ($a_date, $a_mode="datetime", $a_omit_seconds=false, $a_relative=TRUE)
 format a date according to the user language shortcut for Format::fmtDateTime public
 formatUnixTime ($ut, $with_time=false)
 dateDiff ($a_ts1, $a_ts2)
 datetime2unixTS ($a_datetime)
 converts datetime to a unix timestamp
 _secondsToString ($seconds, $force_with_seconds=false)
 converts seconds to string: Long: 7 days 4 hour(s) ...
 _secondsToShortString ($seconds)
 converts seconds to string: Long: 7 days 4 hour(s) ...

Static Public Member Functions

static fmtDateTime ($a_str, $a_dateformat, $a_timeformat, $a_mode="datetime", $a_relative=TRUE)
 formatting function for dates
static _getLocalMoneyFormat ($float_number)
 converts a float number to money format, depending on system language
static _getSizeMagnitude ()
 Returns the magnitude used for size units.
static formatFloat ($size, $a_decimals, $a_suppress_dot_zero=false, $a_mode= 'short', $a_lng=null)
 Returns the specified float in human friendly form.
static formatSize ($size, $a_mode= 'short', $a_lng=null)
 Returns the specified file size value in a human friendly form.

Detailed Description

Definition at line 22 of file class.ilFormat.php.

Member Function Documentation

static ilFormat::_getLocalMoneyFormat (   $float_number)
static

converts a float number to money format, depending on system language

Definition at line 634 of file class.ilFormat.php.

Referenced by ilPaymentObjectGUI\editPrices(), ilObjPaymentSettingsGUI\editPricesObject(), ilPaymentStatisticGUI\editStatistic(), and ilPaymentStatisticGUI\showStatistics().

{
global $ilias;
$language = $ilias->getSetting("language");
$money_locale = $language.'_'.strtoupper($language);
/* de_DE en_US en_EN fr_FR .UTF-8
*/ //$money_locale = 'de_DE.UTF-8';
//vd($_SERVER['HTTP_ACCEPT_LANGUAGE']);
setlocale(LC_MONETARY, $money_locale);
return $float_number;
//return money_format('%!2n', $float_number);
}

+ Here is the caller graph for this function:

static ilFormat::_getSizeMagnitude ( )
static

Returns the magnitude used for size units.

This function always returns the value 1024. Thus the value returned by this function is the same value that Windows and Mac OS X return for a file. The value is a GibiBit, MebiBit, KibiBit or byte unit.

For more information about these units see: http://en.wikipedia.org/wiki/Megabyte

Returns
<type>

Definition at line 661 of file class.ilFormat.php.

Referenced by ilObjRoleGUI\editObject2(), formatSize(), ilObjUserGUI\getValues(), ilObjRoleGUI\loadRoleProperties(), ilObjRoleGUI\readRoleProperties(), ilObjUserGUI\saveObject(), ilObjUserGUI\updateObject(), and ilObjRoleGUI\updateObject2().

{
return 1024;
}

+ Here is the caller graph for this function:

ilFormat::_secondsToShortString (   $seconds)

converts seconds to string: Long: 7 days 4 hour(s) ...

Parameters
stringdatetime
Returns
integer unix timestamp

Definition at line 608 of file class.ilFormat.php.

References $lng, and $rest.

Referenced by ilObjUserFolderGUI\_addLearningProgressWorksheet(), and ilObjUserFolderGUI\learningProgressObject().

{
global $lng;
$seconds = $seconds ? $seconds : 0;
global $lng;
$days = floor($seconds / 86400);
$rest = $seconds % 86400;
$hours = floor($rest / 3600);
$rest = $rest % 3600;
$minutes = floor($rest / 60);
$rest = $rest % 60;
return sprintf("%02d:%02d:%02d:%02d",$days,$hours,$minutes,$rest);
}

+ Here is the caller graph for this function:

ilFormat::_secondsToString (   $seconds,
  $force_with_seconds = false 
)

converts seconds to string: Long: 7 days 4 hour(s) ...

Parameters
stringdatetime
Returns
integer unix timestamp

Definition at line 547 of file class.ilFormat.php.

References $lng, and $rest.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilLPListOfProgressGUI\__appendUserInfo(), ilAccountRegistrationGUI\__distributeMails(), ilCourseContentGUI\__renderItem(), ilCourseContentGUI\__renderUserItem(), ilLearningProgressBaseGUI\__showObjectDetails(), ilInfoScreenGUI\addMetaDataSections(), ilObjSystemFolderGUI\displayBasicSettings(), ilCourseContentGUI\editTimings(), ilCalendarChangedAppointmentsTableGUI\fillRow(), ilCalendarAppointmentsTableGUI\fillRow(), ilObjSCORM2004LearningModule\getTrackingDataAgg(), ilObjSystemFolderGUI\initBasicSettingsForm(), ilPersonalProfileGUI\initGeneralSettingsForm(), ilObjUserTrackingGUI\outputTrackingDataObject(), ilLPItemListGUI\renderObjectInfo(), ilLPItemListGUI\renderObjectInfoXML(), and ilInfoScreenGUI\showLearningProgress().

{
global $lng;
$seconds = $seconds ? $seconds : 0;
global $lng;
$days = floor($seconds / 86400);
$rest = $seconds % 86400;
$hours = floor($rest / 3600);
$rest = $rest % 3600;
$minutes = floor($rest / 60);
$seconds = $rest % 60;
if($days)
{
$message = $days . ' '. $lng->txt('days');
}
if($hours)
{
if($message)
{
$message .= ' ';
}
$message .= ($hours . ' '. $lng->txt('hours'));
}
if($minutes)
{
if($message)
{
$message .= ' ';
}
$message .= ($minutes . ' '. $lng->txt('minutes'));
}
if($force_with_seconds && $seconds)
{
if($message)
{
$message .= ' ';
}
$message .= ($seconds . ' '. $lng->txt('seconds'));
}
if(!$days and !$hours and !$minutes)
{
return $seconds .' '. $lng->txt('seconds');
}
else
{
return $message;
}
}

+ Here is the caller graph for this function:

ilFormat::checkDecimal (   $var)

Prft Zahlen mit Nachkommastellen und erlaubt ein Komma als Nachstellentrenner.

Parameters
string

Definition at line 214 of file class.ilFormat.php.

Referenced by ilPaymentCouponGUI\saveCouponForm().

{
return doubleval(ereg_replace (",",".",$var));
}

+ Here is the caller graph for this function:

ilFormat::compareDates (   $ADate1,
  $ADate2 
)

Datum vergleichen Erwartet timestamps Liefert das aktuellere Datum als Timestamp zurck.

Parameters
string
string

Definition at line 199 of file class.ilFormat.php.

{
if ($ADate1 > $ADate2)
{
return $ADate1;
}
return $ADate2;
}
ilFormat::dateDB2timestamp (   $ADatumSQL)

db-datetime to timestamp

Parameters
string

Definition at line 107 of file class.ilFormat.php.

References $timestamp.

Referenced by ilObjTestGUI\savePropertiesObject().

{
$timestamp = substr($ADatumSQL, 0, 4).
substr($ADatumSQL, 5, 2).
substr($ADatumSQL, 8, 2).
substr($ADatumSQL, 11, 2).
substr($ADatumSQL, 14, 2).
substr($ADatumSQL, 17, 2);
return $timestamp;
}

+ Here is the caller graph for this function:

ilFormat::dateDE2timestamp (   $ADatum)

German datetime to timestamp.

Parameters
string

Definition at line 123 of file class.ilFormat.php.

References $timestamp.

{
$timestamp = substr($ADatum, 6, 4).
substr($ADatum, 3, 2).
substr($ADatum, 0, 2).
substr($ADatum, 11, 2).
substr($ADatum, 14, 2).
substr($ADatum, 17, 2);
return $timestamp;
}
ilFormat::dateDiff (   $a_ts1,
  $a_ts2 
)

Definition at line 493 of file class.ilFormat.php.

{
$r = $a_ts2 - $a_ts1;
$dd = floor($r/86400);
if ($dd <= 9)
$dd = "0".$dd;
$r = $r % 86400;
$hh = floor($r/3600);
if ($hh <= 9)
$hh = "0".$hh;
$r = $r % 3600;
$mm = floor($r/60) ;
if ($mm <= 9)
$mm = "0".$mm;
$r = $r % 60;
$ss = $r;
if ($ss <= 9)
$ss = "0".$ss;
return $hh.":".$mm.":".$ss;
}
ilFormat::datetime2unixTS (   $a_datetime)

converts datetime to a unix timestamp

Parameters
stringdatetime
Returns
integer unix timestamp

Definition at line 531 of file class.ilFormat.php.

{
$arrDT = explode(" ", $a_datetime);
$arrD = explode("-", $arrDT[0]);
$arrT = explode(":", $arrDT[1]);
return mktime($arrT[0], $arrT[1], $arrT[2], $arrD[1], $arrD[2], $arrD[0]);
}
ilFormat::fdateDB2dateDE (   $t)

formats db-datetime to german date

Parameters
string

Definition at line 140 of file class.ilFormat.php.

References $t.

{
return sprintf("%02d.%02d.%04d",substr($t, 8, 2),substr($t, 5, 2),substr($t, 0, 4));
}
ilFormat::fGeld ( )

formatiert Geldwerte (Format: 00,00 + Eurosymbol).

Weiteres siehe fProzent

Definition at line 223 of file class.ilFormat.php.

References $test.

{
$num_args = func_num_args();
$geld = func_get_arg(0);
if ($num_args == 1)
{
$test = intval($geld);
if (!$test)
return "&nbsp;";
}
return number_format($geld,2,",",".")." &euro;";
}
static ilFormat::fmtDateTime (   $a_str,
  $a_dateformat,
  $a_timeformat,
  $a_mode = "datetime",
  $a_relative = TRUE 
)
static

formatting function for dates

In different languages, dates are formatted different. fmtDate expects a sql timestamp and a date format. Optional you may specify a time format. If you skip this parameter no time is displayed The format options follows the rules of the PHP date-function. See in the PHP manual for a list of possible formatting options public

Parameters
stringdate date, given in sql-format YYYY-MM-DD HH:MM:SS
stringdate format (default is Y-m-d)
stringtime format (default is H:i:s)
stringformat mode (datetime, time or date)
booleanrelative date output
Returns
string formatted date
Deprecated:
since 3.10 - 05.03.2009

Definition at line 288 of file class.ilFormat.php.

References $d, $lng, $timestamp, and $y.

Referenced by formatDate(), and assFileUpload\getFileUploadZIPFile().

{
//no format defined. set to default format
if ($a_dateformat == "")
{
$a_dateformat = "Y-m-d";
}
// same for time format
if ($a_timeformat == "")
{
$a_timeformat = "H:i:s";
}
// The sql-date 0000-00-00 00:00:00 means "no-date given"
if ($a_str == '0000-00-00 00:00:00')
{
global $lng;
return $lng->txt('no_date');
}
//
//get values from given sql-date
$d = substr($a_str,8,2);
$m = substr($a_str,5,2);
$y = substr($a_str,0,4);
$h = substr($a_str,11,2);
$i = substr($a_str,14,2);
$s = substr($a_str,17,4);
// Minimum date is 1.1.1970
if(($y < 1970) or
($y == 1970 and ($m < 1 or $d < 1)))
{
$y = 1970;
$m = 1;
$d = 2;
$h = $i = $s = 0;
}
if ($a_mode == "time")
{
return date($a_timeformat,mktime($h,$i,$s,1,1,1999));
}
// BEGIN WebDAV: Display relative date.
$timestamp = mktime($h,$i,$s,$m,$d,$y);
$now = time();
$minuteswest = gettimeofday(false);
$minuteswest = $minuteswest['minuteswest'];
$today = $now - $now % (24 * 60 * 60) + $minuteswest * 60;
$isToday = $today <= $timestamp && $timestamp < $today + 24 * 60 * 60;
$isYesterday = $today - 24 * 60 * 60 <= $timestamp && $timestamp < $today;
$isTomorrow = $today + 24 * 60 * 60 <= $timestamp && $timestamp < $today + 48 * 60 * 60;
global $lng;
if ($a_relative)
{
$date = ($isToday) ? $lng->txt('today') :
(($isYesterday) ? $lng->txt('yesterday') :
(($isTomorrow) ? $lng->txt('tomorrow') :
date($a_dateformat,mktime($h,$i,$s,$m,$d,$y))))
;
}
else
{
$date = date($a_dateformat,mktime($h,$i,$s,$m,$d,$y));
}
return ($a_mode == "date") ? $date : $date.' '.date($a_timeformat,mktime($h,$i,$s,$m,$d,$y));
// END WebDAV: Display relative date.
}

+ Here is the caller graph for this function:

ilFormat::fmtFloat (   $a_float,
  $a_decimals = 0,
  $a_dec_point = null,
  $a_thousands_sep = null,
  $a_suppress_dot_zero = false 
)

format a float

this functions takes php's number_format function and formats the given value with appropriate thousand and decimal separator. public

Parameters
floatthe float to format
integercount of decimals
integerdisplay thousands separator
booleanwhether .0 should be suppressed
Returns
string formatted number

Definition at line 373 of file class.ilFormat.php.

References $lng.

Referenced by formatFloat(), and formatSize().

{
global $lng;
if ($a_dec_point == null)
{
$a_dec_point = $lng->txt('lang_sep_decimal');
{
$a_dec_point = ".";
}
}
if ($a_dec_point == '-lang_sep_decimal-')
{
$a_dec_point = ".";
}
if ($a_thousands_sep == null)
{
$a_thousands_sep = $lng->txt('lang_sep_thousand');
{
$a_th = ",";
}
}
if ($a_thousands_sep == '-lang_sep_thousand-')
{
$a_thousands_sep = ",";
}
$txt = number_format($a_float, $a_decimals, $a_dec_point, $a_thousands_sep);
// remove trailing ".0"
if (($a_suppress_dot_zero == 0 || $a_decimal == 0) &&
substr($txt,-2) == $a_dec_point.'0')
{
$txt = substr($txt, 0, strlen($txt) - 2);
}
if ($a_float == 0 and $txt == "")
{
$txt = "0";
}
return $txt;
}

+ Here is the caller graph for this function:

ilFormat::formatDate (   $a_date,
  $a_mode = "datetime",
  $a_omit_seconds = false,
  $a_relative = TRUE 
)

format a date according to the user language shortcut for Format::fmtDateTime public

Parameters
stringsql date
stringformat mode
booleanRelative date output
Returns
string formatted date
See Also
Format::fmtDateTime
Deprecated:
since 3.10 - 05.03.2009

Definition at line 440 of file class.ilFormat.php.

References $lng, and fmtDateTime().

Referenced by ilObjExercise\__formatBody(), ilFileDataImportMail\__readFiles(), ilFileDataImportForum\__readFiles(), ilFileDataImportGroup\__readFiles(), ilQuestionpoolExport\buildExportFileXLS(), ilShopTopicsTableGUI\fillRow(), ilSCORMCertificateAdapter\getCertificateVariablesForPresentation(), ilTestCertificateAdapter\getCertificateVariablesForPresentation(), ilSCORMCertificateAdapter\getCertificateVariablesForPreview(), ilTestCertificateAdapter\getCertificateVariablesForPreview(), ilFileDataExercise\getFiles(), ilFileDataForum\getFiles(), ilFileDataForum\getFilesOfPost(), ilFileDataMail\getUnsentFiles(), ilObjUserGUI\getValues(), ilObjUserGUI\initForm(), ilLMStatisticsGUI\listUsersGroup(), ilLMStatisticsGUI\listUsersRole(), ilLMStatisticsGUI\search(), ilPaymentCouponGUI\showCoupons(), and ilObjFileAccessSettingsGUI\viewDiskQuotaReport().

{
global $lng;
// return when no datetime is given
if ($a_date == "0000-00-00 00:00:00")
{
return $lng->txt("no_date");
}
$dateformat = $lng->txt("lang_dateformat");
if ($a_omit_seconds && ($lng->txt("lang_timeformat_no_sec") != "-lang_timeformat_no_sec-"))
{
$timeformat = $lng->txt("lang_timeformat_no_sec");
}
else
{
$timeformat = $lng->txt("lang_timeformat");
}
if ($dateformat == "-lang_dateformat-")
{
$dateformat = "";
}
if ($timeformat == "-lang_timeformat-")
{
$timeformat = "";
}
return ilFormat::fmtDateTime($a_date,$dateformat,$timeformat,$a_mode, $a_relative);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilFormat::formatFloat (   $size,
  $a_decimals,
  $a_suppress_dot_zero = false,
  $a_mode = 'short',
  $a_lng = null 
)
static

Returns the specified float in human friendly form.

Parameters
floata float
ilLanguageThe language object, or null if you want to use the system language.

Definition at line 672 of file class.ilFormat.php.

References $lng, $size, and fmtFloat().

Referenced by ilDiskQuotaReminderMail\replacePlaceholders().

{
global $lng;
if ($a_lng == null) {
$a_lng = $lng;
}
return self::fmtFloat($size, $a_decimals, $a_lng->txt('lang_sep_decimal'), $a_lng->txt('lang_sep_thousand', $a_suppress_dot_zero), true).' '.$a_lng->txt($scaled_unit);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilFormat::formatSize (   $size,
  $a_mode = 'short',
  $a_lng = null 
)
static

Returns the specified file size value in a human friendly form.

By default, the oder of magnitude 1024 is used. Thus the value returned by this function is the same value that Windows and Mac OS X return for a file. The value is a GibiBig, MebiBit, KibiBit or byte unit.

For more information about these units see: http://en.wikipedia.org/wiki/Megabyte

Parameters
integersize in bytes
stringmode: "short" is useful for display in the repository "long" is useful for display on the info page of an object
ilLanguageThe language object, or null if you want to use the system language.

Definition at line 696 of file class.ilFormat.php.

References $lng, $result, $size, _getSizeMagnitude(), and fmtFloat().

Referenced by ilInfoScreenGUI\addObjectSections(), ilObjFileListGUI\getProperties(), ilObjFileGUI\infoScreen(), ilObjUserGUI\initForm(), ilDiskQuotaReminderMail\replacePlaceholders(), and ilObjFileAccessSettingsGUI\viewDiskQuotaReport().

{
global $lng;
if ($a_lng == null) {
$a_lng = $lng;
}
require_once 'classes/class.ilFormat.php';
$scaled_size;
$scaled_unit;
if ($size >= $mag * $mag * $mag)
{
$scaled_size = $size/$mag/$mag/$mag;
$scaled_unit = 'lang_size_gb';
}
else if ($size >= $mag * $mag)
{
$scaled_size = $size/$mag/$mag;
$scaled_unit = 'lang_size_mb';
}
else if ($size >= $mag)
{
$scaled_size = $size/$mag;
$scaled_unit = 'lang_size_kb';
}
else
{
$scaled_size = $size;
$scaled_unit = 'lang_size_bytes';
}
$result = self::fmtFloat($scaled_size,($scaled_unit == 'lang_size_bytes') ? 0:1, $a_lng->txt('lang_sep_decimal'), $a_lng->txt('lang_sep_thousand'), true).' '.$a_lng->txt($scaled_unit);
if ($a_mode == 'long' && $size > $mag)
{
$result .= ' ('.
self::fmtFloat($size,0,$a_lng->txt('lang_sep_decimal'),$a_lng->txt('lang_sep_thousand')).
' '.$a_lng->txt('lang_size_bytes').')';
}
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFormat::formatUnixTime (   $ut,
  $with_time = false 
)

Definition at line 473 of file class.ilFormat.php.

References $lng, and $ut.

Referenced by ilPDFPresentation\__addMain(), ilPDFPresentation\__createObjectDetails(), ilMemberExport\createCSV(), ilECSSettingsGUI\exportImported(), ilECSSettingsGUI\exportReleased(), ilObjCourseGUI\fetchPrintMemberData(), and ilObjCourseGUI\printMembersObject().

{
global $lng;
$format = $lng->txt('lang_dateformat');
if($with_time)
{
$format .= (' '.$lng->txt('lang_timeformat_no_sec'));
}
return date($format,$ut);
}

+ Here is the caller graph for this function:

ilFormat::fProzent ( )

formatiert Prozentzahlen (Format: 00,00%).

Wenn nix oder eine Null bergeben wird, wird ein Leerzeichen zurckgegeben Wenn mehr als ein Parameter bergeben wird, wird die Ausgabe auch bei Wert Null erzwungen

Definition at line 245 of file class.ilFormat.php.

References $test.

{
$num_args = func_num_args();
$prozent = func_get_arg(0);
if ($num_args == 1)
{
$test = intval($prozent);
if (!$test)
return "&nbsp;";
}
return number_format($prozent,2,",",".")."%";
}
ilFormat::ftimestamp2dateDB (   $t)

formats timestamp to db-date

Parameters
string

Definition at line 170 of file class.ilFormat.php.

References $t.

Referenced by ilQuestionpoolExport\buildExportFileXLS().

{
return sprintf("%04d-%02d-%02d",substr($t, 0, 4),substr($t, 4, 2),substr($t, 6, 2));
}

+ Here is the caller graph for this function:

ilFormat::ftimestamp2dateDE (   $t)

formats timestamp to german date

Parameters
string

Definition at line 150 of file class.ilFormat.php.

References $t.

{
return sprintf("%02d.%02d.%04d",substr($t, 6, 2),substr($t, 4, 2),substr($t, 0, 4));
}
ilFormat::ftimestamp2datetimeDB (   $aTimestamp)

Timestamp to database datetime.

Parameters
string$aTimestampString in timestamp format
Returns
string Database datetime in format yyyy-mm-dd hh:mm:ss

Definition at line 181 of file class.ilFormat.php.

Referenced by ilTestOutputGUI\endingTimeReached(), and ilObjTest\isExecutable().

{
$date = "";
if (preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $aTimestamp, $matches))
{
$date = "$matches[1]-$matches[2]-$matches[3] $matches[4]:$matches[5]:$matches[6]";
}
return $date;
}

+ Here is the caller graph for this function:

ilFormat::ftimestamp2datetimeDE (   $t)

formats timestamp to german datetime

Parameters
string

Definition at line 160 of file class.ilFormat.php.

References $t.

{
return sprintf("%02d.%02d.%04d %02d:%02d:%02d",substr($t, 6, 2),substr($t, 4, 2),substr($t, 0, 4),substr($t, 8, 2),substr($t, 10, 2),substr($t, 12, 2));
}
ilFormat::getDateDE ( )

Definition at line 30 of file class.ilFormat.php.

{
$date = getdate();
$datum = sprintf("%02d.%02d.%04d", $date["mday"],$date["mon"],$date["year"]);
return $datum;
}
ilFormat::ilFormat ( )

Definition at line 24 of file class.ilFormat.php.

{
return;
}
ilFormat::input2date (   $AInputDate)

Prft eingegebes Datum und wandelt es in DB-konformen Syntax um Eingabe: TT.MM.JJJJ oder T.M.JJ oder TT.MM.JJJJ HH:MM:SS oder T.M.JJ HH:MM:SS Bei zweistelliger Jahresangabe wird bei YY > 70 19, bei YY < 70 20 vorgestellt Ausgabe: YYYY-MM-DD oder YYYY-MM-DD HH:MM:SS OPTIONAL wird die aktuelle Systemzeit hinzugefgt (Ausgabe: YYYY-MM-DD hh:mm:ss)

Parameters
string

Definition at line 45 of file class.ilFormat.php.

References $d, and $y.

{
$date=""; $y=""; $m=""; $d="";
// if (ereg("([0-9]{1,2}).([0-9]{1,2}).([0-9]{2,4})",$idate,$p))
if (ereg("([0-9]{1,2}).([0-9]{1,2}).([0-9]{2,4})",$AInputDate,$p))
{
$d = $p[1];
$m = $p[2];
$y = $p[3];
if (($d>0 && $d<32) && ($m>0 && $m<13) && (strlen($y)!=3))
{
if (strlen($d) == 1) $d = "0".$d;
if (strlen($m) == 1) $m = "0".$m;
if (strlen($y) == 2)
{
if ($y>=70) $y = $y + 1900;
if ($y<70) $y = $y + 2000;
}
// is valid?
checkdate($m, $d, $y);
// Ausgabe mit Uhrzeit
// Uhrzeit holen
$uhrzeit = substr($AInputDate, -8);
// Uhrzeit auf Gltigkeit prfen
if (ereg("([0-9]{2}):([0-9]{2}):([0-9]{2})",$AInputDate,$p))
{
$h = $p[1];
$min = $p[2];
$s = $p[3];
if (($h>-1 && $h<24) && ($min>-1 && $min<60) && ($s>-1 && $s<60))
{
// Uhrzeit stimmt/ist vorhanden
$date = sprintf("%04d-%02d-%02d %02d:%02d:%02d",$y,$m,$d,$h,$min,$s);
}
}
else
{
// Uhrzeit ist falsch/fehlt; hnge aktuelle Zeit an
$zeit = getdate();
$date = sprintf("%04d-%02d-%02d %02d:%02d:%02d",$y,$m,$d,$zeit["hours"],$zeit["minutes"],$zeit["seconds"]);
}
// Ausgabe ohne Uhrzeit
//$date = sprintf("%04d-%02d-%02d",$y,$m,$d);
return $date;
}
}
}
ilFormat::runden (   $value)

Floats auf 2 Nachkommastellen runden.

Parameters
float

Definition at line 266 of file class.ilFormat.php.

{
return round($value * 100) / 100;
}
ilFormat::unixtimestamp2datetime (   $a_unix_timestamp = "")

Definition at line 417 of file class.ilFormat.php.

Referenced by ilSCORMCertificateAdapter\getCertificateVariablesForPresentation(), ilTestCertificateAdapter\getCertificateVariablesForPresentation(), ilSCORMCertificateAdapter\getCertificateVariablesForPreview(), ilTestCertificateAdapter\getCertificateVariablesForPreview(), and assFileUpload\getFileUploadZIPFile().

{
if (strlen($a_unix_timestamp) == 0)
{
return strftime("%Y-%m-%d %H:%M:%S");
}
else
{
return strftime("%Y-%m-%d %H:%M:%S", $a_unix_timestamp);
}
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: