Class to store information about one course in a list of courses.
More...
|
| __construct (stdClass $record) |
| Creates an instance of the class from record.
|
|
| __get ($name) |
| Magic method to get a course property.
|
|
| __isset ($name) |
| Magic method to check if property is set.
|
|
| __set ($name, $value) |
| Magic setter method, we do not want anybody to modify properties from the outside.
|
|
| __unset ($name) |
| All properties are read only, sorry.
|
|
| can_access () |
| Returns true if the current user can access this course.
|
|
| can_backup () |
| Returns true if the current user can backup this course.
|
|
| can_change_visibility () |
| Returns true if the user can change the visibility of this course.
|
|
| can_delete () |
| Returns true if the current user can delete this course.
|
|
| can_edit () |
| Returns true if the user can edit this courses settings.
|
|
| can_restore () |
| Returns true if the current user can restore this course.
|
|
| can_review_enrolments () |
| Returns true if the current user can review enrolments for this course.
|
|
| get_context () |
| Returns the context for this course.
|
|
| get_course_contacts () |
| Returns list of course contacts (usually teachers) to display in course link.
|
|
| get_course_overviewfiles () |
| Returns all course overview files.
|
|
| get_custom_fields () |
| Returns custom fields data for this course.
|
|
| get_formatted_fullname () |
| Returns the formatted fullname for this course.
|
|
| get_formatted_name () |
| Returns the name of this course as it should be displayed within a list.
|
|
| get_formatted_shortname () |
| Returns the formatted shortname for this course.
|
|
| getIterator () |
| Create an iterator because magic vars can't be seen by 'foreach'.
|
|
| has_course_contacts () |
| Indicates if the course have course contacts to display.
|
|
| has_course_overviewfiles () |
| Checks if course has any associated overview files.
|
|
| has_custom_fields () |
| Does this course have custom fields.
|
|
| has_summary () |
| Indicates if the course has non-empty summary field.
|
|
|
bool | $canaccess = null |
| true if the current user can access the course, false otherwise.
|
|
array | $coursecontacts |
| array of course contacts - stores result of call to get_course_contacts()
|
|
stdClass | $record |
| record retrieved from DB, may have additional calculated property such as managers and hassummary
|
|
Class to store information about one course in a list of courses.
Not all information may be retrieved when object is created but it will be retrieved on demand when appropriate property or method is called.
Instances of this class are usually returned by functions core_course_category::search_courses() and core_course_category::get_courses()
was called with option 'summary'. Otherwise will be retrieved from DB on first request
was called with option 'summary'. Otherwise will be retrieved from DB on first request
- Copyright
- 2013 Marina Glancy
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
core_course_list_element::__construct |
( |
stdClass | $record | ) |
|
Creates an instance of the class from record.
- Parameters
-
stdClass | $record | except fields from course table it may contain field hassummary indicating that summary field is not empty. Also it is recommended to have context fields here ready for context preloading |
◆ __get()
core_course_list_element::__get |
( |
| $name | ) |
|
Magic method to get a course property.
Returns any field from table course (retrieves it from DB if it was not retrieved before)
- Parameters
-
- Return values
-
◆ __isset()
core_course_list_element::__isset |
( |
| $name | ) |
|
Magic method to check if property is set.
- Parameters
-
- Return values
-
◆ __set()
core_course_list_element::__set |
( |
| $name, |
|
|
| $value ) |
Magic setter method, we do not want anybody to modify properties from the outside.
- Parameters
-
◆ __unset()
core_course_list_element::__unset |
( |
| $name | ) |
|
All properties are read only, sorry.
- Parameters
-
◆ can_access()
core_course_list_element::can_access |
( |
| ) |
|
Returns true if the current user can access this course.
- Return values
-
◆ can_backup()
core_course_list_element::can_backup |
( |
| ) |
|
Returns true if the current user can backup this course.
Note: this function does not check that the current user can access the course. To do that please call require_login with the course, or if not possible call core_course_list_element::can_access()
- Return values
-
◆ can_change_visibility()
core_course_list_element::can_change_visibility |
( |
| ) |
|
Returns true if the user can change the visibility of this course.
Note: this function does not check that the current user can access the course. To do that please call require_login with the course, or if not possible call core_course_list_element::can_access()
- Return values
-
◆ can_delete()
core_course_list_element::can_delete |
( |
| ) |
|
Returns true if the current user can delete this course.
Note: this function does not check that the current user can access the course. To do that please call require_login with the course, or if not possible call core_course_list_element::can_access()
- Return values
-
◆ can_edit()
core_course_list_element::can_edit |
( |
| ) |
|
Returns true if the user can edit this courses settings.
Note: this function does not check that the current user can access the course. To do that please call require_login with the course, or if not possible call core_course_list_element::can_access()
- Return values
-
◆ can_restore()
core_course_list_element::can_restore |
( |
| ) |
|
Returns true if the current user can restore this course.
Note: this function does not check that the current user can access the course. To do that please call require_login with the course, or if not possible call core_course_list_element::can_access()
- Return values
-
◆ can_review_enrolments()
core_course_list_element::can_review_enrolments |
( |
| ) |
|
Returns true if the current user can review enrolments for this course.
Note: this function does not check that the current user can access the course. To do that please call require_login with the course, or if not possible call core_course_list_element::can_access()
- Return values
-
◆ get_context()
core_course_list_element::get_context |
( |
| ) |
|
Returns the context for this course.
- Return values
-
◆ get_course_contacts()
core_course_list_element::get_course_contacts |
( |
| ) |
|
Returns list of course contacts (usually teachers) to display in course link.
Roles to display are set up in $CFG->coursecontact
The result is the list of users where user id is the key and the value is an array with elements:
- 'user' - object containing basic user information
- 'role' - object containing basic role information (id, name, shortname, coursealias)
- 'rolename' => role_get_name($role, $context, ROLENAME_ALIAS)
- 'username' => fullname($user, $canviewfullnames)
- Return values
-
◆ get_course_overviewfiles()
core_course_list_element::get_course_overviewfiles |
( |
| ) |
|
Returns all course overview files.
- Return values
-
◆ get_custom_fields()
core_course_list_element::get_custom_fields |
( |
| ) |
|
Returns custom fields data for this course.
- Return values
-
core_customfield\data_controller[] | |
◆ get_formatted_fullname()
core_course_list_element::get_formatted_fullname |
( |
| ) |
|
Returns the formatted fullname for this course.
- Return values
-
◆ get_formatted_name()
core_course_list_element::get_formatted_name |
( |
| ) |
|
Returns the name of this course as it should be displayed within a list.
- Return values
-
◆ get_formatted_shortname()
core_course_list_element::get_formatted_shortname |
( |
| ) |
|
Returns the formatted shortname for this course.
- Return values
-
◆ getIterator()
core_course_list_element::getIterator |
( |
| ) |
|
Create an iterator because magic vars can't be seen by 'foreach'.
Exclude context fields
Implementing method from interface IteratorAggregate
- Return values
-
◆ has_course_contacts()
core_course_list_element::has_course_contacts |
( |
| ) |
|
Indicates if the course have course contacts to display.
- Return values
-
◆ has_course_overviewfiles()
core_course_list_element::has_course_overviewfiles |
( |
| ) |
|
Checks if course has any associated overview files.
- Return values
-
◆ has_custom_fields()
core_course_list_element::has_custom_fields |
( |
| ) |
|
Does this course have custom fields.
- Return values
-
◆ has_summary()
core_course_list_element::has_summary |
( |
| ) |
|
Indicates if the course has non-empty summary field.
- Return values
-
The documentation for this class was generated from the following file: