Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
calendar_information Class Reference

Calendar information class. More...

Public Member Functions

 __construct ($day=0, $month=0, $year=0, $time=0)
 Creates a new instance.
 
 add_sidecalendar_blocks (core_calendar_renderer $renderer, $showfilters=false, $view=null)
 Adds the pretend blocks for the calendar.
 
 checkdate ($defaultonow=true)
 Ensures the date for the calendar is correct and either sets it to now or throws a moodle_exception if not.
 
 get_viewmode ()
 Getter method for the calendar's view mode.
 
 prepare_for_view (stdClass $course, array $coursestoload, $ignorefilters=false)
 Initialize calendar information.
 
 set_sources (stdClass $course, array $courses, stdClass $category=null)
 Set the sources for events within the calendar.
 
 set_time ($time=null)
 Set the time period of this instance.
 
 set_viewmode (string $viewmode)
 Setter method for the calendar's view mode.
 
 timestamp_today ()
 Gets todays timestamp for the calendar.
 
 timestamp_tomorrow ()
 Gets tomorrows timestamp for the calendar.
 

Static Public Member Functions

static create ($time, int $courseid, int $categoryid=null)
 Creates and set up a instance.
 

Public Attributes

array $categories = array()
 An array of categories.
 
int $categoryid = null
 The current category.
 
context $context = null
 The anticipated context that the calendar is viewed in.
 
stdClass $course
 course data.
 
int $courseid = null
 A course id.
 
array $courses = array()
 An array of courses.
 
array $groups = array()
 An array of groups.
 
int $time
 The timestamp.
 
array $users = array()
 An array of users.
 

Protected Attributes

int $day
 day.
 
int $month
 month.
 
string $viewmode
 The calendar's view mode.
 
int $year
 year.
 

Detailed Description

Calendar information class.

This class is used simply to organise the information pertaining to a calendar and is used primarily to make information easily available.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

calendar_information::__construct ( $day = 0,
$month = 0,
$year = 0,
$time = 0 )

Creates a new instance.

Parameters
int$daythe number of the day
int$monththe number of the month
int$yearthe number of the year
int$timethe unixtimestamp representing the date we want to view, this is used instead of $calmonth and $calyear to support multiple calendars

Member Function Documentation

◆ add_sidecalendar_blocks()

calendar_information::add_sidecalendar_blocks ( core_calendar_renderer $renderer,
$showfilters = false,
$view = null )

Adds the pretend blocks for the calendar.

Parameters
core_calendar_renderer$renderer
bool$showfiltersdisplay filters, false is set as default
string | null$viewpreference view options (eg: day, month, upcoming)

◆ checkdate()

calendar_information::checkdate ( $defaultonow = true)

Ensures the date for the calendar is correct and either sets it to now or throws a moodle_exception if not.

Parameters
bool$defaultonowuse current time
Exceptions
moodle_exception
Return values
boolvalidation of checkdate

◆ create()

static calendar_information::create ( $time,
int $courseid,
int $categoryid = null )
static

Creates and set up a instance.

Parameters
int$timethe unixtimestamp representing the date we want to view.
int$courseidThe ID of the course the user wishes to view.
int$categoryidThe ID of the category the user wishes to view If a courseid is specified, this value is ignored.
Return values
calendar_information

◆ get_viewmode()

calendar_information::get_viewmode ( )

Getter method for the calendar's view mode.

Return values
string

◆ prepare_for_view()

calendar_information::prepare_for_view ( stdClass $course,
array $coursestoload,
$ignorefilters = false )

Initialize calendar information.

Deprecated
3.4
Parameters
stdClass$courseobject
array$coursestoloadAn array of courses [$course->id => $course]
bool$ignorefiltersoptions to use filter

◆ set_sources()

calendar_information::set_sources ( stdClass $course,
array $courses,
stdClass $category = null )

Set the sources for events within the calendar.

If no category is provided, then the category path for the current course will be used.

Parameters
stdClass$courseThe current course being viewed.
stdClass[]$coursesThe list of all courses currently accessible.
stdClass$categoryThe current category to show.

◆ set_time()

calendar_information::set_time ( $time = null)

Set the time period of this instance.

Parameters
int$timethe unixtimestamp representing the date we want to view.
Return values
$this

◆ set_viewmode()

calendar_information::set_viewmode ( string $viewmode)

Setter method for the calendar's view mode.

Parameters
string$viewmode

◆ timestamp_today()

calendar_information::timestamp_today ( )

Gets todays timestamp for the calendar.

Return values
inttoday timestamp

◆ timestamp_tomorrow()

calendar_information::timestamp_tomorrow ( )

Gets tomorrows timestamp for the calendar.

Return values
inttomorrow timestamp

Member Data Documentation

◆ $time

int calendar_information::$time

The timestamp.

Rather than setting the day, month and year we will set a timestamp which will be able to be used by multiple calendars.


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