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


PHP user_preference_allow_ajax_update函数代码示例

本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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