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


PHP MoodleQuickForm::getElementValue方法代码示例

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


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

示例1: create_edit_form_elements

 /**
  * Adds format options elements to the course/section edit form
  *
  * This function is called from {@link course_edit_form::definition_after_data()}
  *
  * @param MoodleQuickForm $mform form the elements are added to
  * @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form
  * @return array array of references to the added form elements
  */
 public function create_edit_form_elements(&$mform, $forsection = false)
 {
     $elements = array();
     if ($forsection) {
         $options = $this->section_format_options(true);
     } else {
         $options = $this->course_format_options(true);
     }
     foreach ($options as $optionname => $option) {
         if (!isset($option['element_type'])) {
             $option['element_type'] = 'text';
         }
         $args = array($option['element_type'], $optionname, $option['label']);
         if (!empty($option['element_attributes'])) {
             $args = array_merge($args, $option['element_attributes']);
         }
         $elements[] = call_user_func_array(array($mform, 'addElement'), $args);
         if (isset($option['help'])) {
             $helpcomponent = 'format_' . $this->get_format();
             if (isset($option['help_component'])) {
                 $helpcomponent = $option['help_component'];
             }
             $mform->addHelpButton($optionname, $option['help'], $helpcomponent);
         }
         if (isset($option['type'])) {
             $mform->setType($optionname, $option['type']);
         }
         if (is_null($mform->getElementValue($optionname)) && isset($option['default'])) {
             $mform->setDefault($optionname, $option['default']);
         }
     }
     if (!$forsection && empty($this->courseid)) {
         // At this stage (this is called from definition_after_data) course data is already set as default.
         // We can not overwrite what is in the database.
         $mform->setDefault('enddate', $this->get_default_course_enddate($mform));
     }
     return $elements;
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:47,代码来源:lib.php

示例2: create_edit_form_elements

 /**
  * Adds format options elements to the course/section edit form
  *
  * This function is called from {@link course_edit_form::definition_after_data()}
  *
  * @param MoodleQuickForm $mform form the elements are added to
  * @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form
  * @return array array of references to the added form elements
  */
 public function create_edit_form_elements(&$mform, $forsection = false)
 {
     $elements = array();
     if ($forsection) {
         $options = $this->section_format_options(true);
     } else {
         $options = $this->course_format_options(true);
     }
     foreach ($options as $optionname => $option) {
         if (!isset($option['element_type'])) {
             $option['element_type'] = 'text';
         }
         $args = array($option['element_type'], $optionname, $option['label']);
         if (!empty($option['element_attributes'])) {
             $args = array_merge($args, $option['element_attributes']);
         }
         $elements[] = call_user_func_array(array($mform, 'addElement'), $args);
         if (isset($option['help'])) {
             $helpcomponent = 'format_' . $this->get_format();
             if (isset($option['help_component'])) {
                 $helpcomponent = $option['help_component'];
             }
             $mform->addHelpButton($optionname, $option['help'], $helpcomponent);
         }
         if (isset($option['type'])) {
             $mform->setType($optionname, $option['type']);
         }
         if (is_null($mform->getElementValue($optionname)) && isset($option['default'])) {
             $mform->setDefault($optionname, $option['default']);
         }
     }
     return $elements;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:42,代码来源:lib.php


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