}
    }
    closedir($dh);
}
require_login();
$context = get_system_context();
$PAGE->set_context($context);
$PAGE->set_heading($SITE->fullname);
$PAGE->set_title($SITE->fullname . ': ' . get_string('pluginname', 'local_moodlecheck'));
$PAGE->set_url(new moodle_url('/local/moodlecheck/index.php'));
$output = $PAGE->get_renderer('local_moodlecheck');
echo $output->header();
$form = new local_moodlecheck_form();
$form->display();
if ($form->is_submitted() && $form->is_validated()) {
    $data = $form->get_data();
    $paths = preg_split('/\\s*\\n\\s*/', trim($data->path), null, PREG_SPLIT_NO_EMPTY);
    $ignorepaths = preg_split('/\\s*\\n\\s*/', trim($data->ignorepath), null, PREG_SPLIT_NO_EMPTY);
    if (isset($data->checkall) && $data->checkall == 'selected' && isset($data->rule)) {
        foreach ($data->rule as $code => $value) {
            local_moodlecheck_registry::enable_rule($code);
        }
    } else {
        local_moodlecheck_registry::enable_all_rules();
    }
    foreach ($paths as $filename) {
        $path = new local_moodlecheck_path($filename, $ignorepaths);
        echo $output->display_path($path);
    }
}
echo $output->footer();