Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
ltiservice_gradebookservices\local\service\gradebookservices Class Reference

A service implementing LTI Gradebook Services. More...

Inheritance diagram for ltiservice_gradebookservices\local\service\gradebookservices:
mod_lti\local\ltiservice\service_base

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.
 

Detailed Description

A service implementing LTI Gradebook Services.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ check_lti_1x_id()

static ltiservice_gradebookservices\local\service\gradebookservices::check_lti_1x_id (   $linkid,
  $course,
  $typeid 
)
static

Check if an LTI id is valid when we are in a LTI 1.x case.

Parameters
string$linkidThe lti id
string$courseThe course
string$typeidThe lti type id
Return values
boolean

◆ check_lti_id()

static ltiservice_gradebookservices\local\service\gradebookservices::check_lti_id (   $linkid,
  $course,
  $toolproxy 
)
static

Check if an LTI id is valid.

Parameters
string$linkidThe lti id
string$courseThe course
string$toolproxyThe tool proxy id
Return values
boolean

◆ check_tool()

mod_lti\local\ltiservice\service_base::check_tool (   $typeid,
  $body = null,
  $scopes = null 
)
inherited

Check that the request has been properly signed and is permitted.

Parameters
string$typeidLTI type ID
string$bodyRequest body (null if none)
string[]$scopesArray of required scope(s) for incoming request
Return values
boolean

◆ check_tool_proxy()

mod_lti\local\ltiservice\service_base::check_tool_proxy (   $toolproxyguid,
  $body = null 
)
inherited

Check that the request has been properly signed.

Parameters
string$toolproxyguidTool Proxy GUID
string$bodyRequest body (null if none)
Return values
boolean
Deprecated:
since Moodle 3.7 MDL-62599 - please do not use this function any more.
See also
service_base::check_tool()

◆ check_type()

mod_lti\local\ltiservice\service_base::check_type (   $typeid,
  $courseid,
  $body = null 
)
inherited

Check that the request has been properly signed.

Parameters
int$typeidThe tool id
int$courseidThe course we are at
string$bodyRequest body (null if none)
Return values
bool
Deprecated:
since Moodle 3.7 MDL-62599 - please do not use this function any more.
See also
service_base::check_tool()

◆ delete_orphans_ltiservice_gradebookservices_rows()

static ltiservice_gradebookservices\local\service\gradebookservices::delete_orphans_ltiservice_gradebookservices_rows ( )
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

◆ find_ltiservice_gradebookservice_for_lineitem()

static ltiservice_gradebookservices\local\service\gradebookservices::find_ltiservice_gradebookservice_for_lineitem (   $lineitemid)
static

Find the right element in the ltiservice_gradebookservice table for a lineitem.

Parameters
string$lineitemidThe lineitem
Return values
object|boolgradebookservice id or false if none

◆ get_component_id()

mod_lti\local\ltiservice\service_base::get_component_id ( )
inherited

Get the service compoent ID.

Return values
string

◆ get_configuration_options()

ltiservice_gradebookservices\local\service\gradebookservices::get_configuration_options ( $mform)

Adds form elements for gradebook sync add/edit page.

Parameters
MoodleQuickForm$mformMoodle quickform object definition

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_configuration_parameter_names()

mod_lti\local\ltiservice\service_base::get_configuration_parameter_names ( )
inherited

Return an array with the names of the parameters that the service will be saving in the configuration.

Return values
arrayNames list of the parameters that the service will be saving in the configuration
Deprecated:
since Moodle 3.7 - please do not use this function any more.

◆ get_id()

mod_lti\local\ltiservice\service_base::get_id ( )
inherited

Get the service ID.

Return values
string

◆ get_launch_parameters()

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.

Parameters
string$messagetype'basic-lti-launch-request' or 'ContentItemSelectionRequest'.
string$courseidthe course id.
object$userThe user id.
string$typeidThe tool lti type id.
string$modltiThe id of the lti activity.

The type is passed to check the configuration and not return parameters for services not used.

Return values
arrayof key/value pairs to add as launch parameters.

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_lineitem()

ltiservice_gradebookservices\local\service\gradebookservices::get_lineitem (   $courseid,
  $itemid,
  $typeid 
)

Fetch a lineitem instance.

Returns the lineitem instance if found, otherwise false.

Parameters
string$courseidID of course
string$itemidID of lineitem
string$typeid
Return values
ltiservice_gradebookservices

◆ get_lineitems()

ltiservice_gradebookservices\local\service\gradebookservices::get_lineitems (   $courseid,
  $resourceid,
  $ltilinkid,
  $tag,
  $limitfrom,
  $limitnum,
  $typeid 
)

Fetch the lineitem instances.

Parameters
string$courseidID of course
string$resourceidResource identifier used for filtering, may be null
string$ltilinkidResource Link identifier used for filtering, may be null
string$tag
int$limitfromOffset for the first line item to include in a paged set
int$limitnumMaximum number of line items to include in the paged set
string$typeid
Return values
array
Exceptions
Exception

