Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
calendartype_gregorian\structure Class Reference
Inheritance diagram for calendartype_gregorian\structure:
core_calendar\type_base

Public Member Functions

 convert_from_gregorian ($year, $month, $day, $hour=0, $minute=0)
 Provided with a day, month, year, hour and minute in a specific calendar type convert it into the equivalent Gregorian date.
 
 convert_to_gregorian ($year, $month, $day, $hour=0, $minute=0)
 Provided with a day, month, year, hour and minute in a specific calendar type convert it into the equivalent Gregorian date.
 
 convert_to_timestamp ($year, $month, $day, $hour=0, $minute=0)
 Provided with a day, month, year, hour and minute in the specific calendar type convert it into the equivalent Unix Time Stamp.
 
 get_date_order ($minyear=null, $maxyear=null)
 Returns a multidimensional array with information for day, month, year and the order they are displayed when selecting a date.
 
 get_days ()
 Returns a list of all the possible days for all months.
 
 get_max_year ()
 Returns the maximum year for the calendar.
 
 get_min_year ()
 Returns the minimum year for the calendar.
 
 get_months ()
 Returns a list of all the names of the months.
 
 get_name ()
 Returns the name of the calendar.
 
 get_next_day ($daytimestamp)
 Get the next day.
 
 get_next_month ($year, $month)
 Get the next month.
 
 get_num_days_in_month ($year, $month)
 Returns the number of days in a given month.
 
 get_num_weekdays ()
 Returns the number of days in a week.
 
 get_prev_day ($daytimestamp)
 Get the previous day.
 
 get_prev_month ($year, $month)
 Get the previous month.
 
 get_starting_weekday ()
 Returns the index of the starting week day.
 
 get_weekday ($year, $month, $day)
 Returns the index of the weekday for a specific calendar date.
 
 get_weekdays ()
 Returns an indexed list of all the names of the weekdays.
 
 get_years ($minyear=null, $maxyear=null)
 Returns an array of years.
 
 locale_win_charset ()
 This return locale for windows os.
 
 timestamp_to_date_array ($time, $timezone=99)
 Given a $time timestamp in GMT (seconds since epoch), returns an array that represents the date in user time.
 
 timestamp_to_date_string ($time, $format, $timezone, $fixday, $fixhour)
 Returns a formatted string that represents a date in user time.
 

Member Function Documentation

◆ convert_from_gregorian()

calendartype_gregorian\structure::convert_from_gregorian ( $year,
$month,
$day,
$hour = 0,
$minute = 0 )

Provided with a day, month, year, hour and minute in a specific calendar type convert it into the equivalent Gregorian date.

In this function we don't need to do anything except pass the data back as an array. This is because the date received is Gregorian.

Parameters
int$year
int$month
int$day
int$hour
int$minute
Return values
arraythe converted date

Reimplemented from core_calendar\type_base.

◆ convert_to_gregorian()

calendartype_gregorian\structure::convert_to_gregorian ( $year,
$month,
$day,
$hour = 0,
$minute = 0 )

Provided with a day, month, year, hour and minute in a specific calendar type convert it into the equivalent Gregorian date.

In this function we don't need to do anything except pass the data back as an array. This is because the date received is Gregorian.

Parameters
int$year
int$month
int$day
int$hour
int$minute
Return values
arraythe converted date

Reimplemented from core_calendar\type_base.

◆ convert_to_timestamp()

core_calendar\type_base::convert_to_timestamp ( $year,
$month,
$day,
$hour = 0,
$minute = 0 )
inherited

Provided with a day, month, year, hour and minute in the specific calendar type convert it into the equivalent Unix Time Stamp.

Parameters
int$year
int$month
int$day
int$hour
int$minute
Return values
inttimestamp

◆ get_date_order()

calendartype_gregorian\structure::get_date_order ( $minyear = null,
$maxyear = null )

Returns a multidimensional array with information for day, month, year and the order they are displayed when selecting a date.

The order in the array will be the order displayed when selecting a date. Override this function to change the date selector order.

Parameters
int$minyearThe year to start with
int$maxyearThe year to finish with
Return values
arrayFull date information

Reimplemented from core_calendar\type_base.

◆ get_days()

calendartype_gregorian\structure::get_days ( )

Returns a list of all the possible days for all months.

This is used to generate the select box for the days in the date selector elements. Some months contain more days than others so this function should return all possible days as we can not predict what month will be chosen (the user may have JS turned off and we need to support this situation in Moodle).

Return values
arraythe days

Reimplemented from core_calendar\type_base.

◆ get_max_year()

calendartype_gregorian\structure::get_max_year ( )

Returns the maximum year for the calendar.

Return values
intThe maximum year

Reimplemented from core_calendar\type_base.

◆ get_min_year()

