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


PHP moodleform::addElement方法代码示例

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


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

示例1: define_form_specific

 /**
  * Define the setting for a datetime custom field.
  *
  * @param moodleform $form the user form
  */
 public function define_form_specific($form)
 {
     // Get the current calendar in use - see MDL-18375.
     $calendartype = \core_calendar\type_factory::get_calendar_instance();
     // Create variables to store start and end.
     list($year, $month, $day) = explode('_', date('Y_m_d'));
     $currentdate = $calendartype->convert_from_gregorian($year, $month, $day);
     $currentyear = $currentdate['year'];
     $arryears = $calendartype->get_years();
     // Add elements.
     $form->addElement('select', 'param1', get_string('startyear', 'profilefield_datetime'), $arryears);
     $form->setType('param1', PARAM_INT);
     $form->setDefault('param1', $currentyear);
     $form->addElement('select', 'param2', get_string('endyear', 'profilefield_datetime'), $arryears);
     $form->setType('param2', PARAM_INT);
     $form->setDefault('param2', $currentyear);
     $form->addElement('checkbox', 'param3', get_string('wanttime', 'profilefield_datetime'));
     $form->setType('param3', PARAM_INT);
     $form->addElement('hidden', 'startday', '1');
     $form->setType('startday', PARAM_INT);
     $form->addElement('hidden', 'startmonth', '1');
     $form->setType('startmonth', PARAM_INT);
     $form->addElement('hidden', 'startyear', '1');
     $form->setType('startyear', PARAM_INT);
     $form->addElement('hidden', 'endday', '1');
     $form->setType('endday', PARAM_INT);
     $form->addElement('hidden', 'endmonth', '1');
     $form->setType('endmonth', PARAM_INT);
     $form->addElement('hidden', 'endyear', '1');
     $form->setType('endyear', PARAM_INT);
     $form->addElement('hidden', 'defaultdata', '0');
     $form->setType('defaultdata', PARAM_INT);
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:38,代码来源:define.class.php

示例2: define_form_specific

 /**
  * Adds elements to the form for creating/editing this type of profile field.
  * @param moodleform $form
  */
 public function define_form_specific($form)
 {
     // Param 1 for menu type contains the options.
     $form->addElement('textarea', 'param1', get_string('profilemenuoptions', 'admin'), array('rows' => 6, 'cols' => 40));
     $form->setType('param1', PARAM_TEXT);
     // Default data.
     $form->addElement('text', 'defaultdata', get_string('profiledefaultdata', 'admin'), 'size="50"');
     $form->setType('defaultdata', PARAM_TEXT);
 }
开发者ID:krysnuvadga,项目名称:moodle,代码行数:13,代码来源:define.class.php

示例3: specific_definition

 /**
  * Form definition.
  *
  * @param moodleform $mform Moodle form.
  * @return void
  */
 protected function specific_definition($mform)
 {
     $mform->addElement('header', 'confighdr', get_string('configheader', 'block_xp'));
     $mform->addElement('text', 'config_title', get_string('configtitle', 'block_xp'));
     $mform->setDefault('config_title', get_string('levelup', 'block_xp'));
     $mform->setType('config_title', PARAM_TEXT);
     $mform->addElement('textarea', 'config_description', get_string('configdescription', 'block_xp'));
     $mform->setDefault('config_description', get_string('participatetolevelup', 'block_xp'));
     $mform->setType('config_description', PARAM_TEXT);
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:16,代码来源:edit_form.php

示例4: config_form_display

 /**
  * Add appropriate form elements to the critieria form
  *
  * @param moodleform $mform Moodle forms object
  * @param stdClass $data not used
  */
 public function config_form_display(&$mform, $data = null)
 {
     $mform->addElement('checkbox', 'criteria_date', get_string('enable'));
     $mform->addElement('date_selector', 'criteria_date_value', get_string('afterspecifieddate', 'completion'));
     // If instance of criteria exists
     if ($this->id) {
         $mform->setDefault('criteria_date', 1);
         $mform->setDefault('criteria_date_value', $this->timeend);
     } else {
         $mform->setDefault('criteria_date_value', time() + 3600 * 24);
     }
 }
开发者ID:nmicha,项目名称:moodle,代码行数:18,代码来源:completion_criteria_date.php

示例5: config_form_display

 /**
  * Add appropriate form elements to the critieria form
  *
  * @param moodleform $mform Moodle forms object
  * @param stdClass $data not used
  */
 public function config_form_display(&$mform, $data = null)
 {
     $mform->addElement('checkbox', 'criteria_duration', get_string('enable'));
     $thresholdmenu = array();
     for ($i = 1; $i <= 30; $i++) {
         $seconds = $i * 86400;
         $thresholdmenu[$seconds] = get_string('numdays', '', $i);
     }
     $mform->addElement('select', 'criteria_duration_days', get_string('daysafterenrolment', 'completion'), $thresholdmenu);
     if ($this->id) {
         $mform->setDefault('criteria_duration', 1);
         $mform->setDefault('criteria_duration_days', $this->enrolperiod);
     }
 }
开发者ID:nmicha,项目名称:moodle,代码行数:20,代码来源:completion_criteria_duration.php

示例6: config_form_display

 /**
  * Add appropriate form elements to the critieria form
  *
  * @param moodleform $mform Moodle forms object
  * @param stdClass $data Form data
  */
 public function config_form_display(&$mform, $data = null)
 {
     $mform->addElement('checkbox', 'criteria_unenrol', get_string('completiononunenrolment', 'completion'));
     if ($this->id) {
         $mform->setDefault('criteria_unenrol', 1);
     }
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:13,代码来源:completion_criteria_unenrol.php

示例7: config_form_display

 /**
  * Add appropriate form elements to the critieria form
  *
  * @param moodleform $mform  Moodle forms object
  * @param stdClass $data details of various modules
  */
 public function config_form_display(&$mform, $data = null)
 {
     $mform->addElement('checkbox', 'criteria_activity[' . $data->id . ']', ucfirst(self::get_mod_name($data->module)) . ' - ' . $data->name);
     if ($this->id) {
         $mform->setDefault('criteria_activity[' . $data->id . ']', 1);
     }
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:13,代码来源:completion_criteria_activity.php

示例8: define_form_specific

 /**
  * Add elements for creating/editing a textarea profile field.
  * @param moodleform $form
  */
 public function define_form_specific($form)
 {
     // Default data.
     $form->addElement('editor', 'defaultdata', get_string('profiledefaultdata', 'admin'));
     $form->setType('defaultdata', PARAM_RAW);
     // We have to trust person with capability to edit this default description.
 }
开发者ID:evltuma,项目名称:moodle,代码行数:11,代码来源:define.class.php

示例9: edit_field_add

 /**
  * Adds elements for this field type to the edit form.
  * @param moodleform $mform
  */
 public function edit_field_add($mform)
 {
     // Create the form field.
     $mform->addElement('editor', $this->inputname, format_string($this->field->name), null, null);
     $mform->setType($this->inputname, PARAM_RAW);
     // We MUST clean this before display!
 }
开发者ID:evltuma,项目名称:moodle,代码行数:11,代码来源:field.class.php

示例10: config_form_display

 /**
  * Add appropriate form elements to the critieria form
  *
  * @param moodleform $mform  Moodle forms object
  * @param stdClass $data Form data
  */
 public function config_form_display(&$mform, $data = null)
 {
     $mform->addElement('checkbox', 'criteria_self', get_string('enable'));
     if ($this->id) {
         $mform->setDefault('criteria_self', 1);
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:13,代码来源:completion_criteria_self.php

示例11: config_form_display

 /**
  * Add appropriate form elements to the critieria form
  *
  * @param moodleform $mform Moodle forms object
  * @param stdClass $data used to set default values of the form
  */
 public function config_form_display(&$mform, $data = null)
 {
     $mform->addElement('checkbox', 'criteria_role[' . $data->id . ']', $this->get_title($data));
     if ($this->id) {
         $mform->setDefault('criteria_role[' . $data->id . ']', 1);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:13,代码来源:completion_criteria_role.php

示例12: config_form_display

 /**
  * Add appropriate form elements to the critieria form
  *
  * @param moodleform $mform  Moodle forms object
  * @param stdClass $data details of various modules
  */
 public function config_form_display(&$mform, $data = null)
 {
     $modnames = get_module_types_names();
     $mform->addElement('checkbox', 'criteria_activity[' . $data->id . ']', $modnames[self::get_mod_name($data->module)] . ' - ' . format_string($data->name));
     if ($this->id) {
         $mform->setDefault('criteria_activity[' . $data->id . ']', 1);
     }
 }
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:14,代码来源:completion_criteria_activity.php

示例13: setupForm

 /**
  * Adds controls specific to this filter in the form.
  * @param moodleform $mform a MoodleForm object to setup
  */
 public function setupForm(&$mform)
 {
     $choices = array('' => get_string('anyvalue', 'filters')) + $this->_options;
     $mform->addElement('select', $this->_name, $this->_label, $choices);
     if ($this->_advanced) {
         $mform->setAdvanced($this->_name);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:12,代码来源:simpleselect.php

示例14:

 /**
  * Prints out the form snippet for the part of creating or
  * editing a profile field specific to the current data type
  *
  * @param moodleform $form reference to moodleform for adding elements.
  */
 function define_form_specific(&$form)
 {
     //Add elements, set defualt value and define type of data
     $form->addElement('radio', 'defaultdata', get_string('mystring', 'profilefield_myprofilefield'));
     $form->setDefault('defaultdata', 1);
     // defaults to 'yes'
     $form->setType('defaultdata', PARAM_BOOL);
 }
开发者ID:dariogs,项目名称:moosh,代码行数:14,代码来源:define.class.php

示例15: edit_field_add

 /**
  * Add elements for editing the profile field value.
  * @param moodleform $mform
  */
 public function edit_field_add($mform)
 {
     // Create the form field.
     $checkbox = $mform->addElement('advcheckbox', $this->inputname, format_string($this->field->name));
     if ($this->data == '1') {
         $checkbox->setChecked(true);
     }
     $mform->setType($this->inputname, PARAM_BOOL);
     if ($this->is_required() and !has_capability('moodle/user:update', context_system::instance())) {
         $mform->addRule($this->inputname, get_string('required'), 'nonzero', null, 'client');
     }
 }
开发者ID:janeklb,项目名称:moodle,代码行数:16,代码来源:field.class.php


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