ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Date.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 
27 class Date extends Column implements C\Date
28 {
29  public function __construct(
30  Language $lng,
31  string $title,
32  protected DateFormat $format
33  ) {
34  parent::__construct($lng, $title);
35  }
36 
37  public function getFormat(): DateFormat
38  {
39  return $this->format;
40  }
41 
42  public function format($value): string
43  {
44  $this->checkArgInstanceOf('value', $value, \DateTimeImmutable::class);
45  return $value->format($this->getFormat()->toString());
46  }
47 
51  public function getOrderingLabels(): array
52  {
53  return [
54  $this->asc_label ?? $this->getTitle() . self::SEPERATOR . $this->lng->txt('order_option_chronological_ascending'),
55  $this->desc_label ?? $this->getTitle() . self::SEPERATOR . $this->lng->txt('order_option_chronological_descending')
56  ];
57  }
58 }
__construct(Language $lng, string $title, protected DateFormat $format)
Definition: Date.php:29
A Date Format provides a format definition akin to PHP&#39;s date formatting options, but stores the sing...
Definition: DateFormat.php:26
__construct(Container $dic, ilPlugin $plugin)
global $lng
Definition: privfeed.php:31