Changeset 2429 for sandbox/workflow/branches/993/lib/settings
- Timestamp:
- 04/06/10 10:52:46 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/workflow/branches/993/lib/settings/Settings.php
r2418 r2429 11 11 12 12 /** 13 * 13 * General settings class. This class should be used to centralize all settings 14 * used by the module. 14 15 * 15 16 * @package Settings … … 17 18 * @author Pedro Eugênio Rocha - pedro.eugenio.rocha@gmail.com 18 19 */ 19 20 20 class Settings { 21 21 … … 25 25 * an exception when someone asks for it. 26 26 * @access private 27 * @static 27 28 */ 28 29 private static $_configs = array( … … 71 72 ); 72 73 73 private static $loaded_from_db = false; 74 /** 75 * @var boolean $_isLoaded Stores whether the settings are loaded or not. 76 * @access private 77 * @static 78 */ 79 private static $_isLoaded = false; 74 80 75 81 … … 109 115 } 110 116 111 /* check if the setting was loaded */ 112 $methodName = "populate" . ucfirst(strtolower($args[0])); 113 self::$methodName(); 114 117 /* check if we already load the settings */ 118 if (!self::$_isLoaded) 119 self::_load(); 115 120 116 121 /* retrieving the setting. More 'for' programming. */ … … 121 126 122 127 123 public static function load() { 128 /** 129 * Loads settings into $_configs private array. 130 * 131 * @access private 132 * @return void 133 * @static 134 */ 135 private static function _load() { 124 136 137 /* loading global variables into $_configs */ 125 138 self::$_configs['expresso']['db']['name'] = $GLOBALS['phpgw_info']['server']['db_name']; 126 139 self::$_configs['expresso']['db']['host'] = $GLOBALS['phpgw_info']['server']['db_host']; … … 131 144 132 145 self::$_configs['expresso']['ldap']['host'] = $GLOBALS['phpgw_info']['server']['ldap_host']; 133 }134 146 135 private static function populateWorkflow() {136 137 $values = self::loadFromDb();147 /* loading database settings */ 148 $config = &Factory::newInstance('config', 'workflow'); 149 $values = $config->read_repository(); 138 150 139 151 self::$_configs['workflow']['intranet_subnetworks'] = $values['intranet_subnetworks']; … … 157 169 self::$_configs['workflow']['ldap']['password'] = $values['ldap_password']; 158 170 self::$_configs['workflow']['ldap']['follow_referrals'] = $values['ldap_follow_referrals']; 159 }160 171 161 private static function populateExpresso() {} 162 163 164 private static function loadFromDb() { 165 166 /* */ 167 $config = &Factory::newInstance('config', 'workflow'); 168 $values = $config->read_repository(); 169 170 /* 171 foreach ($values as $key => $value) { 172 self::$_configs[$key] = $value; 173 } 174 self::$loaded_from_db = true; 175 */ 176 return $values; 172 /* the settings are already loaded. No need to call this method again. */ 173 self::$_isLoaded = true; 177 174 } 178 175 }
Note: See TracChangeset
for help on using the changeset viewer.