本文整理汇总了PHP中MoodleQuickForm::setExpanded方法的典型用法代码示例。如果您正苦于以下问题:PHP MoodleQuickForm::setExpanded方法的具体用法?PHP MoodleQuickForm::setExpanded怎么用?PHP MoodleQuickForm::setExpanded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoodleQuickForm
的用法示例。
在下文中一共展示了MoodleQuickForm::setExpanded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition_inner
/**
* 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);
}
示例2: add_plugin_grade_elements
/**
* Add elements in grading plugin form.
*
* @param mixed $grade stdClass|null
* @param MoodleQuickForm $mform
* @param stdClass $data
* @param int $userid - The userid we are grading
* @return void
*/
protected function add_plugin_grade_elements($grade, MoodleQuickForm $mform, stdClass $data, $userid)
{
foreach ($this->feedbackplugins as $plugin) {
if ($plugin->is_enabled() && $plugin->is_visible()) {
$mform->addElement('header', 'header_' . $plugin->get_type(), $plugin->get_name());
$mform->setExpanded('header_' . $plugin->get_type());
if (!$plugin->get_form_elements_for_user($grade, $mform, $data, $userid)) {
$mform->removeElement('header_' . $plugin->get_type());
}
}
}
}
示例3: definition_prt
/**
* Add the form elements defining one PRT.
* @param string $prtname the name of the PRT.
* @param MoodleQuickForm $mform the form being assembled.
* @param int $count the number of times this PRT appears in the text of the question.
*/
protected function definition_prt($prtname, MoodleQuickForm $mform, $count)
{
$mform->addElement('header', $prtname . 'header', stack_string('prtheading', $prtname));
if ($count == 0) {
$mform->addElement('static', $prtname . 'prtwarning', '', stack_string('prtwillberemoved', $prtname));
$mform->addElement('advcheckbox', $prtname . 'prtdeleteconfirm', '', stack_string('prtremovedconfirm'));
$mform->setDefault($prtname . 'prtdeleteconfirm', 0);
$mform->setExpanded($prtname . 'header');
}
$mform->addElement('text', $prtname . 'value', stack_string('questionvalue'), array('size' => 3));
$mform->setType($prtname . 'value', PARAM_FLOAT);
$mform->setDefault($prtname . 'value', 1);
$mform->addElement('selectyesno', $prtname . 'autosimplify', stack_string('autosimplify'));
$mform->setDefault($prtname . 'autosimplify', true);
$mform->addHelpButton($prtname . 'autosimplify', 'autosimplifyprt', 'qtype_stack');
$mform->addElement('textarea', $prtname . 'feedbackvariables', stack_string('feedbackvariables'), array('rows' => 3, 'cols' => 80));
$mform->addHelpButton($prtname . 'feedbackvariables', 'feedbackvariables', 'qtype_stack');
$inputnames = implode(', ', $this->get_inputs_used_by_prt($prtname));
$mform->addElement('static', $prtname . 'inputsnote', '', stack_string('prtwillbecomeactivewhen', html_writer::tag('b', $inputnames)));
// Create the section of the form for each node - general bits.
$graph = $this->get_prt_graph($prtname);
$mform->addElement('static', $prtname . 'graph', '', stack_abstract_graph_svg_renderer::render($graph, $prtname . 'graphsvg'));
$nextnodechoices = array('-1' => stack_string('stop'));
foreach ($graph->get_nodes() as $node) {
$nextnodechoices[$node->name - 1] = stack_string('nodex', $node->name);
}
$deletable = count($graph->get_nodes()) > 1;
foreach ($graph->get_nodes() as $node) {
$this->definition_prt_node($prtname, $node->name, $nextnodechoices, $deletable, $mform);
}
$mform->addElement('submit', $prtname . 'nodeadd', stack_string('addanothernode'));
$mform->registerNoSubmitButton($prtname . 'nodeadd');
}