ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
Date.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
26class Date extends Column implements C\Date
27{
29
30 public function __construct(
32 string $title,
34 ) {
36 $this->format = $format;
37 }
38
39 public function getFormat(): DateFormat
40 {
41 return $this->format;
42 }
43
44 public function format($value): string
45 {
46 $this->checkArgInstanceOf('value', $value, \DateTimeImmutable::class);
47 return $value->format($this->getFormat()->toString());
48 }
49
53 public function getOrderingLabels(): array
54 {
55 return [
56 $this->asc_label ?? $this->getTitle() . self::SEPERATOR . $this->lng->txt('order_option_chronological_ascending'),
57 $this->desc_label ?? $this->getTitle() . self::SEPERATOR . $this->lng->txt('order_option_chronological_descending')
58 ];
59 }
60}
A Date Format provides a format definition akin to PHP's date formatting options, but stores the sing...
Definition: DateFormat.php:27
__construct(\ilLanguage $lng, string $title, DateFormat $format)
Definition: Date.php:30
language handling
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...