|
Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
A service implementing LTI Gradebook Services. More...
Public Member Functions | |
| __construct () | |
| Class constructor. | |
| check_tool ($typeid, $body=null, $scopes=null) | |
| Check that the request has been properly signed and is permitted. More... | |
| check_tool_proxy ($toolproxyguid, $body=null) | |
| Check that the request has been properly signed. More... | |
| check_type ($typeid, $courseid, $body=null) | |
| Check that the request has been properly signed. More... | |
| get_component_id () | |
| Get the service compoent ID. More... | |
| get_configuration_options (&$mform) | |
| Adds form elements for gradebook sync add/edit page. More... | |
| get_configuration_parameter_names () | |
| Return an array with the names of the parameters that the service will be saving in the configuration. More... | |
| get_id () | |
| Get the service ID. More... | |
| get_launch_parameters ($messagetype, $courseid, $user, $typeid, $modlti=null) | |
| Return an array of key/values to add to the launch parameters. More... | |
| get_lineitem ($courseid, $itemid, $typeid) | |
| Fetch a lineitem instance. More... | |
| get_lineitems ($courseid, $resourceid, $ltilinkid, $tag, $limitfrom, $limitnum, $typeid) | |
| Fetch the lineitem instances. More... | |
| get_name () | |
| Get the service name. More... | |
| get_permitted_scopes () | |
| Get the scope(s) permitted for this service. More... | |
| get_resources () | |
| Get the resources for this service. More... | |
| get_tool_proxy () | |
| Get the tool proxy object. More... | |
| get_type () | |
| Get the type object. More... | |
| get_typeconfig () | |
| Get the type config array. More... | |
| is_allowed_in_context ($typeid, $courseid) | |
| Checks if there is a site tool or a course tool for this site. More... | |
| is_unsigned () | |
| Get whether the service requests need to be signed. More... | |
| is_used_in_context ($typeid, $courseid) | |
| Default implementation will check for the existence of at least one mod_lti entry for that tool and context. More... | |
| parse_value ($value) | |
| Parse a string for custom substitution parameter variables supported by this service's resources. More... | |
| save_grade_item ($gradeitem, $score, $userid) | |
| Set a grade item. More... | |
| stdClass | set_tool_proxy ($toolproxy) |
| Set the tool proxy object. More... | |
| stdClass | set_type ($type) |
| Set the LTI type object. More... | |
| array | set_typeconfig ($typeconfig) |
| Set the LTI type config object. More... | |
Static Public Member Functions | |
| static | check_lti_1x_id ($linkid, $course, $typeid) |
| Check if an LTI id is valid when we are in a LTI 1.x case. More... | |
| static | check_lti_id ($linkid, $course, $toolproxy) |
| Check if an LTI id is valid. More... | |
| static | delete_orphans_ltiservice_gradebookservices_rows () |
| Deletes orphaned rows from the 'ltiservice_gradebookservices' table. More... | |
| static | find_ltiservice_gradebookservice_for_lineitem ($lineitemid) |
| Find the right element in the ltiservice_gradebookservice table for a lineitem. More... | |
| static | get_service_path () |
| Get the path for service requests. More... | |
| static | is_user_gradable_in_course ($courseid, $userid) |
| Check if a user can be graded in a course. More... | |
| static | item_for_json ($item, $endpoint, $typeid) |
| Get the json object representation of the grade item. More... | |
| static | result_for_json ($grade, $endpoint, $typeid) |
| Get the object matching the JSON representation of the result. More... | |
| static | save_score ($gradeitem, $score, $userid) |
| Set a grade item. More... | |
| static | validate_iso8601_date ($date) |
| Validates specific ISO 8601 format of the timestamps. More... | |
Public Attributes | |
| const | GRADEBOOKSERVICES_FULL = 2 |
| Full access to Gradebook services. | |
| const | GRADEBOOKSERVICES_READ = 1 |
| Read-only access to Gradebook services. | |
| const | LTI_VERSION2P0 = 'LTI-2p0' |
| Label representing an LTI 2 message type. | |
| const | SCOPE_GRADEBOOKSERVICES_LINEITEM = 'https://purl.imsglobal.org/spec/lti-ags/scope/lineitem' |
| Scope for full access to Lineitem service. | |
| const | SCOPE_GRADEBOOKSERVICES_LINEITEM_READ = 'https://purl.imsglobal.org/spec/lti-ags/scope/lineitem.readonly' |
| Scope for full access to Lineitem service. | |
| const | SCOPE_GRADEBOOKSERVICES_RESULT_READ = 'https://purl.imsglobal.org/spec/lti-ags/scope/result.readonly' |
| Scope for access to Result service. | |
| const | SCOPE_GRADEBOOKSERVICES_SCORE = 'https://purl.imsglobal.org/spec/lti-ags/scope/score' |
| Scope for access to Score service. | |
| const | SERVICE_ENABLED = 1 |
| Service enabled. | |
Protected Attributes | |
| string | $id |
| ID for the service. | |
| string | $name |
| Human readable name for the service. | |
| array | $resources |
| Instances of the resources associated with this service. | |
| boolean | $unsigned |
true if requests for this service do not need to be signed. | |
A service implementing LTI Gradebook Services.
|
static |
Check if an LTI id is valid when we are in a LTI 1.x case.
| string | $linkid | The lti id |
| string | $course | The course |
| string | $typeid | The lti type id |
| boolean |
|
static |
Check if an LTI id is valid.
| string | $linkid | The lti id |
| string | $course | The course |
| string | $toolproxy | The tool proxy id |
| boolean |
|
inherited |
Check that the request has been properly signed and is permitted.
| string | $typeid | LTI type ID |
| string | $body | Request body (null if none) |
| string[] | $scopes | Array of required scope(s) for incoming request |
| boolean |
|
inherited |
Check that the request has been properly signed.
| string | $toolproxyguid | Tool Proxy GUID |
| string | $body | Request body (null if none) |
| boolean |
|
inherited |
Check that the request has been properly signed.
| int | $typeid | The tool id |
| int | $courseid | The course we are at |
| string | $body | Request body (null if none) |
| bool |
|
static |
Deletes orphaned rows from the 'ltiservice_gradebookservices' table.
Sometimes, if a gradebook entry is deleted and it was a lineitem the row in the table ltiservice_gradebookservices can become an orphan This method will clean these orphans. It will happens based on a task because it is not urgent and we don't want to slow the service
|
static |
Find the right element in the ltiservice_gradebookservice table for a lineitem.
| string | $lineitemid | The lineitem |
| object|bool | gradebookservice id or false if none |
|
inherited |
Get the service compoent ID.
| string |
| ltiservice_gradebookservices\local\service\gradebookservices::get_configuration_options | ( | & | $mform | ) |
Adds form elements for gradebook sync add/edit page.
| MoodleQuickForm | $mform | Moodle quickform object definition |
Reimplemented from mod_lti\local\ltiservice\service_base.
|
inherited |
Return an array with the names of the parameters that the service will be saving in the configuration.
| array | Names list of the parameters that the service will be saving in the configuration |
|
inherited |
Get the service ID.
| string |
| ltiservice_gradebookservices\local\service\gradebookservices::get_launch_parameters | ( | $messagetype, | |
| $courseid, | |||
| $user, | |||
| $typeid, | |||
$modlti = null |
|||
| ) |
Return an array of key/values to add to the launch parameters.
| string | $messagetype | 'basic-lti-launch-request' or 'ContentItemSelectionRequest'. |
| string | $courseid | the course id. |
| object | $user | The user id. |
| string | $typeid | The tool lti type id. |
| string | $modlti | The id of the lti activity. |
The type is passed to check the configuration and not return parameters for services not used.
| array | of key/value pairs to add as launch parameters. |
Reimplemented from mod_lti\local\ltiservice\service_base.
| ltiservice_gradebookservices\local\service\gradebookservices::get_lineitem | ( | $courseid, | |
| $itemid, | |||
| $typeid | |||
| ) |
Fetch a lineitem instance.
Returns the lineitem instance if found, otherwise false.
| string | $courseid | ID of course |
| string | $itemid | ID of lineitem |
| string | $typeid |
| ltiservice_gradebookservices |
| ltiservice_gradebookservices\local\service\gradebookservices::get_lineitems | ( | $courseid, | |
| $resourceid, | |||
| $ltilinkid, | |||
| $tag, | |||
| $limitfrom, | |||
| $limitnum, | |||
| $typeid | |||
| ) |
Fetch the lineitem instances.
| string | $courseid | ID of course |
| string | $resourceid | Resource identifier used for filtering, may be null |
| string | $ltilinkid | Resource Link identifier used for filtering, may be null |
| string | $tag | |
| int | $limitfrom | Offset for the first line item to include in a paged set |
| int | $limitnum | Maximum number of line items to include in the paged set |
| string | $typeid |
| array |
| Exception |
|
inherited |
Get the service name.
| string |
| ltiservice_gradebookservices\local\service\gradebookservices::get_permitted_scopes | ( | ) |
Get the scope(s) permitted for this service.
| array |
Reimplemented from mod_lti\local\ltiservice\service_base.
| ltiservice_gradebookservices\local\service\gradebookservices::get_resources | ( | ) |
Get the resources for this service.
| resource_base[] |
Reimplemented from mod_lti\local\ltiservice\service_base.
|
staticinherited |
Get the path for service requests.
| string |
|
inherited |
Get the tool proxy object.
| stdClass |
|
inherited |
Get the type object.
| stdClass |
|
inherited |
Get the type config array.
| array|null |
|
inherited |
Checks if there is a site tool or a course tool for this site.
| int | $typeid | The tool lti type id. |
| int | $courseid | The course id. |
| bool | returns True if tool is allowed in context, false otherwise. |
|
inherited |
Get whether the service requests need to be signed.
| boolean |
|
inherited |
Default implementation will check for the existence of at least one mod_lti entry for that tool and context.
It may be overridden if other inferences can be done.
Ideally a Site Tool should be explicitly engaged with a course, the check on the presence of a link is a proxy to infer a Site Tool engagement until an explicit Site Tool - Course relationship exists.
| int | $typeid | The tool lti type id. |
| int | $courseid | The course id. |
| bool | returns True if tool is used in context, false otherwise. |
|
static |
Check if a user can be graded in a course.
| int | $courseid | The course |
| int | $userid | The user |
| bool |
|
static |
Get the json object representation of the grade item.
| object | $item | Grade Item record |
| string | $endpoint | Endpoint for lineitems container request |
| string | $typeid |
| object |
|
inherited |
Parse a string for custom substitution parameter variables supported by this service's resources.
| string | $value | Value to be parsed |
| string |
|
static |
Get the object matching the JSON representation of the result.
| object | $grade | Grade record |
| string | $endpoint | Endpoint for lineitem |
| int | $typeid | The id of the type to include in the result url. |
| object |
| ltiservice_gradebookservices\local\service\gradebookservices::save_grade_item | ( | $gradeitem, | |
| $score, | |||
| $userid | |||
| ) |
Set a grade item.
| object | $gradeitem | Grade Item record |
| object | $score | Result object |
| int | $userid | User ID |
| Exception |
|
static |
Set a grade item.
| object | $gradeitem | Grade Item record |
| object | $score | Result object |
| int | $userid | User ID |
| Exception |
|
inherited |
Set the tool proxy object.
| object | $toolproxy | The tool proxy for this service request |
|
inherited |
Set the LTI type object.
| object | $type | The LTI type for this service request |
|
inherited |
Set the LTI type config object.
| array | $typeconfig | The LTI type config for this service request |
|
static |
Validates specific ISO 8601 format of the timestamps.
| string | $date | The timestamp to check. |
| boolean | true or false if the date matches the format. |