if ($setting->long == 'password' || $setting->long == 'username') { continue; } $mform->addElement($type, $setting->long, $label, $options, $htmloptions); if (isset($setting->default)) { $mform->setDefault($setting->long, $setting->default); } } $this->add_action_buttons(false, 'Generate data!'); } function definition_after_data() { } } if (CLI_SCRIPT) { $generator = new generator_cli($argv, $argc); $generator->generate_data(); } elseif (strstr($_SERVER['REQUEST_URI'], 'generator.php')) { require_login(); $systemcontext = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/site:config', $systemcontext); $PAGE->set_url('/admin/generator.php'); $PAGE->set_pagelayout('base'); $generator = new generator_web(); $generator->setup(); $generator->display(); $generator->generate_data(); $generator->complete(); } else { $generator = new generator_silent(); }
foreach ($setting->default as $option) { $options[$option] = $option; } $htmloptions = array('multiple' => 'multiple'); } elseif (!empty($setting->type)) { $type = 'text'; } if ($setting->long == 'password' || $setting->long == 'username') { continue; } $mform->addElement($type, $setting->long, $label, $options, $htmloptions); $mform->setHelpButton($setting->long, array(false, $label, $setting->help)); if (isset($setting->default)) { $mform->setDefault($setting->long, $setting->default); } } $this->add_action_buttons(false, 'Generate data!'); } function definition_after_data() { } } if (isset($argv) && isset($argc)) { $generator = new generator_cli($argv, $argc); $generator->generate_data(); } else { $generator = new generator_web(); $generator->setup(); $generator->display(); $generator->generate_data(); }