Exemple #1
0
function load_ace_if_required($question, $textareaid, $whichlang)
{
    global $CFG, $PAGE;
    if ($question->useace) {
        if ($whichlang === constants::TEMPLATE_LANGUAGE || empty($question->acelang)) {
            $lang = $question->language;
        } else {
            $lang = $question->acelang;
        }
        $lang = ucwords($lang);
        load_ace_scripts();
        $PAGE->requires->js_init_call('M.qtype_coderunner.init_ace', array($textareaid, $lang));
    }
}
 protected function definition()
 {
     global $PAGE;
     $jsmodule = array('name' => 'qtype_coderunner', 'fullpath' => '/question/type/coderunner/module.js', 'requires' => array('base', 'widget', 'io', 'node-menunav'));
     $mform = $this->_form;
     $this->make_questiontype_panel($mform);
     $this->make_customisation_panel($mform);
     $this->make_advanced_customisation_panel($mform);
     $PAGE->requires->js_init_call('M.qtype_coderunner.setupAllTAs', array(), false, $jsmodule);
     $PAGE->requires->js_init_call('M.qtype_coderunner.initEditForm', array(), false, $jsmodule);
     load_ace_scripts();
     // May be needed e.g. for template editing
     parent::definition($mform);
     // The supercalss adds the "General" stuff
 }