本文整理汇总了PHP中MoodleQuickForm::removeElement方法的典型用法代码示例。如果您正苦于以下问题:PHP MoodleQuickForm::removeElement方法的具体用法?PHP MoodleQuickForm::removeElement怎么用?PHP MoodleQuickForm::removeElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoodleQuickForm
的用法示例。
在下文中一共展示了MoodleQuickForm::removeElement方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: array
/**
* 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));
}
示例3:
/**
* 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);
}
示例4: definition_inner
/**
* 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);
}
示例5: 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);
}
示例6: array
/**
* 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));
}
示例7:
/**
* 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);
}
示例8: array
/**
* Add question-type specific form fields.
*
* @param MoodleQuickForm $mform the form being built.
*/
function definition_inner(&$mform)
{
$mform->removeElement('image');
$mform->addElement('static', 'help_multinumerical', get_string('help'), get_string('helponquestionoptions', 'qtype_multinumerical'));
$mform->addElement('text', 'parameters', get_string('parameters', 'qtype_multinumerical'), array('size' => 30));
$mform->addElement('textarea', 'conditions', get_string('conditions', 'qtype_multinumerical'), array('rows' => 5, 'cols' => 60, 'course' => $this->coursefilesid));
$mform->addElement('textarea', 'feedbackperconditions', get_string('feedbackperconditions', 'qtype_multinumerical'), array('rows' => 5, 'cols' => 60, 'course' => $this->coursefilesid));
$colorfboptions = array(0 => get_string('no'), 1 => get_string('yes'));
$mform->addElement('select', 'usecolorforfeedback', get_string("usecolorforfeedback", "qtype_multinumerical"), $colorfboptions);
$displaycalcoptions = array(0 => get_string('no'), 1 => get_string('yes'), 2 => get_string('onlyforcalculations', 'qtype_multinumerical'));
$mform->addElement('select', 'displaycalc', get_string("displaycalc", "qtype_multinumerical"), $displaycalcoptions);
$binarygradeoptions = array(0 => get_string('gradefractional', 'qtype_multinumerical'), 1 => get_string('gradebinary', 'qtype_multinumerical'));
$mform->addElement('select', 'binarygrade', get_string("binarygrade", "qtype_multinumerical"), $binarygradeoptions);
$creategrades = get_grade_options();
}
示例9: definition_inner
/**
* Add question-type specific form fields.
*
* @param MoodleQuickForm $mform the form being built.
*/
protected function definition_inner($mform)
{
global $PAGE, $CFG;
// We don't need those default element.
$mform->removeElement('defaultmark');
$mform->addElement('hidden', 'defaultmark', 0);
$mform->setType('defaultmark', PARAM_RAW);
// $mform->removeElement('generalfeedback');
// $mform->addElement('hidden', 'generalfeedback');
// $mform->setType('generalfeedback', PARAM_RAW);
$PAGE->requires->js('/question/type/programmedresp/script.js');
// Adding wwwroot required by script.js
echo "<script type=\"text/javascript\">//<![CDATA[\n" . "this.wwwroot = '" . $CFG->wwwroot . "';\n" . "//]]></script>\n";
// TODO: Refacor
// context id will be required on contents.php once it will called by AJAX (script.js)
$mform->addElement('hidden', 'contextid', $PAGE->context->id);
$mform->setType('contextid', PARAM_INT);
$outputmanager = new prgrammedresp_output($mform);
$editingjsparam = 'false';
// In a new question the vars div should be loaded
if (!empty($this->question->id)) {
$editingjsparam = 'true';
}
// Button label
if (!empty($this->question->id)) {
$buttonlabel = get_string('refreshvarsvalues', 'qtype_programmedresp');
} else {
$buttonlabel = get_string('assignvarsvalues', 'qtype_programmedresp');
}
$varsattrs = array('onclick' => 'display_vars(this, ' . $editingjsparam . ');');
$mform->addElement('button', 'vars', $buttonlabel, $varsattrs);
// Link to fill vars data
$mform->addElement('header', 'varsheader', get_string("varsvalues", "qtype_programmedresp"));
$mform->addElement('html', '<div id="id_vars_content">');
if (!empty($this->question->id)) {
$outputmanager->display_vars($this->question->questiontext, false, $this->question->options->concatvars);
}
$mform->addElement('html', '</div>');
// TODO: review this requires. Maybe is not longer nedeed.
if (empty($this->question->id)) {
// Add the onload javascript to hide next steps
$PAGE->requires->js('/question/type/programmedresp/onload.js');
}
}
示例10: add_choice_group
/**
* method to add choice options to the form
*
* @param MoodleQuickForm $mform form
* @param unknown $choice choice (new (negative id) or existing)
*/
private function add_choice_group(MoodleQuickForm $mform, $choice)
{
$elemprefix = 'choices_' . $choice->id . '_';
$mform->addElement('hidden', $elemprefix . 'id', $choice->id);
// Save the record's id.
$mform->setType($elemprefix . 'id', PARAM_INT);
$elementname = 'fieldset_edit_choice' . $choice->id;
$mform->addElement('header', $elementname, get_string('edit_choice', self::MOD_NAME, $choice->title));
$mform->insertElementBefore($mform->removeElement($elementname, false), self::CHOICE_PLACEHOLDER_IDENTIFIER);
$elementname = $elemprefix . 'title';
$mform->addElement('text', $elementname, get_string('choice_title', self::MOD_NAME));
$mform->setDefault($elementname, $choice->title);
$mform->setType($elementname, PARAM_TEXT);
$mform->addHelpButton($elementname, 'choice_title', self::MOD_NAME);
$mform->insertElementBefore($mform->removeElement($elementname, false), self::CHOICE_PLACEHOLDER_IDENTIFIER);
$mform->addRule($elementname, $this->msgerrorrequired, 'required', null, 'server');
$elementname = $elemprefix . 'explanation';
$mform->addElement('text', $elementname, get_string('choice_explanation', self::MOD_NAME));
$mform->insertElementBefore($mform->removeElement($elementname, false), self::CHOICE_PLACEHOLDER_IDENTIFIER);
$mform->setDefault($elementname, $choice->explanation);
$mform->setType($elementname, PARAM_TEXT);
$elementname = $elemprefix . 'maxsize';
$mform->addElement('text', $elementname, get_string('choice_maxsize', self::MOD_NAME));
$mform->insertElementBefore($mform->removeElement($elementname, false), self::CHOICE_PLACEHOLDER_IDENTIFIER);
$mform->setDefault($elementname, $choice->maxsize);
$mform->setType($elementname, PARAM_INT);
$mform->addRule($elementname, $this->msgerrorrequired, 'required', null, 'server');
$elementname = $elemprefix . 'active';
$checkbox = $mform->addElement('advcheckbox', $elementname, get_string('choice_active', self::MOD_NAME), null, null, array(0, 1));
$mform->insertElementBefore($mform->removeElement($elementname, false), self::CHOICE_PLACEHOLDER_IDENTIFIER);
$mform->setDefault($elementname, $choice->active);
$mform->addHelpButton($elementname, 'choice_active', self::MOD_NAME);
$elementname = self::DELETE_CHOICE_ACTION . $choice->id;
$mform->registerNoSubmitButton($elementname);
$mform->addElement('submit', $elementname, get_string('deletechoice', self::MOD_NAME));
$mform->insertElementBefore($mform->removeElement($elementname, false), self::CHOICE_PLACEHOLDER_IDENTIFIER);
}