ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 24 of file ilIndividualAssessmentDateFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

ilIndividualAssessmentDateFormatter::__construct ( DataFactory  $data_factory)

Definition at line 28 of file ilIndividualAssessmentDateFormatter.php.

References $data_factory.

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

Member Function Documentation

◆ format()

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

Definition at line 50 of file ilIndividualAssessmentDateFormatter.php.

References getUserDateFormat().

54  : string {
55  return $this->getUserDateFormat($user, $with_time)->applyTo($datetime);
56  }
getUserDateFormat(ilObjUser $user, bool $with_time=false)
$datetime
+ Here is the call graph for this function:

◆ getUserDateFormat()

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

Definition at line 33 of file ilIndividualAssessmentDateFormatter.php.

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

Referenced by format().

33  : DateFormat
34  {
35  $df = $this->data_factory->dateFormat();
36  $date_format = $user->getDateFormat();
37  if ($with_time) {
38  switch ($user->getTimeFormat()) {
40  $date_format = $df->withTime12($date_format);
41  break;
43  default:
44  $date_format = $df->withTime24($date_format);
45  }
46  }
47  return $date_format;
48  }
A Date Format provides a format definition akin to PHP's date formatting options, but stores the sing...
Definition: DateFormat.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $data_factory

DataFactory ilIndividualAssessmentDateFormatter::$data_factory
protected

Definition at line 26 of file ilIndividualAssessmentDateFormatter.php.

Referenced by __construct().


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