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


PHP format_base::create_edit_form_elements方法代码示例

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


在下文中一共展示了format_base::create_edit_form_elements方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()}
  *
  * Format singleactivity adds a warning when format of the course is about to be changed.
  *
  * @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)
 {
     global $PAGE;
     $elements = parent::create_edit_form_elements($mform, $forsection);
     if (!$forsection && ($course = $PAGE->course) && !empty($course->format) && $course->format !== 'site' && $course->format !== 'singleactivity') {
         // This is the existing course in other format, display a warning.
         $element = $mform->addElement('static', '', '', html_writer::tag('span', get_string('warningchangeformat', 'format_singleactivity'), array('class' => 'error')));
         array_unshift($elements, $element);
     }
     return $elements;
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:22,代码来源: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 = parent::create_edit_form_elements($mform, $forsection);
     // Increase the number of sections combo box values if the user has increased the number of sections
     // using the icon on the course page beyond course 'maxsections' or course 'maxsections' has been
     // reduced below the number of sections already set for the course on the site administration course
     // defaults page.  This is so that the number of sections is not reduced leaving unintended orphaned
     // activities / resources.
     if (!$forsection) {
         $maxsections = get_config('moodlecourse', 'maxsections');
         $numsections = $mform->getElementValue('numsections');
         $numsections = $numsections[0];
         if ($numsections > $maxsections) {
             $element = $mform->getElement('numsections');
             for ($i = $maxsections + 1; $i <= $numsections; $i++) {
                 $element->addOption("{$i}", $i);
             }
         }
     }
     return $elements;
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:30,代码来源:lib.php

示例3: 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 = true)
 {
     global $PAGE, $CFG;
     if ($PAGE->pagetype == 'course-edit') {
         $elements = parent::create_edit_form_elements($mform, $forsection);
         // Increase the number of sections combo box values if the user has increased the number of sections
         // using the icon on the course page beyond course 'maxsections' or course 'maxsections' has been
         // reduced below the number of sections already set for the course on the site administration course
         // defaults page.  This is so that the number of sections is not reduced leaving unintended orphaned
         // activities / resources.
         if (!$forsection) {
             $maxsections = get_config('moodlecourse', 'maxsections');
             $numsections = $mform->getElementValue('numsections');
             $numsections = $numsections[0];
             if ($numsections > $maxsections) {
                 $element = $mform->getElement('numsections');
                 for ($i = $maxsections + 1; $i <= $numsections; $i++) {
                     $element->addOption("{$i}", $i);
                 }
             }
         }
         return $elements;
     } else {
         $validationerror = optional_param('validationerror', null, PARAM_INT);
         $mform->addElement('header', 'gpssettings', new lang_string('editsection_geo_heading', 'format_gps'));
         $mform->addHelpButton('gpssettings', 'gpshelp', 'format_gps');
         if ($validationerror == 'yes') {
             $error = html_writer::div(new lang_string('validationerror', 'format_gps'), 'bold red error');
             $errorlabel = html_writer::div(new lang_string('error'), 'bold red error');
             $mform->addElement('static', 'validationerrror', $errorlabel, $error);
             $mform->addHelpButton('validationerrror', 'errorhelp', 'format_gps');
         }
         $mform->addElement('checkbox', 'format_gps_restricted', new lang_string('active', 'format_gps'));
         $mform->setDefault('format_gps_restricted', FORMAT_GPS_UNRESTRICTED);
         $attributes = array('size' => '100', 'width' => '500', 'maxlength' => '100');
         $mform->addElement('text', 'format_gps_address', new lang_string('address', 'format_gps'), $attributes);
         $mform->setType('format_gps_address', PARAM_TEXT);
         $mform->addElement('text', 'format_gps_latitude', new lang_string('latitude', 'format_gps'));
         $mform->addElement('text', 'format_gps_longitude', new lang_string('longitude', 'format_gps'));
         $mform->addRule('format_gps_address', null, 'maxlength', 255, 'client');
         $mform->addRule('format_gps_longitude', null, 'numeric', null, 'client');
         $mform->addRule('format_gps_longitude', null, 'numeric', null, 'client');
         $mform->addRule('format_gps_latitude', null, 'numeric', null, 'client');
         $mform->setType('format_gps_latitude', PARAM_FLOAT);
         $mform->setType('format_gps_longitude', PARAM_FLOAT);
         $mform->disabledIf('format_gps_address', 'format_gps_restricted', 'notchecked');
         $mform->disabledIf('format_gps_latitude', 'format_gps_restricted', 'notchecked');
         $mform->disabledIf('format_gps_longitude', 'format_gps_restricted', 'notchecked');
     }
 }
