ILIAS  release_8 Revision v8.24
TimeSpan.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
26class TimeSpan extends Column implements C\TimeSpan
27{
29
30 public function __construct(
32 string $title,
34 )
35 {
37 $this->format = $format;
38 }
39
40 public function getFormat(): DateFormat
41 {
42 return $this->format;
43 }
44
45 public function format($value): string
46 {
47 $this->checkArgListElements('value', $value, [\DateTimeImmutable::class]);
48 return
49 $value[0]->format($this->getFormat()->toString())
50 . ' - ' .
51 $value[1]->format($this->getFormat()->toString());
52 }
53
57 public function getOrderingLabels(): array
58 {
59 return [
60 $this->asc_label ?? $this->getTitle() . self::SEPERATOR . $this->lng->txt('order_option_chronological_ascending'),
61 $this->desc_label ?? $this->getTitle() . self::SEPERATOR . $this->lng->txt('order_option_chronological_descending')
62 ];
63 }
64}
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: TimeSpan.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...