/**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     global $QTYPES;
     $menu = array(get_string('answersingleno', 'qtype_multichoice'), get_string('answersingleyes', 'qtype_multichoice'));
     $mform->addElement('select', 'single', get_string('answerhowmany', 'qtype_multichoice'), $menu);
     $mform->setDefault('single', 1);
     $mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffleanswers', 'qtype_multichoice'), null, null, array(0, 1));
     $mform->addHelpButton('shuffleanswers', 'shuffleanswers', 'qtype_multichoice');
     $mform->setDefault('shuffleanswers', 1);
     $numberingoptions = $QTYPES[$this->qtype()]->get_numbering_styles();
     $menu = array();
     foreach ($numberingoptions as $numberingoption) {
         $menu[$numberingoption] = get_string('answernumbering' . $numberingoption, 'qtype_multichoice');
     }
     $mform->addElement('select', 'answernumbering', get_string('answernumbering', 'qtype_multichoice'), $menu);
     $mform->setDefault('answernumbering', 'abc');
     /*        $mform->addElement('static', 'answersinstruct', get_string('choices', 'qtype_multichoice'), get_string('fillouttwochoices', 'qtype_multichoice'));
             $mform->closeHeaderBefore('answersinstruct');
     */
     $creategrades = get_grade_options();
     $this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'), $creategrades->gradeoptionsfull, max(5, QUESTION_NUMANS_START));
     $mform->addElement('header', 'overallfeedbackhdr', get_string('overallfeedback', 'qtype_multichoice'));
     foreach (array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback') as $feedbackname) {
         $mform->addElement('editor', $feedbackname, get_string($feedbackname, 'qtype_multichoice'), array('rows' => 10), $this->editoroptions);
         $mform->setType($feedbackname, PARAM_RAW);
     }
 }
 /**
  * Add the unit handling options to the form.
  * @param object $mform the form being built.
  */
 protected function add_unit_options($mform)
 {
     $mform->addElement('header', 'unithandling', get_string('unithandling', 'qtype_numerical'));
     $unitoptions = array(qtype_numerical::UNITNONE => get_string('onlynumerical', 'qtype_numerical'), qtype_numerical::UNITOPTIONAL => get_string('manynumerical', 'qtype_numerical'), qtype_numerical::UNITGRADED => get_string('unitgraded', 'qtype_numerical'));
     $mform->addElement('select', 'unitrole', get_string('unithandling', 'qtype_numerical'), $unitoptions);
     $penaltygrp = array();
     $penaltygrp[] = $mform->createElement('text', 'unitpenalty', get_string('unitpenalty', 'qtype_numerical'), array('size' => 6));
     $mform->setType('unitpenalty', PARAM_FLOAT);
     $mform->setDefault('unitpenalty', 0.1);
     $unitgradingtypes = array(qtype_numerical::UNITGRADEDOUTOFMARK => get_string('decfractionofresponsegrade', 'qtype_numerical'), qtype_numerical::UNITGRADEDOUTOFMAX => get_string('decfractionofquestiongrade', 'qtype_numerical'));
     $penaltygrp[] = $mform->createElement('select', 'unitgradingtypes', '', $unitgradingtypes);
     $mform->setDefault('unitgradingtypes', 1);
     $mform->addGroup($penaltygrp, 'penaltygrp', get_string('unitpenalty', 'qtype_numerical'), ' ', false);
     $mform->addHelpButton('penaltygrp', 'unitpenalty', 'qtype_numerical');
     $unitinputoptions = array(qtype_numerical::UNITINPUT => get_string('editableunittext', 'qtype_numerical'), qtype_numerical::UNITRADIO => get_string('unitchoice', 'qtype_numerical'), qtype_numerical::UNITSELECT => get_string('unitselect', 'qtype_numerical'));
     $mform->addElement('select', 'multichoicedisplay', get_string('studentunitanswer', 'qtype_numerical'), $unitinputoptions);
     $unitsleftoptions = array(0 => get_string('rightexample', 'qtype_numerical'), 1 => get_string('leftexample', 'qtype_numerical'));
     $mform->addElement('select', 'unitsleft', get_string('unitposition', 'qtype_numerical'), $unitsleftoptions);
     $mform->setDefault('unitsleft', 0);
     $mform->disabledIf('penaltygrp', 'unitrole', 'eq', qtype_numerical::UNITNONE);
     $mform->disabledIf('penaltygrp', 'unitrole', 'eq', qtype_numerical::UNITOPTIONAL);
     $mform->disabledIf('unitsleft', 'unitrole', 'eq', qtype_numerical::UNITNONE);
     $mform->disabledIf('multichoicedisplay', 'unitrole', 'eq', qtype_numerical::UNITNONE);
     $mform->disabledIf('multichoicedisplay', 'unitrole', 'eq', qtype_numerical::UNITOPTIONAL);
 }
    /**
     * Add question-type specific form fields.
     *
     * @param object $mform the form being built.
     */
    protected function definition_inner($mform) {
        $menu = array(
            get_string('answersingleno', 'qtype_multichoice'),
            get_string('answersingleyes', 'qtype_multichoice'),
        );
        $mform->addElement('select', 'single',
                get_string('answerhowmany', 'qtype_multichoice'), $menu);
        $mform->setDefault('single', 1);

        $mform->addElement('advcheckbox', 'shuffleanswers',
                get_string('shuffleanswers', 'qtype_multichoice'), null, null, array(0, 1));
        $mform->addHelpButton('shuffleanswers', 'shuffleanswers', 'qtype_multichoice');
        $mform->setDefault('shuffleanswers', 1);

        $mform->addElement('select', 'answernumbering',
                get_string('answernumbering', 'qtype_multichoice'),
                qtype_multichoice::get_numbering_styles());
        $mform->setDefault('answernumbering', 'abc');

        $this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'),
                question_bank::fraction_options_full(), max(5, QUESTION_NUMANS_START));

        $this->add_combined_feedback_fields(true);
        $mform->disabledIf('shownumcorrect', 'single', 'eq', 1);

        $this->add_interactive_settings(true, true);
    }
 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 protected function definition_inner($mform)
 {
     $mform->removeElement('defaultmark');
     $mform->addElement('hidden', 'defaultmark', '1');
     $mform->removeElement('generalfeedback');
     $mform->addElement('advcheckbox', 'autoplay', get_string('autoplay', 'qtype_turmultiplechoice'), null, null, array(0, 1));
     $mform->addHelpButton('autoplay', 'autoplay', 'qtype_turmultiplechoice');
     $mform->setDefault('autoplay', 0);
     $menu = array(get_string('answersingleno', 'qtype_turmultiplechoice'), get_string('answersingleyes', 'qtype_turmultiplechoice'));
     $mform->addElement('select', 'single', get_string('answerhowmany', 'qtype_turmultiplechoice'), $menu);
     $mform->setDefault('single', 0);
     // 'Image to display' filemanager
     $mform->addElement('filemanager', 'questionimage', 'Image to display', null, array('maxfiles' => 1));
     // TODO: Use lang string
     // 'Choose soundfile for question' filemanager
     $mform->addElement('filemanager', 'questionsound', 'Choose soundfile for question', null, array('maxfiles' => 1, 'accepted_types' => array('.mp3')));
     // TODO: Use lang string
     $question_difficulties = array();
     $question_difficulties[0] = get_string('q_easy1', 'qtype_turmultiplechoice');
     $question_difficulties[1] = get_string('q_easy2', 'qtype_turmultiplechoice');
     $question_difficulties[2] = get_string('q_easy3', 'qtype_turmultiplechoice');
     $question_difficulties[3] = get_string('q_medium1', 'qtype_turmultiplechoice');
     $question_difficulties[4] = get_string('q_medium2', 'qtype_turmultiplechoice');
     $question_difficulties[5] = get_string('q_medium3', 'qtype_turmultiplechoice');
     $question_difficulties[6] = get_string('q_hard1', 'qtype_turmultiplechoice');
     $question_difficulties[7] = get_string('q_hard2', 'qtype_turmultiplechoice');
     $question_difficulties[8] = get_string('q_hard3', 'qtype_turmultiplechoice');
     $mform->addElement('select', 'qdifficulty', get_string('qdifficulty', 'qtype_turmultiplechoice'), $question_difficulties);
     $mform->setDefault('qdifficulty', 0);
     $mform->addElement('hidden', 'shuffleanswers', 1);
     $this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_turmultiplechoice', '{no}'), question_bank::fraction_options_full(), max(4, QUESTION_NUMANS_START), 4);
     $this->add_combined_feedback_fields(true);
     $mform->disabledIf('shownumcorrect', 'single', 'eq', 1);
 }
 /**
  * Add form elements for upload graduate attributes.
  * @param object $mform		form definition
  * @return void
  */
 private function setup_upload_gradatt($mform)
 {
     $mform->addElement('header', 'upload_gradatt_header', get_string('upload_gradatt_header', 'local_metadata'));
     $mform->addHelpButton('upload_gradatt_header', 'upload_gradatt_header', 'local_metadata');
     $mform->addElement('filepicker', 'temp_gradatt', get_string('file'), null, array('maxbytes' => 0, 'accepted_types' => '.csv'));
     $mform->addElement('submit', 'upload_gradatt', get_string('upload_gradatt', 'local_metadata'));
 }
Beispiel #6
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $choices = array();
     foreach ($this->_options as $key => $value) {
         $choices[serialize($value)] = $key;
     }
     if (isset($this->_anyvalue)) {
         $choices = array('' => get_string('anyvalue', 'filters')) + $choices;
     }
     $mform->addElement('select', $this->_uniqueid, $this->_label, $choices);
     $data = $mform->exportValues();
     // ELIS-3474,ELIS-3475: since called from definition_after_data()
     // we MUST check if data has been set or default will override!
     if ((!is_array($data) || !isset($data[$this->_uniqueid]) || $data[$this->_uniqueid] === '') && isset($this->_default)) {
         $value = $this->_default;
         if (is_array($value)) {
             $value = serialize($value);
         }
         $mform->setDefault($this->_uniqueid, $value);
     }
     $mform->addHelpButton($this->_uniqueid, $this->_filterhelp[0], $this->_filterhelp[2]);
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid);
     }
 }
 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 public function definition_inner($mform)
 {
     // cache this plugins name
     $plugin = 'qtype_ordering';
     // selecttype
     $name = 'selecttype';
     $label = get_string($name, $plugin);
     $options = array(0 => get_string('selectall', $plugin), 1 => get_string('selectrandom', $plugin), 2 => get_string('selectcontiguous', $plugin));
     $mform->addElement('select', $name, $label, $options);
     $mform->addHelpButton($name, $name, $plugin);
     $mform->setDefault($name, 0);
     // selectcount
     $name = 'selectcount';
     $label = get_string($name, $plugin);
     $options = array(0 => get_string('all'));
     for ($i = 3; $i <= 20; $i++) {
         $options[$i] = $i;
     }
     $mform->addElement('select', $name, $label, $options);
     $mform->disabledIf($name, 'selecttype', 'eq', 0);
     $mform->addHelpButton($name, $name, $plugin);
     $mform->setDefault($name, 0);
     // answers (=items)
     $elements = array();
     $name = 'answerheader';
     $label = get_string($name, $plugin);
     $elements[] =& $mform->createElement('header', $name, $label);
     $name = 'answer';
     $label = get_string($name, $plugin);
     $options = array('rows' => self::NUM_ANS_ROWS, 'cols' => self::NUM_ANS_COLS);
     $elements[] =& $mform->createElement('textarea', $name, $label, $options);
     if (empty($this->question->options)) {
         $start = 0;
     } else {
         $start = count($this->question->options->answers);
     }
     if ($start < self::NUM_ANS_START) {
         $start = self::NUM_ANS_START;
     }
     $options = array('answerheader' => array('expanded' => true));
     $buttontext = get_string('addmoreanswers', $plugin, self::NUM_ANS_ADD);
     $this->repeat_elements($elements, $start, $options, 'countanswers', 'addanswers', self::NUM_ANS_ADD, $buttontext);
     // feedback
     $this->add_ordering_feedback_fields();
 }
Beispiel #8
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $mform->addElement('select', $this->_uniqueid, $this->_label, $this->_options);
     $mform->addHelpButton($this->_uniqueid, 'simpleselect', 'local_eliscore');
     // TBV
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid);
     }
 }
 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 protected function definition_inner($mform)
 {
     $mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffle', 'qtype_match'), null, null, array(0, 1));
     $mform->addHelpButton('shuffleanswers', 'shuffle', 'qtype_match');
     $mform->setDefault('shuffleanswers', 1);
     $this->add_per_answer_fields($mform, get_string('questionno', 'question', '{no}'), 0);
     $this->add_combined_feedback_fields(true);
     $this->add_interactive_settings(true, true);
 }
Beispiel #10
0
 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffle', 'qtype_match'), null, null, array(0, 1));
     $mform->addHelpButton('shuffleanswers', 'shuffle', 'qtype_match');
     $mform->setDefault('shuffleanswers', 1);
     $mform->addElement('static', 'answersinstruct', get_string('choices', 'quiz'), get_string('filloutthreeqsandtwoas', 'qtype_match'));
     $mform->closeHeaderBefore('answersinstruct');
     $this->add_per_answer_fields($mform, get_string('questionno', 'quiz', '{no}'), 0);
 }
 /**
  * Add form elements for upload course categories.
  * @param object $mform		form definition
  * @return void
  */
 private function setup_upload_categories($mform)
 {
     $mform->addElement('header', 'upload_category_header', get_string('upload_category_header', 'local_metadata'));
     $mform->addHelpButton('upload_category_header', 'upload_category_header', 'local_metadata');
     $mform->addElement('text', 'category_label', get_string('category_label', 'local_metadata'));
     $mform->setType('category_label', PARAM_TEXT);
     //$mform->addRule('category_label', get_string('err_required'), 'required', null, 'server');
     //$faculty_selection = $mform->addElement ('select', 'course_faculty', get_string ( 'course_faculty', 'local_metadata' ), $faculty_list);
     $mform->addElement('filepicker', 'temp_categories', get_string('file'), null, array('maxbytes' => 0, 'accepted_types' => '.csv'));
     $mform->addElement('submit', 'submit_category', get_string('submit_category', 'local_metadata'));
 }
 /**
  * Add form elements for upload a file for program objective.
  * @param object $mform		form definition
  * @return void
  */
 private function setup_upload_program_obj($mform)
 {
     $mform->addElement('header', 'program_obj_header', get_string('program_obj_header', 'local_metadata'));
     // Text box to add new program specific learning objectives
     $mform->addElement('text', 'new_group', get_string('new_group', 'local_metadata'), '');
     //$mform->addRule('new_group', get_string('err_required', 'local_metadata'), 'required', null, 'client');
     $mform->setType('new_group', PARAM_RAW);
     $mform->addHelpButton('program_obj_header', 'program_obj_header', 'local_metadata');
     $mform->addElement('filepicker', 'temp_program_obj', get_string('file'), null, array('maxbytes' => 0, 'accepted_types' => '.csv'));
     $mform->addElement('submit', 'upload_program_obj', get_string('upload_program_obj', 'local_metadata'));
 }
 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 protected function definition_inner($mform)
 {
     $mform->addElement('select', 'correctanswer', get_string('correctanswer', 'qtype_truefalse'), array(0 => get_string('false', 'qtype_truefalse'), 1 => get_string('true', 'qtype_truefalse')));
     $mform->addElement('editor', 'feedbacktrue', get_string('feedbacktrue', 'qtype_truefalse'), null, $this->editoroptions);
     $mform->setType('feedbacktrue', PARAM_RAW);
     $mform->addElement('editor', 'feedbackfalse', get_string('feedbackfalse', 'qtype_truefalse'), null, $this->editoroptions);
     $mform->setType('feedbackfalse', PARAM_RAW);
     $mform->addElement('header', 'multitriesheader', get_string('settingsformultipletries', 'question'));
     $mform->addElement('hidden', 'penalty', 1);
     $mform->addElement('static', 'penaltymessage', get_string('penaltyforeachincorrecttry', 'question'), 1);
     $mform->addHelpButton('penaltymessage', 'penaltyforeachincorrecttry', 'question');
 }
Beispiel #14
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $objs = array();
     $objs[] =& $mform->createElement('select', $this->_uniqueid . '_op', null, $this->getOperators());
     $objs[] =& $mform->createElement('text', $this->_uniqueid, null);
     $grp =& $mform->addElement('group', $this->_uniqueid . '_grp', $this->_label, $objs, '', false);
     $mform->setType($this->_uniqueid, PARAM_RAW);
     $mform->addHelpButton($this->_uniqueid . '_grp', $this->_filterhelp[0], $this->_filterhelp[2]);
     // TBV
     $mform->disabledIf($this->_uniqueid, $this->_uniqueid . '_op', 'eq', 5);
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid . '_grp');
     }
 }
Beispiel #15
0
    /**
     * Add question-type specific form fields.
     *
     * @param object $mform the form being built.
     */
    protected function definition_inner($mform) {
        $mform->addElement('advcheckbox', 'shuffleanswers',
                get_string('shuffle', 'qtype_match'), null, null, array(0, 1));
        $mform->addHelpButton('shuffleanswers', 'shuffle', 'qtype_match');
        $mform->setDefault('shuffleanswers', 1);

        $mform->addElement('static', 'answersinstruct',
                get_string('availablechoices', 'qtype_match'),
                get_string('filloutthreeqsandtwoas', 'qtype_match'));
        $mform->closeHeaderBefore('answersinstruct');

        $this->add_per_answer_fields($mform, get_string('questionno', 'question', '{no}'), 0);

        $this->add_combined_feedback_fields(true);
        $this->add_interactive_settings(true, true);
    }
Beispiel #16
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $objs = array();
     $objs[] =& $mform->createElement('select', $this->_uniqueid . '_op', null, $this->get_operators());
     $objs[] =& $mform->createElement('select', $this->_uniqueid, null, $this->_options);
     $grp =& $mform->addElement('group', $this->_uniqueid . '_grp', $this->_label, $objs, '', false);
     $mform->addHelpButton($this->_uniqueid . '_grp', $this->_filterhelp[0], $this->_filterhelp[2]);
     // TBV
     $mform->disabledIf($this->_uniqueid, $this->_uniqueid . '_op', 'eq', 0);
     if (!is_null($this->_default)) {
         $mform->setDefault($this->_uniqueid, $this->_default);
     }
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid . '_grp');
     }
 }
Beispiel #17
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  * @uses  $PAGE
  */
 function setupForm(&$mform)
 {
     global $PAGE;
     $options_array = $this->get_main_options();
     $fullpath = $this->_report_path . $this->_filename;
     $parent = $this->_uniqueid . '_parent';
     $PAGE->requires->yui_module('moodle-local_eliscore-dependentselect', 'M.local_eliscore.init_dependentselect', array($parent, $this->_uniqueid, $fullpath));
     $objs = array();
     $objs[] =& $mform->createElement('select', $this->_uniqueid . '_parent', null, $options_array);
     $objs[] =& $mform->createElement('select', $this->_uniqueid, null, $this->_options);
     $grp =& $mform->addElement('group', $this->_uniqueid . '_grp', $this->_label, $objs, '<br/>', false);
     $mform->addHelpButton($this->_uniqueid . '_grp', $this->_filterhelp[0], $this->_filterhelp[2]);
     // TBV
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid . '_grp');
     }
 }
 /**
  * Add question-type specific form fields.
  *
  * @param object $mform the form being built.
  */
 protected function definition_inner($mform)
 {
     $mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffleanswers', 'qtype_multichoice'), null, null, array(0, 1));
     $mform->addHelpButton('shuffleanswers', 'shuffleanswers', 'qtype_multichoice');
     $mform->setDefault('shuffleanswers', 1);
     $mform->addElement('select', 'answernumbering', get_string('answernumbering', 'qtype_multichoice'), qtype_multichoice::get_numbering_styles());
     $mform->setDefault('answernumbering', 'abc');
     $this->add_per_answer_fields($mform, get_string('choiceno', 'qtype_multichoice', '{no}'), null, max(5, QUESTION_NUMANS_START));
     $mform->addElement('header', 'overallfeedbackhdr', get_string('combinedfeedback', 'question'));
     foreach (array('correctfeedback', 'incorrectfeedback') as $feedbackname) {
         $element = $mform->addElement('editor', $feedbackname, get_string($feedbackname, 'question'), array('rows' => 5), $this->editoroptions);
         $mform->setType($feedbackname, PARAM_RAW);
         $element->setValue(array('text' => get_string($feedbackname . 'default', 'question')));
         if ($feedbackname == 'incorrectfeedback') {
             $mform->addElement('advcheckbox', 'shownumcorrect', get_string('options', 'question'), get_string('shownumpartscorrect', 'question'));
         }
     }
     $this->add_interactive_settings(true, true);
 }
 /**
  *  Add a checkbox for every header that this form will allow to be excluded in the general tab
  *
  * @param object $mform Form that will be added to
  */
 private function setup_header_items($mform)
 {
     $mform->addElement('checkbox', 'Course_Description', get_string('exclude_Course_Description', 'local_metadata'));
     $mform->addHelpButton('Course_Description', 'exclude_Course_Description', 'local_metadata');
     $mform->addElement('checkbox', 'Course_Readings', get_string('exclude_Course_Readings', 'local_metadata'));
     $mform->addHelpButton('Course_Readings', 'exclude_Course_Readings', 'local_metadata');
     $mform->addElement('checkbox', 'Course_Objectives', get_string('exclude_Course_Objectives', 'local_metadata'));
     $mform->addHelpButton('Course_Objectives', 'exclude_Course_Objectives', 'local_metadata');
     $mform->addElement('checkbox', 'Grading', get_string('exclude_Grading', 'local_metadata'));
     $mform->addHelpButton('Grading', 'exclude_Grading', 'local_metadata');
     $mform->addElement('checkbox', 'Course_Sessions', get_string('exclude_Course_Sessions', 'local_metadata'));
     $mform->addHelpButton('Course_Sessions', 'exclude_Course_Sessions', 'local_metadata');
     $mform->addElement('checkbox', 'Policy', get_string('exclude_Policy', 'local_metadata'));
     $mform->addHelpButton('Policy', 'exclude_Policy', 'local_metadata');
 }
 /**
  * add_field_showactivitygrades
  *
  * @param object  $mform
  * @param string  $plugin
  * @param array   $types
  * @return void, but will update $mform
  */
 protected function add_field_showactivitygrades($mform, $plugin, $types)
 {
     $name = 'showactivitygrades';
     $config_name = 'config_' . $name;
     $elements_name = 'elements_' . $name;
     $label = get_string($name, $plugin);
     $elements = array();
     // "all" or "specific" activity types
     $options = array('' => get_string('none'), 'all' => get_string('allgradeableactivities', $plugin), 'specific' => get_string('specificactivitytypes', $plugin));
     $elements[] = $mform->createElement('select', $config_name, '', $options);
     // multi-select list of activity types
     $params = array('multiple' => 'multiple', 'size' => min(5, count($types)));
     $elements[] = $mform->createElement('select', $config_name . 'types', '', $types, $params);
     // add group of elements
     $mform->addElement('group', $elements_name, $label, $elements, ' ', false);
     $mform->addHelpButton($elements_name, $name, $plugin);
     // set elements types
     $mform->setType($config_name, PARAM_ALPHA);
     $mform->setType($config_name . 'types', PARAM_ALPHANUM);
     // set elements defaults
     $mform->setDefault($config_name, $this->defaultvalue($name));
     $mform->setDefault($config_name . 'types', $this->defaultvalue($name . 'types'));
     // specify conditional access to list of activity types
     $mform->disabledIf($config_name . 'types[]', $config_name, 'ne', 'specific');
 }
Beispiel #21
0
/**
 * Abstracted version of mod_form help_icon to work with Moodle 1.8 through 2.0
 *
 * @param string $element The form element to apply help icon to
 * @param string $string The language string to use
 * @param string $module Which module is the page defined in
 * @param object $mform The mod_form object
 */
function turnitintool_modform_help_icon($element, $string, $module, $mform)
{
    if (is_callable(array($mform, 'addHelpButton'))) {
        $mform->addHelpButton($element, $string, $module);
    } else {
        $mform->setHelpButton($element, array($string, get_string($string, $module), $module));
    }
}
/**
 * adds the list of plagiarism settings to a form.
 *
 * @param object $mform - Moodle form object
 * @oaram boolean $defaults - if this is being loaded from defaults form or from inside a mod.
 */
