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


PHP MoodleQuickForm::createelement方法代码示例

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


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

示例1: setup_elements

    function setup_elements(&$mform)
    {
        global $CFG;
        require_once $CFG->libdir . '/biblelib.php';
        //remove these so we have ui control of where name goes later
        $mform->removeElement('general');
        $mform->removeElement('name');
        /// sermon date
        $mform->addElement('html', '<table id="sermondetails-table" border="0" width="100%">
                                        <tr><td>');
        $mform->addElement('static', null, null, '<span class="sermon-delivery-title">' . get_string('sermonddeliverydate', 'resource') . '</span>');
        $mform->addElement('html', '<div id="datedelivered-picker"></div>' . '<script type="text/javascript">
                                jQuery(document).ready(function () {
                                    jQuery("#datedelivered-picker").datepicker({ dateFormat: "@", 
                                                                                 onSelect: function(dateText, inst){jQuery(".datedelivered").val(dateText)},
                                                                                 defaultDate: jQuery(".datedelivered").val()
                                    });

                                    
                                })
                            </script>' . print_spacer(0, 250, false, true) . '
                        </td><td>');
        $mform->addElement('hidden', 'datedelivered', 'testing', array('class' => 'datedelivered'));
        /// sermon info
        mform_partition_start($mform);
        $mform->addElement('text', 'name', get_string('name'), array('size' => '48'));
        if (!empty($CFG->formatstringstriptags)) {
            $mform->setType('name', PARAM_TEXT);
        } else {
            $mform->setType('name', PARAM_CLEAN);
        }
        $mform->addRule('name', null, 'required', null, 'client');
        $previousseries = get_recordset_sql("SELECT DISTINCT seriesname FROM {$CFG->prefix}resource_sermon ORDER BY seriesname DESC");
        $seriesoptions = array(0 => get_string('selectpreviousseries', 'resource'));
        while (($series = rs_fetch_next_record($previousseries)) !== false) {
            $seriesoptions[$series->seriesname] = $series->seriesname;
        }
        $mform->addElement('select', 'seriesname', get_string('series', 'resource'), $seriesoptions);
        mform_spacer($mform, null, get_string('or', 'resource'));
        $newseries = array();
        $newseries[] =& MoodleQuickForm::createelement('text', 'newseriesname', get_string('newseriesname', 'resource'));
        $newseries[] =& MoodleQuickForm::createelement('checkbox', 'newseries', get_string('newseries', 'resource'));
        $mform->addGroup($newseries, null, get_string('newseriesname', 'resource'));
        $mform->disabledIf('newseriesname', 'newseries', 'notchecked');
        $mform->disabledIf('seriesname', 'newseries', 'checked');
        mform_partition_end($mform);
        mform_partition_start($mform);
        /// link to sermon mp3
        $mform->addElement('html', '<span class="nowrap">');
        $mform->addElement('choosecoursefile', 'reference', get_string('sermonmp3', 'resource'), null, array('maxlength' => 255, 'size' => 18));
        $mform->addGroupRule('reference', array('value' => array(array(get_string('maximumchars', '', 255), 'maxlength', 255, 'server'))));
        $mform->addRule('reference', null, 'required', null, 'client');
        $mform->addElement('html', '</span>');
        /// link to sermon pdf
        $mform->addElement('html', '<span class="nowrap">');
        $mform->addElement('choosecoursefile', 'referencesermontext', get_string('sermontext', 'resource'), null, array('maxlength' => 255, 'size' => 18));
        $mform->addGroupRule('referencesermontext', array('value' => array(array(get_string('maximumchars', '', 255), 'maxlength', 255, 'client'))));
        $mform->addElement('html', '</span>');
        /// link to reference lesson
        $mform->addElement('html', '<span class="nowrap">');
        $mform->addElement('choosecoursefile', 'referencelesson', get_string('sermonlesson', 'resource'), null, array('maxlength' => 255, 'size' => 18));
        $mform->addGroupRule('referencelesson', array('value' => array(array(get_string('maximumchars', '', 255), 'maxlength', 255, 'client'))));
        $mform->addElement('html', '</span>');
        mform_partition_end($mform);
        /// add the bible place fields
        mform_partition_start($mform);
        $mform->addElement('html', '<span class="nowrap">');
        $biblebooks = array_merge(array('' => get_string('choosebook', 'resource')), biblebooks_array());
        $bibleplace = array();
        $bibleplace[] =& MoodleQuickForm::createElement('select', 'book', get_string('biblebook', 'resource'), $biblebooks);
        $bibleplace[] =& MoodleQuickForm::createElement('text', 'beginchapter', get_string('beginchapter', 'resource'), 'size="5"');
        $mform->addGroup($bibleplace, null, get_string('biblebook', 'resource'), get_string('biblechapter', 'resource'));
        $mform->addElement('html', '</span>');
        mform_partition_end($mform);
        /// speaker fields
        mform_partition_start($mform);
        //these are a list of members with the ones who have given sermons in the past at the top of the list
        $potentialspeakers = get_recordset_sql("SELECT DISTINCT u.* FROM {$CFG->prefix}user u \n                                                    LEFT JOIN {$CFG->prefix}resource_sermon rs ON u.id = rs.speakerid\n                                                    LEFT JOIN {$CFG->prefix}user u2 ON u2.id = rs.speakerid\n                                                WHERE u.username != 'guest'\n                                                ORDER BY u2.lastname ASC, u.lastname ASC");
        $speakeroptions = array(0 => get_string('selectfromexistinguser', 'resource'));
        while (($potentialspeaker = rs_fetch_next_record($potentialspeakers)) !== false) {
            $speakeroptions[$potentialspeaker->id] = $potentialspeaker->lastname . ', ' . $potentialspeaker->firstname;
        }
        $mform->addElement('select', 'speakerid', get_string('speakerbyid', 'resource'), $speakeroptions);
        mform_spacer($mform, null, get_string('or', 'resource'));
        $guestspeakergroup = array();
        $guestspeakergroup[] =& MoodleQuickForm::createElement('text', 'guestspeakername', get_string('guestspeakername', 'resource'));
        $guestspeakergroup[] =& MoodleQuickForm::createElement('checkbox', 'guestspeaker', null);
        $mform->addGroup($guestspeakergroup, null, get_string('guestspeakername', 'resource'));
        $mform->disabledIf('guestspeakername', 'guestspeaker', 'notchecked');
        $mform->disabledIf('speakerid', 'guestspeaker', 'checked');
        mform_partition_end($mform);
        /// searchable sermon text
        $mform->addElement('static', 'label', '<span class="searchsermontxt">' . get_string('searchablesermontext', 'resource') . '</span>');
        $mform->addElement('textarea', 'searchablesermontext', null, array('rows' => 10, 'cols' => 70));
        $mform->setType('searchablesermontext', PARAM_TEXT);
        $mform->addElement('html', '</td></tr></table>');
        // no need for description
        $mform->removeElement('summary');
    }
开发者ID:NextEinstein,项目名称:riverhills,代码行数:99,代码来源:resource.class.php


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