Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | List of all members
core_calendar\type_base Class Reference
Inheritance diagram for core_calendar\type_base:
calendartype_gregorian\structure calendartype_test_example\structure

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. More...
 
 convert_to_gregorian ($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 Gregorian date. More...
 
 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. More...
 
 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. More...
 
 get_days ()
 Returns a list of all the possible days for all months. More...
 
 get_max_year ()
 Returns the maximum year for the calendar. More...
 
 get_min_year ()
 Returns the minimum year for the calendar. More...
 
 get_months ()
 Returns a list of all the names of the months. More...
 
 get_name ()
 Returns the name of the calendar. More...
 
 get_next_day ($daytimestamp)
 Get the next day. More...
 
 get_next_month ($year, $month)
 Get the next month. More...
 
 get_num_days_in_month ($year, $month)
 Returns the number of days in a given month. More...
 
 get_num_weekdays ()
 Returns the number of days in a week. More...
 
 get_prev_day ($daytimestamp)
 Get the previous day. More...
 
 get_prev_month ($year, $month)
 Get the previous month. More...
 
 get_starting_weekday ()
 Returns the index of the starting week day. More...
 
 get_weekday ($year, $month, $day)
 Returns the index of the weekday for a specific calendar date. More...
 
 get_weekdays ()
 Returns an indexed list of all the names of the weekdays. More...
 
 get_years ($minyear=null, $maxyear=null)
 Returns an array of years. More...
 
 locale_win_charset ()
 This return locale for windows os. More...
 
 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. More...
 
 timestamp_to_date_string ($time, $format, $timezone, $fixday, $fixhour)
 Returns a formatted string that represents a date in user time. More...
 

Member Function Documentation

◆ convert_from_gregorian()

core_calendar\type_base::convert_from_gregorian (   $year,
  $month,
  $day,
  $hour = 0,
  $minute = 0 
)
abstract

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 date

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ convert_to_gregorian()

core_calendar\type_base::convert_to_gregorian (   $year,
  $month,
  $day,
  $hour = 0,
  $minute = 0 
)
abstract

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

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

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ convert_to_timestamp()

core_calendar\type_base::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.

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

◆ get_date_order()

core_calendar\type_base::get_date_order (   $minyear = null,
  $maxyear = null 
)
abstract

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 in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_days()

core_calendar\type_base::get_days ( )
abstract

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 in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_max_year()

core_calendar\type_base::get_max_year ( )
abstract

Returns the maximum year for the calendar.

Return values
intThe maximum year

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_min_year()

core_calendar\type_base::get_min_year ( )
abstract

Returns the minimum year for the calendar.

Return values
intThe minimum year

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_months()

core_calendar\type_base::get_months ( )
abstract

Returns a list of all the names of the months.

Return values
arraythe month names

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_name()

core_calendar\type_base::get_name ( )
abstract

Returns the name of the calendar.

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

Return values
stringthe calendar name

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_next_day()

core_calendar\type_base::get_next_day (   $daytimestamp)

Get the next day.

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

◆ get_next_month()

core_calendar\type_base::get_next_month (   $year,
  $month 
)
abstract

Get the next month.

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

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_num_days_in_month()

core_calendar\type_base::get_num_days_in_month (   $year,
  $month 
)
abstract

Returns the number of days in a given month.

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

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_num_weekdays()

core_calendar\type_base::get_num_weekdays ( )
abstract

Returns the number of days in a week.

Return values
intthe number of days

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_prev_day()

core_calendar\type_base::get_prev_day (   $daytimestamp)

Get the previous day.

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

◆ get_prev_month()

core_calendar\type_base::get_prev_month (   $year,
  $month 
)
abstract

Get the previous month.

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

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_starting_weekday()

core_calendar\type_base::get_starting_weekday ( )
abstract

Returns the index of the starting week day.

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

Return values
int

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_weekday()

core_calendar\type_base::get_weekday (   $year,
  $month,
  $day 
)
abstract

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

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

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_weekdays()

core_calendar\type_base::get_weekdays ( )
abstract

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 in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ get_years()

core_calendar\type_base::get_years (   $minyear = null,
  $maxyear = null 
)
abstract

Returns an array of years.

Parameters
int$minyear
int$maxyear
Return values
arraythe years

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ locale_win_charset()

core_calendar\type_base::locale_win_charset ( )
abstract

This return locale for windows os.

Return values
stringlocale

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ timestamp_to_date_array()

core_calendar\type_base::timestamp_to_date_array (   $time,
  $timezone = 99 
)
abstract

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 http://docs.moodle.org/dev/Time_API#Timezone
Return values
arrayan array that represents the date in user time

Reimplemented in calendartype_gregorian\structure, and calendartype_test_example\structure.

◆ timestamp_to_date_string()

core_calendar\type_base::timestamp_to_date_string (   $time,
  $format,
  $timezone,
  $fixday,
  $fixhour 
)
abstract

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 http://docs.moodle.org/dev/Time_API#Timezone
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 in calendartype_gregorian\structure, and calendartype_test_example\structure.


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