本文整理汇总了PHP中MoodleQuickForm::addHelpButton方法的典型用法代码示例。如果您正苦于以下问题:PHP MoodleQuickForm::addHelpButton方法的具体用法?PHP MoodleQuickForm::addHelpButton怎么用?PHP MoodleQuickForm::addHelpButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoodleQuickForm
的用法示例。
在下文中一共展示了MoodleQuickForm::addHelpButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_settings
/**
* Get the default setting for file submission plugin
*
* @param MoodleQuickForm $mform The form to add elements to
* @return void
*/
public function get_settings(MoodleQuickForm $mform)
{
global $CFG, $COURSE;
$defaultmaxfilesubmissions = $this->get_config('maxfilesubmissions');
$defaultmaxsubmissionsizebytes = $this->get_config('maxsubmissionsizebytes');
$settings = array();
$options = array();
for ($i = 1; $i <= ASSIGNSUBMISSION_FILE_MAXFILES; $i++) {
$options[$i] = $i;
}
$mform->addElement('select', 'assignsubmission_file_maxfiles', get_string('maxfilessubmission', 'assignsubmission_file'), $options);
$mform->addHelpButton('assignsubmission_file_maxfiles', 'maxfilessubmission', 'assignsubmission_file');
$mform->setDefault('assignsubmission_file_maxfiles', $defaultmaxfilesubmissions);
$mform->disabledIf('assignsubmission_file_maxfiles', 'assignsubmission_file_enabled', 'eq', 0);
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes, get_config('assignsubmission_file', 'maxbytes'));
// Remove the option for 0 bytes.
unset($choices[0]);
if ($COURSE->maxbytes == 0) {
$choices = array(0 => get_string('siteuploadlimit', 'assignsubmission_file')) + $choices;
} else {
$choices = array(0 => get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')') + $choices;
}
$settings[] = array('type' => 'select', 'name' => 'maxsubmissionsizebytes', 'description' => get_string('maximumsubmissionsize', 'assignsubmission_file'), 'options' => $choices, 'default' => $defaultmaxsubmissionsizebytes);
$mform->addElement('select', 'assignsubmission_file_maxsizebytes', get_string('maximumsubmissionsize', 'assignsubmission_file'), $choices);
$mform->addHelpButton('assignsubmission_file_maxsizebytes', 'maximumsubmissionsize', 'assignsubmission_file');
$mform->setDefault('assignsubmission_file_maxsizebytes', $defaultmaxsubmissionsizebytes);
$mform->disabledIf('assignsubmission_file_maxsizebytes', 'assignsubmission_file_enabled', 'eq', 0);
}
示例2: add_filter_to_form
/**
* 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');
}
示例3: 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);
}
示例4: add_settings_form_fields
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);
}
}
}
示例5: get_settings
/**
* Get the default setting for OneNote submission plugin
*
* @param MoodleQuickForm $mform The form to add elements to
* @return void
*/
public function get_settings(MoodleQuickForm $mform)
{
global $CFG, $COURSE;
$defaultmaxfilesubmissions = $this->get_config('maxfilesubmissions');
$defaultmaxsubmissionsizebytes = $this->get_config('maxsubmissionsizebytes');
$settings = array();
$options = array();
for ($i = 1; $i <= \local_onenote\api\base::ASSIGNSUBMISSION_ONENOTE_MAXFILES; $i++) {
$options[$i] = $i;
}
$name = get_string('maxfilessubmission', 'assignsubmission_onenote');
$mform->addElement('select', 'assignsubmission_onenote_maxfiles', $name, $options);
$mform->addHelpButton('assignsubmission_onenote_maxfiles', 'maxfilessubmission', 'assignsubmission_onenote');
$mform->setDefault('assignsubmission_onenote_maxfiles', $defaultmaxfilesubmissions);
$mform->disabledIf('assignsubmission_onenote_maxfiles', 'assignsubmission_onenote_enabled', 'notchecked');
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes, get_config('assignsubmission_onenote', 'maxbytes'));
$settings[] = array('type' => 'select', 'name' => 'maxsubmissionsizebytes', 'description' => get_string('maximumsubmissionsize', 'assignsubmission_onenote'), 'options' => $choices, 'default' => $defaultmaxsubmissionsizebytes);
$name = get_string('maximumsubmissionsize', 'assignsubmission_onenote');
$mform->addElement('select', 'assignsubmission_onenote_maxsizebytes', $name, $choices);
$mform->addHelpButton('assignsubmission_onenote_maxsizebytes', 'maximumsubmissionsize', 'assignsubmission_onenote');
$mform->setDefault('assignsubmission_onenote_maxsizebytes', $defaultmaxsubmissionsizebytes);
$mform->disabledIf('assignsubmission_onenote_maxsizebytes', 'assignsubmission_onenote_enabled', 'notchecked');
}
示例6: specific_definition
/**
* The definition of the fields to use.
*
* @param MoodleQuickForm $mform
*/
protected function specific_definition($mform)
{
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$numberofsections = array();
for ($i = 1; $i < 53; $i++) {
$numberofsections[$i] = $i;
}
$increments = array();
for ($i = 1; $i < 11; $i++) {
$increments[$i] = $i;
}
$config = get_config('block_section_links');
$selected = array(1 => array(22, 2), 2 => array(40, 5));
if (!empty($config->numsections1)) {
if (empty($config->incby1)) {
$config->incby1 = $selected[1][1];
}
$selected[1] = array($config->numsections1, $config->incby1);
}
if (!empty($config->numsections2)) {
if (empty($config->incby1)) {
$config->incby1 = $selected[2][1];
}
$selected[2] = array($config->numsections2, $config->incby2);
}
for ($i = 1; $i < 3; $i++) {
$mform->addElement('select', 'config_numsections' . $i, get_string('numsections' . $i, 'block_section_links'), $numberofsections);
$mform->setDefault('config_numsections' . $i, $selected[$i][0]);
$mform->setType('config_numsections' . $i, PARAM_INT);
$mform->addHelpButton('config_numsections' . $i, 'numsections' . $i, 'block_section_links');
$mform->addElement('select', 'config_incby' . $i, get_string('incby' . $i, 'block_section_links'), $increments);
$mform->setDefault('config_incby' . $i, $selected[$i][1]);
$mform->setType('config_incby' . $i, PARAM_INT);
$mform->addHelpButton('config_incby' . $i, 'incby' . $i, 'block_section_links');
}
}
示例7: add_elements
/**
* 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);
}
示例8: get_settings
/**
* Get the settings for onlinetext submission plugin
*
* @param MoodleQuickForm $mform The form to add elements to
* @return void
*/
public function get_settings(MoodleQuickForm $mform)
{
global $CFG, $COURSE;
$defaultwordlimit = $this->get_config('wordlimit') == 0 ? '' : $this->get_config('wordlimit');
$defaultwordlimitenabled = $this->get_config('wordlimitenabled');
$options = array('size' => '6', 'maxlength' => '6');
$name = get_string('wordlimit', 'assignsubmission_onlinetext');
// Create a text box that can be enabled/disabled for onlinetext word limit.
$wordlimitgrp = array();
$wordlimitgrp[] = $mform->createElement('text', 'assignsubmission_onlinetext_wordlimit', '', $options);
$wordlimitgrp[] = $mform->createElement('checkbox', 'assignsubmission_onlinetext_wordlimit_enabled', '', get_string('enable'));
$mform->addGroup($wordlimitgrp, 'assignsubmission_onlinetext_wordlimit_group', $name, ' ', false);
$mform->addHelpButton('assignsubmission_onlinetext_wordlimit_group', 'wordlimit', 'assignsubmission_onlinetext');
$mform->disabledIf('assignsubmission_onlinetext_wordlimit', 'assignsubmission_onlinetext_wordlimit_enabled', 'notchecked');
// Add numeric rule to text field.
$wordlimitgrprules = array();
$wordlimitgrprules['assignsubmission_onlinetext_wordlimit'][] = array(null, 'numeric', null, 'client');
$mform->addGroupRule('assignsubmission_onlinetext_wordlimit_group', $wordlimitgrprules);
// Rest of group setup.
$mform->setDefault('assignsubmission_onlinetext_wordlimit', $defaultwordlimit);
$mform->setDefault('assignsubmission_onlinetext_wordlimit_enabled', $defaultwordlimitenabled);
$mform->setType('assignsubmission_onlinetext_wordlimit', PARAM_INT);
$mform->disabledIf('assignsubmission_onlinetext_wordlimit_group', 'assignsubmission_onlinetext_enabled', 'notchecked');
}
示例9: add_settings_form_fields
public static function add_settings_form_fields(mod_quiz_mod_form $quizform, MoodleQuickForm $mform)
{
$mform->addElement('select', 'honestycheckrequired', get_string('honestycheckrequired', 'quizaccess_honestycheck'), array(0 => get_string('notrequired', 'quizaccess_honestycheck'), 1 => get_string('honestycheckrequiredoption', 'quizaccess_honestycheck')));
$mform->addHelpButton('honestycheckrequired', 'honestycheckrequired', 'quizaccess_honestycheck');
}
示例10: tool_lp_coursemodule_standard_elements
/**
* Inject the competencies elements into all moodle module settings forms.
*
* @param moodleform $formwrapper The moodle quickforms wrapper object.
* @param MoodleQuickForm $mform The actual form object (required to modify the form).
*/
function tool_lp_coursemodule_standard_elements($formwrapper, $mform)
{
global $CFG, $COURSE;
if (!get_config('core_competency', 'enabled')) {
return;
} else {
if (!has_capability('moodle/competency:coursecompetencymanage', $formwrapper->get_context())) {
return;
}
}
$mform->addElement('header', 'competenciessection', get_string('competencies', 'core_competency'));
MoodleQuickForm::registerElementType('course_competencies', "{$CFG->dirroot}/admin/tool/lp/classes/course_competencies_form_element.php", 'tool_lp_course_competencies_form_element');
$cmid = null;
if ($cm = $formwrapper->get_coursemodule()) {
$cmid = $cm->id;
}
$options = array('courseid' => $COURSE->id, 'cmid' => $cmid);
$mform->addElement('course_competencies', 'competencies', get_string('modcompetencies', 'tool_lp'), $options);
$mform->addHelpButton('competencies', 'modcompetencies', 'tool_lp');
MoodleQuickForm::registerElementType('course_competency_rule', "{$CFG->dirroot}/admin/tool/lp/classes/course_competency_rule_form_element.php", 'tool_lp_course_competency_rule_form_element');
// Reuse the same options.
$mform->addElement('course_competency_rule', 'competency_rule', get_string('uponcoursemodulecompletion', 'tool_lp'), $options);
}
示例11: workshop_reset_course_form_definition
/**
* Extends the course reset form with workshop specific settings.
*
* @param MoodleQuickForm $mform
*/
function workshop_reset_course_form_definition($mform) {
$mform->addElement('header', 'workshopheader', get_string('modulenameplural', 'mod_workshop'));
$mform->addElement('advcheckbox', 'reset_workshop_submissions', get_string('resetsubmissions', 'mod_workshop'));
$mform->addHelpButton('reset_workshop_submissions', 'resetsubmissions', 'mod_workshop');
$mform->addElement('advcheckbox', 'reset_workshop_assessments', get_string('resetassessments', 'mod_workshop'));
$mform->addHelpButton('reset_workshop_assessments', 'resetassessments', 'mod_workshop');
$mform->disabledIf('reset_workshop_assessments', 'reset_workshop_submissions', 'checked');
$mform->addElement('advcheckbox', 'reset_workshop_phase', get_string('resetphase', 'mod_workshop'));
$mform->addHelpButton('reset_workshop_phase', 'resetphase', 'mod_workshop');
}
示例12: get_settings
/**
* Get the default setting for feedback comments plugin
*
* @param MoodleQuickForm $mform The form to add elements to
* @return void
*/
public function get_settings(MoodleQuickForm $mform) {
$default = $this->get_config('commentinline');
$mform->addElement('selectyesno',
'assignfeedback_comments_commentinline',
get_string('commentinline', 'assignfeedback_comments'));
$mform->addHelpButton('assignfeedback_comments_commentinline', 'commentinline', 'assignfeedback_comments');
$mform->setDefault('assignfeedback_comments_commentinline', $default);
// Disable comment online if comment feedback plugin is disabled.
$mform->disabledIf('assignfeedback_comments_commentinline', 'assignfeedback_comments_enabled', 'notchecked');
}
示例13: quickgrade_mode_allowed
if ($quickgrade) {
echo html_writer::end_tag('form');
}
}
// Mini form for setting user preference.
$formaction = new moodle_url('/mod/giportfolio/submissions.php', array('id' => $cm->id));
$mform = new MoodleQuickForm('optionspref', 'post', $formaction, '', array('class' => 'optionspref'));
$mform->addElement('hidden', 'updatepref');
$mform->setDefault('updatepref', 1);
$mform->addElement('header', 'qgprefs', get_string('optionalsettings', 'assignment'));
$mform->setDefault('filter', $filter);
$mform->addElement('text', 'perpage', get_string('pagesize', 'assignment'), array('size' => 1));
$mform->setDefault('perpage', $perpage);
$mform->addElement('checkbox', 'quickgrade', get_string('quickgrade', 'assignment'));
$mform->setDefault('quickgrade', $quickgrade);
$mform->addHelpButton('quickgrade', 'quickgrade', 'assignment');
$mform->addElement('submit', 'savepreferences', get_string('savepreferences'));
$mform->display();
echo $OUTPUT->footer();
/**
* Checks if grading method allows quickgrade mode. At the moment it is hardcoded
* that advanced grading methods do not allow quickgrade.
*
* Assignment type plugins are not allowed to override this method
*
* @param $cmid
* @return boolean
*/
function quickgrade_mode_allowed($cmid)
{
global $CFG;
示例14: add_grade_form_elements
/**
* add elements to grade form
*
* @param MoodleQuickForm $mform
* @param stdClass $data
* @param array $params
* @return void
*/
public function add_grade_form_elements(MoodleQuickForm $mform, stdClass $data, $params) {
global $USER, $CFG;
$settings = $this->get_instance();
$rownum = $params['rownum'];
$last = $params['last'];
$useridlist = $params['useridlist'];
$userid = $useridlist[$rownum];
$grade = $this->get_user_grade($userid, false);
// add advanced grading
$gradingdisabled = $this->grading_disabled($userid);
$gradinginstance = $this->get_grading_instance($userid, $gradingdisabled);
if ($gradinginstance) {
$gradingelement = $mform->addElement('grading', 'advancedgrading', get_string('grade').':', array('gradinginstance' => $gradinginstance));
if ($gradingdisabled) {
$gradingelement->freeze();
} else {
$mform->addElement('hidden', 'advancedgradinginstanceid', $gradinginstance->get_id());
}
} else {
// use simple direct grading
if ($this->get_instance()->grade > 0) {
$gradingelement = $mform->addElement('text', 'grade', get_string('gradeoutof', 'assign',$this->get_instance()->grade));
$mform->addHelpButton('grade', 'gradeoutofhelp', 'assign');
$mform->setType('grade', PARAM_TEXT);
if ($gradingdisabled) {
$gradingelement->freeze();
}
} else {
$grademenu = make_grades_menu($this->get_instance()->grade);
if (count($grademenu) > 0) {
$gradingelement = $mform->addElement('select', 'grade', get_string('grade').':', $grademenu);
$mform->setType('grade', PARAM_INT);
if ($gradingdisabled) {
$gradingelement->freeze();
}
}
}
}
$gradinginfo = grade_get_grades($this->get_course()->id,
'mod',
'assign',
$this->get_instance()->id,
$userid);
if (!empty($CFG->enableoutcomes)) {
foreach($gradinginfo->outcomes as $index=>$outcome) {
$options = make_grades_menu(-$outcome->scaleid);
if ($outcome->grades[$userid]->locked) {
$options[0] = get_string('nooutcome', 'grades');
$mform->addElement('static', 'outcome_'.$index.'['.$userid.']', $outcome->name.':',
$options[$outcome->grades[$userid]->grade]);
} else {
$options[''] = get_string('nooutcome', 'grades');
$attributes = array('id' => 'menuoutcome_'.$index );
$mform->addElement('select', 'outcome_'.$index.'['.$userid.']', $outcome->name.':', $options, $attributes );
$mform->setType('outcome_'.$index.'['.$userid.']', PARAM_INT);
$mform->setDefault('outcome_'.$index.'['.$userid.']', $outcome->grades[$userid]->grade );
}
}
}
if (has_all_capabilities(array('gradereport/grader:view', 'moodle/grade:viewall'), $this->get_course_context())) {
$gradestring = $this->output->action_link(new moodle_url('/grade/report/grader/index.php',
array('id'=>$this->get_course()->id)),
$gradinginfo->items[0]->grades[$userid]->str_grade);
} else {
$gradestring = $gradinginfo->items[0]->grades[$userid]->str_grade;
}
$mform->addElement('static', 'finalgrade', get_string('currentgrade', 'assign').':', $gradestring);
$mform->addElement('static', 'progress', '', get_string('gradingstudentprogress', 'assign', array('index'=>$rownum+1, 'count'=>count($useridlist))));
// plugins
$this->add_plugin_grade_elements($grade, $mform, $data);
// hidden params
$mform->addElement('hidden', 'id', $this->get_course_module()->id);
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'rownum', $rownum);
$mform->setType('rownum', PARAM_INT);
$mform->addElement('hidden', 'useridlist', implode(',', $useridlist));
$mform->setType('useridlist', PARAM_TEXT);
$mform->addElement('hidden', 'ajax', optional_param('ajax', 0, PARAM_INT));
$mform->setType('ajax', PARAM_INT);
if ($this->get_instance()->teamsubmission) {
$mform->addElement('selectyesno', 'applytoall', get_string('applytoteam', 'assign'));
$mform->setDefault('applytoall', 1);
//.........这里部分代码省略.........
示例15: get_form_elements_for_user
/**
* Get form elements for grading form
*
* @param stdClass $grade
* @param MoodleQuickForm $mform
* @param stdClass $data
* @param int $userid
* @return bool true if elements were added to the form
*/
public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid)
{
global $PAGE;
$attempt = -1;
if ($grade) {
$attempt = $grade->attemptnumber;
}
$files = document_services::list_compatible_submission_files_for_attempt($this->setaskment, $userid, $attempt);
// Only show the editor if there was a compatible file submitted.
if (count($files)) {
$renderer = $PAGE->get_renderer('setaskfeedback_editpdf');
$widget = $this->get_widget($userid, $grade, false);
$html = $renderer->render($widget);
$mform->addElement('static', 'editpdf', get_string('editpdf', 'setaskfeedback_editpdf'), $html);
$mform->addHelpButton('editpdf', 'editpdf', 'setaskfeedback_editpdf');
$mform->addElement('hidden', 'editpdf_source_userid', $userid);
$mform->setType('editpdf_source_userid', PARAM_INT);
$mform->setConstant('editpdf_source_userid', $userid);
}
}