|
static | create ($properties, $checkcapability=true) |
| Creates a new event and returns an event object. More...
|
|
static | load ($param) |
| Returns an event object when provided with an event id. More...
|
|
|
string | $_description = null |
| The converted event discription with file paths resolved. More...
|
|
object | $editorcontext = null |
| The context to use with the description editor.
|
|
array | $editoroptions |
| The options to use with this description editor. More...
|
|
array | $properties = null |
| An object containing the event properties can be accessed via the magic __get/set methods.
|
|
◆ __construct()
calendar_event::__construct |
( |
|
$data = null | ) |
|
Instantiates a new event and optionally populates its properties with the data provided.
- Parameters
-
stdClass | $data | Optional. An object containing the properties to for an event |
◆ __get()
calendar_event::__get |
( |
|
$key | ) |
|
Magic get method.
Attempts to call a get_$key method to return the property and ralls over to return the raw property.
- Parameters
-
- Return values
-
- Exceptions
-
◆ __isset()
calendar_event::__isset |
( |
|
$key | ) |
|
Magic isset method.
PHP needs an isset magic method if you use the get magic method and still want empty calls to work.
- Parameters
-
string | $key | $key property name |
- Return values
-
bool|mixed | property value, false if property is not exist |
◆ __set()
calendar_event::__set |
( |
|
$key, |
|
|
|
$value |
|
) |
| |
Magic set method.
Attempts to call a set_$key method if one exists otherwise falls back to simply set the property.
- Parameters
-
string | $key | property name |
mixed | $value | value of the property |
◆ calculate_context()
calendar_event::calculate_context |
( |
| ) |
|
|
protected |
Calculate the context value needed for an event.
Event's type can be determine by the available value store in $data It is important to check for the existence of course/courseid to determine the course event. Default value is set to CONTEXT_USER
- Return values
-
stdClass | The context object. |
◆ count_repeats()
calendar_event::count_repeats |
( |
| ) |
|
Return the number of repeat events there are in this events series.
- Return values
-
int | number of event repeated |
◆ create()
static calendar_event::create |
( |
|
$properties, |
|
|
|
$checkcapability = true |
|
) |
| |
|
static |
Creates a new event and returns an event object.
Capability checking should be performed if the user is directly creating the event and no other capability has been tested. However if the event is not being created directly by the user and another capability has been checked for them to do this then capabilites should not be checked.
For example if a user is creating an event in the calendar the check should be true, but if you are creating an event in an activity when it is created then the calendar capabilites should not be checked.
- Parameters
-
stdClass | array | $properties | An object containing event properties |
bool | $checkcapability | If Moodle should check the user can manage the calendar events for this call or not. |
- Exceptions
-
- Return values
-
calendar_event|bool | The event object or false if it failed |
◆ delete()
calendar_event::delete |
( |
|
$deleterepeated = false | ) |
|
Deletes an event and if selected an repeated events in the same series.
This function deletes an event, any associated events if $deleterepeated=true, and cleans up any files associated with the events.
- See also
- self::delete()
- Parameters
-
bool | $deleterepeated | delete event repeatedly |
- Return values
-
bool | succession of deleting event |
◆ format_external_name()
calendar_event::format_external_name |
( |
| ) |
|
Format the event name using the external API.
This function should we used when text formatting is required in external functions.
- Return values
-
◆ format_external_text()
calendar_event::format_external_text |
( |
| ) |
|
Format the text using the external API.
This function should we used when text formatting is required in external functions.
- Return values
-
array | an array containing the text formatted and the text format |
◆ get_context()
calendar_event::get_context |
( |
| ) |
|
|
protected |
Returns the context for this event.
The context is calculated the first time is is requested and then stored in a member variable to be returned each subsequent time.
This is a magical getter function that will be called when ever the context property is accessed, e.g. $event->context.
- Return values
-
◆ get_description()
calendar_event::get_description |
( |
| ) |
|
|
protected |
Returns an event description: Called by __get Please use $blah = $event->description;.
- Return values
-
◆ get_editoroptions()
calendar_event::get_editoroptions |
( |
| ) |
|
|
protected |
Returns an array of editoroptions for this event.
- Return values
-
array | event editor options |
◆ load()
static calendar_event::load |
( |
|
$param | ) |
|
|
static |
Returns an event object when provided with an event id.
This function makes use of MUST_EXIST, if the event id passed in is invalid it will result in an exception being thrown.
- Parameters
-
int | object | $param | event object or event id |
- Return values
-
◆ properties()
calendar_event::properties |
( |
|
$prepareeditor = false | ) |
|
Fetch all event properties.
This function returns all of the events properties as an object and optionally can prepare an editor for the description field at the same time. This is designed to work when the properties are going to be used to set the default values of a moodle forms form.
- Parameters
-
bool | $prepareeditor | If set to true a editor is prepared for use with the mforms editor element. (for description) |
- Return values
-
stdClass | Object containing event properties |
◆ toggle_visibility()
calendar_event::toggle_visibility |
( |
|
$force = null | ) |
|
Toggles the visibility of an event.
- Parameters
-
null | bool | $force | If it is left null the events visibility is flipped, If it is false the event is made hidden, if it is true it is made visible. |
- Return values
-
bool | if event is successfully updated, toggle will be visible |
◆ update()
calendar_event::update |
( |
|
$data, |
|
|
|
$checkcapability = true |
|
) |
| |
Update or create an event within the database.
Pass in a object containing the event properties and this function will insert it into the database and deal with any associated files
Capability checking should be performed if the user is directly manipulating the event and no other capability has been tested. However if the event is not being manipulated directly by the user and another capability has been checked for them to do this then capabilites should not be checked.
For example if a user is editing an event in the calendar the check should be true, but if you are updating an event in an activities settings are changed then the calendar capabilites should not be checked.
- See also
- self::create()
-
self::update()
- Parameters
-
stdClass | $data | object of event |
bool | $checkcapability | If Moodle should check the user can manage the calendar events for this call or not. |
- Return values
-
◆ $_description
string calendar_event::$_description = null |
|
protected |
The converted event discription with file paths resolved.
This gets populated when someone requests description for the first time
◆ $editoroptions
array calendar_event::$editoroptions |
|
protected |
Initial value:= array(
'subdirs' => false,
'forcehttps' => false,
'maxfiles' => -1,
'maxbytes' => null,
'trusttext' => false)
The options to use with this description editor.
The documentation for this class was generated from the following file: