本文整理汇总了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;
}
示例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");
}