function compilatio_get_form_elements($mform, $defaults = false)
{
    $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
    $tiioptions = array(0 => get_string("never"), 1 => get_string("always"), 2 => get_string("showwhenclosed", "plagiarism_compilatio"));
    $compilatiodraftoptions = array(PLAGIARISM_COMPILATIO_DRAFTSUBMIT_IMMEDIATE => get_string("submitondraft", "plagiarism_compilatio"), PLAGIARISM_COMPILATIO_DRAFTSUBMIT_FINAL => get_string("submitonfinal", "plagiarism_compilatio"));
    $mform->addElement('header', 'plagiarismdesc', get_string('compilatio', 'plagiarism_compilatio'));
    $mform->addElement('select', 'use_compilatio', get_string("usecompilatio", "plagiarism_compilatio"), $ynoptions);
    $analysistypes = array(COMPILATIO_ANALYSISTYPE_AUTO => get_string('analysistypeauto', 'plagiarism_compilatio'), COMPILATIO_ANALYSISTYPE_MANUAL => get_string('analysistypemanual', 'plagiarism_compilatio'), COMPILATIO_ANALYSISTYPE_PROG => get_string('analysistypeprog', 'plagiarism_compilatio'));
    $mform->addElement('select', 'compilatio_analysistype', get_string('analysistype', 'plagiarism_compilatio'), $analysistypes);
    $mform->addHelpButton('compilatio_analysistype', 'analysistype', 'plagiarism_compilatio');
    $mform->setDefault('compilatio_analysistype', COMPILATIO_ANALYSISTYPE_AUTO);
    if (!$defaults) {
        // Only show this inside a module page - not on default settings pages.
        $mform->addElement('date_time_selector', 'compilatio_timeanalyse', get_string('analysisdate', 'plagiarism_compilatio'), array('optional' => false));
        $mform->setDefault('compilatio_timeanalyse', time() + 7 * 24 * 3600);
        $mform->disabledif('compilatio_timeanalyse', 'compilatio_analysistype', 'noteq', COMPILATIO_ANALYSISTYPE_PROG);
    }
    $mform->addElement('select', 'compilatio_show_student_score', get_string("compilatio_show_student_score", "plagiarism_compilatio"), $tiioptions);
    $mform->addHelpButton('compilatio_show_student_score', 'compilatio_show_student_score', 'plagiarism_compilatio');
    $mform->addElement('select', 'compilatio_show_student_report', get_string("compilatio_show_student_report", "plagiarism_compilatio"), $tiioptions);
    $mform->addHelpButton('compilatio_show_student_report', 'compilatio_show_student_report', 'plagiarism_compilatio');
    if ($mform->elementExists('var4') || $mform->elementExists('submissiondrafts')) {
        $mform->addElement('select', 'compilatio_draft_submit', get_string("compilatio_draft_submit", "plagiarism_compilatio"), $compilatiodraftoptions);
    }
    $mform->addElement('select', 'compilatio_studentemail', get_string("compilatio_studentemail", "plagiarism_compilatio"), $ynoptions);
    $mform->addHelpButton('compilatio_studentemail', 'compilatio_studentemail', 'plagiarism_compilatio');
}
Beispiel #23
0
    /**
     * Add the input areas for each unit.
     * @param object $mform the form being built.
     */
    protected function add_unit_fields($mform) {
        $repeated = array(
            $mform->createElement('header', 'unithdr',
                    get_string('unithdr', 'qtype_numerical', '{no}')),
            $mform->createElement('text', 'unit', get_string('unit', 'quiz')),
            $mform->createElement('text', 'multiplier', get_string('multiplier', 'quiz')),
        );

        $repeatedoptions['unit']['type'] = PARAM_NOTAGS;
        $repeatedoptions['multiplier']['type'] = PARAM_NUMBER;
        $repeatedoptions['unit']['disabledif'] =
                array('unitrole', 'eq', qtype_numerical::UNITNONE);
        $repeatedoptions['multiplier']['disabledif'] =
                array('unitrole', 'eq', qtype_numerical::UNITNONE);

        if (isset($this->question->options->units)) {
            $countunits = count($this->question->options->units);
        } else {
            $countunits = 0;
        }
        if ($this->question->formoptions->repeatelements) {
            $repeatsatstart = $countunits + 1;
        } else {
            $repeatsatstart = $countunits;
        }
        $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'nounits',
                'addunits', 2, get_string('addmoreunitblanks', 'qtype_calculated', '{no}'));

        if ($mform->elementExists('multiplier[0]')) {
            $firstunit = $mform->getElement('multiplier[0]');
            $firstunit->freeze();
            $firstunit->setValue('1.0');
            $firstunit->setPersistantFreeze(true);
            $mform->addHelpButton('multiplier[0]', 'numericalmultiplier', 'qtype_numerical');
        }
    }
/**
 * Adds the list of plagiarism settings to a form.
 *
 * @param object $mform - Moodle form object.
 */
function urkund_get_form_elements($mform)
{
    $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
    $tiioptions = array(0 => get_string("never"), 1 => get_string("always"), 2 => get_string("showwhenclosed", "plagiarism_urkund"));
    $urkunddraftoptions = array(PLAGIARISM_URKUND_DRAFTSUBMIT_IMMEDIATE => get_string("submitondraft", "plagiarism_urkund"), PLAGIARISM_URKUND_DRAFTSUBMIT_FINAL => get_string("submitonfinal", "plagiarism_urkund"));
    $mform->addElement('header', 'plagiarismdesc', get_string('urkund', 'plagiarism_urkund'));
    $mform->addElement('select', 'use_urkund', get_string("useurkund", "plagiarism_urkund"), $ynoptions);
    $mform->addElement('text', 'urkund_receiver', get_string("urkund_receiver", "plagiarism_urkund"), array('size' => 40));
    $mform->addHelpButton('urkund_receiver', 'urkund_receiver', 'plagiarism_urkund');
    $mform->setType('urkund_receiver', PARAM_TEXT);
    $mform->addElement('select', 'urkund_show_student_score', get_string("urkund_show_student_score", "plagiarism_urkund"), $tiioptions);
    $mform->addHelpButton('urkund_show_student_score', 'urkund_show_student_score', 'plagiarism_urkund');
    $mform->addElement('select', 'urkund_show_student_report', get_string("urkund_show_student_report", "plagiarism_urkund"), $tiioptions);
    $mform->addHelpButton('urkund_show_student_report', 'urkund_show_student_report', 'plagiarism_urkund');
    if ($mform->elementExists('submissiondrafts')) {
        $mform->addElement('select', 'urkund_draft_submit', get_string("urkund_draft_submit", "plagiarism_urkund"), $urkunddraftoptions);
    }
    $mform->addElement('select', 'urkund_studentemail', get_string("urkund_studentemail", "plagiarism_urkund"), $ynoptions);
    $mform->addHelpButton('urkund_studentemail', 'urkund_studentemail', 'plagiarism_urkund');
    $filetypes = urkund_default_allowed_file_types(true);
    $supportedfiles = array();
    foreach ($filetypes as $ext => $mime) {
        $supportedfiles[$ext] = $ext;
    }
    $mform->addElement('select', 'urkund_allowallfile', get_string('allowallsupportedfiles', 'plagiarism_urkund'), $ynoptions);
    $mform->addHelpButton('urkund_allowallfile', 'allowallsupportedfiles', 'plagiarism_urkund');
    $mform->addElement('select', 'urkund_selectfiletypes', get_string('restrictfiles', 'plagiarism_urkund'), $supportedfiles, array('multiple' => true));
    $contentoptions = array(PLAGIARISM_URKUND_RESTRICTCONTENTNO => get_string('restrictcontentno', 'plagiarism_urkund'), PLAGIARISM_URKUND_RESTRICTCONTENTFILES => get_string('restrictcontentfiles', 'plagiarism_urkund'), PLAGIARISM_URKUND_RESTRICTCONTENTTEXT => get_string('restrictcontenttext', 'plagiarism_urkund'));
    $mform->addElement('select', 'urkund_restrictcontent', get_string('restrictcontent', 'plagiarism_urkund'), $contentoptions);
    $mform->addHelpButton('urkund_restrictcontent', 'restrictcontent', 'plagiarism_urkund');
}
Beispiel #25
0
 /**
  * Adds controls specific to this filter in the form.
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $objs = array();
     $options = array('optional' => false);
     if (!empty($this->_timezone)) {
         $options['timezone'] = $this->_timezone;
     }
     if (!empty($this->_startyear)) {
         $options['startyear'] = $this->_startyear;
     }
     if (!empty($this->_stopyear)) {
         $options['stopyear'] = $this->_stopyear;
     }
     $date_elem = $this->_inctime ? 'date_time_selector' : 'date_selector';
     $objs[] =& $mform->createElement('advcheckbox', $this->_uniqueid . '_sck', null, get_string('isafter', 'filters'));
     $objs[] =& $mform->createElement($date_elem, $this->_uniqueid . '_sdt', null, $options);
     $objs[] =& $mform->createElement('static', $this->_uniqueid . '_break', null, '<br/>');
     $objs[] =& $mform->createElement('advcheckbox', $this->_uniqueid . '_eck', null, get_string('isbefore', 'filters'));
     $objs[] =& $mform->createElement($date_elem, $this->_uniqueid . '_edt', null, $options);
     if ($this->_never_included) {
         $objs[] =& $mform->createElement('advcheckbox', $this->_uniqueid . '_never', null, get_string('includenever', 'filters'));
     }
     $grp =& $mform->addElement('group', $this->_uniqueid . '_grp', $this->_label, $objs, '', false);
     $mform->addHelpButton($this->_uniqueid . '_grp', $this->_filterhelp[0], $this->_filterhelp[2]);
     // TBV
     if ($this->_advanced) {
         $mform->setAdvanced($this->_uniqueid . '_grp');
     }
     $mform->disabledIf($this->_uniqueid . '_sdt[day]', $this->_uniqueid . '_sck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_sdt[month]', $this->_uniqueid . '_sck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_sdt[year]', $this->_uniqueid . '_sck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_edt[day]', $this->_uniqueid . '_eck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_edt[month]', $this->_uniqueid . '_eck', 'notchecked');
     $mform->disabledIf($this->_uniqueid . '_edt[year]', $this->_uniqueid . '_eck', 'notchecked');
     if ($this->_inctime) {
         $mform->disabledIf($this->_uniqueid . '_sdt[hour]', $this->_uniqueid . '_sck', 'notchecked');
         $mform->disabledIf($this->_uniqueid . '_sdt[minute]', $this->_uniqueid . '_sck', 'notchecked');
         $mform->disabledIf($this->_uniqueid . '_edt[hour]', $this->_uniqueid . '_eck', 'notchecked');
         $mform->disabledIf($this->_uniqueid . '_edt[minute]', $this->_uniqueid . '_eck', 'notchecked');
     }
     if ($this->_never_included) {
         $mform->disabledIf($this->_uniqueid . '_never', $this->_uniqueid . '_eck', '0');
     }
 }
/**
 * adds the list of plagiarism settings to a form
 *
 * @param object $mform - Moodle form object
 */
