Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
calendar_information Class Reference

Public Member Functions

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

Static Public Member Functions

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

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.
 
int $courseid = null
 A course id.
 
array $courses = array()
 An array of courses.
 
array $groups = array()
 An array of groups.
 
int $time
 The timestamp. More...
 
array $users = array()
 An array of users.
 

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

◆ 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

◆ 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: