Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Files | Namespaces | Classes | Functions | Variables
core_calendar

Files

file  action.php
 Class representing an action a user should take.
 
file  action_event.php
 Calendar action event class.
 
file  action_event_interface.php
 Calendar action event interface.
 
file  action_factory.php
 Action factory.
 
file  action_factory_interface.php
 Action factory interface.
 
file  action_interface.php
 Action interface.
 
file  api.php
 Contains class containing the internal calendar API.
 
file  behat_calendar.php
 Behat calendar-related steps definitions.
 
file  calendar_day_exporter.php
 Contains event class for displaying the day view.
 
file  calendar_event_exporter.php
 Contains event class for displaying a calendar event.
 
file  calendar_upcoming_exporter.php
 Contains event class for displaying the upcoming view.
 
file  calendartype_test_example.php
 Handles calendar functions for the test calendar.
 
file  cm_info_proxy.php
 Course module cm_info proxy.
 
file  container.php
 Core container for calendar events.
 
file  coursecat_proxy.php
 Course category proxy.
 
file  create.php
 The mform for creating a calendar event.
 
file  create_update_form_mapper.php
 Event create form and update form mapper.
 
file  create_update_form_mapper_interface.php
 Create update form mapper interface.
 
file  date_exporter.php
 Class for normalising the date data.
 
file  day_exporter.php
 Contains event class for displaying the day view.
 
file  day_name_exporter.php
 Contains event class for displaying the day name.
 
file  description_interface.php
 Description value object interface.
 
file  event.php
 Calendar event class.
 
file  event_abstract_factory.php
 Abstract event factory.
 
file  event_action_exporter.php
 Contains event class for displaying a calendar event's action.
 
file  event_collection_interface.php
 Interface for an event collection class.
 
file  event_description.php
 Description value object.
 
file  event_exporter.php
 Contains event class for displaying a calendar event.
 
file  event_exporter_base.php
 Contains event class for displaying a calendar event.
 
file  event_factory.php
 Event factory class.
 
file  event_factory_interface.php
 Event factory interface.
 
file  event_icon_exporter.php
 Contains event class for displaying a calendar event's icon.
 
file  event_interface.php
 Calendar event interface.
 
file  event_mapper.php
 Event mapper.
 
file  event_mapper_interface.php
 Event mapper interface.
 
file  event_subscription_exporter.php
 Contains event class for displaying a calendar event's subscription.
 
file  event_times.php
 Event times class.
 
file  event_vault.php
 Event vault class.
 
file  event_vault_interface.php
 Event vault interface.
 
file  events_exporter.php
 Contains event class for displaying a list of calendar events.
 
file  events_grouped_by_course_exporter.php
 Contains event class for displaying a list of calendar events grouped by course id.
 
 
file  events_same_course_exporter.php
 Contains event class for displaying a list of calendar events for a single course.
 
file  eventtype.php
 The trait for adding eventtype fields to a form.
 
file  export_form.php
 The mform for exporting calendar events.
 
file  externallib.php
 External calendar API.
 
file  footer_options_exporter.php
 Class for exporting calendar footer view options data.
 
file  helpers.php
 This file contains helper classes and functions for testing.
 
file  invalid_callback_exception.php
 Invalid callback exception.
 
file  invalid_parameter_exception.php
 General invalid parameter exception.
 
file  lib.php
 Calendar extension.
 
file  limit_invalid_parameter_exception.php
 Invalid limit parameter exception.
 
file  member_does_not_exist_exception.php
 Member does not exist exception.
 
file  month_exporter.php
 Contains event class for displaying the month view.
 
file  provider.php
 Privacy class for requesting user data.
 
file  proxy_interface.php
 Proxy interface.
 
file  raw_event_retrieval_strategy.php
 Raw event retrieval strategy.
 
file  raw_event_retrieval_strategy_interface.php
 Raw event strategy retrieval interface.
 
file  repeat_event_collection.php
 Event collection class.
 
file  rrule_manager.php
 Defines calendar class to manage recurrence rule (rrule) during ical imports.
 
file  std_proxy.php
 std_proxy class.
 
file  times_interface.php
 Times interface.
 
file  timesort_invalid_parameter_exception.php
 Invalid timesort parameter exception.
 
file  type_base.php
 Defines functions used by calendar type plugins.
 
file  type_factory.php
 Class core_calendar\type_factory.
 
file  update.php
 The mform for updating a calendar event.
 
file  week_day_exporter.php
 Contains event class for displaying the day on month view.
 
file  week_exporter.php
 Contains event class for displaying the week view.
 

Namespaces

 calendartype_test_example
  
 
 core_calendar
  
 
 core_calendar\external
  
 
 core_calendar\local
  
 
 core_calendar\local\event
  
 
 core_calendar\local\event\data_access
  
 
 core_calendar\local\event\entities
  
 
 core_calendar\local\event\exceptions
  
 
 core_calendar\local\event\factories
  
 
 core_calendar\local\event\forms
  
 
 core_calendar\local\event\mappers
  
 
 core_calendar\local\event\proxies
  
 
 core_calendar\local\event\strategies
  
 
 core_calendar\local\event\value_objects
  
 
 core_calendar\privacy
  
 

Classes

class  action_event_test_factory
 A test factory that will create action events. More...
 
class  behat_calendar
 
class  calendar_event
 
class  calendar_information
 
class  calendartype_test_example\structure
 
class  core_calendar\action_factory
 Action factory class. More...
 
class  core_calendar\external\calendar_day_exporter
 Class for displaying the day view. More...
 
class  core_calendar\external\calendar_event_exporter
 Class for displaying a calendar event. More...
 
class  core_calendar\external\calendar_upcoming_exporter
 Class for displaying the day view. More...
 
class  core_calendar\external\date_exporter
 Class for normalising the date data. More...
 
class  core_calendar\external\day_exporter
 Class for displaying the day view. More...
 
class  core_calendar\external\day_name_exporter
 Class for displaying the day view. More...
 
class  core_calendar\external\event_action_exporter
 Class for displaying a calendar event's action. More...
 
class  core_calendar\external\event_exporter
 Class for displaying a calendar event. More...
 
class  core_calendar\external\event_exporter_base
 Class for displaying a calendar event. More...
 
class  core_calendar\external\event_icon_exporter
 Class for displaying a calendar event's icon. More...
 
class  core_calendar\external\event_subscription_exporter
 Class for displaying a calendar event's subscription. More...
 
class  core_calendar\external\events_exporter
 Class for displaying a list of calendar events. More...
 
class  core_calendar\external\events_grouped_by_course_exporter
 Class for displaying a list of calendar events grouped by course id. More...
 
class  core_calendar\external\events_related_objects_cache
 Class to providing the related objects when exporting a list of calendar events. More...
 
class  core_calendar\external\events_same_course_exporter
 Class for displaying a list of calendar events for a single course. More...
 
class  core_calendar\external\footer_options_exporter
 Class for exporting calendar footer view options data. More...
 
class  core_calendar\external\month_exporter
 Class for displaying the month view. More...
 
class  core_calendar\external\week_day_exporter
 Class for displaying the day on month view. More...
 
class  core_calendar\external\week_exporter
 Class for displaying the week view. More...
 
class  core_calendar\local\api
 Class containing the local calendar API. More...
 
class  core_calendar\local\event\container
 Core container. More...
 
class  core_calendar\local\event\data_access\event_vault
 Event vault class. More...
 
interface  core_calendar\local\event\data_access\event_vault_interface
 Interface for an event vault class. More...
 
class  core_calendar\local\event\entities\action_event
 Class representing an actionable event. More...
 
interface  core_calendar\local\event\entities\action_event_interface
 Interface for an action event class. More...
 
interface  core_calendar\local\event\entities\action_interface
 Interface for a action class. More...
 
class  core_calendar\local\event\entities\event
 Class representing a calendar event. More...
 
interface  core_calendar\local\event\entities\event_collection_interface
 Interface for an event collection class. More...
 
interface  core_calendar\local\event\entities\event_interface
 Interface for an event class. More...
 
class  core_calendar\local\event\entities\repeat_event_collection
 Class representing a collection of repeat events. More...
 
class  core_calendar\local\event\exceptions\invalid_callback_exception
 Invalid callback exception. More...
 
class  core_calendar\local\event\exceptions\invalid_parameter_exception
 General invalid parameter exception. More...
 
class  core_calendar\local\event\exceptions\limit_invalid_parameter_exception
 Invalid limit parameter exception. More...
 
class  core_calendar\local\event\exceptions\member_does_not_exist_exception
 Member does not exist exception. More...
 
class  core_calendar\local\event\exceptions\timesort_invalid_parameter_exception
 Invalid timesort parameter exception. More...
 
interface  core_calendar\local\event\factories\action_factory_interface
 
class  core_calendar\local\event\factories\event_abstract_factory
 Abstract factory for creating calendar events. More...
 
class  core_calendar\local\event\factories\event_factory
 Event factory class. More...
 
interface  core_calendar\local\event\factories\event_factory_interface
 Interface for an event factory class. More...
 
class  core_calendar\local\event\forms\create
 The mform class for creating a calendar event. More...
 
class  core_calendar\local\event\forms\update
 The mform class for updating a calendar event. More...
 
class  core_calendar\local\event\mappers\create_update_form_mapper
 Event create form and update form mapper class. More...
 
interface  core_calendar\local\event\mappers\create_update_form_mapper_interface
 Interface for a create_update_form_mapper class. More...
 
class  core_calendar\local\event\mappers\event_mapper
 Event mapper class. More...
 
interface  core_calendar\local\event\mappers\event_mapper_interface
 Interface for an event mapper class. More...
 
class  core_calendar\local\event\proxies\cm_info_proxy
 Course module stdClass proxy. More...
 
class  core_calendar\local\event\proxies\coursecat_proxy
 Course category proxy. More...
 
interface  core_calendar\local\event\proxies\proxy_interface
 Interface for a proxy class. More...
 
class  core_calendar\local\event\proxies\std_proxy
 stdClass proxy. More...
 
class  core_calendar\local\event\strategies\raw_event_retrieval_strategy
 Raw event retrieval strategy. More...
 
interface  core_calendar\local\event\strategies\raw_event_retrieval_strategy_interface
 Interface for an raw event retrival strategy class. More...
 
class  core_calendar\local\event\value_objects\action
 Class representing an action a user should take. More...
 
interface  core_calendar\local\event\value_objects\description_interface
 Interface for a description value object. More...
 
class  core_calendar\local\event\value_objects\event_description
 Class representing a description value object. More...
 
class  core_calendar\local\event\value_objects\event_times
 Class representing event times. More...
 
interface  core_calendar\local\event\value_objects\times_interface
 Interface for various times. More...
 
class  core_calendar\privacy\provider
 Privacy Subsystem for core_calendar implementing metadata, plugin, and user_preference providers. More...
 
class  core_calendar\rrule_manager
 Defines calendar class to manage recurrence rule (rrule) during ical imports. More...
 
class  core_calendar\type_base
 
class  core_calendar\type_factory
 
class  core_calendar_export_form
 The mform class for creating and editing a calendar. More...
 
class  core_calendar_external
 

Functions

 calendar_add_event_allowed ($event)
 Check wether the current user is permitted to add events. More...
 
 calendar_add_event_metadata ($event)
 Add calendar event metadata. More...
 
 calendar_add_icalendar_event ($event, $unused=null, $subscriptionid, $timezone='UTC')
 Add an iCalendar event to the Moodle calendar. More...
 
 calendar_add_month ($month, $year)
 Get the next following month. More...
 
 calendar_add_subscription ($sub)
 Add an iCalendar subscription to the database. More...
 
 calendar_can_edit_subscription ($subscriptionorid)
 Checks to see if the user can edit a given subscription feed. More...
 
 calendar_day_representation ($tstamp, $now=false, $usecommonwords=true)
 Return the representation day. More...
 
 calendar_days_in_month ($month, $year)
 Return the number of days in month. More...
 
 calendar_delete_event_allowed ($event)
 Return the capability for deleting a calendar event. More...
 
 calendar_delete_subscription ($subscription)
 Delete subscription and all related events. More...
 
 calendar_edit_event_allowed ($event, $manualedit=false)
 Return the capability for editing calendar event. More...
 
 calendar_events_by_day ($events, $month, $year, &$eventsbyday, &$durationbyday, &$typesbyday, &$courses)
 Get per-day basis events. More...
 
 calendar_format_event_time ($event, $now, $linkparams=null, $usecommonwords=true, $showtime=0)
 Get event format time. More...
 
 calendar_get_allowed_event_types (int $courseid=null)
 Get event types the user can create event based on categories, courses and groups the logged in user belongs to. More...
 
 calendar_get_allowed_types (&$allowed, $course=null, $groups=null, $category=null)
 Get calendar's allowed types. More...
 
 calendar_get_calendar_context ($subscription)
 Helper function to determine the context of a calendar subscription. More...
 
 calendar_get_course_cached (&$coursecache, $courseid)
 Get current course cache. More...
 
 calendar_get_courselink ($course)
 Get a HTML link to a course. More...
 
 calendar_get_days ()
 Return the days of the week. More...
 
 calendar_get_default_courses ($courseid=null, $fields=' *', $canmanage=false, int $userid=null)
 Returns the default courses to display on the calendar when there isn't a specific course to display. More...
 
 calendar_get_events ($tstart, $tend, $users, $groups, $courses, $withduration=true, $ignorehidden=true, $categories=[])
 Get calendar events. More...
 
 calendar_get_events_by_id ($eventids)
 Get calendar events by id. More...
 
 calendar_get_eventtype_choices ($courseid)
 Returns option list of available options for the calendar event type, given the current user and course. More...
 
 calendar_get_filter_types ()
 Get the list of potential calendar filter types as a type => name combination. More...
 
 calendar_get_footer_options ($calendar)
 Get the calendar footer options. More...
 
 calendar_get_group_cached ($groupid)
 Get group from groupid for calendar display. More...
 
 calendar_get_icalendar ($url)
 From a URL, fetch the calendar and return an iCalendar object. More...
 
 calendar_get_legacy_events ($tstart, $tend, $users, $groups, $courses, $withduration=true, $ignorehidden=true, $categories=[], $limitnum=0)
 Get legacy calendar events. More...
 
 calendar_get_link_href ($linkbase, $d, $m, $y, $time=0)
 Adds day, month, year arguments to a URL and returns a moodle_url object. More...
 
 calendar_get_link_next ($text, $linkbase, $d, $m, $y, $accesshide=false, $time=0)
 Build and return a next month HTML link, with an arrow. More...
 
 calendar_get_link_previous ($text, $linkbase, $d, $m, $y, $accesshide=false, $time=0)
 Build and return a previous month HTML link, with an arrow. More...
 
 calendar_get_module_cached (&$modulecache, $modulename, $instance)
 Get current module cache. More...
 
 calendar_get_pollinterval_choices ()
 Returns option list for the poll interval setting. More...
 
 calendar_get_starting_weekday ()
 Gets the first day of the week. More...
 
 calendar_get_subscription ($id)
 Get the subscription from a given id. More...
 
 calendar_get_timestamp ($d, $m, $y, $time=0)
 Calculate the timestamp from the supplied Gregorian Year, Month, and Day. More...
 
 calendar_get_view (\calendar_information $calendar, $view, $includenavigation=true, bool $skipevents=false, ?int $lookahead=null)
 Get the calendar view output. More...
 
 calendar_import_icalendar_events ($ical, $unused=null, $subscriptionid=null)
 Import events from an iCalendar object into a course calendar. More...
 
 calendar_internal_update_course_and_group_permission (int $courseid, context $context, array &$types)
 Given a course id, and context, updates the permission types array to add the 'course' or 'group' permission if it is relevant for that course. More...
 
 calendar_is_valid_eventtype ($type)
 Check whether the specified event type is valid. More...
 
 calendar_output_fragment_event_form ($args)
 Request and render event form fragment. More...
 
 calendar_process_subscription_row ($subscriptionid, $pollinterval, $action)
 Update a subscription from the form data in one of the rows in the existing subscriptions table. More...
 
 calendar_set_event_type_display ($type, $display=null, $user=null)
 Sets the display of the event type given $display. More...
 
 calendar_set_filters (array $courseeventsfrom, $ignorefilters=false, stdClass $user=null)
 Returns the courses to load events for. More...
 
 calendar_show_event_type ($type, $user=null)
 Checks to see if the requested type of event should be shown for the given user. More...
 
 calendar_sub_month ($month, $year)
 Get the previous month. More...
 
 calendar_time_representation ($time)
 return the formatted representation time. More...
 
 calendar_top_controls ($type, $data)
 Get control options for calendar. More...
 
 calendar_update_subscription ($subscription)
 Update a calendar subscription. More...
 
 calendar_update_subscription_events ($subscriptionid)
 Fetch a calendar subscription and update the events in the calendar. More...
 
 calendar_user_can_add_event ($course)
 See if user can add calendar entries at all used to print the "New Event" button. More...
 
 calendar_view_event_allowed (calendar_event $event)
 Return the capability for viewing a calendar event. More...
 
 core_calendar_user_preferences ()
 Implements callback user_preferences, whitelists preferences that users are allowed to update directly. More...
 
 create_event ($properties)
 Create a calendar event with the given properties. More...
 

Variables

global $CFG
 
const CALENDAR_DEFAULT_STARTING_WEEKDAY 1
 CALENDAR_DEFAULT_STARTING_WEEKDAY - default value to display the starting weekday.
 
const CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD (!defined('MOODLE_INTERNAL')) 21
 These are read by the administration component to provide default values. More...
 
const CALENDAR_DEFAULT_UPCOMING_MAXEVENTS 10
 CALENDAR_DEFAULT_UPCOMING_MAXEVENTS - default value to display the maximum number of upcoming event.
 
const CALENDAR_DEFAULT_WEEKEND 65
 CALENDAR_DEFAULT_WEEKEND - default value for weekend (Saturday & Sunday)
 
const CALENDAR_EVENT_COURSE 2
 CALENDAR_EVENT_COURSE - Course calendar event types.
 
const CALENDAR_EVENT_COURSECAT 16
 CALENDAR_EVENT_COURSECAT - Course category calendar event types.
 
const CALENDAR_EVENT_GLOBAL 1
 CALENDAR_EVENT_GLOBAL - Site calendar event types. More...
 
const CALENDAR_EVENT_GROUP 4
 CALENDAR_EVENT_GROUP - group calendar event types.
 
const CALENDAR_EVENT_SITE 1
 CALENDAR_EVENT_SITE - Site calendar event types.
 
const CALENDAR_EVENT_TYPE_ACTION 1
 CALENDAR_EVENT_TYPE_ACTION - Action events.
 
const CALENDAR_EVENT_TYPE_STANDARD 0
 CALENDAR_EVENT_TYPE_STANDARD - Standard events.
 
const CALENDAR_EVENT_USER 8
 CALENDAR_EVENT_USER - user calendar event types.
 
const CALENDAR_EVENT_USER_OVERRIDE_PRIORITY 0
 CALENDAR_EVENT_USER_OVERRIDE_PRIORITY - Constant for the user override priority.
 
const CALENDAR_IMPORT_EVENT_INSERTED 2
 CALENDAR_IMPORT_EVENT_INSERTED - imported event was added by insert.
 
const CALENDAR_IMPORT_EVENT_SKIPPED -1
 CALENDAR_IMPORT_EVENT_UPDATED_SKIPPED - imported event was skipped.
 
const CALENDAR_IMPORT_EVENT_UPDATED 1
 CALENDAR_IMPORT_EVENT_UPDATED - imported event was updated.
 
const CALENDAR_IMPORT_FROM_FILE 0
 CALENDAR_IMPORT_FROM_FILE - import the calendar from a file.
 
const CALENDAR_IMPORT_FROM_URL 1
 CALENDAR_IMPORT_FROM_URL - import the calendar from a URL.
 
const CALENDAR_SUBSCRIPTION_REMOVE 2
 CALENDAR_SUBSCRIPTION_REMOVE - Used to represent remove action for subscriptions in various forms.
 
const CALENDAR_SUBSCRIPTION_UPDATE 1
 CALENDAR_SUBSCRIPTION_UPDATE - Used to represent update action for subscriptions in various forms.
 
const CALENDAR_TF_12 '%I:%M %p'
 CALENDAR_TF_12 - Calendar time in 12 hours format.
 
const CALENDAR_TF_24 '%H:%M'
 CALENDAR_TF_24 - Calendar time in 24 hours format.
 
const CALENDAR_URL $CFG->wwwroot.'/calendar/'
 CALENDAR_URL - path to calendar's folder.
 
 if (!defined( 'MOODLE_INTERNAL'))
 

Detailed Description

Function Documentation

◆ calendar_add_event_allowed()

calendar_add_event_allowed (   $event)

Check wether the current user is permitted to add events.

Parameters
stdClass$eventobject of event
Return values
boolhas the capability to add event

◆ calendar_add_event_metadata()

calendar_add_event_metadata (   $event)

Add calendar event metadata.

Parameters
stdClass$eventevent info
Return values
stdClass::$eventmetadata

◆ calendar_add_icalendar_event()

calendar_add_icalendar_event (   $event,
  $unused = null,
  $subscriptionid,
  $timezone = 'UTC' 
)

Add an iCalendar event to the Moodle calendar.

Parameters
stdClass$eventThe RFC-2445 iCalendar event
int$unusedDeprecated
int$subscriptionidThe iCalendar subscription ID
string$timezoneThe X-WR-TIMEZONE iCalendar property if provided
Exceptions
dml_exceptionA DML specific exception is thrown for invalid subscriptionids.
Return values
intCode: CALENDAR_IMPORT_EVENT_UPDATED = updated, CALENDAR_IMPORT_EVENT_INSERTED = inserted, 0 = error

◆ calendar_add_month()

calendar_add_month (   $month,
  $year 
)

Get the next following month.

Parameters
int$monththe number of the month.
int$yearthe number of the year.
Return values
arraythe following month

◆ calendar_add_subscription()

calendar_add_subscription (   $sub)

Add an iCalendar subscription to the database.

Parameters
stdClass$subThe subscription object (e.g. from the form)
Return values
intThe insert ID, if any.

◆ calendar_can_edit_subscription()

calendar_can_edit_subscription (   $subscriptionorid)

Checks to see if the user can edit a given subscription feed.

Parameters
mixed$subscriptionoridSubscription object or id
Return values
booltrue if current user can edit the subscription else false

◆ calendar_day_representation()

calendar_day_representation (   $tstamp,
  $now = false,
  $usecommonwords = true 
)

Return the representation day.

Parameters
int$tstampTimestamp in GMT
int | bool$nowcurrent Unix timestamp
bool$usecommonwords
Return values
stringthe formatted date/time

◆ calendar_days_in_month()

calendar_days_in_month (   $month,
  $year 
)

Return the number of days in month.

Parameters
int$monththe number of the month.
int$yearthe number of the year
Return values
int

◆ calendar_delete_event_allowed()

calendar_delete_event_allowed (   $event)

Return the capability for deleting a calendar event.

Parameters
calendar_event$eventThe event object
Return values
boolWhether the user has permission to delete the event or not.

◆ calendar_delete_subscription()

calendar_delete_subscription (   $subscription)

Delete subscription and all related events.

Parameters
int | stdClass$subscriptionsubscription or it's id, which needs to be deleted.

◆ calendar_edit_event_allowed()

calendar_edit_event_allowed (   $event,
  $manualedit = false 
)

Return the capability for editing calendar event.

Parameters
calendar_event$eventevent object
bool$manualeditis the event being edited manually by the user
Return values
boolcapability to edit event

◆ calendar_events_by_day()

calendar_events_by_day (   $events,
  $month,
  $year,
$eventsbyday,
$durationbyday,
$typesbyday,
$courses 
)

Get per-day basis events.

Parameters
array$eventslist of events
int$monththe number of the month
int$yearthe number of the year
array$eventsbydayevent on specific day
array$durationbydayduration of the event in days
array$typesbydayevent type (eg: site, course, user, or group)
array$courseslist of courses
Return values
void

◆ calendar_format_event_time()

calendar_format_event_time (   $event,
  $now,
  $linkparams = null,
  $usecommonwords = true,
  $showtime = 0 
)

Get event format time.

Parameters
calendar_event$eventevent object
int$nowcurrent time in gmt
array$linkparamslist of params for event link
bool$usecommonwordsthe words as formatted date/time.
int$showtimedetermine the show time GMT timestamp
Return values
string::$eventtimelink/string for event time

◆ calendar_get_allowed_event_types()

calendar_get_allowed_event_types ( int  $courseid = null)

Get event types the user can create event based on categories, courses and groups the logged in user belongs to.

Parameters
int | null$courseidThe course id.
Return values
arrayThe array of allowed types.

◆ calendar_get_allowed_types()

calendar_get_allowed_types ( $allowed,
  $course = null,
  $groups = null,
  $category = null 
)

Get calendar's allowed types.

Parameters
stdClass$allowedlist of allowed edit for event type
stdClass | int$courseobject of a course or course id
array$groupsarray of groups for the given course
stdClass | int$categoryobject of a category

◆ calendar_get_calendar_context()

calendar_get_calendar_context (   $subscription)

Helper function to determine the context of a calendar subscription.

Subscriptions can be created in two contexts COURSE, or USER.

Parameters
stdClass$subscription
Return values
contextinstance

◆ calendar_get_course_cached()

calendar_get_course_cached ( $coursecache,
  $courseid 
)

Get current course cache.

Parameters
array$coursecachelist of course cache
int$courseidid of the course
Return values
stdClass::$coursecache,[$courseid]return the specific course cache

◆ calendar_get_courselink()

calendar_get_courselink (   $course)

Get a HTML link to a course.

Parameters
int | stdClass$coursethe course id or course object
Return values
stringa link to the course (as HTML); empty if the course id is invalid

◆ calendar_get_days()

calendar_get_days ( )

Return the days of the week.

Return values
arrayarray of days

◆ calendar_get_default_courses()

calendar_get_default_courses (   $courseid = null,
  $fields = '*',
  $canmanage = false,
int  $userid = null 
)

Returns the default courses to display on the calendar when there isn't a specific course to display.

Parameters
int$courseid(optional) If passed, an additional course can be returned for admins (the current course).
string$fieldsComma separated list of course fields to return.
bool$canmanageIf true, this will return the list of courses the user can create events in, rather than the list of courses they see events from (an admin can always add events in a course calendar, even if they are not enrolled in the course).
int$userid(optional) The user which this function returns the default courses for. By default the current user.
Return values
array::$coursesArray of courses to display

◆ calendar_get_events()

calendar_get_events (   $tstart,
  $tend,
  $users,
  $groups,
  $courses,
  $withduration = true,
  $ignorehidden = true,
  $categories = [] 
)

Get calendar events.

Parameters
int$tstartStart time of time range for events
int$tendEnd time of time range for events
array | int | boolean$usersarray of users, user id or boolean for all/no user events
array | int | boolean$groupsarray of groups, group id or boolean for all/no group events
array | int | boolean$coursesarray of courses, course id or boolean for all/no course events
boolean$withdurationwhether only events starting within time range selected or events in progress/already started selected as well
boolean$ignorehiddenwhether to select only visible events or all events
array | int | boolean$categoriesarray of categories, category id or boolean for all/no course events
Return values
array::$eventsof selected events or an empty array if there aren't any (or there was an error)

◆ calendar_get_events_by_id()

calendar_get_events_by_id (   $eventids)

Get calendar events by id.

Since
Moodle 2.5
Parameters
array$eventidslist of event ids
Return values
arrayArray of event entries, empty array if nothing found

◆ calendar_get_eventtype_choices()

calendar_get_eventtype_choices (   $courseid)

Returns option list of available options for the calendar event type, given the current user and course.

Parameters
int$courseidThe id of the course
Return values
arrayAn array containing the event types the user can create.

◆ calendar_get_filter_types()

calendar_get_filter_types ( )

Get the list of potential calendar filter types as a type => name combination.

Return values
array

◆ calendar_get_footer_options()

calendar_get_footer_options (   $calendar)

Get the calendar footer options.

Parameters
calendar_information$calendarThe calendar information object.
Return values
arrayThe data for template and template name.

◆ calendar_get_group_cached()

calendar_get_group_cached (   $groupid)

Get group from groupid for calendar display.

Parameters
int$groupid
Return values
stdClassgroup object with fields 'id', 'name' and 'courseid'

◆ calendar_get_icalendar()

calendar_get_icalendar (   $url)

From a URL, fetch the calendar and return an iCalendar object.

Parameters
string$urlThe iCalendar URL
Return values
iCalendarThe iCalendar object

◆ calendar_get_legacy_events()

