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. | |
| fmtDateTime ($a_str, $a_dateformat, $a_timeformat, $a_mode="datetime") | |
| formatting function for dates | |
| fmtFloat ($a_float, $a_decimals="", $a_th="") | |
| format a float | |
| formatDate ($a_date, $a_mode="datetime") | |
| dateDiff ($a_ts1, $a_ts2) | |
| datetime2unixTS ($a_datetime) | |
| converts datetime to a unix timestamp | |
Definition at line 40 of file class.ilFormat.php.
| ilFormat::checkDecimal | ( | $ | var | ) |
Prft Zahlen mit Nachkommastellen und erlaubt ein Komma als Nachstellentrenner.
| string |
Definition at line 232 of file class.ilFormat.php.
{
return doubleval(ereg_replace (",",".",$var));
}
| ilFormat::compareDates | ( | $ | ADate1, | |
| $ | ADate2 | |||
| ) |
Datum vergleichen Erwartet timestamps Liefert das aktuellere Datum als Timestamp zurck.
| string | ||
| string |
Definition at line 217 of file class.ilFormat.php.
{
if ($ADate1 > $ADate2)
{
return $ADate1;
}
return $ADate2;
}
| ilFormat::dateDB2timestamp | ( | $ | ADatumSQL | ) |
db-datetime to timestamp
| string |
Definition at line 125 of file class.ilFormat.php.
{
$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;
}
| ilFormat::dateDE2timestamp | ( | $ | ADatum | ) |
German datetime to timestamp.
| string |
Definition at line 141 of file class.ilFormat.php.
Referenced by ilObjGroup::registrationPossible().
{
$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;
}
Here is the caller graph for this function:| ilFormat::dateDiff | ( | $ | a_ts1, | |
| $ | a_ts2 | |||
| ) |
Definition at line 427 of file class.ilFormat.php.
Referenced by ilPersonalDesktopGUI::displayUsersOnline().
{
$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;
}
Here is the caller graph for this function:| ilFormat::datetime2unixTS | ( | $ | a_datetime | ) |
converts datetime to a unix timestamp
| string | datetime |
Definition at line 465 of file class.ilFormat.php.
Referenced by ilPersonalDesktopGUI::displayUsersOnline().
{
$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]);
}
Here is the caller graph for this function:| ilFormat::fdateDB2dateDE | ( | $ | t | ) |
formats db-datetime to german date
| string |
Definition at line 158 of file class.ilFormat.php.
References $t.
Referenced by ilObjGroup::getExpirationDateTime().
Here is the caller graph for this function:| ilFormat::fGeld | ( | ) |
formatiert Geldwerte (Format: 00,00 + Eurosymbol).
Weiteres siehe fProzent
Definition at line 241 of file class.ilFormat.php.
{
$num_args = func_num_args();
$geld = func_get_arg(0);
if ($num_args == 1)
{
$test = intval($geld);
if (!$test)
return " ";
}
return number_format($geld,2,",",".")." €";
}
| ilFormat::fmtDateTime | ( | $ | a_str, | |
| $ | a_dateformat, | |||
| $ | a_timeformat, | |||
| $ | a_mode = "datetime" | |||
| ) |
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
| string | date date, given in sql-format YYYY-MM-DD HH:MM:SS | |
| string | date format (default is Y-m-d) | |
| string | time format (default is H:i:s) | |
| string | format mode (datetime, time or date) |
Definition at line 304 of file class.ilFormat.php.
References $d.
Referenced by formatDate().
{
//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";
}
//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));
}
if ($a_mode == "date")
{
return date($a_dateformat,mktime($h,$i,$s,$m,$d,$y));
}
return date($a_dateformat." ".$a_timeformat,mktime($h,$i,$s,$m,$d,$y));
}
Here is the caller graph for this function:| ilFormat::fmtFloat | ( | $ | a_float, | |
| $ | a_decimals = "", |
|||
| $ | a_th = "" | |||
| ) |
format a float
this functions takes php's number_format function and formats the given value with appropriate thousand and decimal separator. public
| float | the float to format | |
| integer | count of decimals | |
| integer | display thousands separator |
Definition at line 361 of file class.ilFormat.php.
{
//thousandskomma?
if (!empty($a_th))
{
if ($a_th == "-lang_sep_thousand-")
{
$a_th = ",";
}
}
//decimalpoint?
$dec = $a_decimals;
if ($dec == "-lang_sep_decimal-")
{
$dec = ".";
}
return number_format($a_float, $a_decimals, $dec, $a_th);
}
| ilFormat::formatDate | ( | $ | a_date, | |
| $ | a_mode = "datetime" | |||
| ) |
Definition at line 393 of file class.ilFormat.php.
References $lng, and fmtDateTime().
Referenced by ilFileDataImportMail::__readFiles(), ilFileDataImportGroup::__readFiles(), ilFileDataImportForum::__readFiles(), ilObjSurveyGUI::codesObject(), ilLOListGUI::displayList(), ilPersonalDesktopGUI::displayMails(), ilPersonalDesktopGUI::displaySystemMessages(), exercise(), ilFileDataForum::getFiles(), ilFileDataExercise::getFiles(), ilFileDataForum::getFilesOfPost(), ilFileDataMail::getUnsentFiles(), ilObjAssessmentFolderGUI::logsObject(), ilObjTestGUI::outIntroductionPage(), ilObjSurveyGUI::questionBrowser(), ilObjTestGUI::questionBrowser(), ilObjSurveyQuestionPoolGUI::questionsObject(), and ilObjQuestionPoolGUI::questionsObject().
{
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");
$timeformat = $lng->txt("lang_timeformat");
if ($dateformat == "-lang_dateformat-")
{
$dateformat = "";
}
if ($timeformat == "-lang_timeformat-")
{
$timeformat = "";
}
return ilFormat::fmtDateTime($a_date,$dateformat,$timeformat,$a_mode);
}
Here is the call graph for this function:
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 263 of file class.ilFormat.php.
{
$num_args = func_num_args();
$prozent = func_get_arg(0);
if ($num_args == 1)
{
$test = intval($prozent);
if (!$test)
return " ";
}
return number_format($prozent,2,",",".")."%";
}
| ilFormat::ftimestamp2dateDB | ( | $ | t | ) |
formats timestamp to db-date
| string |
Definition at line 188 of file class.ilFormat.php.
References $t.
Referenced by ilObjSurveyGUI::codesObject(), exercise(), ilObjSurveyGUI::questionBrowser(), ilObjTestGUI::questionBrowser(), ilObjSurveyQuestionPoolGUI::questionsObject(), ilObjQuestionPoolGUI::questionsObject(), and ilObjSurveyGUI::runShowIntroductionPage().
Here is the caller graph for this function:| ilFormat::ftimestamp2dateDE | ( | $ | t | ) |
| ilFormat::ftimestamp2datetimeDB | ( | $ | aTimestamp | ) |
Timestamp to database datetime.
| string | $aTimestamp String in timestamp format |
Definition at line 199 of file class.ilFormat.php.
Referenced by ilObjTestGUI::endingTimeReached(), ilObjAssessmentFolderGUI::logsObject(), and ilObjTestGUI::outIntroductionPage().
{
$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 | ) |
| ilFormat::getDateDE | ( | ) |
Definition at line 48 of file class.ilFormat.php.
Referenced by ilObjGroup::registrationPossible().
{
$date = getdate();
$datum = sprintf("%02d.%02d.%04d", $date["mday"],$date["mon"],$date["year"]);
return $datum;
}
Here is the caller graph for this function:| ilFormat::ilFormat | ( | ) |
Definition at line 42 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).
| string |
Definition at line 63 of file class.ilFormat.php.
References $d.
Referenced by ilObjGroup::setExpirationDateTime().
{
$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;
}
}
}
Here is the caller graph for this function:| ilFormat::runden | ( | $ | value | ) |
Floats auf 2 Nachkommastellen runden.
| float |
Definition at line 284 of file class.ilFormat.php.
{
return round($value * 100) / 100;
}
1.7.1