コード例 #1
0
require_once '../../../config.php';
require_once 'report.class.php';
require_once 'report_create_pivot_form.class.php';
require_login();
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout('standard');
$PAGE->set_url(new moodle_url('/blocks/dial_rewards/info_pages/report_create_pivot.php'));
$title = 'Generate New Pivot Table';
$PAGE->set_heading($title);
$PAGE->set_title($title);
$mform = new report_form();
//Form processing and displaying is done here
if ($mform->is_cancelled()) {
    // Redircet user to dashbosrd page
    redirect(new moodle_url('/blocks/dial_rewards/reports/report_home.php'));
} elseif ($mform->no_submit_button_pressed()) {
    echo 'Fetching data ';
    if ($data = $mform->get_data()) {
        echo 'No Data! ';
    } else {
        echo 'Here is the data: ';
        print_r($data);
    }
} elseif ($data = $mform->get_data()) {
    //In this case you process validated data.
    //$mform->get_data() returns data posted in form.
} else {
    // this branch is executed if the form is submitted but
    // the data doesn't validate and the form should be
    // redisplayed or on the first display of the form.
}