本文整理汇总了PHP中admin_setting_configtext类的典型用法代码示例。如果您正苦于以下问题:PHP admin_setting_configtext类的具体用法?PHP admin_setting_configtext怎么用?PHP admin_setting_configtext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了admin_setting_configtext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_text
public function add_text($setting, $default = '')
{
$text = new admin_setting_configtext($this->name_for($setting), $this->title_for($setting), $this->description_for($setting), $default);
$text->set_updatedcallback('theme_reset_all_caches');
$this->settingspage->add($text);
}
示例2: admin_setting_special_backupsaveto
function admin_setting_special_backupsaveto()
{
$name = 'backup_sche_destination';
$visiblename = get_string('saveto');
$description = get_string('backupsavetohelp');
parent::admin_setting_configtext($name, $visiblename, $description, '');
}
示例3: add_texts
public function add_texts($setting, $instance, $default = '')
{
$text = new admin_setting_configtext($this->name_for($setting . $instance), $this->title_for($setting, $instance), $this->description_for($setting), $default);
$text->set_updatedcallback('theme_reset_all_caches');
return $text;
}
示例4: array
$timezone = 0;
} else {
if ($timezone > 0) {
$timezone = $timezone - 24;
}
}
$options = array();
for ($i = 0; $i <= 23; $i++) {
$options[($i - $timezone) % 24] = gmdate('H:i', $i * HOURSECS);
}
$settings->add(new admin_setting_configmultiselect('hotpot_enablecron', get_string('enablecron', 'mod_hotpot'), get_string('configenablecron', 'mod_hotpot'), array(), $options));
// enable embedding of swf media objects inhotpot quizzes (default=1)
$settings->add(new admin_setting_configcheckbox('hotpot_enableswf', get_string('enableswf', 'mod_hotpot'), get_string('configenableswf', 'mod_hotpot'), 1));
// enable obfuscation of javascript in html files (default=1)
$settings->add(new admin_setting_configcheckbox('hotpot_enableobfuscate', get_string('enableobfuscate', 'mod_hotpot'), get_string('configenableobfuscate', 'mod_hotpot'), 1));
$options = array(hotpot::BODYSTYLES_BACKGROUND => get_string('bodystylesbackground', 'mod_hotpot'), hotpot::BODYSTYLES_COLOR => get_string('bodystylescolor', 'mod_hotpot'), hotpot::BODYSTYLES_FONT => get_string('bodystylesfont', 'mod_hotpot'), hotpot::BODYSTYLES_MARGIN => get_string('bodystylesmargin', 'mod_hotpot'));
$settings->add(new admin_setting_configmultiselect('hotpot_bodystyles', get_string('bodystyles', 'mod_hotpot'), get_string('configbodystyles', 'mod_hotpot'), array(), $options));
// hotpot navigation frame height (default=85)
$settings->add(new admin_setting_configtext('hotpot_frameheight', get_string('frameheight', 'mod_hotpot'), get_string('configframeheight', 'mod_hotpot'), 85, PARAM_INT, 4));
// lock hotpot navigation frame so it is not scrollable (default=0)
$settings->add(new admin_setting_configcheckbox('hotpot_lockframe', get_string('lockframe', 'mod_hotpot'), get_string('configlockframe', 'mod_hotpot'), 0));
// store raw xml details of HotPot quiz attempts (default=1)
$str = get_string('cleardetails', 'mod_hotpot');
$url = new moodle_url('/mod/hotpot/tools/clear_details.php', array('sesskey' => sesskey()));
$link = html_writer::link($url, $str, array('class' => 'small', 'style' => 'white-space: nowrap', 'onclick' => "this.target='_blank'")) . "\n";
$settings->add(new admin_setting_configcheckbox('hotpot_storedetails', get_string('storedetails', 'mod_hotpot'), get_string('configstoredetails', 'mod_hotpot') . ' ' . $link, 0));
// maximum duration of a single calendar event (default=5 mins)
$setting = new admin_setting_configtext('hotpot_maxeventlength', get_string('maxeventlength', 'mod_hotpot'), get_string('configmaxeventlength', 'mod_hotpot'), 5, PARAM_INT, 4);
$setting->set_updatedcallback('hotpot_refresh_events');
$settings->add($setting);
unset($i, $link, $options, $setting, $str, $timezone, $datetime, $url);
示例5: defined
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Defines the form for editing activity results block instances.
*
* @package block_activity_results
* @copyright 2016 Stephen Bourget
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// Default high scores.
$setting = new admin_setting_configtext('block_activity_results/config_showbest', new lang_string('defaulthighestgrades', 'block_activity_results'), new lang_string('defaulthighestgrades_desc', 'block_activity_results'), 3, PARAM_INT);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Default low scores.
$setting = new admin_setting_configtext('block_activity_results/config_showworst', new lang_string('defaultlowestgrades', 'block_activity_results'), new lang_string('defaultlowestgrades_desc', 'block_activity_results'), 0, PARAM_INT);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Default group display.
$yesno = array(0 => get_string('no'), 1 => get_string('yes'));
$setting = new admin_setting_configselect('block_activity_results/config_usegroups', new lang_string('defaultshowgroups', 'block_activity_results'), new lang_string('defaultshowgroups_desc', 'block_activity_results'), 0, $yesno);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Default privacy settings.
$nameoptions = array(B_ACTIVITYRESULTS_NAME_FORMAT_FULL => get_string('config_names_full', 'block_activity_results'), B_ACTIVITYRESULTS_NAME_FORMAT_ID => get_string('config_names_id', 'block_activity_results'), B_ACTIVITYRESULTS_NAME_FORMAT_ANON => get_string('config_names_anon', 'block_activity_results'));
$setting = new admin_setting_configselect('block_activity_results/config_nameformat', new lang_string('defaultnameoptions', 'block_activity_results'), new lang_string('defaultnameoptions_desc', 'block_activity_results'), B_ACTIVITYRESULTS_NAME_FORMAT_FULL, $nameoptions);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Default grade display settings.
$gradeoptions = array(B_ACTIVITYRESULTS_GRADE_FORMAT_PCT => get_string('config_format_percentage', 'block_activity_results'), B_ACTIVITYRESULTS_GRADE_FORMAT_FRA => get_string('config_format_fraction', 'block_activity_results'), B_ACTIVITYRESULTS_GRADE_FORMAT_ABS => get_string('config_format_absolute', 'block_activity_results'));
$setting = new admin_setting_configselect('block_activity_results/config_gradeformat', new lang_string('defaultgradedisplay', 'block_activity_results'), new lang_string('defaultgradedisplay_desc', 'block_activity_results'), B_ACTIVITYRESULTS_GRADE_FORMAT_PCT, $gradeoptions);
示例6: array
<?php
// This file defines settingpages and externalpages under the "appearance" category
$capabilities = array('moodle/my:configsyspages', 'moodle/tag:manage');
if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
// speedup for non-admins, add all caps used on this page
$ADMIN->add('appearance', new admin_category('themes', new lang_string('themes')));
// "themesettings" settingpage
$temp = new admin_settingpage('themesettings', new lang_string('themesettings', 'admin'));
$setting = new admin_setting_configtext('themelist', new lang_string('themelist', 'admin'), new lang_string('configthemelist', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$setting = new admin_setting_configcheckbox('themedesignermode', new lang_string('themedesignermode', 'admin'), new lang_string('configthemedesignermode', 'admin'), 0);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
$temp->add(new admin_setting_configcheckbox('allowuserthemes', new lang_string('allowuserthemes', 'admin'), new lang_string('configallowuserthemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowcoursethemes', new lang_string('allowcoursethemes', 'admin'), new lang_string('configallowcoursethemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowcategorythemes', new lang_string('allowcategorythemes', 'admin'), new lang_string('configallowcategorythemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowthemechangeonurl', new lang_string('allowthemechangeonurl', 'admin'), new lang_string('configallowthemechangeonurl', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'), new lang_string('configallowuserblockhiding', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('allowblockstodock', new lang_string('allowblockstodock', 'admin'), new lang_string('configallowblockstodock', 'admin'), 1));
$temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'), new lang_string('configcustommenuitems', 'admin'), '', PARAM_RAW, '50', '10'));
$temp->add(new admin_setting_configtextarea('customusermenuitems', new lang_string('customusermenuitems', 'admin'), new lang_string('configcustomusermenuitems', 'admin'), 'grades,grades|/grade/report/mygrades.php|grades
messages,message|/message/index.php|message
preferences,moodle|/user/preferences.php|preferences', PARAM_RAW, '50', '10'));
$temp->add(new admin_setting_configcheckbox('enabledevicedetection', new lang_string('enabledevicedetection', 'admin'), new lang_string('configenabledevicedetection', 'admin'), 1));
$temp->add(new admin_setting_devicedetectregex('devicedetectregex', new lang_string('devicedetectregex', 'admin'), new lang_string('devicedetectregex_desc', 'admin'), ''));
$ADMIN->add('themes', $temp);
$ADMIN->add('themes', new admin_externalpage('themeselector', new lang_string('themeselector', 'admin'), $CFG->wwwroot . '/theme/index.php'));
// settings for each theme
foreach (core_component::get_plugin_list('theme') as $theme => $themedir) {
示例7: dirname
require_once dirname(__FILE__) . '/lib.php';
// Start of "scheduling" section
$settings->add(new admin_setting_heading('dhexport_version1elis/scheduling', get_string('exportfilesheading', 'dhexport_version1elis'), ''));
// Export filename settings
$settings->add(new admin_setting_configtext('dhexport_version1elis/export_path', get_string('export_path', 'dhexport_version1elis'), get_string('config_export_path', 'dhexport_version1elis'), '/datahub/dhexport_version1elis'));
$settings->add(new admin_setting_configtext('dhexport_version1elis/export_file', get_string('export_file', 'dhexport_version1elis'), get_string('config_export_file', 'dhexport_version1elis'), 'export_version1elis.csv'));
// Timestamp export file
$settings->add(new admin_setting_configcheckbox('dhexport_version1elis/export_file_timestamp', get_string('export_file_timestamp_label', 'dhexport_version1elis'), get_string('config_export_file_timestamp', 'dhexport_version1elis'), 1));
// Start of "logging" section
$settings->add(new admin_setting_heading('dhexport_version1elis/logging', get_string('logging', 'dhexport_version1elis'), ''));
// Log file location
$settings->add(new admin_setting_configtext('dhexport_version1elis/logfilelocation', get_string('logfilelocation', 'dhexport_version1elis'), get_string('configlogfilelocation', 'dhexport_version1elis'), RLIP_DEFAULT_LOG_PATH));
// Email notification
$settings->add(new admin_setting_configtext('dhexport_version1elis/emailnotification', get_string('emailnotification', 'dhexport_version1elis'), get_string('configemailnotification', 'dhexport_version1elis'), ''));
/**
* Time period settings
*/
// Header
$headerstring = get_string('timeperiodheader', 'dhexport_version1elis');
$settings->add(new admin_setting_heading('dhexport_version1elis_timeperiod', $headerstring, ''));
// Checkbox for enabling
$displaystring = get_string('nonincremental', 'dhexport_version1elis');
$infostring = get_string('confignonincremental', 'dhexport_version1elis');
$settings->add(new admin_setting_configcheckbox('dhexport_version1elis/nonincremental', $displaystring, $infostring, 0));
// Time delta
$displaystring = get_string('incrementaldelta', 'dhexport_version1elis');
$infostring = get_string('configincrementaldelta', 'dhexport_version1elis');
$setting = new admin_setting_configtext('dhexport_version1elis/incrementaldelta', $displaystring, $infostring, '1d');
// Callback to sanitize time delta
$setting->set_updatedcallback('rlipexport_version1elis_incrementaldelta_updatedcallback');
$settings->add($setting);
示例8: write_setting
public function write_setting($data)
{
// your custom validation logic here
if ($data == '') {
$data = random_string(60);
}
return parent::write_setting($data);
}
示例9: __construct
/**
* @param string $name
* @param string $visiblename
* @param string $description
* @param mixed $defaultsetting string or array
* @param mixed $paramtype
*/
public function __construct($name, $visiblename, $description, $defaultsetting, $paramtype = PARAM_RAW, $cols = '60', $rows = '8', $filearea = 'bcumarketingimages')
{
$this->rows = $rows;
$this->cols = $cols;
$this->filearea = $filearea;
parent::__construct($name, $visiblename, $description, $defaultsetting, $paramtype);
editors_head_setup();
}
示例10: config_write
public function config_write($name, $value)
{
if ($value === '') {
// We do not want empty values in config table,
// delete it instead.
$value = null;
}
return parent::config_write($name, $value);
}
示例11: validate
public function validate($data)
{
global $PAGE;
// Don't force the plugin to be fully set up when installing.
if ($PAGE->pagelayout === 'maintenance' && strlen($data) === 0) {
return true;
}
return parent::validate($data);
}
示例12: __construct
/**
* Config text constructor
*
* @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting'
* for ones in config_plugins.
* @param string $visiblename localised
* @param string $description long localised info
* @param string $defaultsetting
* @param mixed $paramtype int means PARAM_XXX type, string is a allowed format in regex
* @param int $size default field size
*/
public function __construct($name, $visiblename, $description, $defaultsetting, $paramtype = PARAM_RAW_TRIMMED, $size = null)
{
$this->paramtype = $paramtype;
if (!is_null($size)) {
$this->size = $size;
} else {
$this->size = $paramtype === PARAM_INT ? 5 : 30;
}
parent::__construct($name, $visiblename, $description, $defaultsetting);
}
示例13: validate
/**
* Validate data.
*
* @param string $data
* @return mixed True on success, else error message
*/
public function validate($data)
{
$result = parent::validate($data);
if ($result !== true) {
return $result;
}
if ((int) $data < 1) {
return get_string('awaittimeerror', 'realtimequiz');
}
return true;
}
示例14: validate
/**
* Validate data.
*
* This ensures that key ID is specified if URL is provided
*
* @param string $data
* @return mixed True on success, else error message.
*/
public function validate($data)
{
$result = parent::validate($data);
if ($result !== true) {
return $result;
}
$url = get_config('filter_cloudfront_signurl', 'distributionurl');
if ($url != '' && empty($data)) {
return get_string('errornokeyid', 'filter_cloudfront_signurl');
}
return true;
}
示例15:
/**
* Set the cron field for the gdata block record
* to the number of sections set in this setting.
*
* @return boolean
**/
function config_write($name, $value)
{
global $DB;
if (empty($value)) {
$cron = 0;
} else {
$cron = $value * MINSECS;
}
if ($DB->set_field('block', 'cron', $cron, array('name' => 'gdata'))) {
return parent::config_write($name, $value);
}
return false;
}