|
static | create_from_datetime (DateTimeInterface $startdatetime, ?DateTimeInterface $enddatetime, ?int $near=DAYSECS, ?url $link=null, ?string $langtimeformat=null, bool $userelatives=true,) |
| Creates a new humantimeperiod instance from a datetime.
|
|
static | create_from_timestamp (int $starttimestamp, ?int $endtimestamp, ?int $near=DAYSECS, ?url $link=null, ?string $langtimeformat=null, bool $userelatives=true,) |
| Creates a new humantimeperiod instance from a timestamp.
|
|
|
| __construct (protected DateTimeImmutable DateTimeImmutable $startdatetime, protected DateTimeImmutable|null ?DateTimeImmutable $enddatetime,) |
| Class constructor.
|
|
|
string null string | $langtimeformat = null |
| An optional date format to apply.
|
|
url null url | $link = null |
| URL to link the date to.
|
|
int null | $near = DAYSECS |
| Number of seconds that indicates a nearby date.
|
|
bool bool | $userelatives = true |
| Whether to use human common words or not.
|
|
◆ __construct()
core_calendar\output\humantimeperiod::__construct |
( |
protected DateTimeImmutable DateTimeImmutable | $startdatetime, |
|
|
protected DateTimeImmutable|null ?DateTimeImmutable | $enddatetime ) |
|
protected |
Class constructor.
- Parameters
-
DateTimeImmutable | $startdatetime | The starting timestamp. |
DateTimeImmutable | null | $enddatetime | The ending timestamp. |
- Parameters
-
$startdatetime | $startdatetime The starting date time. |
$enddatetime | $enddatetime The ending date time. |
◆ create_from_datetime()
static core_calendar\output\humantimeperiod::create_from_datetime |
( |
DateTimeInterface | $startdatetime, |
|
|
?DateTimeInterface | $enddatetime, |
|
|
?int | $near = DAYSECS, |
|
|
?url | $link = null, |
|
|
?string | $langtimeformat = null, |
|
|
bool | $userelatives = true ) |
|
static |
Creates a new humantimeperiod instance from a datetime.
- Parameters
-
DateTimeInterface | $startdatetime | The starting datetime. |
DateTimeInterface | null | $enddatetime | The ending datetime. |
int | null | $near | The number of seconds that indicates a nearby date. Default to DAYSECS, use null for no indication. |
url | null | $link | URL to link the date to. |
string | null | $langtimeformat | Lang date and time format to use to format the date. |
bool | $userelatives | Whether to use human common words or not. |
- Return values
-
humantimeperiod | The new instance. |
◆ create_from_timestamp()
static core_calendar\output\humantimeperiod::create_from_timestamp |
( |
int | $starttimestamp, |
|
|
?int | $endtimestamp, |
|
|
?int | $near = DAYSECS, |
|
|
?url | $link = null, |
|
|
?string | $langtimeformat = null, |
|
|
bool | $userelatives = true ) |
|
static |
Creates a new humantimeperiod instance from a timestamp.
- Parameters
-
int | $starttimestamp | The starting timestamp. |
int | null | $endtimestamp | The ending timestamp. |
int | null | $near | The number of seconds that indicates a nearby date. Default to DAYSECS, use null for no indication. |
url | null | $link | URL to link the date to. |
string | null | $langtimeformat | Lang date and time format to use to format the date. |
bool | $userelatives | Whether to use human common words or not. |
- Return values
-
humantimeperiod | The new instance. |
◆ export_for_template()
core_calendar\output\humantimeperiod::export_for_template |
( |
renderer_base | $output | ) |
|
Function to export the renderer data in a format that is suitable for a mustache template.
This means:
- No complex types - only stdClass, array, int, string, float, bool
- Any additional info that is required for the template is pre-calculated (e.g. capability checks).
- Parameters
-
renderer_base | $output | Used to do a final render of any components that need to be rendered for export. |
- Return values
-
Implements core\output\templatable.
◆ set_lang_time_format()
core_calendar\output\humantimeperiod::set_lang_time_format |
( |
?string | $langtimeformat | ) |
|
Sets an optional date format to apply.
- Parameters
-
string | null | $langtimeformat | Lang date and time format to use to format the date. |
- Return values
-
humantimeperiod | The instance. |
◆ set_link()
core_calendar\output\humantimeperiod::set_link |
( |
?url | $link | ) |
|
Sets the link for the date.
If null, no link will be added.
- Parameters
-
url | null | $link | The link for the date. |
- Return values
-
humantimeperiod | The instance. |
◆ set_near_limit()
core_calendar\output\humantimeperiod::set_near_limit |
( |
?int | $near | ) |
|
Sets the number of seconds within which a date is considered near.
- Parameters
-
int | null | $near | The number of seconds within which a date is considered near. |
- Return values
-
humantimeperiod | The instance. |
◆ set_use_relatives()
core_calendar\output\humantimeperiod::set_use_relatives |
( |
bool | $userelatives | ) |
|
Sets whether to use human relative terminology.
- Parameters
-
bool | $userelatives | Whether to use human relative terminology. |
- Return values
-
humantimeperiod | The instance. |
◆ $near
int null core_calendar\output\humantimeperiod::$near = DAYSECS |
|
protected |
Number of seconds that indicates a nearby date.
Default to DAYSECS. Use null for no indication.
The documentation for this class was generated from the following file:
- calendar/classes/output/humantimeperiod.php