/**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $menu = array(get_string('caseno', 'quiz'), get_string('caseyes', 'quiz'));
     $mform->addElement('select', 'usecase', get_string('casesensitive', 'quiz'), $menu);
     $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'quiz'), get_string('filloutoneanswer', 'quiz'));
     $mform->closeHeaderBefore('answersinstruct');
     $creategrades = get_grade_options();
     $gradeoptions = $creategrades->gradeoptions;
     $repeated = array();
     $repeated[] =& $mform->createElement('header', 'answerhdr', get_string('answerno', 'qtype_shortanswer', '{no}'));
     $repeated[] =& $mform->createElement('text', 'answer', get_string('answer', 'quiz'), array('size' => 54));
     $repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions);
     $repeated[] =& $mform->createElement('htmleditor', 'feedback', get_string('feedback', 'quiz'), array('course' => $this->coursefilesid));
     if (isset($this->question->options)) {
         $countanswers = count($this->question->options->answers);
     } else {
         $countanswers = 0;
     }
     if ($this->question->formoptions->repeatelements) {
         $repeatsatstart = QUESTION_NUMANS_START > $countanswers + QUESTION_NUMANS_ADD ? QUESTION_NUMANS_START : $countanswers + QUESTION_NUMANS_ADD;
     } else {
         $repeatsatstart = $countanswers;
     }
     $repeatedoptions = array();
     $mform->setType('answer', PARAM_RAW);
     $repeatedoptions['fraction']['default'] = 0;
     $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', QUESTION_NUMANS_ADD, get_string('addmoreanswerblanks', 'qtype_shortanswer'));
 }
 /**
  * @param MoodleQuickForm $mform
  */
 protected function specific_definition(MoodleQuickForm $mform)
 {
     $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
     $options = ['tree' => get_string('config_type_tree', 'block_activity_tree'), 'prev_next' => get_string('config_type_prev_next', 'block_activity_tree')];
     $mform->addElement('select', 'config_type', get_string('config_type', 'block_activity_tree'), $options);
     $mform->setDefault('config_type', 'tree');
 }
Пример #3
0
 public function add_preflight_check_form_fields(mod_quiz_preflight_check_form $quizform, MoodleQuickForm $mform, $attemptid)
 {
     $mform->addElement('header', 'passwordheader', get_string('password'));
     $mform->addElement('static', 'passwordmessage', '', get_string('requirepasswordmessage', 'quizaccess_password'));
     // Don't use the 'proper' field name of 'password' since that get's
     // Firefox's password auto-complete over-excited.
     $mform->addElement('password', 'quizpassword', get_string('quizpassword', 'quizaccess_password'), array('autofocus' => 'true'));
 }
