ILIAS  release_8 Revision v8.24
ilIndividualAssessmentDateFormatter Class Reference
+ Collaboration diagram for ilIndividualAssessmentDateFormatter:

Public Member Functions

 __construct (DataFactory $data_factory)
 
 getUserDateFormat (ilObjUser $user, bool $with_time=false)
 
 format (ilObjUser $user, DateTimeImmutable $datetime, bool $with_time=false)
 

Protected Attributes

DataFactory $data_factory
 

Detailed Description

Definition at line 23 of file ilIndividualAssessmentDateFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

ilIndividualAssessmentDateFormatter::__construct ( DataFactory  $data_factory)

Definition at line 27 of file ilIndividualAssessmentDateFormatter.php.

28 {
29 $this->data_factory = $data_factory;
30 }

References $data_factory.

Member Function Documentation

◆ format()

ilIndividualAssessmentDateFormatter::format ( ilObjUser  $user,
DateTimeImmutable  $datetime,
bool  $with_time = false 
)

Definition at line 60 of file ilIndividualAssessmentDateFormatter.php.

64 : string {
65 return $this->getUserDateFormat($user, $with_time)->applyTo($datetime);
66 }
getUserDateFormat(ilObjUser $user, bool $with_time=false)

◆ getUserDateFormat()

ilIndividualAssessmentDateFormatter::getUserDateFormat ( ilObjUser  $user,
bool  $with_time = false 
)

Definition at line 32 of file ilIndividualAssessmentDateFormatter.php.

33 {
34 $df = $this->data_factory->dateFormat();
35 switch ($user->getDateFormat()) {
37 $date_format = $df->germanShort();
38 break;
40 //americanShort
41 $date_format = $df->custom()->month()->slash()->day()->slash()->year()->get();
42 break;
44 default:
45 $date_format = $df->standard();
46 }
47 if ($with_time) {
48 switch ($user->getTimeFormat()) {
50 $date_format = $df->withTime12($date_format);
51 break;
53 default:
54 $date_format = $df->withTime24($date_format);
55 }
56 }
57 return $date_format;
58 }
A Date Format provides a format definition akin to PHP's date formatting options, but stores the sing...
Definition: DateFormat.php:27

References ilCalendarSettings\DATE_FORMAT_DMY, ilCalendarSettings\DATE_FORMAT_MDY, ilCalendarSettings\DATE_FORMAT_YMD, ilObjUser\getDateFormat(), ilObjUser\getTimeFormat(), ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

+ Here is the call graph for this function:

Field Documentation

◆ $data_factory

DataFactory ilIndividualAssessmentDateFormatter::$data_factory
protected

Definition at line 25 of file ilIndividualAssessmentDateFormatter.php.

Referenced by __construct().


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