本文整理汇总了PHP中user_preference_allow_ajax_update函数的典型用法代码示例。如果您正苦于以下问题:PHP user_preference_allow_ajax_update函数的具体用法?PHP user_preference_allow_ajax_update怎么用?PHP user_preference_allow_ajax_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_preference_allow_ajax_update函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: organizer_make_infobox
function organizer_make_infobox($params, $organizer, $context, &$popups)
{
global $PAGE;
user_preference_allow_ajax_update('mod_organizer_showpasttimeslots', PARAM_BOOL);
user_preference_allow_ajax_update('mod_organizer_showmyslotsonly', PARAM_BOOL);
user_preference_allow_ajax_update('mod_organizer_showfreeslotsonly', PARAM_BOOL);
$PAGE->requires->js_init_call('M.mod_organizer.init_infobox');
$output = '';
if ($organizer->alwaysshowdescription || time() > $organizer->allowregistrationsfromdate) {
$output = organizer_make_description_section($organizer);
}
switch ($params['mode']) {
case ORGANIZER_TAB_APPOINTMENTS_VIEW:
break;
case ORGANIZER_TAB_STUDENT_VIEW:
$output .= organizer_make_myapp_section($params, $organizer, organizer_get_last_user_appointment($organizer), $popups);
break;
case ORGANIZER_TAB_REGISTRATION_STATUS_VIEW:
$output .= organizer_make_reminder_section($params, $context);
break;
default:
print_error("Wrong view mode: {$params['mode']}");
}
$output .= organizer_make_slotoptions_section($params);
$output .= organizer_make_messages_section($params);
return $output;
}
开发者ID:nmisic,项目名称:moodle-mod_organizer,代码行数:27,代码来源:infobox.php
示例2: load_all_js
/**
* Gets Javascript that may be required for navigation
*/
function load_all_js($expandable)
{
global $CFG;
user_preference_allow_ajax_update('docked_block_instance_' . $this->instance->id, PARAM_INT);
$this->page->requires->js_module('core_dock');
$limit = 20;
if (!empty($CFG->navcourselimit)) {
$limit = $CFG->navcourselimit;
}
$expansionlimit = 0;
if (!empty($this->config->expansionlimit)) {
$expansionlimit = $this->config->expansionlimit;
}
if (!empty($CFG->block_course_menu_docked_background)) {
$bg_color = $CFG->block_course_menu_docked_background;
} else {
$bg_color = self::DEFAULT_DOCKED_BG;
}
$arguments = array('id' => $this->instance->id, 'instance' => $this->instance->id, 'candock' => $this->instance_can_be_docked(), 'courselimit' => $limit, 'expansionlimit' => $expansionlimit, 'bg_color' => $bg_color, 'expansions' => $expandable);
$this->page->requires->string_for_js('viewallcourses', 'moodle');
$this->page->requires->yui_module(array('core_dock', 'moodle-block_course_menu-navigation'), 'M.block_course_menu.init_add_tree', array($arguments));
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:25,代码来源:block_course_menu.php
示例3: print_collapsible_region_start
/**
* Print (or return) the start of a collapsible region, that has a caption that can
* be clicked to expand or collapse the region. If JavaScript is off, then the region
* will always be expanded.
*
* @param string $classes class names added to the div that is output.
* @param string $id id added to the div that is output. Must not be blank.
* @param string $caption text displayed at the top. Clicking on this will cause the region to expand or contract.
* @param string $userpref the name of the user preference that stores the user's preferred default state.
* (May be blank if you do not wish the state to be persisted.
* @param boolean $default Initial collapsed state to use if the user_preference it not set.
* @param boolean $return if true, return the HTML as a string, rather than printing it.
* @return string|void if $return is false, returns nothing, otherwise returns a string of HTML.
*/
function print_collapsible_region_start($classes, $id, $caption, $userpref = '', $default = false, $return = false)
{
global $CFG, $PAGE, $OUTPUT;
// Work out the initial state.
if (!empty($userpref) and is_string($userpref)) {
user_preference_allow_ajax_update($userpref, PARAM_BOOL);
$collapsed = get_user_preferences($userpref, $default);
} else {
$collapsed = $default;
$userpref = false;
}
if ($collapsed) {
$classes .= ' collapsed';
}
$output = '';
$output .= '<div id="' . $id . '" class="collapsibleregion ' . $classes . '">';
$output .= '<div id="' . $id . '_sizer">';
$output .= '<div id="' . $id . '_caption" class="collapsibleregioncaption">';
$output .= $caption . ' ';
$output .= '</div><div id="' . $id . '_inner" class="collapsibleregioninner">';
$PAGE->requires->js_init_call('M.util.init_collapsible_region', array($id, $userpref, get_string('clicktohideshow')));
if ($return) {
return $output;
} else {
echo $output;
}
}
开发者ID:hatone,项目名称:moodle,代码行数:41,代码来源:weblib.php
示例4: initialise_filepicker
/**
* Generate all options needed by filepicker
*
* @param array $args including following keys
* context
* accepted_types
* return_types
*
* @return array the list of repository instances, including meta infomation, containing the following keys
* externallink
* repositories
* accepted_types
*/
function initialise_filepicker($args)
{
global $CFG, $USER, $PAGE, $OUTPUT;
static $templatesinitialized = array();
require_once $CFG->libdir . '/licenselib.php';
$return = new stdClass();
$licenses = array();
if (!empty($CFG->licenses)) {
$array = explode(',', $CFG->licenses);
foreach ($array as $license) {
$l = new stdClass();
$l->shortname = $license;
$l->fullname = get_string($license, 'license');
$licenses[] = $l;
}
}
if (!empty($CFG->sitedefaultlicense)) {
$return->defaultlicense = $CFG->sitedefaultlicense;
}
$return->licenses = $licenses;
$return->author = fullname($USER);
if (empty($args->context)) {
$context = $PAGE->context;
} else {
$context = $args->context;
}
$disable_types = array();
if (!empty($args->disable_types)) {
$disable_types = $args->disable_types;
}
$user_context = context_user::instance($USER->id);
list($context, $course, $cm) = get_context_info_array($context->id);
$contexts = array($user_context, context_system::instance());
if (!empty($course)) {
// adding course context
$contexts[] = context_course::instance($course->id);
}
$externallink = (int) get_config(null, 'repositoryallowexternallinks');
$repositories = repository::get_instances(array('context' => $contexts, 'currentcontext' => $context, 'accepted_types' => $args->accepted_types, 'return_types' => $args->return_types, 'disable_types' => $disable_types));
$return->repositories = array();
if (empty($externallink)) {
$return->externallink = false;
} else {
$return->externallink = true;
}
$return->userprefs = array();
$return->userprefs['recentrepository'] = get_user_preferences('filepicker_recentrepository', '');
$return->userprefs['recentlicense'] = get_user_preferences('filepicker_recentlicense', '');
$return->userprefs['recentviewmode'] = get_user_preferences('filepicker_recentviewmode', '');
user_preference_allow_ajax_update('filepicker_recentrepository', PARAM_INT);
user_preference_allow_ajax_update('filepicker_recentlicense', PARAM_SAFEDIR);
user_preference_allow_ajax_update('filepicker_recentviewmode', PARAM_INT);
// provided by form element
$return->accepted_types = file_get_typegroup('extension', $args->accepted_types);
$return->return_types = $args->return_types;
$templates = array();
foreach ($repositories as $repository) {
$meta = $repository->get_meta();
// Please note that the array keys for repositories are used within
// JavaScript a lot, the key NEEDS to be the repository id.
$return->repositories[$repository->id] = $meta;
// Register custom repository template if it has one
if (method_exists($repository, 'get_upload_template') && !array_key_exists('uploadform_' . $meta->type, $templatesinitialized)) {
$templates['uploadform_' . $meta->type] = $repository->get_upload_template();
$templatesinitialized['uploadform_' . $meta->type] = true;
}
}
if (!array_key_exists('core', $templatesinitialized)) {
// we need to send each filepicker template to the browser just once
$fprenderer = $PAGE->get_renderer('core', 'files');
$templates = array_merge($templates, $fprenderer->filepicker_js_templates());
$templatesinitialized['core'] = true;
}
if (sizeof($templates)) {
$PAGE->requires->js_init_call('M.core_filepicker.set_templates', array($templates), true);
}
return $return;
}
开发者ID:isuruAb,项目名称:moodle,代码行数:91,代码来源:lib.php
示例5: get_required_javascript
/**
* Allows the block to load any JS it requires into the page.
*
* By default this function simply permits the user to dock the block if it is dockable.
*/
function get_required_javascript()
{
if ($this->instance_can_be_docked() && !$this->hide_header()) {
user_preference_allow_ajax_update('docked_block_instance_' . $this->instance->id, PARAM_INT);
}
}
开发者ID:nikitskynikita,项目名称:moodle,代码行数:11,代码来源:moodleblock.class.php
示例6: get_required_javascript
function get_required_javascript()
{
if ($this->instance_can_be_docked() && !$this->hide_header()) {
$this->page->requires->js_init_call('M.core_dock.init_genericblock', array($this->instance->id));
user_preference_allow_ajax_update('docked_block_instance_' . $this->instance->id, PARAM_INT);
}
}
开发者ID:vuchannguyen,项目名称:web,代码行数:7,代码来源:moodleblock.class.php
示例7: theme_bcu_initialise_full
function theme_bcu_initialise_full(moodle_page $page)
{
user_preference_allow_ajax_update('theme_bcu_full', PARAM_TEXT);
$page->requires->yui_module('moodle-theme_bcu-full', 'M.theme_bcu.full.init', array());
}
开发者ID:JOANMM,项目名称:bcu,代码行数:5,代码来源:lib.php
示例8: splash_initialise_colourswitcher
/**
* Adds the JavaScript for the colour switcher to the page.
*
* The colour switcher is a YUI moodle module that is located in
* theme/splash/yui/splash/splash.js
*
* @param moodle_page $page
*/
function splash_initialise_colourswitcher(moodle_page $page)
{
user_preference_allow_ajax_update('theme_splash_chosen_colour', PARAM_ALPHA);
$page->requires->yui_module('moodle-theme_splash-colourswitcher', 'M.theme_splash.initColourSwitcher', array(array('div' => '#colourswitcher')));
}
开发者ID:vuchannguyen,项目名称:web,代码行数:13,代码来源:lib.php
示例9: init_block_hider_js
/**
* Calls the JS require function to hide a block.
* @param block_contents $bc A block_contents object
* @return void
*/
protected function init_block_hider_js($bc)
{
if ($bc->collapsible != block_contents::NOT_HIDEABLE) {
$userpref = 'block' . $bc->blockinstanceid . 'hidden';
user_preference_allow_ajax_update($userpref, PARAM_BOOL);
$this->page->requires->yui_lib('dom');
$this->page->requires->yui_lib('event');
$plaintitle = strip_tags($bc->title);
$this->page->requires->js_function_call('new block_hider', array($bc->id, $userpref, get_string('hideblocka', 'access', $plaintitle), get_string('showblocka', 'access', $plaintitle), $this->old_icon_url('t/switch_minus'), $this->old_icon_url('t/switch_plus')));
}
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:16,代码来源:outputrenderers.php
示例10: theme_bootstrap_initialise_zoom
/**
* Loads the JavaScript for the zoom function.
*
* @param moodle_page $page Pass in $PAGE.
*/
function theme_bootstrap_initialise_zoom(moodle_page $page)
{
user_preference_allow_ajax_update('theme_bootstrap_zoom', PARAM_TEXT);
$page->requires->yui_module('moodle-theme_bootstrap-zoom', 'M.theme_bootstrap.zoom.init', array());
}
开发者ID:adonm,项目名称:learning,代码行数:10,代码来源:lib.php
示例11: mymobile_initialise_colpos
/**
* Allow AJAX updating of the user defined columns for tablets or not
*
* @param moodle_page $page
*/
function mymobile_initialise_colpos(moodle_page $page) {
user_preference_allow_ajax_update('theme_mymobile_chosen_colpos', PARAM_ALPHA);
}
开发者ID:number33,项目名称:moodle,代码行数:8,代码来源:lib.php
示例12: 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/>.
/**
* A two column layout for the boost theme.
*
* @package theme_boost
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
user_preference_allow_ajax_update('drawer-open-nav', PARAM_ALPHA);
require_once($CFG->libdir . '/behat/lib.php');
if (isloggedin()) {
$navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
} else {
$navdraweropen = false;
}
$extraclasses = [];
if ($navdraweropen) {
$extraclasses[] = 'drawer-open-left';
}
$bodyattributes = $OUTPUT->body_attributes($extraclasses);
$blockshtml = $OUTPUT->blocks('side-pre');
$hasblocks = strpos($blockshtml, 'data-block=') !== false;
$regionmainsettingsmenu = $OUTPUT->region_main_settings_menu();
开发者ID:rezaies,项目名称:moodle,代码行数:31,代码来源:columns2.php
示例13: render_stats_view
public function render_stats_view($name, $maintitle, $content, $subtitle = '', $info = '', $form = null, $ajax = false)
{
global $PAGE, $OUTPUT;
if ($ajax) {
// Don't render - return the data.
$out = new stdClass();
$out->name = $name;
$out->maintitle = $maintitle;
$out->maintitleclass = 'oublog_statsview_title';
$out->subtitle = $subtitle;
$out->subtitleclass = 'oublog_statsview_subtitle';
$out->content = $content;
$out->info = $info;
$out->infoclass = "oublog_{$name}_info";
$out->containerclass = "oublog_statsview_content_{$name}";
$out->contentclass = "oublog_statsview_innercontent_{$name}";
return $out;
}
$out = '';
if (!empty($subtitle)) {
$out .= $OUTPUT->heading($subtitle, 3, 'oublog_statsview_subtitle');
}
if (!empty($info)) {
$out .= html_writer::start_tag('a', array('class' => 'block_action_oublog', 'tabindex' => 0, 'href' => '#'));
$minushide = '';
$plushide = ' oublog_displaynone';
if ($userpref = get_user_preferences("mod_oublog_hidestatsform_{$name}", false)) {
$minushide = ' oublog_displaynone';
$plushide = '';
}
// Setup Javascript for stats view.
user_preference_allow_ajax_update("mod_oublog_hidestatsform_{$name}", PARAM_BOOL);
$PAGE->requires->js('/mod/oublog/module.js');
$module = array('name' => 'mod_oublog');
$module['fullpath'] = '/mod/oublog/module.js';
$module['requires'] = array('node', 'node-event-delegate');
$module['strings'] = array();
$PAGE->requires->js_init_call('M.mod_oublog.init_showhide', array($name, $userpref), false, $module);
$out .= $this->output->pix_icon('t/switch_minus', get_string('timefilter_close', 'oublog'), 'moodle', array('class' => 'oublog_stats_minus' . $minushide));
$out .= $this->output->pix_icon('t/switch_plus', get_string('timefilter_open', 'oublog'), 'moodle', array('class' => 'oublog_stats_plus' . $plushide));
$out .= html_writer::end_tag('a');
// Stats bar - call once per 'view'.
$PAGE->requires->yui_module('moodle-mod_oublog-statsbar', 'M.mod_oublog.statsbar.init', array("oublog_statsview_content_{$name}"));
$out .= html_writer::tag('p', $info, array('class' => "oublog_{$name}_info"));
}
if (!empty($form)) {
$out .= $form->render();
}
$out .= html_writer::div($content, "oublog_statsview_innercontent oublog_statsview_innercontent_{$name}");
return html_writer::div($this->output->heading($maintitle, 2), 'oublog_statsview_title') . $this->output->container($out, "oublog_statsview_content oublog_statsview_content_{$name}");
}
开发者ID:nadavkav,项目名称:moodle-mod_oublog,代码行数:51,代码来源:renderer.php
示例14: print_collapsible_region_start
/**
* Print (or return) the start of a collapisble region, that has a caption that can
* be clicked to expand or collapse the region. If JavaScript is off, then the region
* will always be exanded.
*
* @global object
* @param string $classes class names added to the div that is output.
* @param string $id id added to the div that is output. Must not be blank.
* @param string $caption text displayed at the top. Clicking on this will cause the region to expand or contract.
* @param boolean $userpref the name of the user preference that stores the user's preferred deafault state.
* (May be blank if you do not wish the state to be persisted.
* @param boolean $default Inital collapsed state to use if the user_preference it not set.
* @param boolean $return if true, return the HTML as a string, rather than printing it.
* @return string|void if $return is false, returns nothing, otherwise returns a string of HTML.
*/
function print_collapsible_region_start($classes, $id, $caption, $userpref = false, $default = false, $return = false)
{
global $CFG, $PAGE, $OUTPUT;
// Include required JavaScript libraries.
$PAGE->requires->yui_lib('animation');
// Work out the initial state.
if (is_string($userpref)) {
user_preference_allow_ajax_update($userpref, PARAM_BOOL);
$collapsed = get_user_preferences($userpref, $default);
} else {
$collapsed = $default;
$userpref = false;
}
if ($collapsed) {
$classes .= ' collapsed';
}
$output = '';
$output .= '<div id="' . $id . '" class="collapsibleregion ' . $classes . '">';
$output .= '<div id="' . $id . '_sizer">';
$output .= '<div id="' . $id . '_caption" class="collapsibleregioncaption">';
$output .= $caption . ' ';
$output .= '</div><div id="' . $id . '_inner" class="collapsibleregioninner">';
$PAGE->requires->js_function_call('new collapsible_region', array($id, $userpref, get_string('clicktohideshow'), $OUTPUT->old_icon_url('t/collapsed'), $OUTPUT->old_icon_url('t/expanded')));
if ($return) {
return $output;
} else {
echo $output;
}
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:44,代码来源:weblib.php
示例15: print_collapsible_region_start
/**
* Print (or return) the start of a collapisble region, that has a caption that can
* be clicked to expand or collapse the region. If JavaScript is off, then the region
* will always be exanded.
*
* @param string $classes class names added to the div that is output.
* @param string $id id added to the div that is output. Must not be blank.
* @param string $caption text displayed at the top. Clicking on this will cause the region to expand or contract.
* @param string $userpref the name of the user preference that stores the user's preferred deafault state.
* (May be blank if you do not wish the state to be persisted.
* @param boolean $default Inital collapsed state to use if the user_preference it not set.
* @param boolean $return if true, return the HTML as a string, rather than printing it.
* @return mixed if $return is false, returns nothing, otherwise returns a string of HTML.
*/
function print_collapsible_region_start($classes, $id, $caption, $userpref = false, $default = false, $return = false)
{
global $CFG;
// Include required JavaScript libraries.
require_js(array('yui_yahoo', 'yui_dom-event', 'yui_event', 'yui_animation'));
// Work out the initial state.
if (is_string($userpref)) {
user_preference_allow_ajax_update($userpref, PARAM_BOOL);
$collapsed = get_user_preferences($userpref, $default);
} else {
$collapsed = $default;
$userpref = false;
}
if ($collapsed) {
$classes .= ' collapsed';
}
$output = '';
$output .= '<div id="' . $id . '" class="collapsibleregion ' . $classes . '">';
$output .= '<div id="' . $id . '_sizer">';
$output .= '<div id="' . $id . '_caption" class="collapsibleregioncaption">';
$output .= $caption . ' ';
$output .= '</div><div id="' . $id . '_inner" class="collapsibleregioninner">';
$output .= print_js_call('new collapsible_region', array($id, $userpref, get_string('clicktohideshow')), true);
if ($return) {
return $output;
} else {
echo $output;
}
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:43,代码来源:weblib.php
示例16: get_content
/**
* Gets the content for this block by grabbing it from $this->page
*/
function get_content()
{
global $CFG, $OUTPUT;
// First check if we have already generated, don't waste cycles
if ($this->contentgenerated === true) {
return true;
}
$this->page->requires->yui2_lib('dom');
// JS for navigation moved to the standard theme, the code will probably have to depend on the actual page structure
// $this->page->requires->js('/lib/javascript-navigation.js');
block_settings::$navcount++;
// Check if this block has been docked
if ($this->docked === null) {
$this->docked = get_user_preferences('nav_in_tab_panel_settingsnav' . block_settings::$navcount, 0);
}
// Check if there is a param to change the docked state
if ($this->docked && optional_param('undock', null, PARAM_INT) == $this->instance->id) {
unset_user_preference('nav_in_tab_panel_settingsnav' . block_settings::$navcount, 0);
$url = $this->page->url;
$url->remove_params(array('undock'));
redirect($url);
} else {
if (!$this->docked && optional_param('dock', null, PARAM_INT) == $this->instance->id) {
set_user_preferences(array('nav_in_tab_panel_settingsnav' . block_settings::$navcount => 1));
$url = $this->page->url;
$url->remove_params(array('dock'));
redirect($url);
}
}
$renderer = $this->page->get_renderer('block_settings');
$this->content->text = $renderer->settings_tree($this->page->settingsnav);
// only do search if you have moodle/site:config
if (!empty($this->content->text)) {
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
$this->content->footer = $renderer->search_form(new moodle_url("{$CFG->wwwroot}/{$CFG->admin}/search.php"), optional_param('query', '', PARAM_RAW));
} else {
$this->content->footer = '';
}
if (!empty($this->config->enabledock) && $this->config->enabledock == 'yes') {
user_preference_allow_ajax_update('nav_in_tab_panel_settingsnav' . block_settings::$navcount, PARAM_INT);
}
}
$this->contentgenerated = true;
return true;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:48,代码来源:block_settings.php
示例17: collapsible_region_start
/**
* Print (or return) the start of a collapsible region, that has a caption that can
* be clicked to expand or collapse the region. If JavaScript is off, then the region
* will always be expanded.
*
* @param string $classes class names added to the div that is output.
* @param string $id id added to the div that is output. Must not be blank.
* @param string $caption text displayed at the top. Clicking on this will cause the region to expand or contract.
* @param string $userpref the name of the user preference that stores the user's preferred default state.
* (May be blank if you do not wish the state to be persisted.
* @param bool $default Initial collapsed state to use if the user_preference it not set.
* @return bool if true, return the HTML as a string, rather than printing it.
*/
protected function collapsible_region_start($classes, $id, $caption, $userpref = '', $default = false)
{
// Work out the initial state.
if (!empty($userpref) and is_string($userpref)) {
user_preference_allow_ajax_update($userpref, PARAM_BOOL);
$collapsed = get_user_preferences($userpref, $default);
} else {
$collapsed = $default;
$userpref = false;
}
if ($collapsed) {
$classes .= ' collapsed';
}
$output = '';
$output .= '<div id="' . $id . '" class="collapsibleregion ' . $classes . '">';
$output .= '<div id="' . $id . '_sizer">';
$output .= '<div id="' . $id . '_caption" class="collapsibleregioncaption">';
$output .= $caption . ' ';
$output .= '</div><div id="' . $id . '_inner" class="collapsibleregioninner">';
$this->page->requires->js_init_call('M.block_course_overview.collapsible', array($id, $userpref, get_string('clicktohideshow')));
return $output;
}
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:35,代码来源:renderer.php
示例18: initialise_colourswitcher
/**
* Adds the JavaScript for the colour switcher to the page.
*
* The colour switcher is a YUI moodle module that is located in
* theme/udemspl/yui/udemspl/udemspl.js
*
* @param moodle_page $page
*/
public static function initialise_colourswitcher(\moodle_page $page)
{
self::check_colours_switch();
\user_preference_allow_ajax_update('theme_essential_colours', PARAM_ALPHANUM);
$page->requires->js_call_amd('theme_essential/coloursswitcher', 'init', array(array('div' => '#custom_menu_themecolours .dropdown-menu')));
}
开发者ID:lucisgit,项目名称:moodle-theme_essential,代码行数:14,代码来源:toolbox.php
示例19: option_checkbox
private function option_checkbox($name, $on, $label) {
if ($on) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
$name = 'userselector_' . $name;
$output = '<p><input type="hidden" name="' . $name . '" value="0" />' .
// For the benefit of brain-dead IE, the id must be different from the name of the hidden form field above.
// It seems that document.getElementById('frog') in IE will return and element with name="frog".
'<input type="checkbox" id="' . $name . 'id" name="' . $name . '" value="1"' . $checked . ' /> ' .
'<label for="' . $name . 'id">' . $label . "</label></p>\n";
user_preference_allow_ajax_update($name, PARAM_BOOL);
return $output;
}
开发者ID:Burick,项目名称:moodle,代码行数:15,代码来源:lib.php
示例20: notices
/**
* Return the notices.
*
* @param block_xp_manager $manager The manager.
* @return string The notices.
*/
public function notices($manager)
{
global $CFG;
$o = '';
if (!$manager->can_manage()) {
return $o;
}
if (!get_user_preferences(block_xp_manager::USERPREF_NOTICES, false)) {
require_once $CFG->libdir . '/ajax/ajaxlib.php';
user_preference_allow_ajax_update(block_xp_manager::USERPREF_NOTICES, PARAM_BOOL);
$moodleorgurl = new moodle_url('https://moodle.org/plugins/view.php?plugin=block_xp');
$githuburl = new moodle_url('https://github.com/FMCorz/moodle-block_xp');
$text = get_string('likenotice', 'block_xp', (object) array('moodleorg' => $moodleorgurl->out(), 'github' => $githuburl->out()));
$id = html_writer::random_id();
$this->page->requires->js_init_call("Y.one('.block-xp-rocks').on('click', function(e) {\n e.preventDefault();\n M.util.set_user_preference('" . block_xp_manager::USERPREF_NOTICES . "', 1);\n Y.one('.block-xp-notices').hide();\n });");
$icon = new pix_icon('t/delete', get_string('dismissnotice', 'block_xp'));
$actionicon = $this->action_icon(new moodle_url($this->page->url), $icon, null, array('class' => 'block-xp-rocks'));
$text .= html_writer::div($actionicon, 'dismiss-action');
$o .= html_writer::div($this->notification($text, 'notifysuccess'), 'block-xp-notices');
}
return $o;
}
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:28,代码来源:renderer.php
注:本文中的user_preference_allow_ajax_update函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论