Пример #4
0
 protected function other_preference_fields(MoodleQuickForm $mform) {
     if (quiz_has_grades($this->_customdata['quiz'])) {
         $mform->addElement('selectyesno', 'slotmarks',
                 get_string('showdetailedmarks', 'quiz_overview'));
     } else {
         $mform->addElement('hidden', 'slotmarks', 0);
     }
 }
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     global $QTYPES;
     $this->qtypeobj =& $QTYPES[$this->qtype()];
     $label = get_string("sharedwildcards", "qtype_datasetdependent");
     $mform->addElement('hidden', 'initialcategory', 1);
     $html2 = $this->qtypeobj->print_dataset_definitions_category($this->question);
     $mform->insertElementBefore($mform->createElement('static', 'listcategory', $label, $html2), 'name');
     $addfieldsname = 'updatecategory';
     $addstring = get_string("updatecategory", "qtype_calculated");
     $mform->registerNoSubmitButton($addfieldsname);
     $mform->insertElementBefore($mform->createElement('submit', $addfieldsname, $addstring), 'listcategory');
     $repeated = array();
     $repeated[] =& $mform->createElement('header', 'answerhdr', get_string('answerhdr', 'qtype_calculated', '{no}'));
     $repeated[] =& $mform->createElement('text', 'answers', get_string('correctanswerformula', 'quiz') . '=', array('size' => 50));
     $repeatedoptions['answers']['type'] = PARAM_NOTAGS;
     $creategrades = get_grade_options();
     $gradeoptions = $creategrades->gradeoptions;
     $repeated[] =& $mform->createElement('select', 'fraction', get_string('grade'), $gradeoptions);
     $repeatedoptions['fraction']['default'] = 0;
     $repeated[] =& $mform->createElement('text', 'tolerance', get_string('tolerance', 'qtype_calculated'));
     $repeatedoptions['tolerance']['type'] = PARAM_NUMBER;
     $repeatedoptions['tolerance']['default'] = 0.01;
     $repeated[] =& $mform->createElement('select', 'tolerancetype', get_string('tolerancetype', 'quiz'), $this->qtypeobj->tolerance_types());
     $repeated[] =& $mform->createElement('select', 'correctanswerlength', get_string('correctanswershows', 'qtype_calculated'), range(0, 9));
     $repeatedoptions['correctanswerlength']['default'] = 2;
     $answerlengthformats = array('1' => get_string('decimalformat', 'quiz'), '2' => get_string('significantfiguresformat', 'quiz'));
     $repeated[] =& $mform->createElement('select', 'correctanswerformat', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats);
     $repeated[] =& $mform->createElement('htmleditor', 'feedback', get_string('feedback', 'quiz'));
     $repeatedoptions['feedback']['type'] = PARAM_RAW;
     if (isset($this->question->options)) {
         $count = count($this->question->options->answers);
     } else {
         $count = 0;
     }
     $repeatsatstart = $count + 1;
     $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'noanswers', 'addanswers', 1, get_string('addmoreanswerblanks', 'qtype_calculated'));
     $repeated = array();
     $repeated[] =& $mform->createElement('header', 'unithdr', get_string('unithdr', 'qtype_numerical', '{no}'));
     $repeated[] =& $mform->createElement('text', 'unit', get_string('unit', 'quiz'));
     $mform->setType('unit', PARAM_NOTAGS);
     $repeated[] =& $mform->createElement('text', 'multiplier', get_string('multiplier', 'quiz'));
     $mform->setType('multiplier', PARAM_NUMBER);
     if (isset($this->question->options)) {
         $countunits = count($this->question->options->units);
     } else {
         $countunits = 0;
     }
     $repeatsatstart = $countunits + 1;
     $this->repeat_elements($repeated, $repeatsatstart, array(), 'nounits', 'addunits', 2, get_string('addmoreunitblanks', 'qtype_calculated', '{no}'));
     $firstunit =& $mform->getElement('multiplier[0]');
     $firstunit->freeze();
     $firstunit->setValue('1.0');
     $firstunit->setPersistantFreeze(true);
     //hidden elements
     $mform->addElement('hidden', 'wizard', 'datasetdefinitions');
     $mform->setType('wizard', PARAM_ALPHA);
 }
Пример #6
0
 /**
  * Extends the standard instance config form with custom
  * fields for moodletxt specifically
  * @param MoodleQuickForm $form Form to extend
  * @version 2011072201
  * @since 2011072201
  */
 protected function specific_definition($form)
 {
     // Section header title according to language file.
     $form->addElement('header', 'configheader', get_string('headerinstanceconfig', 'block_moodletxt'));
     // The title of the block
     $form->addElement('text', 'config_title', get_string('labelblocktitle', 'block_moodletxt'));
     $form->setDefault('config_title', get_string('blocktitle', 'block_moodletxt'));
     $form->setType('config_title', PARAM_MULTILANG);
 }
Пример #7
0
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->addElement('htmleditor', 'feedback', get_string("feedback", "quiz"), array('course' => $this->coursefilesid));
     $mform->setType('feedback', PARAM_RAW);
     $mform->addElement('hidden', 'fraction', 0);
     //don't need this default element.
     $mform->removeElement('penalty');
     $mform->addElement('hidden', 'penalty', 0);
 }
Пример #8
0
 /**
  * @param MoodleQuickForm $mform
  */
 protected function specific_definition($mform)
 {
     // Section header title according to language file.
     $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
     // A sample string variable with a default value.
     $mform->addElement('text', 'config_text', get_string('blockstring', 'block_simplehtml'));
     $mform->setDefault('config_text', 'default value');
     $mform->setType('config_text', PARAM_RAW);
 }
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $menu = array(get_string('caseno', 'quiz'), get_string('caseyes', 'quiz'));
     $mform->addElement('select', 'usecase', get_string('casesensitive', 'quiz'), $menu);
     $mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'quiz'), get_string('filloutoneanswer', 'quiz'));
     $mform->closeHeaderBefore('answersinstruct');
     $creategrades = get_grade_options();
     $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_shortanswer', '{no}'), $creategrades->gradeoptions);
 }
Пример #10
0
 public function add_to_moodleform_testinput(MoodleQuickForm $mform)
 {
     $values = $this->get_choices();
     if (empty($values)) {
         $mform->addElement('static', $this->name, stack_string('ddl_empty'));
     } else {
         $mform->addElement('select', $this->name, $this->name, $values);
     }
 }
 /**
  * Builds the form to edit instance settings
  *
  * @param MoodleQuickForm $mform
  */
 protected function specific_definition($mform)
 {
     // Section header title according to language file.
     $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
     // Set the title for the block.
     $mform->addElement('text', 'config_title', get_string('configtitle', 'block_filtered_course_list'));
     $mform->setDefault('config_title', get_string('blockname', 'block_filtered_course_list'));
     $mform->setType('config_title', PARAM_TEXT);
 }
 /**
  * Get form elements for the grading page
  *
  * @param stdClass|null $grade
  * @param MoodleQuickForm $mform
  * @param stdClass $data
  * @return bool true if elements were added to the form
  */
 public function get_form_elements($grade, MoodleQuickForm $mform, stdClass $data)
 {
     $choices = get_string_manager()->get_list_of_countries();
     $choices = array('' => get_string('selectacountry') . '...') + $choices;
     $mform->addElement('select', 'country', 'Country for E-signature', $choices);
     $mform->addElement('static', 'description', '', get_string('savechanges', 'assignfeedback_esign'));
     $mform->setDefault('country', 'SE');
     $mform->addRule('country', get_string('selectacountry'), 'required', '', 'client', false, false);
     return true;
 }
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->addElement('header', 'globalvarshdr', get_string('globalvarshdr', 'qtype_coordinates'));
     $mform->removeElement('defaultgrade');
     $mform->addElement('hidden', 'defaultgrade');
     $mform->setType('defaultgrade', PARAM_RAW);
     $mform->removeElement('penalty');
     $mform->addElement('hidden', 'penalty');
     $mform->setType('penalty', PARAM_NUMBER);
     $mform->setDefault('penalty', 0.1);
     $mform->addElement('static', 'help_coordinates', get_string('help'), get_string('helponquestionoptions', 'qtype_coordinates'));
     $mform->addElement('textarea', 'varsrandom', get_string('varsrandom', 'qtype_coordinates'), array('rows' => 4, 'cols' => 70, 'course' => $this->coursefilesid));
     $mform->addElement('textarea', 'varsglobal', get_string('varsglobal', 'qtype_coordinates'), array('rows' => 6, 'cols' => 70, 'course' => $this->coursefilesid));
     $mform->addElement('select', 'showperanswermark', get_string('showperanswermark', 'qtype_coordinates'), array(get_string('choiceno', 'qtype_coordinates'), get_string('choiceyes', 'qtype_coordinates')));
     $mform->setDefault('showperanswermark', 1);
     $mform->addElement('select', 'peranswersubmit', get_string('peranswersubmit', 'qtype_coordinates'), array(get_string('choiceno', 'qtype_coordinates'), get_string('choiceyes', 'qtype_coordinates')));
     $mform->setDefault('peranswersubmit', 1);
     $mform->addElement('text', 'retrymarkseq', get_string('retrymarkseq', 'qtype_coordinates'), array('size' => 30));
     $show_group = array();
     $show_group[] =& $mform->createElement('checkbox', 'vars2', '', get_string('vars2', 'qtype_coordinates'), 'onclick="coordinates_form_display(\'vars2\', this.checked)"');
     $show_group[] =& $mform->createElement('checkbox', 'preunit', '', get_string('preunit', 'qtype_coordinates'), 'onclick="coordinates_form_display(\'preunit\', this.checked)"');
     $show_group[] =& $mform->createElement('checkbox', 'otherrule', '', get_string('otherrule', 'qtype_coordinates'), 'onclick="coordinates_form_display(\'otherrule\', this.checked)"');
     //$show_group[] =& $mform->createElement('checkbox','subqtext','',get_string('subqtext','qtype_coordinates'),
     //    'onclick="coordinates_form_display(\'subqtext\', this.checked)"');
     //$show_group[] =& $mform->createElement('checkbox','feedback','',get_string('feedback','qtype_coordinates'),
     //    'onclick="coordinates_form_display(\'feedback\', this.checked)"');
     $show_group[] =& $mform->createElement('checkbox', 'correctnessraw', '', get_string('correctnessraw', 'qtype_coordinates'), 'onclick="coordinates_form_correctness(this.checked)"');
     $mform->addGroup($show_group, 'showoptions', get_string('showoptions', 'qtype_coordinates'), array(' '), true);
     $creategrades = get_grade_options();
     $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_coordinates', '{no}'), $creategrades->gradeoptions, 1, 1);
 }
Пример #14
0
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->addElement('editor', 'feedback', get_string('feedback', 'quiz'), null, $this->editoroptions);
     $mform->setType('feedback', PARAM_RAW);
     $mform->addElement('hidden', 'fraction', 0);
     $mform->setType('fraction', PARAM_RAW);
     //don't need this default element.
     $mform->removeElement('penalty');
     $mform->addElement('hidden', 'penalty', 0);
     $mform->setType('penalty', PARAM_RAW);
 }
Пример #15
0
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     $mform->removeElement('image');
     $questionstoselect = array();
     for ($i = 2; $i <= QUESTION_NUMANS; $i++) {
         $questionstoselect[$i] = $i;
     }
     $mform->addElement('select', 'choose', get_string("randomsamatchnumber", "quiz"), $questionstoselect);
     $mform->setType('feedback', PARAM_RAW);
     $mform->addElement('hidden', 'fraction', 0);
 }
Пример #16
0
 /**
  * Creates form fields specific to this type of block.
  * 
  * @param MoodleQuickForm $mform The pear quick form form being built.
  */
 protected function specific_definition($mform)
 {
     // Create a fieldset with a legend
     $mform->addElement('header', 'config_header', get_string('blocksettings', 'block'));
     // Add an input text element to form
     $mform->addElement('text', 'config_title', get_string('inconfblocktitlelabel', 'block_openveo_videos'));
     // Add help button
     $mform->addHelpButton('config_title', 'inconfblocktitlelabel', 'block_openveo_videos');
     // Set input text default value
     $mform->setDefault('config_title', get_string('inconfblocktitlelabel', 'block_openveo_videos'));
     // Clean title to plain text while submitting
     $mform->setType('config_title', PARAM_TEXT);
 }
Пример #17
0
 /**
  * The definition of the fields to use.
  *
  * @param MoodleQuickForm $mform
  */
 protected function specific_definition($mform)
 {
     global $DB;
     // Load defaults.
     $blockconfig = get_config('block_activity_results');
     // Fields for editing activity_results block title and contents.
     $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
     // Get supported modules (Only modules using grades or scales will be listed).
     $sql = 'SELECT id, itemname FROM {grade_items} WHERE courseid = ? and itemtype = ? and (gradetype = ? or gradetype = ?)';
     $params = array($this->page->course->id, 'mod', GRADE_TYPE_VALUE, GRADE_TYPE_SCALE);
     $activities = $DB->get_records_sql_menu($sql, $params);
     if (empty($activities)) {
         $mform->addElement('static', 'noactivitieswarning', get_string('config_select_activity', 'block_activity_results'), get_string('config_no_activities_in_course', 'block_activity_results'));
     } else {
         foreach ($activities as $id => $name) {
             $activities[$id] = strip_tags(format_string($name));
         }
         $mform->addElement('select', 'config_activitygradeitemid', get_string('config_select_activity', 'block_activity_results'), $activities);
         $mform->setDefault('config_activitygradeitemid', $this->block->get_owning_activity()->id);
     }
     $mform->addElement('text', 'config_showbest', get_string('config_show_best', 'block_activity_results'), array('size' => 3));
     $mform->setDefault('config_showbest', $blockconfig->config_showbest);
     $mform->setType('config_showbest', PARAM_INT);
     if ($blockconfig->config_showbest_locked) {
         $mform->freeze('config_showbest');
     }
     $mform->addElement('text', 'config_showworst', get_string('config_show_worst', 'block_activity_results'), array('size' => 3));
     $mform->setDefault('config_showworst', $blockconfig->config_showworst);
     $mform->setType('config_showworst', PARAM_INT);
     if ($blockconfig->config_showworst_locked) {
         $mform->freeze('config_showworst');
     }
     $mform->addElement('selectyesno', 'config_usegroups', get_string('config_use_groups', 'block_activity_results'));
     $mform->setDefault('config_usegroups', $blockconfig->config_usegroups);
     if ($blockconfig->config_usegroups_locked) {
         $mform->freeze('config_usegroups');
     }
     $nameoptions = array(B_ACTIVITYRESULTS_NAME_FORMAT_FULL => get_string('config_names_full', 'block_activity_results'), B_ACTIVITYRESULTS_NAME_FORMAT_ID => get_string('config_names_id', 'block_activity_results'), B_ACTIVITYRESULTS_NAME_FORMAT_ANON => get_string('config_names_anon', 'block_activity_results'));
     $mform->addElement('select', 'config_nameformat', get_string('config_name_format', 'block_activity_results'), $nameoptions);
     $mform->setDefault('config_nameformat', $blockconfig->config_nameformat);
     if ($blockconfig->config_nameformat_locked) {
         $mform->freeze('config_nameformat');
     }
     $gradeeoptions = array(B_ACTIVITYRESULTS_GRADE_FORMAT_PCT => get_string('config_format_percentage', 'block_activity_results'), B_ACTIVITYRESULTS_GRADE_FORMAT_FRA => get_string('config_format_fraction', 'block_activity_results'), B_ACTIVITYRESULTS_GRADE_FORMAT_ABS => get_string('config_format_absolute', 'block_activity_results'));
     $mform->addElement('select', 'config_gradeformat', get_string('config_grade_format', 'block_activity_results'), $gradeeoptions);
     $mform->setDefault('config_gradeformat', $blockconfig->config_gradeformat);
     if ($blockconfig->config_gradeformat_locked) {
         $mform->freeze('config_gradeformat');
     }
     $options = array();
     for ($i = 0; $i <= 5; $i++) {
         $options[$i] = $i;
     }
     $mform->addElement('select', 'config_decimalpoints', get_string('config_decimalplaces', 'block_activity_results'), $options);
     $mform->setDefault('config_decimalpoints', $blockconfig->config_decimalpoints);
     $mform->setType('config_decimalpoints', PARAM_INT);
     if ($blockconfig->config_decimalpoints_locked) {
         $mform->freeze('config_decimalpoints');
     }
 }
 /**
  * Adds the fields for showing the Venn diagram where teacher can define the areas of correct answer.
  * 
  * @param MoodleQuickForm $mform 
  */
 protected function add_vd_fields($mform)
 {
     $vd = new qtype_vdmarker_vd3("correct_answer_vd");
     $vd->readonly = false;
     if (isset($this->question->options)) {
         $state = $this->question->options->vd_correctanswer;
     } else {
         $state = 0;
     }
     $vd->set_state($state);
     $vd->fieldtoupdate = 'vd_correctanswer';
     $mform->addElement('hidden', $vd->fieldtoupdate, $vd->get_state(), 'id="' . str_replace(':', '_', $vd->fieldtoupdate) . '"');
     $mform->addElement('static', 'diagram', get_string('correct_answer', 'qtype_vdmarker'), $vd->render());
     unset($vd);
 }
Пример #19
0
 /**
  * The constructor function calls the abstract function definition() and it will then
  * process and clean and attempt to validate incoming data.
  *
  * It will call your custom validate method to validate data and will also check any rules
  * you have specified in definition using addRule
  *
  * The name of the form (id attribute of the form) is automatically generated depending on
  * the name you gave the class extending moodleform. You should call your class something
  * like
  *
  * @param mixed $action the action attribute for the form. If empty defaults to auto detect the
  *                  current url. If a moodle_url object then outputs params as hidden variables.
  * @param array $customdata if your form defintion method needs access to data such as $course
  *               $cm, etc. to construct the form definition then pass it in this array. You can
  *               use globals for somethings.
  * @param string $method if you set this to anything other than 'post' then _GET and _POST will
  *               be merged and used as incoming data to the form.
  * @param string $target target frame for form submission. You will rarely use this. Don't use
  *                  it if you don't need to as the target attribute is deprecated in xhtml
  *                  strict.
  * @param mixed $attributes you can pass a string of html attributes here or an array.
  * @return moodleform
  */
 function moodleform($action = null, $customdata = null, $method = 'post', $target = '', $attributes = null, $editable = true)
 {
     if (empty($action)) {
         $action = strip_querystring(qualified_me());
     }
     $this->_formname = get_class($this);
     // '_form' suffix kept in order to prevent collisions of form id and other element
     $this->_customdata = $customdata;
     $this->_form =& new MoodleQuickForm($this->_formname, $method, $action, $target, $attributes);
     if (!$editable) {
         $this->_form->hardFreeze();
     }
     $this->set_upload_manager(new upload_manager());
     $this->definition();
     $this->_form->addElement('hidden', 'sesskey', null);
     // automatic sesskey protection
     $this->_form->setType('sesskey', PARAM_RAW);
     $this->_form->setDefault('sesskey', sesskey());
     $this->_form->addElement('hidden', '_qf__' . $this->_formname, null);
     // form submission marker
     $this->_form->setType('_qf__' . $this->_formname, PARAM_RAW);
     $this->_form->setDefault('_qf__' . $this->_formname, 1);
     $this->_form->_setDefaultRuleMessages();
     // we have to know all input types before processing submission ;-)
     $this->_process_submission($method);
 }
Пример #20
0
 /**
  * definition_inner adds all specific fields to the form.
  *
  * @param MoodleQuickForm $mform (the form being built).
  */
 protected function definition_inner($mform)
 {
     $mform->addElement('header', 'previewareaheader', get_string('previewareaheader', 'qtype_' . $this->qtype()));
     $mform->setExpanded('previewareaheader');
     $mform->addElement('static', 'previewarea', '', get_string('previewareamessage', 'qtype_' . $this->qtype()));
     $mform->registerNoSubmitButton('refresh');
     $mform->addElement('submit', 'refresh', get_string('refresh', 'qtype_' . $this->qtype()));
     $mform->addElement('filepicker', 'bgimage', get_string('bgimage', 'qtype_' . $this->qtype()), null, self::file_picker_options());
     $mform->closeHeaderBefore('dropzoneheader');
     // Add the draggable image fields & drop zones to the form.
     list($itemrepeatsatstart, $imagerepeats) = $this->get_drag_item_repeats();
     $this->definition_draggable_items($mform, $itemrepeatsatstart);
     $this->definition_drop_zones($mform, $imagerepeats);
     $this->add_combined_feedback_fields(true);
     $this->add_interactive_settings(true, true);
 }
Пример #21
0
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     //don't need these default elements :
     $mform->removeElement('defaultgrade');
     $mform->removeElement('penalty');
     $mform->addElement('hidden', 'defaultgrade', 0);
 }
Пример #22
0
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 protected function definition_inner($mform)
 {
     // We don't need this default element.
     $mform->removeElement('defaultmark');
     $mform->addElement('hidden', 'defaultmark', 0);
     $mform->setType('defaultmark', PARAM_RAW);
 }
 /**
  * Add re-usable form elements for forum preferences
  * @param MoodleQuickForm $mform
  */
 public static function add_elements(&$mform)
 {
     global $CFG, $OUTPUT;
     $mform->addElement('html', $OUTPUT->heading(get_string('forumsubscription', 'forumng'), 3));
     $choices = array();
     $choices['0'] = get_string('emaildigestoff');
     $choices['1'] = get_string('emaildigestcomplete');
     $mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices);
     $mform->setDefault('maildigest', $CFG->defaultpreference_maildigest);
     $mform->addHelpButton('maildigest', 'emaildigest');
     $mform->addElement('html', html_writer::empty_tag('hr'));
     $choices = array();
     $choices['1'] = get_string('htmlformat');
     $choices['0'] = get_string('textformat');
     $mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
     $mform->setDefault('autosubscribe', $CFG->defaultpreference_mailformat);
 }
Пример #24
0
 /**
  * Get form elements for grading form
  *
  * @param stdClass $grade
  * @param MoodleQuickForm $mform
  * @param stdClass $data
  * @return bool true if elements were added to the form
  */
 public function get_form_elements($grade, MoodleQuickForm $mform, stdClass $data)
 {
     $fileoptions = $this->get_file_options();
     $gradeid = $grade ? $grade->id : 0;
     $data = file_prepare_standard_filemanager($data, 'files', $fileoptions, $this->assignment->get_context(), 'assignfeedback_file', ASSIGNFEEDBACK_FILE_FILEAREA, $gradeid);
     $mform->addElement('filemanager', 'files_filemanager', '', null, $fileoptions);
     return true;
 }
Пример #25
0
 /**
  * Add the form elements for the filter to the supplied form.
  *
  * @param   MoodleQuickForm $mform      The form to add filter settings to.
  */
 public static function add_filter_to_form(\MoodleQuickForm &$mform)
 {
     $options = [static::ANYVALUE => get_string('all')];
     $options += static::get_filter_options();
     $filtername = static::get_filter_name();
     $key = "filter_{$filtername}";
     $mform->addElement('select', $key, get_string($key, 'tool_usertours'), $options, ['multiple' => true]);
     $mform->setDefault($key, static::ANYVALUE);
     $mform->addHelpButton($key, $key, 'tool_usertours');
 }
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     global $COURSE, $CFG;
     // don't need these default elements :
     $mform->removeElement('defaultgrade');
     $mform->removeElement('penalty');
     // add feedback
     $mform->addElement('htmleditor', 'feedback', get_string("feedback", "quiz"));
     $mform->setType('feedback', PARAM_RAW);
     // add default elements
     $mform->addElement('hidden', 'defaultgrade', 0);
     $mform->addElement('hidden', 'fraction', 0);
     // add max upload limit menu
     $choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
     $choices[0] = get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')';
     $mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
     $mform->setDefault('maxbytes', $COURSE->maxbytes);
     // add essay area checkbox
     $mform->addElement('advcheckbox', 'essay', get_string('addessay', 'qtype_fileresponse'), null, null, array(0, 1));
 }
Пример #27
0
 /**
  * @param MoodleQuickForm $mform
  */
 protected function specific_definition($mform)
 {
     global $CFG;
     $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
     $mods = array('enabledock' => 'yes');
     $yesnooptions = array('yes' => get_string('yes'), 'no' => get_string('no'));
     foreach ($mods as $modname => $default) {
         $mform->addElement('select', 'config_' . $modname, get_string($modname . 'desc', $this->block->blockname), $yesnooptions);
         $mform->setDefault('config_' . $modname, $default);
     }
     $options = array(block_navigation::TRIM_RIGHT => get_string('trimmoderight', $this->block->blockname), block_navigation::TRIM_LEFT => get_string('trimmodeleft', $this->block->blockname), block_navigation::TRIM_CENTER => get_string('trimmodecenter', $this->block->blockname));
     $mform->addElement('select', 'config_trimmode', get_string('trimmode', $this->block->blockname), $options);
     $mform->setType('config_trimmode', PARAM_INT);
     $mform->addElement('text', 'config_trimlength', get_string('trimlength', $this->block->blockname));
     $mform->setDefault('config_trimlength', 50);
     $mform->setType('config_trimlength', PARAM_INT);
     $options = array(0 => get_string('everything', $this->block->blockname), global_navigation::TYPE_COURSE => get_string('courses', $this->block->blockname), global_navigation::TYPE_SECTION => get_string('coursestructures', $this->block->blockname), global_navigation::TYPE_ACTIVITY => get_string('courseactivities', $this->block->blockname));
     $mform->addElement('select', 'config_expansionlimit', get_string('expansionlimit', $this->block->blockname), $options);
     $mform->setType('config_expansionlimit', PARAM_INT);
 }
Пример #28
0
    /**
     * Get form elements for the grading page
     *
     * @param stdClass|null $grade
     * @param MoodleQuickForm $mform
     * @param stdClass $data
     * @return bool true if elements were added to the form
     */
    public function get_form_elements($grade, MoodleQuickForm $mform, stdClass $data) {
        if ($grade) {
            $feedbackcomments = $this->get_feedback_comments($grade->id);
            if ($feedbackcomments) {
                $data->assignfeedbackcomments_editor['text'] = $feedbackcomments->commenttext;
                $data->assignfeedbackcomments_editor['format'] = $feedbackcomments->commentformat;
            }
        }

        $mform->addElement('editor', 'assignfeedbackcomments_editor', '', null, null);
        return true;
    }
 /**
  * Add question-type specific form fields.
  *
  * @param MoodleQuickForm $mform the form being built.
  */
 function definition_inner(&$mform)
 {
     global $COURSE, $CFG;
     // don't need these default elements :
     $mform->removeElement('defaultgrade');
     $mform->removeElement('penalty');
     $mform->addElement('html', '<a target="_new" href="' . $CFG->wwwroot . '/files/index.php?id=' . $COURSE->id . '">' . get_string("openinnewwindow", "qtype_imagedit") . '</a>');
     // this element will hold the URL of the HTML's IMG SRC value
     // of the altered image file that was uploaded by the user
     // to the current course's "users" folder
     //$mform->addElement('hidden', 'imgurl', '');
     // add feedback
     $mform->addElement('htmleditor', 'feedback', get_string("feedback", "quiz"));
     $mform->setType('feedback', PARAM_RAW);
     // add default elements
     $mform->addElement('hidden', 'defaultgrade', 0);
     $mform->addElement('hidden', 'fraction', 0);
     // add max upload limit menu
     $choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
     $choices[0] = get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')';
     $mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
     $mform->setDefault('maxbytes', $COURSE->maxbytes);
     // add essay area checkbox
     $mform->addElement('advcheckbox', 'essay', get_string('addessay', 'qtype_imagedit'), null, null, array(0, 1));
 }
 public static function add_settings_form_fields(mod_quiz_mod_form $quizform, MoodleQuickForm $mform)
 {
     $config = get_config('quizaccess_offlinemode');
     $mform->addElement('selectyesno', 'offlinemode_enabled', get_string('offlinemodeenabled', 'quizaccess_offlinemode'));
     $mform->addHelpButton('offlinemode_enabled', 'offlinemodeenabled', 'quizaccess_offlinemode');
     $mform->setDefault('offlinemode_enabled', !empty($config->defaultenabled));
     $mform->setAdvanced('offlinemode_enabled', !empty($config->defaultenabled_adv));
     foreach (question_engine::get_behaviour_options(null) as $behaviour => $notused) {
         if (!self::is_compatible_behaviour($behaviour)) {
             $mform->disabledIf('offlinemode_enabled', 'preferredbehaviour', 'eq', $behaviour);
         }
     }
 }