当前位置: 首页>>代码示例>>PHP>>正文


PHP MoodleQuickForm::addElement方法代码示例

本文整理汇总了PHP中MoodleQuickForm::addElement方法的典型用法代码示例。如果您正苦于以下问题:PHP MoodleQuickForm::addElement方法的具体用法?PHP MoodleQuickForm::addElement怎么用?PHP MoodleQuickForm::addElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MoodleQuickForm的用法示例。


在下文中一共展示了MoodleQuickForm::addElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 /**
  * 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'));
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:33,代码来源:edit_shortanswer_form.php

示例2: specific_definition

 /**
  * @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');
 }
开发者ID:robologo3000,项目名称:block-activity-tree,代码行数:10,代码来源:edit_form.php

示例3: add_preflight_check_form_fields

 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'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:8,代码来源:rule.php

示例4: other_preference_fields

 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);
     }
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:8,代码来源:overview_form.php

示例5: array

 /**
  * 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);
 }
开发者ID:veritech,项目名称:pare-project,代码行数:63,代码来源:edit_calculated_form.php

示例6: specific_definition

 /**
  * 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);
 }
开发者ID:educacionbe,项目名称:campus,代码行数:16,代码来源:edit_form.php

示例7: array

 /**
  * 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);
 }
开发者ID:kai707,项目名称:ITSA-backup,代码行数:14,代码来源:edit_essay_form.php

示例8: specific_definition

 /**
  * @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);
 }
开发者ID:MoobiEgc,项目名称:webgd_community,代码行数:12,代码来源:edit_form.php

示例9: array

 /**
  * 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);
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:14,代码来源:edit_shortanswer_form.php

示例10: add_to_moodleform_testinput

 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);
     }
 }
开发者ID:sowirepo,项目名称:moodle-qtype_stack,代码行数:9,代码来源:dropdown.class.php

示例11: specific_definition

 /**
  * 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);
 }
开发者ID:sharpchi,项目名称:moodle-blocks_filtered_course_list,代码行数:14,代码来源:edit_form.php

示例12: get_form_elements

 /**
  * 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;
 }
开发者ID:dsv-su,项目名称:moodle-assignfeedback_esign,代码行数:18,代码来源:locallib.php

示例13: array

 /**
  * 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);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:36,代码来源:edit_coordinates_form.php

示例14:

 /**
  * 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);
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:16,代码来源:edit_essay_form.php

示例15: specific_definition

 /**
  * 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);
 }
开发者ID:veo-labs,项目名称:openveo-moodle-block,代码行数:18,代码来源:edit_form.php


注:本文中的MoodleQuickForm::addElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。