ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
Date.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
26 class Date extends Column implements C\Date
27 {
28  public function __construct(
30  string $title,
31  protected DateFormat $format
32  ) {
33  parent::__construct($lng, $title);
34  }
35 
36  public function getFormat(): DateFormat
37  {
38  return $this->format;
39  }
40 
41  public function format($value): string
42  {
43  $this->checkArgInstanceOf('value', $value, \DateTimeImmutable::class);
44  return $value->format($this->getFormat()->toString());
45  }
46 
50  public function getOrderingLabels(): array
51  {
52  return [
53  $this->asc_label ?? $this->getTitle() . self::SEPERATOR . $this->lng->txt('order_option_chronological_ascending'),
54  $this->desc_label ?? $this->getTitle() . self::SEPERATOR . $this->lng->txt('order_option_chronological_descending')
55  ];
56  }
57 }
__construct(\ilLanguage $lng, string $title, protected DateFormat $format)
Definition: Date.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(VocabulariesInterface $vocabularies)
A Date Format provides a format definition akin to PHP&#39;s date formatting options, but stores the sing...
Definition: DateFormat.php:26
$lng