calendartype_gregorian\structure::get_min_year ( )

Returns the minimum year for the calendar.

Return values
intThe minimum year

Reimplemented from core_calendar\type_base.

◆ get_months()

calendartype_gregorian\structure::get_months ( )

Returns a list of all the names of the months.

Return values
arraythe month names

Reimplemented from core_calendar\type_base.

◆ get_name()

calendartype_gregorian\structure::get_name ( )

Returns the name of the calendar.

This is the non-translated name, usually just the name of the folder.

Return values
stringthe calendar name

Reimplemented from core_calendar\type_base.

◆ get_next_day()

core_calendar\type_base::get_next_day ( $daytimestamp)
inherited

Get the next day.

Parameters
int$daytimestampThe day timestamp.
Return values
intthe following day

◆ get_next_month()

calendartype_gregorian\structure::get_next_month ( $year,
$month )

Get the next month.

If the current month is December, it will get the first month of the following year.

Parameters
int$year
int$month
Return values
arraythe following month and year

Reimplemented from core_calendar\type_base.

◆ get_num_days_in_month()

calendartype_gregorian\structure::get_num_days_in_month ( $year,
$month )

Returns the number of days in a given month.

Parameters
int$year
int$month
Return values
intthe number of days

Reimplemented from core_calendar\type_base.

◆ get_num_weekdays()

calendartype_gregorian\structure::get_num_weekdays ( )

Returns the number of days in a week.

Return values
intthe number of days

Reimplemented from core_calendar\type_base.

◆ get_prev_day()

core_calendar\type_base::get_prev_day ( $daytimestamp)
inherited

Get the previous day.

Parameters
int$daytimestampThe day timestamp.
Return values
intprevious day timestamp

◆ get_prev_month()

calendartype_gregorian\structure::get_prev_month ( $year,
$month )

Get the previous month.

If the current month is January, it will get the last month of the previous year.

Parameters
int$year
int$month
Return values
arrayprevious month and year

Reimplemented from core_calendar\type_base.

◆ get_starting_weekday()

calendartype_gregorian\structure::get_starting_weekday ( )

Returns the index of the starting week day.

This may vary, for example some may consider Monday as the start of the week, where as others may consider Sunday the start.

Return values
int

Reimplemented from core_calendar\type_base.

◆ get_weekday()

calendartype_gregorian\structure::get_weekday ( $year,
$month,
$day )

Returns the index of the weekday for a specific calendar date.

Parameters
int$year
int$month
int$day
Return values
int

Reimplemented from core_calendar\type_base.

◆ get_weekdays()

calendartype_gregorian\structure::get_weekdays ( )

Returns an indexed list of all the names of the weekdays.

The list starts with the index 0. Each index, representing a day, must be an array that contains the indexes 'shortname' and 'fullname'.

Return values
arrayarray of days

Reimplemented from core_calendar\type_base.

◆ get_years()

calendartype_gregorian\structure::get_years ( $minyear = null,
$maxyear = null )

Returns an array of years.

Parameters
int$minyear
int$maxyear
Return values
arraythe years

Reimplemented from core_calendar\type_base.

◆ locale_win_charset()

calendartype_gregorian\structure::locale_win_charset ( )

This return locale for windows os.

Return values
stringlocale

Reimplemented from core_calendar\type_base.

◆ timestamp_to_date_array()

calendartype_gregorian\structure::timestamp_to_date_array ( $time,
$timezone = 99 )

Given a $time timestamp in GMT (seconds since epoch), returns an array that represents the date in user time.

Parameters
int$timeTimestamp in GMT
float | int | string$timezoneoffset's time with timezone, if float and not 99, then no dst offset is applied
Return values
arrayan array that represents the date in user time

Reimplemented from core_calendar\type_base.

◆ timestamp_to_date_string()

calendartype_gregorian\structure::timestamp_to_date_string ( $time,
$format,
$timezone,
$fixday,
$fixhour )

Returns a formatted string that represents a date in user time.

Returns a formatted string that represents a date in user time WARNING: note that the format is for strftime(), not date(). Because of a bug in most Windows time libraries, we can't use the nicer e, so we have to use d which has leading zeroes. A lot of the fuss in the function is just getting rid of these leading zeroes as efficiently as possible.

If parameter fixday = true (default), then take off leading zero from d, else maintain it.

Parameters
int$timethe timestamp in UTC, as obtained from the database
string$formatstrftime format
int | float | string$timezonethe timezone to use
bool$fixdayif true then the leading zero from d is removed, if false then the leading zero is maintained
bool$fixhourif true then the leading zero from I is removed, if false then the leading zero is maintained
Return values
stringthe formatted date/time

Reimplemented from core_calendar\type_base.


The documentation for this class was generated from the following file: