本文整理汇总了PHP中admin_setting_configselect类的典型用法代码示例。如果您正苦于以下问题:PHP admin_setting_configselect类的具体用法?PHP admin_setting_configselect怎么用?PHP admin_setting_configselect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了admin_setting_configselect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Constants from "locallib.php".
$options = array('none' => get_string('attemptreopenmethod_none', 'mod_assign'), 'manual' => get_string('attemptreopenmethod_manual', 'mod_assign'), 'untilpass' => get_string('attemptreopenmethod_untilpass', 'mod_assign'));
$name = new lang_string('attemptreopenmethod', 'mod_assign');
$description = new lang_string('attemptreopenmethod_help', 'mod_assign');
$setting = new admin_setting_configselect('assign/attemptreopenmethod', $name, $description, 'none', $options);
$setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
// Constants from "locallib.php".
$options = array(-1 => get_string('unlimitedattempts', 'mod_assign'));
$options += array_combine(range(1, 30), range(1, 30));
$name = new lang_string('maxattempts', 'mod_assign');
$description = new lang_string('maxattempts_help', 'mod_assign');
$setting = new admin_setting_configselect('assign/maxattempts', $name, $description, -1, $options);
$setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
$name = new lang_string('teamsubmission', 'mod_assign');
$description = new lang_string('teamsubmission_help', 'mod_assign');
$setting = new admin_setting_configcheckbox('assign/teamsubmission', $name, $description, 0);
$setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
$name = new lang_string('preventsubmissionnotingroup', 'mod_assign');
$description = new lang_string('preventsubmissionnotingroup_help', 'mod_assign');
$setting = new admin_setting_configcheckbox('assign/preventsubmissionnotingroup', $name, $description, 0);
$setting->set_advanced_flag_options(admin_setting_flag::ENABLED, false);
$setting->set_locked_flag_options(admin_setting_flag::ENABLED, false);
$settings->add($setting);
示例2: get_site
}
$course = get_site();
$role = get_default_course_role($course);
$defaultroleid = $role->id;
$item = new admin_setting_configcheckbox('block_fn_site_groups_enabled', get_string('fn_site_groups_enabled', 'block_fn_site_groups'), get_string('fn_config_site_groups_enabled', 'block_fn_site_groups'), '0');
$item->set_updatedcallback('fn_sg_set_site_group_mode');
$settings->add($item);
$settings->add(new admin_setting_configselect('block_fn_site_groups_defaultroleid', get_string('fn_site_groups_defaultroleid', 'block_fn_site_groups'), get_string('fn_config_site_groups_defaultroleid', 'block_fn_site_groups'), $defaultroleid, $roles));
$settings->add(new admin_setting_configmulticheckbox('block_fn_site_groups_roles', get_string('fn_site_groups_roles', 'block_fn_site_groups'), get_string('fn_config_site_groups_roles', 'block_fn_site_groups'), '0', $roles));
/// These settings don't actually use the $CFG variable, but are used to manage capabilities.
$caps = role_context_capabilities($gmroleid, $context);
$sgusers = array();
if (!empty($caps['block/fn_site_groups:assignowngroupusers'])) {
$sgusers[] = 1;
}
if (!empty($caps['block/fn_site_groups:assignallusers'])) {
$sgusers[] = 2;
}
$CFG->block_fn_site_groups_users = implode(',', $sgusers);
$users = array(1 => get_string('fn_site_groups:assignowngroupusers', 'block_fn_site_groups'), 2 => get_string('fn_site_groups:assignallusers', 'block_fn_site_groups'));
$item = new admin_setting_configmulticheckbox('block_fn_site_groups_users', get_string('fn_site_groups_users', 'block_fn_site_groups'), get_string('fn_config_site_groups_users', 'block_fn_site_groups'), '1', $users);
$item->set_updatedcallback('fn_sg_set_user_capability');
$settings->add($item);
if (!empty($caps['block/fn_site_groups:createnewgroups'])) {
$CFG->block_fn_site_groups_creategroups = 1;
} else {
$CFG->block_fn_site_groups_creategroups = 0;
}
$item = new admin_setting_configselect('block_fn_site_groups_creategroups', get_string('fn_site_groups_creategroups', 'block_fn_site_groups'), get_string('fn_config_site_groups_creategroups', 'block_fn_site_groups'), 1, array(0 => get_string('no'), 1 => get_string('yes')));
$item->set_updatedcallback('fn_sg_set_user_capability');
$settings->add($item);
示例3: add_select
public function add_select($setting, $default, $options)
{
$select = new admin_setting_configselect($this->name_for($setting), $this->title_for($setting), $this->description_for($setting), $default, $options);
$select->set_updatedcallback('theme_reset_all_caches');
$this->settingspage->add($select);
}
示例4: moodle_url
$settings = null;
$readme = new moodle_url('/theme/essentials/README.txt');
$readme = html_writer::link($readme, 'README.txt', array('target' => '_blank'));
$ADMIN->add('themes', new admin_category('theme_essentials', 'Essentials'));
$generalsettings = new admin_settingpage('theme_essentials_general', get_string('generalsettings', 'theme_essentials'));
// Overridden Essential settings.
// Logo file setting.
$name = 'theme_essentials/logo';
$title = get_string('logo', 'theme_essentials');
$description = get_string('logodesc', 'theme_essentials');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'logo');
$setting->set_updatedcallback('theme_reset_all_caches');
$generalsettings->add($setting);
// Custom CSS.
$name = 'theme_essentials/customcss';
$title = get_string('customcss', 'theme_essentials');
$description = get_string('customcssdesc', 'theme_essentials');
$default = '';
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
$setting->set_updatedcallback('theme_reset_all_caches');
$generalsettings->add($setting);
// Essentials settings.
// Front page title style.
$name = 'theme_essentials/frontpagetitlestyle';
$title = get_string('frontpagetitlestyle', 'theme_essentials');
$description = get_string('frontpagetitlestyledesc', 'theme_essentials');
$default = 'inherit';
$setting = new admin_setting_configselect($name, $title, $description, $default, array('inherit' => get_string('inherit', 'theme_essentials'), 'normal' => get_string('normal', 'theme_essentials'), 'italic' => get_string('italic', 'theme_essentials')));
$setting->set_updatedcallback('theme_reset_all_caches');
$generalsettings->add($setting);
$ADMIN->add('theme_essentials', $generalsettings);
示例5: defined
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Shoehorn theme with the underlying Bootstrap theme.
*
* @package theme
* @subpackage majhub
* @copyright © 2016-onwards JHunt in respect to modifications of the Bootstrap theme.
* @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
* @author Based on code originally written by Bas Brands, David Scotson, G J Barnard and many other contributors.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
// Settings.
$settings = null;
$ADMIN->add('themes', new admin_category('theme_majhub', 'majhub'));
$leaderboardsettings = new admin_settingpage('theme_majhub_leaderboards', get_string('leaderboards', 'theme_majhub'));
// The leaderboardcount.
$name = 'theme_majhub/leaderboardcount';
$title = get_string('leaderboardcount', 'theme_majhub');
$description = get_string('leaderboardcount_desc', 'theme_majhub');
$default = 3;
$leaderboardcount = array();
for ($x = 0; $x < 11; $x++) {
$leaderboardcount[$x] = $x;
}
$setting = new admin_setting_configselect($name, $title, $description, $default, $leaderboardcount);
$setting->set_updatedcallback('theme_reset_all_caches');
$leaderboardsettings->add($setting);
$ADMIN->add('theme_majhub', $leaderboardsettings);
示例6: admin_setting_special_debug
function admin_setting_special_debug()
{
$name = 'debug';
$visiblename = get_string('debug', 'admin');
$description = get_string('configdebug', 'admin');
$choices = array(DEBUG_NONE => get_string('debugnone', 'admin'), DEBUG_MINIMAL => get_string('debugminimal', 'admin'), DEBUG_NORMAL => get_string('debugnormal', 'admin'), DEBUG_ALL => get_string('debugall', 'admin'), DEBUG_DEVELOPER => get_string('debugdeveloper', 'admin'));
parent::admin_setting_configselect($name, $visiblename, $description, '', $choices);
}
示例7: admin_setting_configtextarea
$default = '';
$setting = new admin_setting_configtextarea($name, $title, $description, $default, PARAM_TEXT);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
// URL.
$name = 'theme_lambda/carousel_url_' . $i;
$title = get_string('carousel_url', 'theme_lambda');
$description = get_string('carousel_urldesc', 'theme_lambda');
$default = '';
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_URL);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
// Button Text.
$name = 'theme_lambda/carousel_btntext_' . $i;
$title = get_string('carousel_btntext', 'theme_lambda');
$description = get_string('carousel_btntextdesc', 'theme_lambda');
$default = '';
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_TEXT);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
// Color
$name = 'theme_lambda/carousel_color_' . $i;
$title = get_string('carousel_color', 'theme_lambda');
$description = get_string('carousel_colordesc', 'theme_lambda');
$default = '0';
$choices = array('0' => 'green', '1' => 'purple', '2' => 'orange', '3' => 'lightblue', '4' => 'yellow', '5' => 'turquoise');
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
}
$ADMIN->add('theme_lambda', $temp);
示例8: defined
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package elisprogram_enrolrolesync
* @author Remote-Learner.net Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2008-2013 Remote-Learner.net Inc (http://www.remote-learner.net)
*
*/
defined('MOODLE_INTERNAL') || die;
require_once dirname(__FILE__) . '/../../../../config.php';
global $CFG;
require_once $CFG->dirroot . '/local/elisprogram/lib/setup.php';
require_once elispm::lib('lib.php');
require_once elispm::file('plugins/enrolrolesync/lib.php');
if ($ADMIN->fulltree) {
$options = array(0 => get_string('no_default_role', 'local_elisprogram'));
pm_get_select_roles_for_contexts($options, array(CONTEXT_ELIS_CLASS));
//setting header
$settings->add(new admin_setting_heading('elisprogram_enrolrolesync/settings', get_string('enrolment_role_sync_settings', 'elisprogram_enrolrolesync'), ''));
//student role setting
$setting = new admin_setting_configselect('elisprogram_enrolrolesync/student_role', get_string('sync_student_role_setting', 'elisprogram_enrolrolesync'), get_string('sync_student_role_help', 'elisprogram_enrolrolesync'), 0, $options);
$setting->set_updatedcallback('enrolment_role_sync_updatedcallback');
$settings->add($setting);
//instructor role setting
$setting = new admin_setting_configselect('elisprogram_enrolrolesync/instructor_role', get_string('sync_instructor_role_setting', 'elisprogram_enrolrolesync'), get_string('sync_instructor_role_help', 'elisprogram_enrolrolesync'), 0, $options);
$setting->set_updatedcallback('enrolment_role_sync_updatedcallback');
$settings->add($setting);
}
示例9: admin_setting_configcheckbox
$settings->add(new admin_setting_configcheckbox('local_elisprogram/userdefinedtrack', get_string('userdef_tracks_setting', 'local_elisprogram'), '', 0));
// ***Learning Plan
$settings->add(new admin_setting_heading('learning_plan', get_string('learningplan', 'local_elisprogram'), ''));
// Turn off learning plan
$settings->add(new admin_setting_configcheckbox('local_elisprogram/disablecoursecatalog', get_string('learning_plan_setting', 'local_elisprogram'), '', 0));
// Number of curricula to display before automatically collapsing
$settings->add(new admin_setting_configtext('local_elisprogram/catalog_collapse_count', get_string('auto_collapse_setting', 'local_elisprogram'), '', 4, PARAM_INT));
// TBD
// Enable curriculum expiration
$setting = new admin_setting_configcheckbox('local_elisprogram/enable_curriculum_expiration', get_string('crlm_expire_setting', 'local_elisprogram'), '', 0);
//callback to handle updating curriculum assignment expiry times
$setting->set_updatedcallback('curriculum_expiration_enabled_updatedcallback');
$settings->add($setting);
// Calculate curriculum expiration based on the time a student
$opts = array(CURR_EXPIRE_ENROL_START => get_string('curriculum_expire_enrol_start', 'local_elisprogram'), CURR_EXPIRE_ENROL_COMPLETE => get_string('curriculum_expire_enrol_complete', 'local_elisprogram'));
$setting = new admin_setting_configselect('local_elisprogram/curriculum_expiration_start', get_string('expire_basis_setting', 'local_elisprogram'), '', CURR_EXPIRE_ENROL_START, $opts);
//callback to handle updating curriculum assignment expiry times
$setting->set_updatedcallback('curriculum_expiration_start_updatedcallback');
$settings->add($setting);
// TBD
// Allow students to see completed courses on their dashboard
$settings->add(new admin_setting_configcheckbox('local_elisprogram/display_completed_courses', get_string('completed_courses_setting', 'local_elisprogram'), get_string('completed_courses_help', 'local_elisprogram'), 1));
// ***Certificates
$settings->add(new admin_setting_heading('certificates', get_string('certificates', 'local_elisprogram'), ''));
// Disable Certificates
$settings->add(new admin_setting_configcheckbox('local_elisprogram/disablecoursecertificates', get_string('disable_crs_cert', 'local_elisprogram'), get_string('disable_crs_cert_desc', 'local_elisprogram'), 0));
$settings->add(new admin_setting_configcheckbox('local_elisprogram/disablecertificates', get_string('disable_cert_setting', 'local_elisprogram'), '', 1));
// Certificate border image
$borders = function_exists('cm_certificate_get_borders') ? cm_certificate_get_borders() : array('Fancy1-blue.jpg' => 'Fancy1-blue', 'Fancy1-green.jpg' => 'Fancy1-green', 'Fancy2-black.jpg' => 'Fancy2-black', 'Fancy2-brown.jpg' => 'Fancy2-brown', '' => 'None');
// for testing
$settings->add(new admin_setting_configselect('local_elisprogram/certificate_border_image', get_string('cert_border_setting', 'local_elisprogram'), get_string('cert_border_help', 'local_elisprogram'), 0, $borders));
示例10: write_setting
/**
* Save a setting
*
* @param string $data
* @return string empty of error string
*/
public function write_setting($data)
{
$validated = $this->validate($data);
if ($validated !== true) {
return $validated;
}
return parent::write_setting($data);
}
示例11: output_select_html
/**
* Returns XHTML select field
*
* Ensure the options are loaded, and generate the XHTML for the select
* element and any warning message. Separating this out from output_html
* makes it easier to subclass this class.
*
* @param string $data the option to show as selected.
* @param string $current the currently selected option in the database, null if none.
* @param string $default the default selected option.
* @return array the HTML for the select element, and a warning message.
*/
public function output_select_html($data, $current, $default, $extraname = '')
{
if (!$this->load_choices() or empty($this->choices)) {
return array('', '');
}
if (is_null($current)) {
// First run.
if (!is_null($default) and empty($data)) {
$data = $default;
}
}
return parent::output_select_html($data, $current, $default, $extraname);
}
示例12: get_defaultsetting
/**
* Returns the default option
*
* @return string empty or default option
*/
public function get_defaultsetting()
{
$this->load_choices();
$defaultsetting = parent::get_defaultsetting();
if (array_key_exists($defaultsetting, $this->choices)) {
return $defaultsetting;
} else {
return '';
}
}
示例13: __construct
/**
* 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|int $defaultsetting
*/
public function __construct($name, $visiblename, $description, $defaultsetting)
{
parent::__construct($name, $visiblename, $description, $defaultsetting, null);
}
示例14: __construct
/**
* Constructor.
*/
public function __construct()
{
parent::__construct('forcetimezone', new lang_string('forcetimezone', 'core_admin'), new lang_string('helpforcetimezone', 'core_admin'), '99', null);
}
示例15: write_setting
/**
* Save the selected setting
*
* @param string $data The selected site
* @return string empty string or error message
*/
public function write_setting($data)
{
global $CFG;
set_marsupial_state($data);
return parent::write_setting($data);
}