Example #1
0
use Tsugi\Core\Settings;
use Tsugi\UI\SettingsForm;
// Retrieve the launch data if present
$LTI = LTIX::requireData();
$p = $CFG->dbprefix;
$displayname = $USER->displayname;
// Handle the incoming post saving the settings form
if (SettingsForm::handleSettingsPost()) {
    $_SESSION['debug_log'] = Settings::getDebugArray();
    header('Location: ' . addSession('index.php'));
    return;
}
// Handle our own manual set of the manual_key setting
if (isset($_POST['manual_key'])) {
    Settings::linkSet('manual_key', $_POST['manual_key']);
    $_SESSION['debug_log'] = Settings::getDebugArray();
    $_SESSION['success'] = "Setting updated";
    header('Location: ' . addSession('index.php'));
    return;
}
// Start of the output
$OUTPUT->header();
// Start of the view
$OUTPUT->bodyStart();
$OUTPUT->flashMessages();
// Place the settings button in the upper right.
if ($USER->instructor) {
    SettingsForm::button(true);
}
// Put out the hidden settings form using predefined UI routines
if ($USER->instructor) {