Exemplo n.º 1
0
 function definition()
 {
     global $CFG;
     $plugincfg = get_config('mod_vpl');
     $mform =& $this->_form;
     $id = $this->vpl->get_course_module()->id;
     $instance = $this->vpl->get_instance();
     $mform->addElement('hidden', 'id', $id);
     $mform->setType('id', PARAM_INT);
     $mform->addElement('header', 'header_execution_limits', get_string('resourcelimits', VPL));
     $mform->addElement('select', 'maxexetime', get_string('maxexetime', VPL), vpl_get_select_time((int) $plugincfg->maxexetime));
     $mform->setType('maxexetime', PARAM_INT);
     if ($instance->maxexetime) {
         $mform->setDefault('maxexetime', $instance->maxexetime);
     }
     $mform->addElement('select', 'maxexememory', get_string('maxexememory', VPL), vpl_get_select_sizes(16 * 1024 * 1024, (int) $plugincfg->maxexememory));
     $mform->setType('maxexememory', PARAM_INT);
     if ($instance->maxexememory) {
         $mform->setDefault('maxexememory', $instance->maxexememory);
     }
     $mform->addElement('select', 'maxexefilesize', get_string('maxexefilesize', VPL), vpl_get_select_sizes(1024 * 256, (int) $plugincfg->maxexefilesize));
     $mform->setType('maxexefilesize', PARAM_INT);
     if ($instance->maxexefilesize) {
         $mform->setDefault('maxexefilesize', $instance->maxexefilesize);
     }
     $mform->addElement('text', 'maxexeprocesses', get_string('maxexeprocesses', VPL));
     $mform->setType('maxexeprocesses', PARAM_INT);
     if ($instance->maxexeprocesses) {
         $mform->setDefault('maxexeprocesses', $instance->maxexeprocesses);
     }
     $mform->addElement('submit', 'savelimitoptions', get_string('saveoptions', VPL));
 }
Exemplo n.º 2
0
$prefix = 'mod_vpl/';
$settings->add(new admin_setting_heading('heading1', '', get_string('maxresourcelimits', VPL)));
$settings->add(new admin_setting_configselect($prefix . 'maxfilesize', get_string('maxfilesize', VPL), get_string('maxfilesize', VPL), $default_maxfilesize, $list_maxfilesize));
$settings->add(new admin_setting_configselect($prefix . 'maxexetime', get_string('maxexetime', VPL), get_string('maxexetime', VPL), $default_maxtime, $list_maxtime));
$settings->add(new admin_setting_configselect($prefix . 'maxexefilesize', get_string('maxexefilesize', VPL), get_string('maxexefilesize', VPL), $default_maxexefilesize, $list_maxexefilesize));
$settings->add(new admin_setting_configselect($prefix . 'maxexememory', get_string('maxexememory', VPL), get_string('maxexememory', VPL), $default_maxexememory, $list_maxexememory));
$settings->add(new admin_setting_configtext($prefix . 'maxexeprocesses', get_string('maxexeprocesses', VPL), get_string('maxexeprocesses', VPL), $default_maxexeprocesses, PARAM_INT, 4));
$settings->add(new admin_setting_heading('headingd', '', get_string('defaultresourcelimits', VPL)));
$name = 'defaultfilesize';
$settings->add(new admin_setting_configselect($prefix . $name, get_string($name, VPL), get_string($name, VPL), $default_defaultfilesize, $list_maxfilesize));
$name = 'defaultexetime';
$settings->add(new admin_setting_configselect($prefix . $name, get_string($name, VPL), get_string($name, VPL), $default_defaulttime, $list_maxtime));
$name = 'defaultexefilesize';
$settings->add(new admin_setting_configselect($prefix . $name, get_string($name, VPL), get_string($name, VPL), $default_defaultexefilesize, $list_maxexefilesize));
$name = 'defaultexememory';
$settings->add(new admin_setting_configselect($prefix . $name, get_string($name, VPL), get_string($name, VPL), $default_defaultexememory, $list_maxexememory));
$name = 'defaultexeprocesses';
$settings->add(new admin_setting_configtext($prefix . $name, get_string($name, VPL), get_string($name, VPL), $default_defaultexeprocesses, PARAM_INT, 4));
$settings->add(new admin_setting_heading('heading2', '', get_string('jail_servers_config', VPL)));
$default = "#This server is only for test use. " . "Install your own Jail server and remove the following line as soon as possible\n" . 'http://demojail.dis.ulpgc.es';
$settings->add(new admin_setting_configtextarea($prefix . 'jail_servers', get_string('jail_servers', VPL), get_string('jail_servers_description', VPL), $default));
$settings->add(new admin_setting_configcheckbox($prefix . 'acceptcertificates', get_string('acceptcertificates', VPL), get_string('acceptcertificates_description', VPL), 1));
$ws_options = array('always_use_wss' => get_string('always_use_wss', VPL), 'always_use_ws' => get_string('always_use_ws', VPL), 'depends_on_https' => get_string('depends_on_https', VPL));
$name = 'websocket_protocol';
$settings->add(new admin_setting_configselect($prefix . 'websocket_protocol', get_string('websocket_protocol', VPL), get_string('websocket_protocol_description', VPL), 'depends_on_https', $ws_options));
$name = 'proxy';
$settings->add(new admin_setting_configtext($prefix . $name, get_string($name, VPL), get_string($name . '_description', VPL), '', PARAM_URL));
$settings->add(new admin_setting_heading('heading3', '', get_string('miscellaneous')));
$list = vpl_get_select_time();
$default = vpl_get_array_key($list, 60);
$settings->add(new admin_setting_configselect($prefix . 'discard_submission_period', get_string('discard_submission_period', VPL), get_string('discard_submission_period_description', VPL), $default, $list));