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);