From c25501e89dc7749923987ec0618b7683f48e584b Mon Sep 17 00:00:00 2001 From: Aaron Wells Date: Wed, 10 Apr 2024 17:15:35 +1200 Subject: [PATCH] MDL-80231 core_ltix: updating references from ltiservice to ltixservice --- .../classes/local/resources/lineitem.php | 4 ++-- .../classes/local/resources/results.php | 2 +- .../classes/local/resources/scores.php | 2 +- .../local/service/gradebookservices.php | 18 +++++++++--------- .../classes/task/cleanup_task.php | 2 +- .../tests/gradebookservices_test.php | 6 +++--- .../classes/local/ltiservice/service_base.php | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ltix/service/gradebookservices/classes/local/resources/lineitem.php b/ltix/service/gradebookservices/classes/local/resources/lineitem.php index adf3d375110e6..4abc18e1a0d73 100644 --- a/ltix/service/gradebookservices/classes/local/resources/lineitem.php +++ b/ltix/service/gradebookservices/classes/local/resources/lineitem.php @@ -151,7 +151,7 @@ private function process_put_request($body, $olditem, $typeid) { throw new \Exception(null, 400); } $item = \grade_item::fetch(array('id' => $olditem->id, 'courseid' => $olditem->courseid)); - $gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($olditem->id); + $gbs = gradebookservices::find_ltixservice_gradebookservice_for_lineitem($olditem->id); $updategradeitem = false; $rescalegrades = false; $oldgrademax = grade_floatval($item->grademax); @@ -297,7 +297,7 @@ private function process_delete_request($item) { global $DB; $gradeitem = \grade_item::fetch(array('id' => $item->id)); - if (($gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($item->id)) == false) { + if (($gbs = gradebookservices::find_ltixservice_gradebookservice_for_lineitem($item->id)) == false) { throw new \Exception(null, 403); } if (!$gradeitem->delete('mod/ltixservice_gradebookservices')) { diff --git a/ltix/service/gradebookservices/classes/local/resources/results.php b/ltix/service/gradebookservices/classes/local/resources/results.php index 13c980c603b1b..b82c32918d23e 100644 --- a/ltix/service/gradebookservices/classes/local/resources/results.php +++ b/ltix/service/gradebookservices/classes/local/resources/results.php @@ -90,7 +90,7 @@ public function execute($response) { if ($item === false) { throw new \Exception('Line item does not exist', 404); } - $gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($itemid); + $gbs = gradebookservices::find_ltixservice_gradebookservice_for_lineitem($itemid); $ltilinkid = null; if (isset($item->iteminstance)) { $ltilinkid = $item->iteminstance; diff --git a/ltix/service/gradebookservices/classes/local/resources/scores.php b/ltix/service/gradebookservices/classes/local/resources/scores.php index 536bc112bc4a7..1a5dc5f0eb75e 100644 --- a/ltix/service/gradebookservices/classes/local/resources/scores.php +++ b/ltix/service/gradebookservices/classes/local/resources/scores.php @@ -105,7 +105,7 @@ public function execute($response) { if ($item === false) { throw new \Exception('Line item does not exist', 404); } - $gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($itemid); + $gbs = gradebookservices::find_ltixservice_gradebookservice_for_lineitem($itemid); $ltilinkid = null; if (isset($item->iteminstance)) { $ltilinkid = $item->iteminstance; diff --git a/ltix/service/gradebookservices/classes/local/service/gradebookservices.php b/ltix/service/gradebookservices/classes/local/service/gradebookservices.php index 38c43cdc1e891..942b70a689201 100644 --- a/ltix/service/gradebookservices/classes/local/service/gradebookservices.php +++ b/ltix/service/gradebookservices/classes/local/service/gradebookservices.php @@ -322,7 +322,7 @@ public function get_lineitems($courseid, $resourceid, $ltilinkid, $tag, $limitfr $lineitemsandtotalcount = array(); if ($lineitems) { foreach ($lineitems as $lineitem) { - $gbs = $this->find_ltiservice_gradebookservice_for_lineitem($lineitem->id); + $gbs = $this->find_ltixservice_gradebookservice_for_lineitem($lineitem->id); if ($gbs && (!isset($tag) || (isset($tag) && $gbs->tag == $tag)) && (!isset($ltilinkid) || (isset($ltilinkid) && $gbs->ltilinkid == $ltilinkid)) && (!isset($resourceid) || (isset($resourceid) && $gbs->resourceid == $resourceid))) { @@ -390,7 +390,7 @@ public function get_lineitem($courseid, $itemid, $typeid) { require_once($CFG->libdir . '/gradelib.php'); $lineitem = \grade_item::fetch(array('id' => $itemid)); if ($lineitem) { - $gbs = $this->find_ltiservice_gradebookservice_for_lineitem($itemid); + $gbs = $this->find_ltixservice_gradebookservice_for_lineitem($itemid); if (!$gbs) { // We will need to check if the activity related belongs to our tool proxy. $ltiactivity = $DB->get_record('lti', array('id' => $lineitem->iteminstance)); @@ -571,7 +571,7 @@ public static function item_for_json($item, $endpoint, $typeid) { $lineitem->id = "{$endpoint}/{$item->id}/lineitem" . $typeidstring; $lineitem->label = $item->itemname; $lineitem->scoreMaximum = floatval($item->grademax); - $gbs = self::find_ltiservice_gradebookservice_for_lineitem($item->id); + $gbs = self::find_ltixservice_gradebookservice_for_lineitem($item->id); if ($gbs) { $lineitem->resourceId = (!empty($gbs->resourceid)) ? $gbs->resourceid : ''; $lineitem->tag = (!empty($gbs->tag)) ? $gbs->tag : ''; @@ -734,7 +734,7 @@ public static function update_coupled_gradebookservices(object $ltiinstance, $resourceid = (isset($resourceid) && empty(trim($resourceid))) ? null : $resourceid; $subreviewurlstr = $subreviewurl ? $subreviewurl->out(false) : null; $tag = (isset($tag) && empty(trim($tag))) ? null : $tag; - $gbs = self::find_ltiservice_gradebookservice_for_lineitem($gradeitem->id); + $gbs = self::find_ltixservice_gradebookservice_for_lineitem($gradeitem->id); if ($gbs) { $gbs->resourceid = $resourceid; $gbs->tag = $tag; @@ -792,7 +792,7 @@ public function set_instance_form_values(object $defaultvalues): void { $defaultvalues->subreviewurl = ''; $defaultvalues->subreviewparams = ''; if (is_object($defaultvalues) && $defaultvalues->instance) { - $gbs = self::find_ltiservice_gradebookservice_for_lti($defaultvalues->instance); + $gbs = self::find_ltixservice_gradebookservice_for_lti($defaultvalues->instance); if ($gbs) { $defaultvalues->lineitemresourceid = $gbs->resourceid; $defaultvalues->lineitemtag = $gbs->tag; @@ -810,7 +810,7 @@ public function set_instance_form_values(object $defaultvalues): void { * 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 */ - public static function delete_orphans_ltiservice_gradebookservices_rows() { + public static function delete_orphan_ltixservice_gradebookservices_rows() { global $DB; $sql = "DELETE @@ -853,13 +853,13 @@ public static function is_user_gradable_in_course($courseid, $userid) { * @param string $instanceid The LTI module instance id * @return object gradebookservice for this line item */ - public static function find_ltiservice_gradebookservice_for_lti($instanceid) { + public static function find_ltixservice_gradebookservice_for_lti($instanceid) { global $DB; if ($instanceid) { $gradeitem = $DB->get_record('grade_items', array('itemmodule' => 'lti', 'iteminstance' => $instanceid)); if ($gradeitem) { - return self::find_ltiservice_gradebookservice_for_lineitem($gradeitem->id); + return self::find_ltixservice_gradebookservice_for_lineitem($gradeitem->id); } } } @@ -870,7 +870,7 @@ public static function find_ltiservice_gradebookservice_for_lti($instanceid) { * @param string $lineitemid The lineitem (gradeitem) id * @return object gradebookservice if it exists */ - public static function find_ltiservice_gradebookservice_for_lineitem($lineitemid) { + public static function find_ltixservice_gradebookservice_for_lineitem($lineitemid) { global $DB; if ($lineitemid) { return $DB->get_record('ltixservice_gradebookservices', diff --git a/ltix/service/gradebookservices/classes/task/cleanup_task.php b/ltix/service/gradebookservices/classes/task/cleanup_task.php index 031eaabf1eea4..35c53ab1a557a 100644 --- a/ltix/service/gradebookservices/classes/task/cleanup_task.php +++ b/ltix/service/gradebookservices/classes/task/cleanup_task.php @@ -52,7 +52,7 @@ public function get_name() { * Run forum cron. */ public function execute() { - gradebookservices::delete_orphans_ltiservice_gradebookservices_rows(); + gradebookservices::delete_orphan_ltixservice_gradebookservices_rows(); } } diff --git a/ltix/service/gradebookservices/tests/gradebookservices_test.php b/ltix/service/gradebookservices/tests/gradebookservices_test.php index 65b7d81323f5c..b8f116c202f86 100644 --- a/ltix/service/gradebookservices/tests/gradebookservices_test.php +++ b/ltix/service/gradebookservices/tests/gradebookservices_test.php @@ -53,7 +53,7 @@ public function test_lti_add_coupled_lineitem() { $this->assertNotNull($ltiinstance); - $gbs = gradebookservices::find_ltiservice_gradebookservice_for_lti($ltiinstance->id); + $gbs = gradebookservices::find_ltixservice_gradebookservice_for_lti($ltiinstance->id); $this->assertNotNull($gbs); $this->assertEquals($resourceid, $gbs->resourceid); @@ -86,7 +86,7 @@ public function test_lti_add_coupled_lineitem_default_subreview() { $this->assertNotNull($ltiinstance); - $gbs = gradebookservices::find_ltiservice_gradebookservice_for_lti($ltiinstance->id); + $gbs = gradebookservices::find_ltixservice_gradebookservice_for_lti($ltiinstance->id); $this->assertNotNull($gbs); $this->assertEquals('DEFAULT', $gbs->subreviewurl); @@ -114,7 +114,7 @@ public function test_lti_add_standalone_lineitem() { } /** - * @covers ::find_ltiservice_gradebookservice_for_lti + * @covers ::find_ltixservice_gradebookservice_for_lti * * Test line item URL is populated for coupled line item only * if there is not another line item bound to the lti instance, diff --git a/mod/lti/classes/local/ltiservice/service_base.php b/mod/lti/classes/local/ltiservice/service_base.php index 6db397edadb76..a26eee138a14d 100644 --- a/mod/lti/classes/local/ltiservice/service_base.php +++ b/mod/lti/classes/local/ltiservice/service_base.php @@ -99,7 +99,7 @@ public function get_id() { */ public function get_component_id() { - return 'ltiservice_' . $this->id; + return 'ltixservice_' . $this->id; }