From aab56d07dead4cf36e93cf41817b13b14b508ba1 Mon Sep 17 00:00:00 2001 From: Nicholas Hoobin Date: Mon, 22 Mar 2021 12:40:22 +1100 Subject: [PATCH] Issue #137: Cleanup debugging noise Generates a localid for records that are forced via config.php --- classes/form/config.php | 8 ++------ classes/local/envbarlib.php | 6 ++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/classes/form/config.php b/classes/form/config.php index 65700a9..b0a16ea 100644 --- a/classes/form/config.php +++ b/classes/form/config.php @@ -145,24 +145,20 @@ public function definition() { $mform->setDefault('dividerselector', 'filler'); } - $localid = -1; - foreach ($records as $record) { $locked = false; // Local records set in config.php will be locked for editing. if (isset($record->local)) { - $record->id = $localid; $locked = true; $mform->addElement( "hidden", - "locked[{$localid}]", + "locked[{$record->id}]", $locked ); - $mform->setType("locked[{$localid}]", PARAM_INT); - $localid--; + $mform->setType("locked[{$record->id}]", PARAM_INT); } $id = $record->id; diff --git a/classes/local/envbarlib.php b/classes/local/envbarlib.php index ce2c027..6057eba 100644 --- a/classes/local/envbarlib.php +++ b/classes/local/envbarlib.php @@ -143,8 +143,10 @@ public static function get_records() { // Converting them to stdClass and adding a local flag. foreach ($items as $key => $value) { - $value['local'] = true; - $items[$key] = (object) $value; + $record = (object) $value; + $record->id = $key . 'LOCAL'; + $record->local = true; + $items[$key] = $record; } $result = array_merge($items, $result);