Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
calendartype_test_example\structure Class Reference
Inheritance diagram for calendartype_test_example\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 Gregorian date convert it into the specific calendar type date.
 
 convert_to_gregorian ($year, $month, $day, $hour=0, $minute=0)
 Provided with a day, month, year, hour and minute 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_test_example\structure::convert_from_gregorian ( $year,
$month,
$day,
$hour = 0,
$minute = 0 )

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

Parameters
int$year
int$month
int$day
int$hour
int$minute
Return values
arraythe converted day, month, year, hour and minute.

Reimplemented from core_calendar\type_base.

◆ convert_to_gregorian()

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

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

Parameters
int$year
int$month
int$day
int$hour
int$minute
Return values
arraythe converted day, month, year, hour and minute.

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_test_example\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_test_example\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_test_example\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_test_example\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_test_example\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_test_example\structure::get_name ( )

Returns the name of the calendar.

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_test_example\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_test_example\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_test_example\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_test_example\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_test_example\structure::get_starting_weekday ( )

Returns the index of the starting week day.

Return values
int

Reimplemented from core_calendar\type_base.

◆ get_weekday()

calendartype_test_example\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_test_example\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_test_example\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_test_example\structure::locale_win_charset ( )

This return locale for windows os.

Return values
stringlocale

Reimplemented from core_calendar\type_base.

◆ timestamp_to_date_array()

calendartype_test_example\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$timezonethe timezone to use to calculate the time
Return values
arrayan array that represents the date in user time

Reimplemented from core_calendar\type_base.

◆ timestamp_to_date_string()

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

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

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: