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


PHP Container::getSettingsManager方法代码示例

本文整理汇总了PHP中Chamilo\CoreBundle\Framework\Container::getSettingsManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getSettingsManager方法的具体用法?PHP Container::getSettingsManager怎么用?PHP Container::getSettingsManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chamilo\CoreBundle\Framework\Container的用法示例。


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

示例1: api_get_setting

/**
 * Returns the value of a setting from the web-adjustable admin config settings.
 *
 * WARNING true/false are stored as string, so when comparing you need to check e.g.
 * if (api_get_setting('course.show_navigation_menu') == 'true') //CORRECT
 * instead of
 * if (api_get_setting('course.show_navigation_menu') == true) //INCORRECT
 * @param string    $variable The variable name
 * @return string
 *
 * @author Julio Montoya
 */
function api_get_setting($variable)
{
    $variable = trim($variable);
    switch ($variable) {
        case 'server_type':
            $test = ['dev', 'test'];
            $environment = Container::getEnvironment();
            if (in_array($environment, $test)) {
                return 'test';
            }
            return 'prod';
        case 'stylesheets':
            $variable = 'platform.theme';
        default:
            return Container::getSettingsManager()->getSetting($variable);
    }
    global $_setting;
    if ($variable == 'header_extra_content') {
        $filename = api_get_path(SYS_PATH) . api_get_home_path() . 'header_extra_content.txt';
        if (file_exists($filename)) {
            $value = file_get_contents($filename);
            return $value;
        } else {
            return '';
        }
    }
    if ($variable == 'footer_extra_content') {
        $filename = api_get_path(SYS_PATH) . api_get_home_path() . 'footer_extra_content.txt';
        if (file_exists($filename)) {
            $value = file_get_contents($filename);
            return $value;
        } else {
            return '';
        }
    }
    $value = null;
    if (is_null($key)) {
        $value = isset($_setting[$variable]) && $_setting[$variable] != '' ? $_setting[$variable] : null;
    } else {
        if (isset($_setting[$variable][$key])) {
            $value = $_setting[$variable][$key];
        }
    }
    return $value;
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:57,代码来源:api.lib.php

示例2: api_get_setting

/**
 * Returns the value of a setting from the web-adjustable admin config settings.
 *
 * WARNING true/false are stored as string, so when comparing you need to check e.g.
 * if (api_get_setting('show_navigation_menu') == 'true') //CORRECT
 * instead of
 * if (api_get_setting('show_navigation_menu') == true) //INCORRECT
 * @param string    $variable The variable name
 * @param string    $key The subkey (sub-variable) if any. Defaults to NULL
 * @author René Haentjens
 * @author Bart Mollet
 */
function api_get_setting($variable, $key = null)
{
    return Container::getSettingsManager()->getSetting($variable);
    //chamilo_core.settings_schema.platform
    $_setting = Session::read('_setting');
    if ($variable == 'header_extra_content') {
        $filename = api_get_path(SYS_PATH) . api_get_home_path() . 'header_extra_content.txt';
        if (file_exists($filename)) {
            $value = file_get_contents($filename);
            return $value;
        } else {
            return '';
        }
    }
    if ($variable == 'footer_extra_content') {
        $filename = api_get_path(SYS_PATH) . api_get_home_path() . 'footer_extra_content.txt';
        if (file_exists($filename)) {
            $value = file_get_contents($filename);
            return $value;
        } else {
            return '';
        }
    }
    $value = null;
    if (is_null($key)) {
        $value = isset($_setting[$variable]) && $_setting[$variable] != '' ? $_setting[$variable] : null;
    } else {
        if (isset($_setting[$variable][$key])) {
            $value = $_setting[$variable][$key];
        }
    }
    return $value;
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:45,代码来源:api.lib.php


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