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
 * @package mod_vpl
 * @copyright 2012 Juan Carlos Rodríguez-del-Pino
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @author Juan Carlos Rodríguez-del-Pino <*****@*****.**>
 */
defined('MOODLE_INTERNAL') || die;
require_once $CFG->dirroot . '/mod/vpl/lib.php';
$kbyte = 1024;
$megabyte = 1024 * $kbyte;
$gigabyte = 1024 * $megabyte;
$minute = 60;
$list_maxfilesize = vpl_get_select_sizes(64 * $kbyte, vpl_get_max_post_size());
$list_maxtime = vpl_get_select_time(120 * $minute);
$list_maxexefilesize = vpl_get_select_sizes(16 * $megabyte);
//Start value
$list_maxexememory = vpl_get_select_sizes(16 * $megabyte);
//Start value
$default_maxfilesize = vpl_get_array_key($list_maxfilesize, $megabyte);
$default_maxtime = vpl_get_array_key($list_maxtime, 16 * $minute);
$default_maxexefilesize = vpl_get_array_key($list_maxexefilesize, 128 * $megabyte);
$default_maxexememory = vpl_get_array_key($list_maxexememory, 512 * $megabyte);
$default_maxexeprocesses = 200;
$default_defaultfilesize = vpl_get_array_key($list_maxfilesize, 64 * $kbyte);
$default_defaulttime = vpl_get_array_key($list_maxtime, 4 * $minute);
$default_defaultexefilesize = vpl_get_array_key($list_maxexefilesize, 64 * $megabyte);
$default_defaultexememory = vpl_get_array_key($list_maxexememory, 64 * $megabyte);
$default_defaultexeprocesses = 100;
$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));
Exemplo n.º 3
0
 function definition()
 {
     global $CFG;
     $plugincfg = get_config('mod_vpl');
     $mform =& $this->_form;
     $mform->addElement('header', 'general', get_string('general', 'form'));
     // name
     $modname = 'vpl';
     $mform->addElement('text', 'name', get_string('name'), array('size' => '50'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->applyFilter('name', 'trim');
     // shortdescription
     $mform->addElement('textarea', 'shortdescription', get_string('shortdescription', VPL), array('cols' => 70, 'rows' => 1));
     $mform->setType('shortdescription', PARAM_RAW);
     if ($CFG->version < 2015041700.0) {
         //Moodle version < 2.9Beta
         $this->add_intro_editor(false, get_string('fulldescription', VPL));
         //deprecated from 2.9beta
     } else {
         $this->standard_intro_elements(get_string('fulldescription', VPL));
     }
     $mform->addElement('header', 'submissionperiod', get_string('submissionperiod', VPL));
     $secondsday = 24 * 60 * 60;
     $now = time();
     $inittime = round($now / $secondsday) * $secondsday + 5 * 60;
     $endtime = $inittime + 8 * $secondsday - 5 * 60;
     // startdate
     $mform->addElement('date_time_selector', 'startdate', get_string('startdate', VPL), array('optional' => true));
     $mform->setDefault('startdate', 0);
     $mform->setAdvanced('startdate');
     // duedate
     $mform->addElement('date_time_selector', 'duedate', get_string('duedate', VPL), array('optional' => true));
     $mform->setDefault('duedate', $endtime);
     // maxfiles
     $mform->addElement('header', 'submissionrestrictions', get_string('submissionrestrictions', VPL));
     $mform->addElement('text', 'maxfiles', get_string('maxfiles', VPL), array('size' => '2'));
     $mform->setType('maxfiles', PARAM_INT);
     $mform->setDefault('maxfiles', 1);
     $mform->addElement('select', 'worktype', get_string('worktype', VPL), array(0 => get_string('individualwork', VPL), 1 => get_string('groupwork', VPL)));
     $mform->addElement('selectyesno', 'restrictededitor', get_string('restrictededitor', VPL));
     $mform->setDefault('restrictededitor', false);
     $mform->setAdvanced('restrictededitor');
     $mform->addElement('selectyesno', 'example', get_string('isexample', VPL));
     $mform->setDefault('example', false);
     $mform->setAdvanced('example');
     $max = vpl_get_max_post_size();
     if ($plugincfg->maxfilesize > 0 && $plugincfg->maxfilesize < $max) {
         $max = $plugincfg->maxfilesize;
     }
     $mform->addElement('select', 'maxfilesize', get_string('maxfilesize', VPL), vpl_get_select_sizes(16 * 1024, $max));
     $mform->setType('maxfilesize', PARAM_INT);
     $mform->setDefault('maxfilesize', 0);
     $mform->setAdvanced('maxfilesize');
     $mform->addElement('passwordunmask', 'password', get_string('password'));
     $mform->setType('password', PARAM_TEXT);
     $mform->setAdvanced('password');
     $mform->addElement('text', 'requirednet', get_string('requirednet', VPL), array('size' => '60'));
     $mform->setType('requirednet', PARAM_TEXT);
     $mform->setDefault('requirednet', '');
     $mform->setAdvanced('requirednet');
     // grade
     $this->standard_grading_coursemodule_elements();
     $mform->addElement('selectyesno', 'visiblegrade', get_string('visiblegrade', VPL));
     $mform->setDefault('visiblegrade', 1);
     //Standard course elements
     $this->standard_coursemodule_elements();
     // end form
     $this->add_action_buttons();
 }