function turnitin_get_form_elements($mform)
{
    $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
    $tiishowoptions = array(PLAGIARISM_TII_SHOW_NEVER => get_string("never"), PLAGIARISM_TII_SHOW_ALWAYS => get_string("always"), PLAGIARISM_TII_SHOW_CLOSED => get_string("showwhenclosed", "plagiarism_turnitin"));
    $tiidraftoptions = array(PLAGIARISM_TII_DRAFTSUBMIT_IMMEDIATE => get_string("submitondraft", "plagiarism_turnitin"), PLAGIARISM_TII_DRAFTSUBMIT_FINAL => get_string("submitonfinal", "plagiarism_turnitin"));
    $reportgenoptions = array(0 => get_string('reportgenimmediate', 'plagiarism_turnitin'), 1 => get_string('reportgenimmediateoverwrite', 'plagiarism_turnitin'), 2 => get_string('reportgenduedate', 'plagiarism_turnitin'));
    $excludetype = array(0 => get_string('no'), 1 => get_string('wordcount', 'plagiarism_turnitin'), 2 => get_string('percentage', 'plagiarism_turnitin'));
    $mform->addElement('header', 'plagiarismdesc');
    $mform->addElement('select', 'use_turnitin', get_string("useturnitin", "plagiarism_turnitin"), $ynoptions);
    $mform->addElement('select', 'plagiarism_show_student_score', get_string("showstudentsscore", "plagiarism_turnitin"), $tiishowoptions);
    $mform->addHelpButton('plagiarism_show_student_score', 'showstudentsscore', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_show_student_report', get_string("showstudentsreport", "plagiarism_turnitin"), $tiishowoptions);
    $mform->addHelpButton('plagiarism_show_student_report', 'showstudentsreport', 'plagiarism_turnitin');
    if ($mform->elementExists('var4')) {
        $mform->addElement('select', 'plagiarism_draft_submit', get_string("draftsubmit", "plagiarism_turnitin"), $tiidraftoptions);
    }
    $mform->addElement('select', 'plagiarism_compare_student_papers', get_string("comparestudents", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_compare_student_papers', 'comparestudents', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_compare_internet', get_string("compareinternet", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_compare_internet', 'compareinternet', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_compare_journals', get_string("comparejournals", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_compare_journals', 'comparejournals', 'plagiarism_turnitin');
    if (get_config('plagiarism', 'turnitin_institutionnode')) {
        $mform->addElement('select', 'plagiarism_compare_institution', get_string("compareinstitution", "plagiarism_turnitin"), $ynoptions);
        $mform->addHelpButton('plagiarism_compare_institution', 'compareinstitution', 'plagiarism_turnitin');
    }
    $mform->addElement('select', 'plagiarism_report_gen', get_string("reportgen", "plagiarism_turnitin"), $reportgenoptions);
    $mform->addHelpButton('plagiarism_report_gen', 'reportgen', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_exclude_biblio', get_string("excludebiblio", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_exclude_biblio', 'excludebiblio', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_exclude_quoted', get_string("excludequoted", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_exclude_quoted', 'excludequoted', 'plagiarism_turnitin');
    $mform->addElement('select', 'plagiarism_exclude_matches', get_string("excludematches", "plagiarism_turnitin"), $excludetype);
    $mform->addHelpButton('plagiarism_exclude_matches', 'excludematches', 'plagiarism_turnitin');
    $mform->addElement('text', 'plagiarism_exclude_matches_value', '');
    $mform->addRule('plagiarism_exclude_matches_value', null, 'numeric', null, 'client');
    $mform->disabledIf('plagiarism_exclude_matches_value', 'plagiarism_exclude_matches', 'eq', 0);
    $mform->addElement('select', 'plagiarism_anonymity', get_string("anonymity", "plagiarism_turnitin"), $ynoptions);
    $mform->addHelpButton('plagiarism_anonymity', 'anonymity', 'plagiarism_turnitin');
}
Beispiel #27
0
 /**
  * Add the tag collection selector
  *
  * @param object $mform the form being built.
  */
 protected function add_collection_selector($mform)
 {
     $tagcolls = core_tag_collection::get_collections_menu(false, false, get_string('anycollection', 'block_tags'));
     if (count($tagcolls) <= 1) {
         return;
     }
     $tagcollssearchable = core_tag_collection::get_collections_menu(false, true);
     $hasunsearchable = false;
     foreach ($tagcolls as $id => $name) {
         if ($id && !array_key_exists($id, $tagcollssearchable)) {
             $hasunsearchable = true;
             $tagcolls[$id] = $name . '*';
         }
     }
     $mform->addElement('select', 'config_tagcoll', get_string('tagcollection', 'block_tags'), $tagcolls);
     if ($hasunsearchable) {
         $mform->addHelpButton('config_tagcoll', 'tagcollection', 'block_tags');
     }
     $mform->setDefault('config_tagcoll', 0);
 }
Beispiel #28
0
 /**
  * Adds controls specific to this filter in the form.
  *
  * @param object $mform a MoodleForm object to setup
  */
 function setupForm(&$mform)
 {
     $mform->addElement('textarea', $this->_uniqueid, $this->_label, array('cols' => $this->_columns, 'rows' => $this->_rows));
     $mform->addHelpButton($this->_uniqueid, $this->_filterhelp[0], $this->_filterhelp[2]);
     // TBV
 }
 /**
  * hook to add plagiarism specific settings to a module settings page
  * @param object $mform  - Moodle form
  * @param object $context - current context
  */
 public function get_form_elements_module($mform, $context, $modulename = '')
 {
     global $CFG, $DB;
     $plagiarismsettings = $this->get_settings();
     if (!$plagiarismsettings) {
         return;
     }
     $cmid = optional_param('update', 0, PARAM_INT);
     if (!empty($cmid)) {
         $plagiarismvalues = $DB->get_records_menu('plagiarism_vericite_config', array('cm' => $cmid), '', 'name,value');
     }
     $plagiarismelements = $this->config_options();
     //add form:
     $mform->addElement('header', 'plagiarismdesc', get_string('pluginname', 'plagiarism_vericite'));
     $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
     $mform->addElement('checkbox', 'use_vericite', get_string("usevericite", "plagiarism_vericite"));
     if (isset($plagiarismvalues['use_vericite'])) {
         $mform->setDefault('use_vericite', $plagiarismvalues['use_vericite']);
     } else {
         if (strcmp("mod_forum", $modulename) != 0 && isset($plagiarismsettings['vericite_use_default'])) {
             $mform->setDefault('use_vericite', $plagiarismsettings['vericite_use_default']);
         }
     }
     $mform->addElement('checkbox', 'plagiarism_show_student_score', get_string("studentscorevericite", "plagiarism_vericite"));
     $mform->addHelpButton('plagiarism_show_student_score', 'studentscorevericite', 'plagiarism_vericite');
     $mform->disabledIf('plagiarism_show_student_score', 'use_vericite');
     if (isset($plagiarismvalues['plagiarism_show_student_score'])) {
         $mform->setDefault('plagiarism_show_student_score', $plagiarismvalues['plagiarism_show_student_score']);
     } else {
         if (strcmp("mod_forum", $modulename) != 0 && isset($plagiarismsettings['vericite_student_score_default'])) {
             $mform->setDefault('plagiarism_show_student_score', $plagiarismsettings['vericite_student_score_default']);
         } else {
             if (strcmp("mod_forum", $modulename) == 0 && isset($plagiarismsettings['vericite_student_score_default_forums'])) {
                 $mform->setDefault('plagiarism_show_student_score', $plagiarismsettings['vericite_student_score_default_forums']);
             }
         }
     }
     $mform->addElement('checkbox', 'plagiarism_show_student_report', get_string("studentreportvericite", "plagiarism_vericite"));
     $mform->addHelpButton('plagiarism_show_student_report', 'studentreportvericite', 'plagiarism_vericite');
     $mform->disabledIf('plagiarism_show_student_report', 'use_vericite');
     if (isset($plagiarismvalues['plagiarism_show_student_report'])) {
         $mform->setDefault('plagiarism_show_student_report', $plagiarismvalues['plagiarism_show_student_report']);
     } else {
         if (strcmp("mod_forum", $modulename) != 0 && isset($plagiarismsettings['vericite_student_score_default'])) {
             $mform->setDefault('plagiarism_show_student_report', $plagiarismsettings['vericite_student_report_default']);
         } else {
             if (strcmp("mod_forum", $modulename) == 0 && isset($plagiarismsettings['vericite_student_score_default_forums'])) {
                 $mform->setDefault('plagiarism_show_student_report', $plagiarismsettings['vericite_student_report_default_forums']);
             }
         }
     }
 }
Beispiel #30
0
    /**
     * Adds controls specific to this filter in the form.
     * @param object $mform a MoodleForm object to setup
     * @uses  $CFG
     * @uses  $OUTPUT
     * @uses  $PAGE
     * @uses  $USER
     */
    function setupForm(&$mform)
    {
        global $CFG, $OUTPUT, $PAGE, $USER;
        // Javascript for cluster dropdown onchange event
        $cluster_group_separator = '------------------------------';
        $js = '
<script type="text/javascript">
//<![CDATA[
    function dropdown_separator(selectelem) {
        /* alert("dropdown_separator(" + selectelem.selectedIndex + ")"); */
        if (selectelem.options[selectelem.selectedIndex].value < 0) {
            return 0;
        }
        return selectelem.selectedIndex;
    }
//]]>
</script>
';
        /**
         * CSS includes
         */
        $mform->addElement('html', '<style>@import url("' . $CFG->wwwroot . '/lib/yui/2.9.0/build/treeview/assets/skins/sam/treeview-skin.css");</style>' . $js);
        /**
         * Get set up necessary CSS classes
         */
        $manageclusters_css_class = block_elisadmin_get_item_css_class('manageclusters');
        $cluster_css_class = block_elisadmin_get_item_css_class('cluster_instance');
        //figure out which capability to check
        if ($this->execution_mode == php_report::EXECUTION_MODE_SCHEDULED) {
            $capability = 'local/elisreports:schedule';
        } else {
            $capability = 'local/elisreports:view';
        }
        $context_result = pm_context_set::for_user_with_capability('cluster', $capability, $USER->id);
        /**
         * TreeView-related work
         */
        //CM entities for placement at the top of the menu
        $cm_entity_pages = array();
        $cm_entity_pages[] = new menuitem('root');
        if ($clusters = cluster_get_listing('priority, name', 'ASC', 0, 0, '', '', array('parent' => 0))) {
            foreach ($clusters as $cluster) {
                $params = array('id' => $cluster->id, 'action' => 'viewreport', 'execution_mode' => $this->execution_mode);
                $cluster_count = cluster_count_records('', '', array('parent' => $cluster->id));
                $isLeaf = empty($cluster_count);
                $cm_entity_pages[] = test_cluster_tree_get_menu_item('cluster', $cluster, 'root', $manageclusters_css_class, $cluster->id, 0, $params, $isLeaf);
            }
        }
        $menuitemlisting = new menuitemlisting($cm_entity_pages);
        $tree = new checkbox_treerepresentation($menuitemlisting, $this->options['report_id']);
        /**
         * UI element setup
         */
        require_once $CFG->dirroot . '/local/eliscore/lib/filtering/equalityselect.php';
        $choices_array = array(0 => get_string('anyvalue', 'filters'));
        //set up cluster listing
        if ($records = $this->cluster_dropdown_get_listing($context_result)) {
            foreach ($records as $record) {
                if (empty($choices_array[$record->id])) {
                    if (count($choices_array) > 1) {
                        $choices_array[-$record->id] = $cluster_group_separator;
                    }
                    $ancestors = $record->depth - 1;
                    // shorten really long cluster names
                    $name = strlen($record->name) > 100 ? substr($record->name, 0, 100) . '...' : $record->name;
                    $choices_array[$record->id] = $ancestors ? str_repeat('- ', $ancestors) . $name : $name;
                    //merge in child clusters
                    $child_array = $this->find_child_clusters($records, $record->id, $ancestors);
                    $choices_array = $this->merge_array_keep_keys($choices_array, $child_array);
                }
            }
        }
        //get help text
        if (isset($this->options['help'])) {
            $this->_filterhelp = $this->options['help'];
        } else {
            $this->_filterhelp = null;
        }
        //add filterhelp and label to this filter
        //import required css for the fieldset
        $style = '<style>@import url("' . $CFG->wwwroot . '/local/elisprogram/styles.css");</style>';
        $helplink = '';
        $nested_fieldset = '';
        $title = '';
        if ($this->options['fieldset']) {
            $nested_fieldset = '<fieldset class="nested clearfix" id="' . $this->_uniqueid . "_label\">\n";
        } else {
            $title = $this->_label . $helplink . '&nbsp;';
        }
        $legend = '<legend class="ftoggler">' . $this->_label . "</legend>\n";
        $mform->addElement('html', $style . $nested_fieldset . $legend);
        $mform->addElement('static', $this->_uniqueid . '_help', '');
        // cluster select dropdown
        $selectparams = array('onchange' => 'this.selectedIndex = dropdown_separator(this);');
        $mform->addElement('select', $this->_uniqueid . '_dropdown', $title, $choices_array, $selectparams);
        //dropdown / cluster tree state storage
        $mform->addElement('hidden', $this->_uniqueid . '_usingdropdown');
        $mform->setType($this->_uniqueid . '_usingdropdown', PARAM_BOOL);
        // Must use addHelpButton() to NOT open help link on page, but in popup!
        $mform->addHelpButton($this->_uniqueid . '_dropdown', $this->_filterhelp[0], $this->_filterhelp[2]);
        // TBV
        //default to showing dropdown if nothing has been persisted
        $report_shortname = $this->options['report_shortname'];
        $preferences = php_report_filtering_get_user_preferences($report_shortname);
        if (!isset($preferences["php_report_{$report_shortname}/{$this->_uniqueid}_usingdropdown"])) {
            $mform->setDefault($this->_uniqueid . '_usingdropdown', 1);
        }
        $initclustertreeopts = array($CFG->httpswwwroot, $tree->instanceid, $this->_uniqueid, $tree->get_js_object(), $this->execution_mode, $this->options['report_id'], $this->options['dropdown_button_text'], $this->options['tree_button_text']);
        $PAGE->requires->yui_module('moodle-local_elisprogram-clustertree', 'M.local_elisprogram.init_clustertree', $initclustertreeopts, null, true);
        // cluster tree
        $clustertreehtml = '<div class="fitem"><div class="fitemtitle"></div>' . '<style>@import url("' . $CFG->wwwroot . '/lib/yui/2.9.0/build/treeview/assets/skins/sam/treeview.css");</style>' . '<div id="cluster_param_tree_' . $tree->instanceid . '_' . $this->_uniqueid . '" class="ygtv-checkbox felement"></div>' . '</div>';
        $mform->addElement('html', $clustertreehtml);
        //list of explicitly selected elements
        $mform->addElement('hidden', $this->_uniqueid . '_listing');
        $mform->setType($this->_uniqueid . '_listing', PARAM_TEXT);
        //list of selected and unexpanded elements
        $mform->addElement('hidden', $this->_uniqueid . '_unexpanded');
        $mform->setType($this->_uniqueid . '_unexpanded', PARAM_TEXT);
        //list of explicitly unselected elements
        $mform->addElement('hidden', $this->_uniqueid . '_clrunexpanded');
        $mform->setType($this->_uniqueid . '_clrunexpanded', PARAM_TEXT);
        $mform->addElement('button', $this->_uniqueid . '_toggle', '');
        // close hacked nested fieldset
        if ($this->options['fieldset']) {
            $mform->addElement('html', '</fieldset>');
        }
    }