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


PHP admin_find_write_settings函数代码示例

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


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

示例1: admin_find_write_settings

/**
 * Internal recursive function - finds all settings from submitted form
 *
 * @param object $node Instance of admin_category, or admin_settingpage
 * @param array $data
 * @return array
 */
function admin_find_write_settings($node, $data)
{
    $return = array();
    if (empty($data)) {
        return $return;
    }
    if ($node instanceof admin_category) {
        $entries = array_keys($node->children);
        foreach ($entries as $entry) {
            $return = array_merge($return, admin_find_write_settings($node->children[$entry], $data));
        }
    } else {
        if ($node instanceof admin_settingpage) {
            foreach ($node->settings as $setting) {
                $fullname = $setting->get_full_name();
                if (array_key_exists($fullname, $data)) {
                    $return[$fullname] = $setting;
                }
            }
        }
    }
    return $return;
}
开发者ID:raymondAntonio,项目名称:moodle,代码行数:30,代码来源:adminlib.php

示例2: save_config_data

 protected function save_config_data(admin_root $adminroot, array $data)
 {
     $adminroot->errors = array();
     $settings = admin_find_write_settings($adminroot, $data);
     $count = 0;
     foreach ($settings as $fullname => $setting) {
         /** @var $setting admin_setting */
         $original = $setting->get_setting();
         $error = $setting->write_setting($data[$fullname]);
         if ($error !== '') {
             $adminroot->errors[$fullname] = new stdClass();
             $adminroot->errors[$fullname]->data = $data[$fullname];
             $adminroot->errors[$fullname]->id = $setting->get_id();
             $adminroot->errors[$fullname]->error = $error;
         }
         $count++;
     }
     return $count;
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:19,代码来源:admintree_test.php


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