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


PHP MoodleQuickForm::addGroupRule方法代码示例

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


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

示例1: 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');
 }
开发者ID:qanuj,项目名称:moodle,代码行数:30,代码来源:locallib.php


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