◆ get_name()

mod_lti\local\ltiservice\service_base::get_name ( )
inherited

Get the service name.

Return values
string

◆ get_permitted_scopes()

ltiservice_gradebookservices\local\service\gradebookservices::get_permitted_scopes ( )

Get the scope(s) permitted for this service.

Return values
array

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_resources()

ltiservice_gradebookservices\local\service\gradebookservices::get_resources ( )

Get the resources for this service.

Return values
resource_base[]

Reimplemented from mod_lti\local\ltiservice\service_base.

◆ get_service_path()

static mod_lti\local\ltiservice\service_base::get_service_path ( )
staticinherited

Get the path for service requests.

Return values
string

◆ get_tool_proxy()

mod_lti\local\ltiservice\service_base::get_tool_proxy ( )
inherited

Get the tool proxy object.

Return values
stdClass

◆ get_type()

mod_lti\local\ltiservice\service_base::get_type ( )
inherited

Get the type object.

Return values
stdClass

◆ get_typeconfig()

mod_lti\local\ltiservice\service_base::get_typeconfig ( )
inherited

Get the type config array.

Return values
array|null

◆ is_allowed_in_context()

mod_lti\local\ltiservice\service_base::is_allowed_in_context (   $typeid,
  $courseid 
)
inherited

Checks if there is a site tool or a course tool for this site.

Parameters
int$typeidThe tool lti type id.
int$courseidThe course id.
Return values
boolreturns True if tool is allowed in context, false otherwise.

◆ is_unsigned()

mod_lti\local\ltiservice\service_base::is_unsigned ( )
inherited

Get whether the service requests need to be signed.

Return values
boolean

◆ is_used_in_context()

mod_lti\local\ltiservice\service_base::is_used_in_context (   $typeid,
  $courseid 
)
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.

Parameters
int$typeidThe tool lti type id.
int$courseidThe course id.
Return values
boolreturns True if tool is used in context, false otherwise.

◆ is_user_gradable_in_course()

static ltiservice_gradebookservices\local\service\gradebookservices::is_user_gradable_in_course (   $courseid,
  $userid 
)
static

Check if a user can be graded in a course.

Parameters
int$courseidThe course
int$useridThe user
Return values
bool

◆ item_for_json()

static ltiservice_gradebookservices\local\service\gradebookservices::item_for_json (   $item,
  $endpoint,
  $typeid 
)
static

Get the json object representation of the grade item.

Parameters
object$itemGrade Item record
string$endpointEndpoint for lineitems container request
string$typeid
Return values
object

◆ parse_value()

mod_lti\local\ltiservice\service_base::parse_value (   $value)
inherited

Parse a string for custom substitution parameter variables supported by this service's resources.

Parameters
string$valueValue to be parsed
Return values
string

◆ result_for_json()

static ltiservice_gradebookservices\local\service\gradebookservices::result_for_json (   $grade,
  $endpoint,
  $typeid 
)
static

Get the object matching the JSON representation of the result.

Parameters
object$gradeGrade record
string$endpointEndpoint for lineitem
int$typeidThe id of the type to include in the result url.
Return values
object

◆ save_grade_item()

ltiservice_gradebookservices\local\service\gradebookservices::save_grade_item (   $gradeitem,
  $score,
  $userid 
)

Set a grade item.

Parameters
object$gradeitemGrade Item record
object$scoreResult object
int$useridUser ID
Exceptions
Exception

◆ save_score()

static ltiservice_gradebookservices\local\service\gradebookservices::save_score (   $gradeitem,
  $score,
  $userid 
)
static

Set a grade item.

Parameters
object$gradeitemGrade Item record
object$scoreResult object
int$useridUser ID
Exceptions
Exception
Deprecated:
since Moodle 3.7 MDL-62599 - please do not use this function any more.
See also
gradebookservices::save_grade_item($gradeitem, $score, $userid)

◆ set_tool_proxy()

stdClass mod_lti\local\ltiservice\service_base::set_tool_proxy (   $toolproxy)
inherited

Set the tool proxy object.

Parameters
object$toolproxyThe tool proxy for this service request

◆ set_type()

stdClass mod_lti\local\ltiservice\service_base::set_type (   $type)
inherited

Set the LTI type object.

Parameters
object$typeThe LTI type for this service request

◆ set_typeconfig()

array mod_lti\local\ltiservice\service_base::set_typeconfig (   $typeconfig)
inherited

Set the LTI type config object.

Parameters
array$typeconfigThe LTI type config for this service request

◆ validate_iso8601_date()

static ltiservice_gradebookservices\local\service\gradebookservices::validate_iso8601_date (   $date)
static

Validates specific ISO 8601 format of the timestamps.

Parameters
string$dateThe timestamp to check.
Return values
booleantrue or false if the date matches the format.

The documentation for this class was generated from the following file: