Beispiel #1
0
 /**
  * Validate that the library function rlip_get_maxruntime()
  * returns correct type and value.
  */
 public function test_rlip_get_maxruntime()
 {
     $mrt = rlip_get_maxruntime();
     $this->assertTrue(is_int($mrt));
     $this->assertGreaterThanOrEqual(RLIP_MAXRUNTIME_MIN, $mrt);
 }
Beispiel #2
0
rlip_manualrun_page_setup($baseurl, $plugin_display);
//javascript library needed by the form
$PAGE->requires->js('/local/datahub/js/lib.js');
//create our basic form
$form = new rlip_manualexport_form();
$form->set_data(array('plugin' => $plugin));
//run the export before printing a page header
if ($data = $form->get_data()) {
    //run the export
    $filename = rlip_get_export_filename($plugin, $USER->timezone);
    $fileplugin = rlip_fileplugin_factory::factory($filename, NULL, false, true);
    //indicate to the factory class that this is a manual run
    $manual = true;
    $instance = rlip_dataplugin_factory::factory($plugin, NULL, $fileplugin, $manual);
    ob_start();
    $result = $instance->run(0, 0, rlip_get_maxruntime());
    $errors = ob_get_contents();
    ob_end_clean();
    if ($result !== null) {
        // Error running export (probably time limit exceeded)
        echo $OUTPUT->header();
        //display errors in a span so we can clear it using javascript when needed
        $attributes = array('id' => 'rlipexporterrors');
        echo html_writer::tag('span', $errors, $attributes);
        //display the form
        $form->display();
        echo $OUTPUT->footer();
    } else {
        $fileplugin->send_headers();
        $fileplugin->output_file();
        $fileplugin->delete();