本文整理汇总了PHP中get_max_upload_sizes函数的典型用法代码示例。如果您正苦于以下问题:PHP get_max_upload_sizes函数的具体用法?PHP get_max_upload_sizes怎么用?PHP get_max_upload_sizes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_max_upload_sizes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: field_definition
/**
* Field settings.
*/
protected function field_definition()
{
global $CFG;
$mform =& $this->_form;
// Enable editor.
$mform->addElement('selectyesno', 'param1', get_string('editorenable', 'dataform'));
// Size units.
$sizeunits = array('px' => 'px', 'em' => 'em', '%' => '%');
// Field width.
$colsunit = array('cols' => get_string('cols', 'editor'));
$options = array('units' => $colsunit + $sizeunits);
$this->add_field_size_elements('width', get_string('width', 'editor'), $options);
// Field height.
$rowsunit = array('rows' => get_string('rows', 'editor'));
$options = array('units' => $rowsunit + $sizeunits);
$this->add_field_size_elements('height', get_string('height', 'editor'), $options);
// Trust text.
$mform->addElement('selectyesno', 'param4', get_string('trusttext', 'dataformfield_textarea'));
// Editor file settings.
$mform->addElement('header', 'filesettingshdr', get_string('filesettings', 'dataform'));
// Max bytes.
$options = get_max_upload_sizes($CFG->maxbytes, $this->_field->df->course->maxbytes);
$mform->addElement('select', 'param5', get_string('filemaxsize', 'dataform'), $options);
$mform->disabledIf('param5', 'param1', 'eq', 0);
// Max files.
$range = range(1, 100);
$options = array(-1 => get_string('unlimited')) + array_combine($range, $range);
$mform->addElement('select', 'param6', get_string('filesmax', 'dataform'), $options);
$mform->disabledIf('param6', 'param1', 'eq', 0);
}
示例2: get_settings
/**
* Get the default setting for file submission plugin
*
* @param MoodleQuickForm $mform The form to add elements to
* @return void
*/
public function get_settings(MoodleQuickForm $mform)
{
global $CFG, $COURSE;
$defaultmaxfilesubmissions = $this->get_config('maxfilesubmissions');
$defaultmaxsubmissionsizebytes = $this->get_config('maxsubmissionsizebytes');
$settings = array();
$options = array();
for ($i = 1; $i <= ASSIGNSUBMISSION_FILE_MAXFILES; $i++) {
$options[$i] = $i;
}
$mform->addElement('select', 'assignsubmission_file_maxfiles', get_string('maxfilessubmission', 'assignsubmission_file'), $options);
$mform->addHelpButton('assignsubmission_file_maxfiles', 'maxfilessubmission', 'assignsubmission_file');
$mform->setDefault('assignsubmission_file_maxfiles', $defaultmaxfilesubmissions);
$mform->disabledIf('assignsubmission_file_maxfiles', 'assignsubmission_file_enabled', 'eq', 0);
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes, get_config('assignsubmission_file', 'maxbytes'));
// Remove the option for 0 bytes.
unset($choices[0]);
if ($COURSE->maxbytes == 0) {
$choices = array(0 => get_string('siteuploadlimit', 'assignsubmission_file')) + $choices;
} else {
$choices = array(0 => get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')') + $choices;
}
$settings[] = array('type' => 'select', 'name' => 'maxsubmissionsizebytes', 'description' => get_string('maximumsubmissionsize', 'assignsubmission_file'), 'options' => $choices, 'default' => $defaultmaxsubmissionsizebytes);
$mform->addElement('select', 'assignsubmission_file_maxsizebytes', get_string('maximumsubmissionsize', 'assignsubmission_file'), $choices);
$mform->addHelpButton('assignsubmission_file_maxsizebytes', 'maximumsubmissionsize', 'assignsubmission_file');
$mform->setDefault('assignsubmission_file_maxsizebytes', $defaultmaxsubmissionsizebytes);
$mform->disabledIf('assignsubmission_file_maxsizebytes', 'assignsubmission_file_enabled', 'eq', 0);
}
示例3: definition_inner
/**
* Add question-type specific form fields.
*
* @param MoodleQuickForm $mform the form being built.
*/
function definition_inner(&$mform)
{
global $COURSE, $CFG;
// don't need these default elements :
$mform->removeElement('defaultgrade');
$mform->removeElement('penalty');
$mform->addElement('html', '<a target="_new" href="' . $CFG->wwwroot . '/files/index.php?id=' . $COURSE->id . '">' . get_string("openinnewwindow", "qtype_imagedit") . '</a>');
// this element will hold the URL of the HTML's IMG SRC value
// of the altered image file that was uploaded by the user
// to the current course's "users" folder
//$mform->addElement('hidden', 'imgurl', '');
// add feedback
$mform->addElement('htmleditor', 'feedback', get_string("feedback", "quiz"));
$mform->setType('feedback', PARAM_RAW);
// add default elements
$mform->addElement('hidden', 'defaultgrade', 0);
$mform->addElement('hidden', 'fraction', 0);
// add max upload limit menu
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
$choices[0] = get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')';
$mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
$mform->setDefault('maxbytes', $COURSE->maxbytes);
// add essay area checkbox
$mform->addElement('advcheckbox', 'essay', get_string('addessay', 'qtype_imagedit'), null, null, array(0, 1));
}
示例4: definition
function definition()
{
global $CFG, $COURSE, $DB;
$mform = $this->_form;
$pluginconfig = get_config('dialogue');
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('text', 'name', get_string('dialoguename', 'dialogue'), array('size' => '64'));
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', null, 'required', null, 'client');
moodleform_mod::standard_intro_elements();
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes, $pluginconfig->maxbytes);
$mform->addElement('select', 'maxbytes', get_string('maxattachmentsize', 'dialogue'), $choices);
$mform->addHelpButton('maxbytes', 'maxattachmentsize', 'dialogue');
$mform->setDefault('maxbytes', $pluginconfig->maxbytes);
$choices = range(0, $pluginconfig->maxattachments);
$choices[0] = get_string('uploadnotallowed');
$mform->addElement('select', 'maxattachments', get_string('maxattachments', 'dialogue'), $choices);
$mform->addHelpButton('maxattachments', 'maxattachments', 'dialogue');
$mform->setDefault('maxattachments', $pluginconfig->maxattachments);
$mform->addElement('checkbox', 'usecoursegroups', get_string('usecoursegroups', 'dialogue'));
$mform->addHelpButton('usecoursegroups', 'usecoursegroups', 'dialogue');
$mform->setDefault('usecoursegroups', 0);
$this->standard_grading_coursemodule_elements();
$this->standard_coursemodule_elements();
$this->add_action_buttons();
}
示例5: definition
/**
* Defines the teamwork instance configuration form
*
* @return void
*/
public function definition()
{
global $CFG;
$teamworkconfig = get_config('teamwork');
$mform = $this->_form;
// General --------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
// Teamwork name
$label = get_string('teamworkname', 'teamwork');
$mform->addElement('text', 'name', $label, array('size' => '64'));
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('name', PARAM_TEXT);
} else {
$mform->setType('name', PARAM_CLEANHTML);
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
// Introduction
$this->add_intro_editor(false, get_string('introduction', 'teamwork'));
// Grading settings -----------------------------------------------------------
$mform->addElement('header', 'gradingsettings', get_string('gradingsettings', 'teamwork'));
$label = get_string('strategy', 'teamwork');
$mform->addElement('select', 'strategy', $label, teamwork::available_strategies_list());
$mform->setDefault('strategy', $teamworkconfig->strategy);
$mform->addHelpButton('strategy', 'strategy', 'teamwork');
$options = array();
for ($i = 5; $i >= 0; $i--) {
$options[$i] = $i;
}
$label = get_string('gradedecimals', 'teamwork');
$mform->addElement('select', 'gradedecimals', $label, $options);
$mform->setDefault('gradedecimals', $teamworkconfig->gradedecimals);
// Submission settings --------------------------------------------------------
$mform->addElement('header', 'submissionsettings', get_string('submissionsettings', 'teamwork'));
$options = get_max_upload_sizes($CFG->maxbytes, $this->course->maxbytes, 0, $teamworkconfig->maxbytes);
$mform->addElement('select', 'maxbytes', get_string('maxbytes', 'teamwork'), $options);
$mform->setDefault('maxbytes', $teamworkconfig->maxbytes);
// Participation settings --------------------------------------------------------
$mform->addElement('header', 'participationsettings', get_string('participationsettings', 'teamwork'));
$options = array();
for ($i = 1; $i <= 10; $i++) {
$options[$i] = $i;
}
$mform->addElement('select', 'participationnumlimit', get_string('participationnumlimit', 'teamwork'), $options);
$mform->addHelpButton('participationnumlimit', 'participationnumlimit', 'teamwork');
// Date settings---------------------------------------------------------------
$mform->addElement('header', 'datecontrol', get_string('datesettings', 'teamwork'));
$label = get_string('applystart', 'teamwork');
$mform->addElement('date_time_selector', 'applystart', $label, array('optional' => false));
$label = get_string('applyend', 'teamwork');
$mform->addElement('date_time_selector', 'applyend', $label, array('optional' => false));
// Common module settings, Restrict availability, Activity completion etc. ----
$this->_features = array('groups' => false, 'groupings' => false, 'outcomes' => true, 'gradecat' => false, 'idnumber' => true);
$this->standard_coursemodule_elements();
// Standard buttons, common to all modules ------------------------------------
$this->add_action_buttons();
}
示例6: definition_file_settings
/**
*
*/
protected function definition_file_settings()
{
global $CFG;
$mform =& $this->_form;
// File settings.
$mform->addElement('header', 'filesettingshdr', get_string('filesettings', 'dataform'));
// Max bytes (param1).
$options = get_max_upload_sizes($CFG->maxbytes, $this->_field->df->course->maxbytes);
$mform->addElement('select', 'param1', get_string('filemaxsize', 'dataform'), $options);
// Max files (param2).
$range = range(1, 100);
$options = array_combine($range, $range);
$options[-1] = get_string('unlimited');
$mform->addElement('select', 'param2', get_string('filesmax', 'dataform'), $options);
$mform->setDefault('param2', -1);
// Accetped types.
$this->definition_filetypes();
}
示例7: definition_inner
/**
* Add question-type specific form fields.
*
* @param MoodleQuickForm $mform the form being built.
*/
function definition_inner(&$mform)
{
global $COURSE, $CFG;
// don't need these default elements :
$mform->removeElement('defaultgrade');
$mform->removeElement('penalty');
// add feedback
$mform->addElement('htmleditor', 'feedback', get_string("feedback", "quiz"));
$mform->setType('feedback', PARAM_RAW);
// add default elements
$mform->addElement('hidden', 'defaultgrade', 0);
$mform->addElement('hidden', 'fraction', 0);
// add max upload limit menu
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
$choices[0] = get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')';
$mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
$mform->setDefault('maxbytes', $COURSE->maxbytes);
// add essay area checkbox
$mform->addElement('advcheckbox', 'essay', get_string('addessay', 'qtype_fileresponse'), null, null, array(0, 1));
}
示例8: get_settings
/**
* Get the default setting for OneNote submission plugin
*
* @param MoodleQuickForm $mform The form to add elements to
* @return void
*/
public function get_settings(MoodleQuickForm $mform)
{
global $CFG, $COURSE;
$defaultmaxfilesubmissions = $this->get_config('maxfilesubmissions');
$defaultmaxsubmissionsizebytes = $this->get_config('maxsubmissionsizebytes');
$settings = array();
$options = array();
for ($i = 1; $i <= \local_onenote\api\base::ASSIGNSUBMISSION_ONENOTE_MAXFILES; $i++) {
$options[$i] = $i;
}
$name = get_string('maxfilessubmission', 'assignsubmission_onenote');
$mform->addElement('select', 'assignsubmission_onenote_maxfiles', $name, $options);
$mform->addHelpButton('assignsubmission_onenote_maxfiles', 'maxfilessubmission', 'assignsubmission_onenote');
$mform->setDefault('assignsubmission_onenote_maxfiles', $defaultmaxfilesubmissions);
$mform->disabledIf('assignsubmission_onenote_maxfiles', 'assignsubmission_onenote_enabled', 'notchecked');
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes, get_config('assignsubmission_onenote', 'maxbytes'));
$settings[] = array('type' => 'select', 'name' => 'maxsubmissionsizebytes', 'description' => get_string('maximumsubmissionsize', 'assignsubmission_onenote'), 'options' => $choices, 'default' => $defaultmaxsubmissionsizebytes);
$name = get_string('maximumsubmissionsize', 'assignsubmission_onenote');
$mform->addElement('select', 'assignsubmission_onenote_maxsizebytes', $name, $choices);
$mform->addHelpButton('assignsubmission_onenote_maxsizebytes', 'maximumsubmissionsize', 'assignsubmission_onenote');
$mform->setDefault('assignsubmission_onenote_maxsizebytes', $defaultmaxsubmissionsizebytes);
$mform->disabledIf('assignsubmission_onenote_maxsizebytes', 'assignsubmission_onenote_enabled', 'notchecked');
}
示例9: admin_setting_configselect
for ($i = 1; $i <= 52; $i++) {
$sectionmenu[$i] = "{$i}";
}
$temp->add(new admin_setting_configselect('moodlecourse/numsections', get_string('numberweeks'), get_string('coursehelpnumberweeks'), 10, $sectionmenu));
$choices = array();
$choices['0'] = get_string('hiddensectionscollapsed');
$choices['1'] = get_string('hiddensectionsinvisible');
$temp->add(new admin_setting_configselect('moodlecourse/hiddensections', get_string('hiddensections'), get_string('coursehelphiddensections'), 0, $choices));
$options = range(0, 10);
$temp->add(new admin_setting_configselect('moodlecourse/newsitems', get_string('newsitemsnumber'), get_string('coursehelpnewsitemsnumber'), 5, $options));
$temp->add(new admin_setting_configselect('moodlecourse/showgrades', get_string('showgrades'), get_string('coursehelpshowgrades'), 1, array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/showreports', get_string('showreports'), '', 0, array(0 => get_string('no'), 1 => get_string('yes'))));
if (isset($CFG->maxbytes)) {
$choices = get_max_upload_sizes($CFG->maxbytes);
} else {
$choices = get_max_upload_sizes();
}
$temp->add(new admin_setting_configselect('moodlecourse/maxbytes', get_string('maximumupload'), get_string('coursehelpmaximumupload'), key($choices), $choices));
$temp->add(new admin_setting_configselect('moodlecourse/metacourse', get_string('metacourse'), get_string('coursehelpmetacourse'), 0, array(0 => get_string('no'), 1 => get_string('yes'))));
///enrolement course settings
$temp->add(new admin_setting_heading('enrolhdr', get_string('enrolments'), ''));
require_once $CFG->dirroot . '/enrol/enrol.class.php';
$choices = array();
$modules = explode(',', $CFG->enrol_plugins_enabled);
foreach ($modules as $module) {
$name = get_string('enrolname', "enrol_{$module}");
$plugin = enrolment_factory::factory($module);
if (method_exists($plugin, 'print_entry')) {
$choices[$name] = $module;
}
}
示例10: stdClass
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once $CFG->dirroot . '/mod/forumng/mod_forumng.php';
$module = new stdClass();
require $CFG->dirroot . '/mod/forumng/version.php';
$settings->add(new admin_setting_heading('forumng_version', '', get_string('displayversion', 'forumng', $module->displayversion)));
$settings->add(new admin_setting_configcheckbox('forumng_replytouser', get_string('replytouser', 'forumng'), get_string('configreplytouser', 'forumng'), 1));
$settings->add(new admin_setting_configtext('forumng_usebcc', get_string('usebcc', 'forumng'), get_string('configusebcc', 'forumng'), 0, PARAM_INT));
$settings->add(new admin_setting_configtext('forumng_donotmailafter', get_string('donotmailafter', 'forumng'), get_string('configdonotmailafter', 'forumng'), 48, PARAM_INT));
// Number of discussions on a page
$settings->add(new admin_setting_configtext('forumng_discussionsperpage', get_string('discussionsperpage', 'forumng'), get_string('configdiscussionsperpage', 'forumng'), 20, PARAM_INT));
if (isset($CFG->maxbytes)) {
$sizes = get_max_upload_sizes($CFG->maxbytes);
} else {
$sizes = get_max_upload_sizes(0);
}
unset($sizes[0]);
$sizes[-1] = get_string('forbidattachments', 'forumng');
$settings->add(new admin_setting_configselect('forumng_attachmentmaxbytes', get_string('attachmentmaxbytes', 'forumng'), get_string('configattachmentmaxbytes', 'forumng'), 512000, $sizes));
// Option about read tracking
$settings->add(new admin_setting_configcheckbox('forumng_trackreadposts', get_string('trackreadposts', 'forumng'), get_string('configtrackreadposts', 'forumng'), 1));
// Number of days that a post is considered old and we don't store unread data
$settings->add(new admin_setting_configtext('forumng_readafterdays', get_string('readafterdays', 'forumng'), get_string('configreadafterdays', 'forumng'), 60, PARAM_INT));
// RSS feeds
if (empty($CFG->enablerssfeeds)) {
$options = array(0 => get_string('rssglobaldisabled', 'admin'));
$str = get_string('configenablerssfeeds', 'forumng') . '<br />' . get_string('configenablerssfeedsdisabled2', 'admin');
} else {
$options = array(0 => get_string('no'), 1 => get_string('yes'));
$str = get_string('configenablerssfeeds', 'forumng');
示例11: defined
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Configure site-wide settings specific to the Dialogue modue
*
* Note: the only setting currently relates to unread-post tracking - this will only be
* supported in your courses if you have applied the patch in CONTRIB-1134 which modifies
* course/lib.php to check and display unread post counts in the course/topic area.
* If you havent applied that patch this setting will still be stored in Moodle but it
* will have no effect on the display of your courses, ie users will not see an unread
* posts count
*
* @package mod_dialogue
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
require_once $CFG->dirroot . '/mod/dialogue/lib.php';
// whether to provide unread post count
$settings->add(new admin_setting_configcheckbox('dialogue/trackunread', new lang_string('configtrackunread', 'dialogue'), '', 1));
// Default total maxbytes of attached files
if (isset($CFG->maxbytes)) {
$settings->add(new admin_setting_configselect('dialogue/maxbytes', new lang_string('maxattachmentsize', 'dialogue'), new lang_string('configmaxbytes', 'dialogue'), 512000, get_max_upload_sizes($CFG->maxbytes)));
}
$choices = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20);
// Default number of attachments allowed per post in all dialogues
$settings->add(new admin_setting_configselect('dialogue/maxattachments', new lang_string('maxattachments', 'dialogue'), new lang_string('configmaxattachments', 'dialogue'), 5, $choices));
$settings->add(new admin_setting_configcheckbox('dialogue/viewconversationsbyrole', new lang_string('viewconversationsbyrole', 'dialogue'), new lang_string('configviewconversationsbyrole', 'dialogue'), 0));
}
示例12: admin_setting_configcheckbox
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file defines the admin settings for this plugin
*
* @package assignsubmission_file
* @copyright 2012 NetSpot {@link http://www.netspot.com.au}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Note: This is on by default.
$settings->add(new admin_setting_configcheckbox('assignsubmission_file/default', new lang_string('default', 'assignsubmission_file'), new lang_string('default_help', 'assignsubmission_file'), 1));
if (isset($CFG->maxbytes)) {
$name = new lang_string('maximumsubmissionsize', 'assignsubmission_file');
$description = new lang_string('configmaxbytes', 'assignsubmission_file');
$maxbytes = get_config('assignsubmission_file', 'maxbytes');
$element = new admin_setting_configselect('assignsubmission_file/maxbytes', $name, $description, 1048576, get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes));
$settings->add($element);
}
示例13: definition
function definition()
{
global $CFG, $FORUM_TYPES, $COURSE;
$mform =& $this->_form;
//-------------------------------------------------------------------------------
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('text', 'name', get_string('forumname', 'forum'), array('size' => '64'));
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
asort($FORUM_TYPES);
$mform->addElement('select', 'type', get_string('forumtype', 'forum'), $FORUM_TYPES);
$mform->setHelpButton('type', array('forumtype', get_string('forumtype', 'forum'), 'forum'));
$mform->setDefault('type', 'general');
$mform->addElement('htmleditor', 'intro', get_string('forumintro', 'forum'));
$mform->setType('intro', PARAM_RAW);
$mform->addRule('intro', get_string('required'), 'required', null, 'client');
$mform->setHelpButton('intro', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton');
$options = array();
$options[0] = get_string('no');
$options[1] = get_string('yesforever', 'forum');
$options[FORUM_INITIALSUBSCRIBE] = get_string('yesinitially', 'forum');
$options[FORUM_DISALLOWSUBSCRIBE] = get_string('disallowsubscribe', 'forum');
$mform->addElement('select', 'forcesubscribe', get_string('forcesubscribeq', 'forum'), $options);
$mform->setHelpButton('forcesubscribe', array('subscription2', get_string('forcesubscribeq', 'forum'), 'forum'));
$options = array();
$options[FORUM_TRACKING_OPTIONAL] = get_string('trackingoptional', 'forum');
$options[FORUM_TRACKING_OFF] = get_string('trackingoff', 'forum');
$options[FORUM_TRACKING_ON] = get_string('trackingon', 'forum');
$mform->addElement('select', 'trackingtype', get_string('trackingtype', 'forum'), $options);
$mform->setHelpButton('trackingtype', array('trackingtype', get_string('trackingtype', 'forum'), 'forum'));
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
$choices[1] = get_string('uploadnotallowed');
$choices[0] = get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')';
$mform->addElement('select', 'maxbytes', get_string('maxattachmentsize', 'forum'), $choices);
$mform->setHelpButton('maxbytes', array('maxattachmentsize', get_string('maxattachmentsize', 'forum'), 'forum'));
$mform->setDefault('maxbytes', $CFG->forum_maxbytes);
if ($CFG->enablerssfeeds && isset($CFG->forum_enablerssfeeds) && $CFG->forum_enablerssfeeds) {
//-------------------------------------------------------------------------------
$mform->addElement('header', '', get_string('rss'));
$choices = array();
$choices[0] = get_string('none');
$choices[1] = get_string('discussions', 'forum');
$choices[2] = get_string('posts', 'forum');
$mform->addElement('select', 'rsstype', get_string('rsstype'), $choices);
$mform->setHelpButton('rsstype', array('rsstype', get_string('rsstype'), 'forum'));
$choices = array();
$choices[0] = '0';
$choices[1] = '1';
$choices[2] = '2';
$choices[3] = '3';
$choices[4] = '4';
$choices[5] = '5';
$choices[10] = '10';
$choices[15] = '15';
$choices[20] = '20';
$choices[25] = '25';
$choices[30] = '30';
$choices[40] = '40';
$choices[50] = '50';
$mform->addElement('select', 'rssarticles', get_string('rssarticles'), $choices);
$mform->setHelpButton('rssarticles', array('rssarticles', get_string('rssarticles'), 'forum'));
}
//-------------------------------------------------------------------------------
$mform->addElement('header', '', get_string('grade'));
$mform->addElement('checkbox', 'assessed', get_string('allowratings', 'forum'), get_string('ratingsuse', 'forum'));
$mform->addElement('modgrade', 'scale', get_string('grade'), false);
$mform->disabledIf('scale', 'assessed');
$mform->addElement('checkbox', 'ratingtime', get_string('ratingtime', 'forum'));
$mform->disabledIf('ratingtime', 'assessed');
$mform->addElement('date_time_selector', 'assesstimestart', get_string('from'));
$mform->disabledIf('assesstimestart', 'assessed');
$mform->disabledIf('assesstimestart', 'ratingtime');
$mform->addElement('date_time_selector', 'assesstimefinish', get_string('to'));
$mform->disabledIf('assesstimefinish', 'assessed');
$mform->disabledIf('assesstimefinish', 'ratingtime');
//-------------------------------------------------------------------------------
$mform->addElement('header', '', get_string('blockafter', 'forum'));
$options = array();
$options[0] = get_string('blockperioddisabled', 'forum');
$options[60 * 60 * 24] = '1 ' . get_string('day');
$options[60 * 60 * 24 * 2] = '2 ' . get_string('days');
$options[60 * 60 * 24 * 3] = '3 ' . get_string('days');
$options[60 * 60 * 24 * 4] = '4 ' . get_string('days');
$options[60 * 60 * 24 * 5] = '5 ' . get_string('days');
$options[60 * 60 * 24 * 6] = '6 ' . get_string('days');
$options[60 * 60 * 24 * 7] = '1 ' . get_string('week');
$mform->addElement('select', 'blockperiod', get_string("blockperiod", "forum"), $options);
$mform->setHelpButton('blockperiod', array('manageposts', get_string('blockperiod', 'forum'), 'forum'));
$mform->addElement('text', 'blockafter', get_string('blockafter', 'forum'));
$mform->setType('blockafter', PARAM_INT);
$mform->setDefault('blockafter', '0');
$mform->addRule('blockafter', null, 'numeric', null, 'client');
$mform->setHelpButton('blockafter', array('manageposts', get_string('blockafter', 'forum'), 'forum'));
$mform->disabledIf('blockafter', 'blockperiod', 'eq', 0);
$mform->addElement('text', 'warnafter', get_string('warnafter', 'forum'));
$mform->setType('warnafter', PARAM_INT);
$mform->setDefault('warnafter', '0');
$mform->addRule('warnafter', null, 'numeric', null, 'client');
$mform->setHelpButton('warnafter', array('manageposts', get_string('warnafter', 'forum'), 'forum'));
//.........这里部分代码省略.........
示例14: admin_setting_configiplist
$temp->add(new admin_setting_configiplist('allowedip', new lang_string('allowediplist', 'admin'), new lang_string('ipblockersyntax', 'admin'), ''));
$temp->add(new admin_setting_configiplist('blockedip', new lang_string('blockediplist', 'admin'), new lang_string('ipblockersyntax', 'admin'), ''));
$ADMIN->add('security', $temp);
// "sitepolicies" settingpage
$temp = new admin_settingpage('sitepolicies', new lang_string('sitepolicies', 'admin'));
$temp->add(new admin_setting_configcheckbox('protectusernames', new lang_string('protectusernames', 'admin'), new lang_string('configprotectusernames', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('forcelogin', new lang_string('forcelogin', 'admin'), new lang_string('configforcelogin', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', new lang_string('forceloginforprofiles', 'admin'), new lang_string('configforceloginforprofiles', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', new lang_string('forceloginforprofileimage', 'admin'), new lang_string('forceloginforprofileimage_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('opentogoogle', new lang_string('opentogoogle', 'admin'), new lang_string('configopentogoogle', 'admin'), 0));
$temp->add(new admin_setting_pickroles('profileroles', new lang_string('profileroles', 'admin'), new lang_string('configprofileroles', 'admin'), array('student', 'teacher', 'editingteacher')));
$maxbytes = 0;
if (!empty($CFG->maxbytes)) {
$maxbytes = $CFG->maxbytes;
}
$max_upload_choices = get_max_upload_sizes(0, 0, 0, $maxbytes);
// maxbytes set to 0 will allow the maximum server limit for uploads
$temp->add(new admin_setting_configselect('maxbytes', new lang_string('maxbytes', 'admin'), new lang_string('configmaxbytes', 'admin'), 0, $max_upload_choices));
// 100MB
$defaultuserquota = 104857600;
$params = new stdClass();
$params->bytes = $defaultuserquota;
$params->displaysize = display_size($defaultuserquota);
$temp->add(new admin_setting_configtext('userquota', new lang_string('userquota', 'admin'), new lang_string('configuserquota', 'admin', $params), $defaultuserquota));
$temp->add(new admin_setting_configcheckbox('allowobjectembed', new lang_string('allowobjectembed', 'admin'), new lang_string('configallowobjectembed', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('enabletrusttext', new lang_string('enabletrusttext', 'admin'), new lang_string('configenabletrusttext', 'admin'), 0));
$temp->add(new admin_setting_configselect('maxeditingtime', new lang_string('maxeditingtime', 'admin'), new lang_string('configmaxeditingtime', 'admin'), 1800, array(60 => new lang_string('numminutes', '', 1), 300 => new lang_string('numminutes', '', 5), 900 => new lang_string('numminutes', '', 15), 1800 => new lang_string('numminutes', '', 30), 2700 => new lang_string('numminutes', '', 45), 3600 => new lang_string('numminutes', '', 60))));
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', new lang_string('extendedusernamechars', 'admin'), new lang_string('configextendedusernamechars', 'admin'), 0));
$temp->add(new admin_setting_configtext('sitepolicy', new lang_string('sitepolicy', 'admin'), new lang_string('sitepolicy_help', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtext('sitepolicyguest', new lang_string('sitepolicyguest', 'admin'), new lang_string('sitepolicyguest_help', 'admin'), isset($CFG->sitepolicy) ? $CFG->sitepolicy : '', PARAM_RAW));
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', new lang_string('extendedusernamechars', 'admin'), new lang_string('configextendedusernamechars', 'admin'), 0));
示例15: admin_setting_configselect
$settings->add(new admin_setting_configselect('workshop/grade', get_string('submissiongrade', 'workshop'),
get_string('configgrade', 'workshop'), 80, $grades));
$settings->add(new admin_setting_configselect('workshop/gradinggrade', get_string('gradinggrade', 'workshop'),
get_string('configgradinggrade', 'workshop'), 20, $grades));
$options = array();
for ($i = 5; $i >= 0; $i--) {
$options[$i] = $i;
}
$settings->add(new admin_setting_configselect('workshop/gradedecimals', get_string('gradedecimals', 'workshop'),
get_string('configgradedecimals', 'workshop'), 0, $options));
if (isset($CFG->maxbytes)) {
$options = get_max_upload_sizes($CFG->maxbytes);
$settings->add(new admin_setting_configselect('workshop/maxbytes', get_string('maxbytes', 'workshop'),
get_string('configmaxbytes', 'workshop'), 0, $options));
}
$settings->add(new admin_setting_configselect('workshop/strategy', get_string('strategy', 'workshop'),
get_string('configstrategy', 'workshop'), 'accumulative', workshop::available_strategies_list()));
$options = workshop::available_example_modes_list();
$settings->add(new admin_setting_configselect('workshop/examplesmode', get_string('examplesmode', 'workshop'),
get_string('configexamplesmode', 'workshop'), workshop::EXAMPLES_VOLUNTARY, $options));
// include the settings of allocation subplugins
$allocators = get_plugin_list('workshopallocation');
foreach ($allocators as $allocator => $path) {
if (file_exists($settingsfile = $path . '/settings.php')) {