calendar_get_legacy_events (   $tstart,
  $tend,
  $users,
  $groups,
  $courses,
  $withduration = true,
  $ignorehidden = true,
  $categories = [],
  $limitnum = 0 
)

Get legacy calendar events.

Parameters
int$tstartStart time of time range for events
int$tendEnd time of time range for events
array | int | boolean$usersarray of users, user id or boolean for all/no user events
array | int | boolean$groupsarray of groups, group id or boolean for all/no group events
array | int | boolean$coursesarray of courses, course id or boolean for all/no course events
boolean$withdurationwhether only events starting within time range selected or events in progress/already started selected as well
boolean$ignorehiddenwhether to select only visible events or all events
array$categoriesarray of category ids and/or objects.
int$limitnumNumber of events to fetch or zero to fetch all.
Return values
array::$eventsof selected events or an empty array if there aren't any (or there was an error)

◆ calendar_get_link_href()

calendar_get_link_href (   $linkbase,
  $d,
  $m,
  $y,
  $time = 0 
)

Adds day, month, year arguments to a URL and returns a moodle_url object.

Parameters
string | moodle_url$linkbase
int$dThe number of the day.
int$mThe number of the month.
int$yThe number of the year.
int$timethe unixtime, used for multiple calendar support. The values $d, $m and $y are kept for backwards compatibility.
Return values
moodle_url|null::$linkbase

◆ calendar_get_link_next()

calendar_get_link_next (   $text,
  $linkbase,
  $d,
  $m,
  $y,
  $accesshide = false,
  $time = 0 
)

Build and return a next month HTML link, with an arrow.

Parameters
string$textThe text label.
string | moodle_url$linkbaseThe URL stub.
int$dthe number of the Day
int$mThe number of the month.
int$yThe number of the year.
bool$accesshideDefault visible, or hide from all except screenreaders.
int$timethe unixtime, used for multiple calendar support. The values $d, $m and $y are kept for backwards compatibility.
Return values
stringHTML string.

◆ calendar_get_link_previous()

calendar_get_link_previous (   $text,
  $linkbase,
  $d,
  $m,
  $y,
  $accesshide = false,
  $time = 0 
)

Build and return a previous month HTML link, with an arrow.

Parameters
string$textThe text label.
string | moodle_url$linkbaseThe URL stub.
int$dThe number of the date.
int$mThe number of the month.
int$yyear The number of the year.
bool$accesshideDefault visible, or hide from all except screenreaders.
int$timethe unixtime, used for multiple calendar support. The values $d, $m and $y are kept for backwards compatibility.
Return values
stringHTML string.

◆ calendar_get_module_cached()

calendar_get_module_cached ( $modulecache,
  $modulename,
  $instance 
)

Get current module cache.

Only use this method if you do not know courseid. Otherwise use: get_fast_modinfo($courseid)->instances[$modulename][$instance]

Parameters
array$modulecachein memory module cache
string$modulenamename of the module
int$instancemodule instance number
Return values
stdClass|bool::$moduleinformation

◆ calendar_get_pollinterval_choices()

calendar_get_pollinterval_choices ( )

Returns option list for the poll interval setting.

Return values
arrayAn array of poll interval options. Interval => description.

◆ calendar_get_starting_weekday()

calendar_get_starting_weekday ( )

Gets the first day of the week.

Used to be define('CALENDAR_STARTING_WEEKDAY', blah);

Return values
int

◆ calendar_get_subscription()

calendar_get_subscription (   $id)

Get the subscription from a given id.

Since
Moodle 2.5
Parameters
int$idid of the subscription
Return values
stdClassSubscription record from DB
Exceptions
moodle_exceptionfor an invalid id

◆ calendar_get_timestamp()

calendar_get_timestamp (   $d,
  $m,
  $y,
  $time = 0 
)

Calculate the timestamp from the supplied Gregorian Year, Month, and Day.

Parameters
int$dThe day
int$mThe month
int$yThe year
int$timeThe timestamp to use instead of a separate y/m/d.
Return values
intThe timestamp

◆ calendar_get_view()

calendar_get_view ( \calendar_information  $calendar,
  $view,
  $includenavigation = true,
bool  $skipevents = false,
?int  $lookahead = null 
)

Get the calendar view output.

Parameters
calendar_information$calendarThe calendar being represented
string$viewThe type of calendar to have displayed
bool$includenavigationWhether to include navigation
bool$skipeventsWhether to load the events or not
int$lookaheadOverwrites site and users's lookahead setting.
Return values
array[array,string]

◆ calendar_import_icalendar_events()

calendar_import_icalendar_events (   $ical,
  $unused = null,
  $subscriptionid = null 
)

Import events from an iCalendar object into a course calendar.

Parameters
iCalendar$icalThe iCalendar object.
int$unusedDeprecated
int$subscriptionidThe subscription ID.
Return values
stringA log of the import progress, including errors.

◆ calendar_internal_update_course_and_group_permission()

calendar_internal_update_course_and_group_permission ( int  $courseid,
context  $context,
array &  $types 
)

Given a course id, and context, updates the permission types array to add the 'course' or 'group' permission if it is relevant for that course.

For efficiency, if they already have 'course' or 'group' then it skips checks.

Do not call this function directly, it is only for use by calendar_get_allowed_event_types().

Parameters
int$courseidCourse id
context$contextContext for that course
array$typesCurrent permissions

◆ calendar_is_valid_eventtype()

calendar_is_valid_eventtype (   $type)

Check whether the specified event type is valid.

Parameters
string$type
Return values
bool

◆ calendar_output_fragment_event_form()

calendar_output_fragment_event_form (   $args)

Request and render event form fragment.

Parameters
array$argsThe fragment arguments.
Return values
stringThe rendered mform fragment.

◆ calendar_process_subscription_row()

calendar_process_subscription_row (   $subscriptionid,
  $pollinterval,
  $action 
)

Update a subscription from the form data in one of the rows in the existing subscriptions table.

Parameters
int$subscriptionidThe ID of the subscription we are acting upon.
int$pollintervalThe poll interval to use.
int$actionThe action to be performed. One of update or remove.
Exceptions
dml_exceptionif invalid subscriptionid is provided
Return values
stringA log of the import progress, including errors

◆ calendar_set_event_type_display()

calendar_set_event_type_display (   $type,
  $display = null,
  $user = null 
)

Sets the display of the event type given $display.

If $display = true the event type will be shown. If $display = false the event type will NOT be shown. If $display = null the current value will be toggled and saved.

Parameters
int$typeobject of CALENDAR_EVENT_XXX
bool$displayoption to display event type
stdClass | int$usermoodle user object or id, null means current user

◆ calendar_set_filters()

calendar_set_filters ( array  $courseeventsfrom,
  $ignorefilters = false,
stdClass  $user = null 
)

Returns the courses to load events for.

Parameters
array$courseeventsfromAn array of courses to load calendar events for
bool$ignorefiltersspecify the use of filters, false is set as default
stdClass$userThe user object. This defaults to the global $USER object.
Return values
arrayAn array of courses, groups, and user to load calendar events for based upon filters

◆ calendar_show_event_type()

calendar_show_event_type (   $type,
  $user = null 
)

Checks to see if the requested type of event should be shown for the given user.

Parameters
int$typeThe type to check the display for (default is to display all)
stdClass | int | null$userThe user to check for - by default the current user
Return values
boolTrue if the tyep should be displayed false otherwise

◆ calendar_sub_month()

calendar_sub_month (   $month,
  $year 
)

Get the previous month.

Parameters
int$monththe number of the month.
int$yearthe number of the year.
Return values
arrayprevious month

◆ calendar_time_representation()

calendar_time_representation (   $time)

return the formatted representation time.

Parameters
int$timethe timestamp in UTC, as obtained from the database
Return values
stringthe formatted date/time

◆ calendar_top_controls()

calendar_top_controls (   $type,
  $data 
)

Get control options for calendar.

Parameters
string$typeof calendar
array$datacalendar information
Return values
string::$contentreturn available control for the calender in html

◆ calendar_update_subscription()

calendar_update_subscription (   $subscription)

Update a calendar subscription.

Also updates the associated cache.

Parameters
stdClass | array$subscriptionSubscription record.
Exceptions
coding_exceptionIf something goes wrong
Since
Moodle 2.5

◆ calendar_update_subscription_events()

calendar_update_subscription_events (   $subscriptionid)

Fetch a calendar subscription and update the events in the calendar.

Parameters
int$subscriptionidThe course ID for the calendar.
Return values
stringA log of the import progress, including errors.

◆ calendar_user_can_add_event()

calendar_user_can_add_event (   $course)

See if user can add calendar entries at all used to print the "New Event" button.

Parameters
stdClass$courseobject of a course or course id
Return values
boolhas the capability to add at least one event type

◆ calendar_view_event_allowed()

calendar_view_event_allowed ( calendar_event  $event)

Return the capability for viewing a calendar event.

Parameters
calendar_event$eventevent object
Return values
boolean

◆ core_calendar_user_preferences()

core_calendar_user_preferences ( )

Implements callback user_preferences, whitelists preferences that users are allowed to update directly.

Used in {

See also
core_user::fill_preferences_cache()}, see also {
useredit_update_user_preference()}
Return values
array

◆ create_event()

create_event (   $properties)

Create a calendar event with the given properties.

Parameters
array$propertiesThe properties to set on the event
Return values
calendar_event

Variable Documentation

◆ CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD

const CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD(!defined( 'MOODLE_INTERNAL')) 21

These are read by the administration component to provide default values.

CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD - default value of upcoming event preference

◆ CALENDAR_EVENT_GLOBAL

const CALENDAR_EVENT_GLOBAL 1

CALENDAR_EVENT_GLOBAL - Site calendar event types.

Deprecated:
since 3.8