So I have an activity module and I want to add a button on the settings.php page which when clicked runs a particular function in locallib.php, I have gone over the adminlib.php to see my options but couldn't find anything that I could make use of aside from using a checkbox that resets itself every time after it is saved but I don't know if that is a good idea nor if I can actually do it.
I've tried this:
$link = "<a href=".$_SERVER['SERVER_NAME']."/moodle/mod/game/clear.php" . " class='btn btn-danger'>Empty all results</a>";
$settings->add(new admin_setting_heading('modemptydb', get_string('modemptydb', 'game'), $link));
The button goes to http://localhost/moodle/admin/localhost/moodle/mod/game/clear.php
instead of http://localhost/moodle/mod/game/clear.php