Example #1
0
// View
$OUTPUT->header();
$OUTPUT->bodyStart();
// Settings button and dialog
// echo('<span style="position: fixed; right: 10px; top: 5px;">');
echo '<span style="float: right; margin-bottom: 10px;">';
if ($USER->instructor) {
    echo '<a href="configure.php" class="btn btn-default">Edit Quiz Content</a> ';
    echo '<a href="grades.php" target="_blank"><button class="btn btn-info">Grade detail</button></a> ' . "\n";
}
$OUTPUT->exitButton();
SettingsForm::button();
echo '</span>';
SettingsForm::start();
SettingsForm::text('tries', __('The number of tries allowed for this quiz.  Leave blank or set to 1 for a single try.'));
SettingsForm::text('delay', __('The number of seconds between retries.  Leave blank or set to zero to allow immediate retries.'));
SettingsForm::dueDate();
SettingsForm::done();
SettingsForm::end();
$OUTPUT->welcomeUserCourse();
$OUTPUT->flashMessages();
// Clean up the JSON for presentation
if ($gift === false || strlen($gift) < 1) {
    echo '<p class="alert-warning" style="clear:both;">This quiz has not yet been configured</p>' . "\n";
    $OUTPUT->footer();
    return;
}
if ($RESULT->grade > 0) {
    echo '<p class="alert alert-info" style="clear:both;">Your current grade on this assignment is: ' . percent($RESULT->grade) . '</p>' . "\n";
}
if (!$ok) {
Example #2
0
    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) {
    SettingsForm::start();
    echo '<label for="sample_key">Please enter a string for "sample_key" below.<br/>' . "\n";
    SettingsForm::text('sample_key');
    echo "</label>\n";
    SettingsForm::end();
}
echo "<h1>Settings Test Harness</h1>\n";
$OUTPUT->welcomeUserCourse();
if ($USER->instructor) {
    echo "<p>Press the settings button in the upper left to change the settings.</p>\n";
}
// Load the old values for the settings
$sk = Settings::linkGet('sample_key');
echo "<p>The currentsetting for sample_key is: <b>" . htmlent_utf8($sk) . "</b></p>\n";
$mk = Settings::linkGet('manual_key');
echo "<p>The currentsetting for manual_key is: <b>" . htmlent_utf8($mk) . "</b></p>\n";
// Lets show how to set a setting in our own code
if ($USER->instructor) {