Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
This file contains a class definition for the LTI Gradebook Services
Author: | Dirk Singels, Diego del Blanco, Claude Vervoort |
Copyright: | 2017 Cengage Learning http://www.cengage.com |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 835 lines (34 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
gradebookservices:: (25 methods):
__construct()
get_resources()
get_permitted_scopes()
get_scopes()
get_configuration_options()
get_jwt_claim_mappings()
get_launch_parameters()
get_lineitems()
get_lineitem()
add_standalone_lineitem()
save_score()
save_grade_item()
item_for_json()
result_for_json()
check_lti_id()
check_lti_1x_id()
update_coupled_gradebookservices()
instance_added()
instance_updated()
set_instance_form_values()
delete_orphans_ltiservice_gradebookservices_rows()
is_user_gradable_in_course()
find_ltiservice_gradebookservice_for_lti()
find_ltiservice_gradebookservice_for_lineitem()
validate_iso8601_date()
Class: gradebookservices - X-Ref
A service implementing LTI Gradebook Services.__construct() X-Ref |
Class constructor. |
get_resources() X-Ref |
Get the resources for this service. return: resource_base[] |
get_permitted_scopes() X-Ref |
Get the scope(s) permitted for this service. return: array |
get_scopes() X-Ref |
Get the scopes defined by this service. return: array |
get_configuration_options(&$mform) X-Ref |
Adds form elements for gradebook sync add/edit page. param: \MoodleQuickForm $mform Moodle quickform object definition |
get_jwt_claim_mappings() X-Ref |
Return an array of key/claim mapping allowing LTI 1.1 custom parameters to be transformed to LTI 1.3 claims. return: array Key/value pairs of params to claim mapping. |
get_launch_parameters($messagetype, $courseid, $user, $typeid, $modlti = null) X-Ref |
Return an array of key/values to add to the launch parameters. return: array of key/value pairs to add as launch parameters. param: string $messagetype 'basic-lti-launch-request' or 'ContentItemSelectionRequest'. param: string $courseid the course id. param: object $user The user id. param: string $typeid The tool lti type id. param: string $modlti The id of the lti activity. |
get_lineitems($courseid, $resourceid, $ltilinkid, $tag, $limitfrom, $limitnum, $typeid) X-Ref |
Fetch the lineitem instances. return: array param: string $courseid ID of course param: string $resourceid Resource identifier used for filtering, may be null param: string $ltilinkid Resource Link identifier used for filtering, may be null param: string $tag param: int $limitfrom Offset for the first line item to include in a paged set param: int $limitnum Maximum number of line items to include in the paged set param: string $typeid |
get_lineitem($courseid, $itemid, $typeid) X-Ref |
Fetch a lineitem instance. Returns the lineitem instance if found, otherwise false. return: \ltiservice_gradebookservices\local\resources\lineitem|bool param: string $courseid ID of course param: string $itemid ID of lineitem param: string $typeid |
add_standalone_lineitem(string $courseid, string $label, float $maximumscore,string $baseurl, ?int $ltilinkid, ?string $resourceid, ?string $tag, int $typeid,int $toolproxyid = null) X-Ref |
Adds a decoupled (standalone) line item. Decoupled line items are not directly attached to an lti instance activity. They are recorded in the gradebook as manual activities and the gradebookservices is used to associate that manual column with the tool in addition to storing the LTI related metadata (resource id, tag). return: int id of the created gradeitem param: string $courseid ID of course param: string $label label of lineitem param: float $maximumscore maximum score of lineitem param: string $baseurl param: int|null $ltilinkid id of lti instance this line item is associated with param: string|null $resourceid resource id of lineitem param: string|null $tag tag of lineitem param: int $typeid lti type to which this line item is associated with param: int|null $toolproxyid lti2 tool proxy to which this lineitem is associated to |
save_score($gradeitem, $score, $userid) X-Ref |
Set a grade item. param: object $gradeitem Grade Item record param: object $score Result object param: int $userid User ID |
save_grade_item($gradeitem, $score, $userid) X-Ref |
Saves a score received from the LTI tool. param: object $gradeitem Grade Item record param: object $score Result object param: int $userid User ID |
item_for_json($item, $endpoint, $typeid) X-Ref |
Get the json object representation of the grade item return: object param: object $item Grade Item record param: string $endpoint Endpoint for lineitems container request param: string $typeid |
result_for_json($grade, $endpoint, $typeid) X-Ref |
Get the object matching the JSON representation of the result. return: object param: object $grade Grade record param: string $endpoint Endpoint for lineitem param: int $typeid The id of the type to include in the result url. |
check_lti_id($linkid, $course, $toolproxy) X-Ref |
Check if an LTI id is valid. return: boolean param: string $linkid The lti id param: string $course The course param: string $toolproxy The tool proxy id |
check_lti_1x_id($linkid, $course, $typeid) X-Ref |
Check if an LTI id is valid when we are in a LTI 1.x case return: boolean param: string $linkid The lti id param: string $course The course param: string $typeid The lti type id |
update_coupled_gradebookservices(object $ltiinstance, ?string $resourceid, ?string $tag) X-Ref |
Updates the tag and resourceid values for a grade item coupled to an lti link instance. param: object $ltiinstance The lti instance to which the grade item is coupled to param: string|null $resourceid The resourceid to apply to the lineitem. If empty string which will be stored as null. param: string|null $tag The tag to apply to the lineitem. If empty string which will be stored as null. |
instance_added(object $lti) X-Ref |
Called when a new LTI Instance is added. param: object $lti LTI Instance. |
instance_updated(object $lti) X-Ref |
Called when a new LTI Instance is updated. param: object $lti LTI Instance. |
set_instance_form_values(object $defaultvalues) X-Ref |
Set the form data when displaying the LTI Instance form. param: object $defaultvalues Default form values. |
delete_orphans_ltiservice_gradebookservices_rows() X-Ref |
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 |
is_user_gradable_in_course($courseid, $userid) X-Ref |
Check if a user can be graded in a course return: bool param: int $courseid The course param: int $userid The user |
find_ltiservice_gradebookservice_for_lti($instanceid) X-Ref |
Find the right element in the ltiservice_gradebookservice table for an lti instance return: object gradebookservice for this line item param: string $instanceid The LTI module instance id |
find_ltiservice_gradebookservice_for_lineitem($lineitemid) X-Ref |
Find the right element in the ltiservice_gradebookservice table for a lineitem return: object gradebookservice if it exists param: string $lineitemid The lineitem (gradeitem) id |
validate_iso8601_date($date) X-Ref |
Validates specific ISO 8601 format of the timestamps. return: boolean true or false if the date matches the format. param: string $date The timestamp to check. |