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


PHP admin_output_new_settings_by_page函数代码示例

本文整理汇总了PHP中admin_output_new_settings_by_page函数的典型用法代码示例。如果您正苦于以下问题:PHP admin_output_new_settings_by_page函数的具体用法?PHP admin_output_new_settings_by_page怎么用?PHP admin_output_new_settings_by_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了admin_output_new_settings_by_page函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: admin_output_new_settings_by_page

/**
 * Internal function - returns arrays of html pages with uninitialised settings
 *
 * @param object $node Instance of admin_category or admin_settingpage
 * @return array
 */
function admin_output_new_settings_by_page($node)
{
    global $OUTPUT;
    $return = array();
    if ($node instanceof admin_category) {
        $entries = array_keys($node->children);
        foreach ($entries as $entry) {
            $return += admin_output_new_settings_by_page($node->children[$entry]);
        }
    } else {
        if ($node instanceof admin_settingpage) {
            $newsettings = array();
            foreach ($node->settings as $setting) {
                if (is_null($setting->get_setting())) {
                    $newsettings[] = $setting;
                }
            }
            if (count($newsettings) > 0) {
                $adminroot = admin_get_root();
                $page = $OUTPUT->heading(get_string('upgradesettings', 'admin') . ' - ' . $node->visiblename, 2, 'main');
                $page .= '<fieldset class="adminsettings">' . "\n";
                foreach ($newsettings as $setting) {
                    $fullname = $setting->get_full_name();
                    if (array_key_exists($fullname, $adminroot->errors)) {
                        $data = $adminroot->errors[$fullname]->data;
                    } else {
                        $data = $setting->get_setting();
                        if (is_null($data)) {
                            $data = $setting->get_defaultsetting();
                        }
                    }
                    $page .= '<div class="clearer"><!-- --></div>' . "\n";
                    $page .= $setting->output_html($data);
                }
                $page .= '</fieldset>';
                $return[$node->name] = $page;
            }
        }
    }
    return $return;
}
开发者ID:raymondAntonio,项目名称:moodle,代码行数:47,代码来源:adminlib.php

示例2: optional_param

require_once '../config.php';
require_once $CFG->libdir . '/adminlib.php';
$return = optional_param('return', '', PARAM_ALPHA);
/// no guest autologin
require_login(0, false);
$adminroot = admin_get_root();
// need all settings
admin_externalpage_setup('upgradesettings');
// now hidden page
// now we'll deal with the case that the admin has submitted the form with new settings
if ($data = data_submitted() and confirm_sesskey()) {
    $count = admin_write_settings($data);
    $adminroot = admin_get_root(true);
    //reload tree
}
$newsettings = admin_output_new_settings_by_page($adminroot);
if (isset($newsettings['frontpagesettings'])) {
    $frontpage = $newsettings['frontpagesettings'];
    unset($newsettings['frontpagesettings']);
    array_unshift($newsettings, $frontpage);
}
$newsettingshtml = implode($newsettings);
unset($newsettings);
$focus = '';
if (empty($adminroot->errors) and $newsettingshtml === '') {
    // there must be either redirect without message or continue button or else upgrade would be sometimes broken
    if ($return == 'site') {
        redirect("{$CFG->wwwroot}/");
    } else {
        redirect("{$CFG->wwwroot}/{$CFG->admin}/index.php");
    }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:upgradesettings.php


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