ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Date.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
27class Date extends Column implements C\Date
28{
29 public function __construct(
31 string $title,
32 protected DateFormat $format
33 ) {
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}
A Date Format provides a format definition akin to PHP's date formatting options, but stores the sing...
Definition: DateFormat.php:27
__construct(Language $lng, string $title, protected DateFormat $format)
Definition: Date.php:29
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31