开发者ID:nadavkav,项目名称:moodle-format_gps,代码行数:59,代码来源:lib.php

示例4: 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) {
        global $CFG, $OUTPUT;
        MoodleQuickForm::registerElementType('tccolourpopup', "$CFG->dirroot/course/format/topcoll/js/tc_colourpopup.php",
                                             'MoodleQuickForm_tccolourpopup');

        $elements = parent::create_edit_form_elements($mform, $forsection);
        if ($forsection == false) {
            global $COURSE, $USER;
            /*
             Increase the number of sections combo box values if the user has increased the number of sections
             using the icon on the course page beyond course 'maxsections' or course 'maxsections' has been
             reduced below the number of sections already set for the course on the site administration course
             defaults page.  This is so that the number of sections is not reduced leaving unintended orphaned
             activities / resources.
             */
            $maxsections = get_config('moodlecourse', 'maxsections');
            $numsections = $mform->getElementValue('numsections');
            $numsections = $numsections[0];
            if ($numsections > $maxsections) {
                $element = $mform->getElement('numsections');
                for ($i = $maxsections+1; $i <= $numsections; $i++) {
                    $element->addOption("$i", $i);
                }
            }

            $coursecontext = context_course::instance($COURSE->id);

            $changelayout = has_capability('format/topcoll:changelayout', $coursecontext);
            $changecolour = has_capability('format/topcoll:changecolour', $coursecontext);
            $changetogglealignment = has_capability('format/topcoll:changetogglealignment', $coursecontext);
            $changetoggleiconset = has_capability('format/topcoll:changetoggleiconset', $coursecontext);
            $resetall = is_siteadmin($USER); // Site admins only.

            $elements[] = $mform->addElement('header', 'ctreset', get_string('ctreset', 'format_topcoll'));
            $mform->addHelpButton('ctreset', 'ctreset', 'format_topcoll', '', true);

            $resetelements = array();
            $checkboxname = get_string('resetdisplayinstructions', 'format_topcoll').$OUTPUT->help_icon('resetdisplayinstructions', 'format_topcoll');
            $resetelements[] =& $mform->createElement('checkbox', 'resetdisplayinstructions', '', $checkboxname);

            if ($changelayout) {
                $checkboxname = get_string('resetlayout', 'format_topcoll').$OUTPUT->help_icon('resetlayout', 'format_topcoll');
                $resetelements[] =& $mform->createElement('checkbox', 'resetlayout', '', $checkboxname);
            }

            if ($changecolour) {
                $checkboxname = get_string('resetcolour', 'format_topcoll').$OUTPUT->help_icon('resetcolour', 'format_topcoll');
                $resetelements[] =& $mform->createElement('checkbox', 'resetcolour', '', $checkboxname);
            }

            if ($changetogglealignment) {
                $checkboxname = get_string('resettogglealignment', 'format_topcoll').$OUTPUT->help_icon('resettogglealignment', 'format_topcoll');
                $resetelements[] =& $mform->createElement('checkbox', 'resettogglealignment', '', $checkboxname);
            }

            if ($changetoggleiconset) {
                $checkboxname = get_string('resettoggleiconset', 'format_topcoll').$OUTPUT->help_icon('resettoggleiconset', 'format_topcoll');
                $resetelements[] =& $mform->createElement('checkbox', 'resettoggleiconset', '', $checkboxname);
            }
            $elements[] = $mform->addGroup($resetelements, 'resetgroup', get_string('resetgrp', 'format_topcoll'), null, false);

            if ($resetall) {
                $resetallelements = array();

                $checkboxname = get_string('resetalldisplayinstructions', 'format_topcoll').$OUTPUT->help_icon('resetalldisplayinstructions', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetalldisplayinstructions', '', $checkboxname);

                $checkboxname = get_string('resetalllayout', 'format_topcoll').$OUTPUT->help_icon('resetalllayout', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetalllayout', '', $checkboxname);

                $checkboxname = get_string('resetallcolour', 'format_topcoll').$OUTPUT->help_icon('resetallcolour', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetallcolour', '', $checkboxname);

                $checkboxname = get_string('resetalltogglealignment', 'format_topcoll').$OUTPUT->help_icon('resetalltogglealignment', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetalltogglealignment', '', $checkboxname);

                $checkboxname = get_string('resetalltoggleiconset', 'format_topcoll').$OUTPUT->help_icon('resetalltoggleiconset', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetalltoggleiconset', '', $checkboxname);

                $elements[] = $mform->addGroup($resetallelements, 'resetallgroup', get_string('resetallgrp', 'format_topcoll'), null, false);
            }
        }

        return $elements;
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:94,代码来源:lib.php

示例5: 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)
 {
     global $CFG, $OUTPUT;
     MoodleQuickForm::registerElementType('gfcolourpopup', "{$CFG->dirroot}/course/format/grid/js/gf_colourpopup.php", 'MoodleQuickForm_gfcolourpopup');
     $elements = parent::create_edit_form_elements($mform, $forsection);
     if ($forsection == false) {
         global $USER;
         /*
          Increase the number of sections combo box values if the user has increased the number of sections
          using the imagecontainer on the course page beyond course 'maxsections' or course 'maxsections' has been
          reduced below the number of sections already set for the course on the site administration course
          defaults page.  This is so that the number of sections is not reduced leaving unintended orphaned
          activities / resources.
         */
         $maxsections = get_config('moodlecourse', 'maxsections');
         $numsections = $mform->getElementValue('numsections');
         $numsections = $numsections[0];
         if ($numsections > $maxsections) {
             $element = $mform->getElement('numsections');
             for ($i = $maxsections + 1; $i <= $numsections; $i++) {
                 $element->addOption("{$i}", $i);
             }
         }
         $coursecontext = context_course::instance($this->courseid);
         $changeimagecontainersize = has_capability('format/grid:changeimagecontainersize', $coursecontext);
         $changeimageresizemethod = has_capability('format/grid:changeimageresizemethod', $coursecontext);
         $changeimagecontainerstyle = has_capability('format/grid:changeimagecontainerstyle', $coursecontext);
         $resetall = is_siteadmin($USER);
         // Site admins only.
         $elements[] = $mform->addElement('header', 'gfreset', get_string('gfreset', 'format_grid'));
         $mform->addHelpButton('gfreset', 'gfreset', 'format_grid', '', true);
         $resetelements = array();
         if ($changeimagecontainersize || $changeimageresizemethod || $changeimagecontainerstyle) {
             if ($changeimagecontainersize) {
                 $checkboxname = get_string('resetimagecontainersize', 'format_grid') . $OUTPUT->help_icon('resetimagecontainersize', 'format_grid');
                 $resetelements[] =& $mform->createElement('checkbox', 'resetimagecontainersize', '', $checkboxname);
             }
             if ($changeimageresizemethod) {
                 $checkboxname = get_string('resetimageresizemethod', 'format_grid') . $OUTPUT->help_icon('resetimageresizemethod', 'format_grid');
                 $resetelements[] =& $mform->createElement('checkbox', 'resetimageresizemethod', '', $checkboxname);
             }
             if ($changeimagecontainerstyle) {
                 $checkboxname = get_string('resetimagecontainerstyle', 'format_grid') . $OUTPUT->help_icon('resetimagecontainerstyle', 'format_grid');
                 $resetelements[] =& $mform->createElement('checkbox', 'resetimagecontainerstyle', '', $checkboxname);
             }
         }
         $checkboxname = get_string('resetnewactivity', 'format_grid') . $OUTPUT->help_icon('resetnewactivity', 'format_grid');
         $resetelements[] =& $mform->createElement('checkbox', 'resetnewactivity', '', $checkboxname);
         $checkboxname = get_string('resetfitpopup', 'format_grid') . $OUTPUT->help_icon('resetfitpopup', 'format_grid');
         $resetelements[] =& $mform->createElement('checkbox', 'resetfitpopup', '', $checkboxname);
         $elements[] = $mform->addGroup($resetelements, 'resetgroup', get_string('resetgrp', 'format_grid'), null, false);
         if ($resetall) {
             $resetallelements = array();
             $checkboxname = get_string('resetallimagecontainersize', 'format_grid') . $OUTPUT->help_icon('resetallimagecontainersize', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallimagecontainersize', '', $checkboxname);
             $checkboxname = get_string('resetallimageresizemethod', 'format_grid') . $OUTPUT->help_icon('resetallimageresizemethod', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallimageresizemethod', '', $checkboxname);
             $checkboxname = get_string('resetallimagecontainerstyle', 'format_grid') . $OUTPUT->help_icon('resetallimagecontainerstyle', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallimagecontainerstyle', '', $checkboxname);
             $checkboxname = get_string('resetallnewactivity', 'format_grid') . $OUTPUT->help_icon('resetallnewactivity', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallnewactivity', '', $checkboxname);
             $checkboxname = get_string('resetallfitpopup', 'format_grid') . $OUTPUT->help_icon('resetallfitpopup', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallfitpopup', '', $checkboxname);
             $elements[] = $mform->addGroup($resetallelements, 'resetallgroup', get_string('resetallgrp', 'format_grid'), null, false);
         }
     }
     return $elements;
 }
开发者ID:Keneth1212,项目名称:moodle,代码行数:77,代码来源:lib.php


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