|
static | can_request (context $context) |
| Checks if current user can request a course in this context. More...
|
|
static | create ($data) |
| Static function to create a new course request when passed an array of properties for it. More...
|
|
static | prepare ($data=null) |
| Static function to prepare the summary editor for working with a course request. More...
|
|
static | summary_editor_options () |
| Returns an array of options to use with a summary editor. More...
|
|
|
| notify ($touser, $fromuser, $name='courserequested', $subject, $message, $courseid=null) |
| Send a message from one user to another using events_trigger. More...
|
|
|
stdClass | $properties |
| This is the stdClass that stores the properties for the course request and is externally accessed through the __get magic method.
|
|
◆ __construct()
course_request::__construct |
( |
|
$properties | ) |
|
Loads the properties for this course request object.
Id is required and if only id is provided then we load the rest of the properties from the database
- Parameters
-
stdClass | int | $properties | Either an object containing properties or the course_request id to load |
◆ __get()
course_request::__get |
( |
|
$key | ) |
|
Returns the requested property.
- Parameters
-
- Return values
-
◆ __isset()
course_request::__isset |
( |
|
$key | ) |
|
Override this to ensure empty($request->blah) calls return a reliable answer...
This is required because we define the __get method
- Parameters
-
- Return values
-
bool | True is it not empty, false otherwise |
◆ approve()
course_request::approve |
( |
| ) |
|
This function approves the request turning it into a course.
This function converts the course request into a course, at the same time transferring any files used in the summary to the new course and then removing the course request and the files associated with it.
- Return values
-
int | The id of the course that was created from this request |
◆ can_approve()
course_request::can_approve |
( |
| ) |
|
Checks user capability to approve a requested course.
If course was requested without category for some reason (might happen if $CFG->defaultrequestcategory is misconfigured), we check capabilities 'moodle/site:approvecourse' and 'moodle/course:changecategory'.
- Return values
-
◆ can_request()
static course_request::can_request |
( |
context |
$context | ) |
|
|
static |
Checks if current user can request a course in this context.
- Parameters
-
- Return values
-
◆ check_shortname_collision()
course_request::check_shortname_collision |
( |
|
$shortnamemark = '[*]' | ) |
|
Checks that the shortname used by the course does not conflict with any other courses that exist.
- Parameters
-
string | null | $shortnamemark | The string to append to the requests shortname should a conflict be found |
- Return values
-
bool | true is there is a conflict, false otherwise |
◆ create()
static course_request::create |
( |
|
$data | ) |
|
|
static |
Static function to create a new course request when passed an array of properties for it.
This function also handles saving any files that may have been used in the editor
- Parameters
-
- Return values
-
◆ get_category()
course_request::get_category |
( |
| ) |
|
Returns the category where this course request should be created.
Note that we don't check here that user has a capability to view hidden categories if he has capabilities 'moodle/site:approvecourse' and 'moodle/course:changecategory'
- Return values
-
◆ get_requester()
course_request::get_requester |
( |
| ) |
|
Returns the user who requested this course.
Uses a static var to cache the results and cut down the number of db queries
@staticvar array $requesters An array of cached users
- Return values
-
stdClass | The user who requested the course |
◆ notify()
course_request::notify |
( |
|
$touser, |
|
|
|
$fromuser, |
|
|
|
$name = 'courserequested' , |
|
|
|
$subject, |
|
|
|
$message, |
|
|
|
$courseid = null |
|
) |
| |
|
protected |
Send a message from one user to another using events_trigger.
- Parameters
-
object | $touser | |
object | $fromuser | |
string | $name | |
string | $subject | |
string | $message | |
int | null | $courseid | |
◆ prepare()
static course_request::prepare |
( |
|
$data = null | ) |
|
|
static |
Static function to prepare the summary editor for working with a course request.
- Parameters
-
null | stdClass | $data | Optional, an object containing the default values for the form, these may be modified when preparing the editor so this should be called before creating the form |
- Return values
-
stdClass | An object that can be used to set the default values for an mforms form |
◆ reject()
course_request::reject |
( |
|
$notice | ) |
|
Reject a course request.
This function rejects a course request, emailing the requesting user the provided notice and then removing the request from the database
- Parameters
-
string | $notice | The message to display to the user |
◆ summary_editor_options()
static course_request::summary_editor_options |
( |
| ) |
|
|
static |
◆ $summaryeditoroptions
array course_request::$summaryeditoroptions |
|
staticprotected |
An array of options for the summary editor used by course request forms.
This is initially set by summary_editor_options()
The documentation for this class was generated from the following file: