예제 #1
0
 private function make_advanced_customisation_panel(&$mform)
 {
     $mform->addElement('header', 'advancedcustomisationheader', get_string('advanced_customisation', 'qtype_coderunner'));
     $prototypecontrols = array();
     $prototypeselect =& $mform->createElement('select', 'prototypetype', get_string('prototypeQ', 'qtype_coderunner'));
     $prototypeselect->addOption('No', '0');
     $prototypeselect->addOption('Yes (built-in)', '1', array('disabled' => 'disabled'));
     $prototypeselect->addOption('Yes (user defined)', '2');
     $prototypecontrols[] =& $prototypeselect;
     $prototypecontrols[] =& $mform->createElement('text', 'typename', get_string('typename', 'qtype_coderunner'), array('size' => 30));
     $mform->addElement('group', 'prototypecontrols', get_string('prototypecontrols', 'qtype_coderunner'), $prototypecontrols, null, false);
     $mform->setDefault('is_prototype', False);
     $mform->setType('typename', PARAM_RAW);
     $mform->addElement('hidden', 'saved_prototype_type');
     $mform->setType('saved_prototype_type', PARAM_RAW);
     $mform->addHelpButton('prototypecontrols', 'prototypecontrols', 'qtype_coderunner');
     $sandboxcontrols = array();
     $sandboxes = array('DEFAULT' => 'DEFAULT');
     foreach (qtype_coderunner_sandbox::available_sandboxes() as $ext => $class) {
         $sandboxes[$ext] = $ext;
     }
     $sandboxcontrols[] = $mform->createElement('select', 'sandbox', null, $sandboxes);
     $sandboxcontrols[] =& $mform->createElement('text', 'cputimelimitsecs', get_string('cputime', 'qtype_coderunner'), array('size' => 3));
     $sandboxcontrols[] =& $mform->createElement('text', 'memlimitmb', get_string('memorylimit', 'qtype_coderunner'), array('size' => 5));
     $sandboxcontrols[] =& $mform->createElement('text', 'sandboxparams', get_string('sandboxparams', 'qtype_coderunner'), array('size' => 15));
     $mform->addElement('group', 'sandboxcontrols', get_string('sandboxcontrols', 'qtype_coderunner'), $sandboxcontrols, null, false);
     $mform->setType('cputimelimitsecs', PARAM_RAW);
     $mform->setType('memlimitmb', PARAM_RAW);
     $mform->setType('sandboxparams', PARAM_RAW);
     $mform->addHelpButton('sandboxcontrols', 'sandboxcontrols', 'qtype_coderunner');
     $languages = array();
     $languages[] =& $mform->createElement('text', 'language', get_string('language', 'qtype_coderunner'), array('size' => 10));
     $mform->setType('language', PARAM_RAW);
     $languages[] =& $mform->createElement('text', 'acelang', get_string('ace-language', 'qtype_coderunner'), array('size' => 10));
     $mform->setType('acelang', PARAM_RAW);
     $mform->addElement('group', 'languages', get_string('languages', 'qtype_coderunner'), $languages, null, false);
     $mform->addHelpButton('languages', 'languages', 'qtype_coderunner');
     $combinatorcontrols = array();
     $combinatorcontrols[] =& $mform->createElement('advcheckbox', 'enablecombinator', null, get_string('enablecombinator', 'qtype_coderunner'));
     $combinatorcontrols[] =& $mform->createElement('text', 'testsplitterre', get_string('testsplitterre', 'qtype_coderunner'), array('size' => 45));
     $mform->setType('testsplitterre', PARAM_RAW);
     $mform->disabledIf('typename', 'prototypetype', 'neq', '2');
     $combinatorcontrols[] =& $mform->createElement('textarea', 'combinatortemplate', '', array('cols' => 60, 'rows' => 8, 'class' => 'template edit_code', 'name' => 'combinatortemplate'));
     $mform->addElement('group', 'combinatorcontrols', get_string('combinatorcontrols', 'qtype_coderunner'), $combinatorcontrols, null, false);
     $mform->addHelpButton('combinatorcontrols', 'combinatorcontrols', 'qtype_coderunner');
     $mform->setExpanded('customisationheader');
     // Although expanded it's hidden until JavaScript unhides it
 }
예제 #2
0
파일: settings.php 프로젝트: pac/CodeRunner
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Configuration settings declaration information for the CodeRunner question type.
 *
 * @package    qtype
 * @subpackage coderunner
 * @copyright  2014 Richard Lobb, The University of Canterbury.
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die;
require_once $CFG->dirroot . '/question/type/coderunner/sandbox/sandboxbase.php';
$sandboxes = qtype_coderunner_sandbox::available_sandboxes();
foreach ($sandboxes as $sandbox => $classname) {
    $settings->add(new admin_setting_configcheckbox("qtype_coderunner/{$sandbox}_enabled", get_string('enable', 'qtype_coderunner') . ' ' . $sandbox, get_string('enable_sandbox_desc', 'qtype_coderunner'), $sandbox === 'jobesandbox'));
}
$settings->add(new admin_setting_configtext("qtype_coderunner/jobe_host", get_string('jobe_host', 'qtype_coderunner'), get_string('jobe_host_desc', 'qtype_coderunner'), 'jobe2.cosc.canterbury.ac.nz'));
$settings->add(new admin_setting_configtext("qtype_coderunner/jobe_apikey", get_string('jobe_apikey', 'qtype_coderunner'), get_string('jobe_apikey_desc', 'qtype_coderunner'), '2AAA7A5415B4A9B394B54BF1D2E9D'));
$settings->add(new admin_setting_configtext("qtype_coderunner/ideone_user", get_string('ideone_user', 'qtype_coderunner'), get_string('ideone_user_desc', 'qtype_coderunner'), ''));
$settings->add(new admin_setting_configtext("qtype_coderunner/ideone_password", get_string('ideone_pass', 'qtype_coderunner'), get_string('ideone_pass_desc', 'qtype_coderunner'), ''));
예제 #3
0
파일: question.php 프로젝트: pac/CodeRunner
 private function setup_sandbox()
 {
     global $CFG;
     $sandbox = $this->sandbox;
     if ($sandbox === null) {
         $this->sandbox = $sandbox = $this->get_best_sandbox($this->language);
         if ($sandbox === null) {
             throw new coderunner_exception("Language {$this->language} is not available on this system");
         }
     } else {
         if (!get_config('qtype_coderunner', strtolower($sandbox) . '_enabled')) {
             throw new coderunner_exception("Question is configured to use a disabled sandbox ({$sandbox})");
         }
     }
     $sandboxes = qtype_coderunner_sandbox::available_sandboxes();
     $sandboxclass = $sandboxes[$sandbox];
     $filename = qtype_coderunner_sandbox::get_filename($sandbox);
     require_once $CFG->dirroot . "/question/type/coderunner/sandbox/{$filename}";
     $this->sandboxinstance = new $sandboxclass();
 }