| @@ 238-256 (lines=19) @@ | ||
| 235 | * |
|
| 236 | * @return array array of {@link UserconfigsConfig}s |
|
| 237 | */ |
|
| 238 | public function getConfigsByUser($uid, $moduleId) |
|
| 239 | { |
|
| 240 | static $_cachedConfigs; |
|
| 241 | if (!empty($_cachedConfigs[$moduleId][$uid])) { |
|
| 242 | return $_cachedConfigs[$moduleId][$uid]; |
|
| 243 | } else { |
|
| 244 | $ret = array(); |
|
| 245 | $criteria = new CriteriaCompo(new Criteria('conf_modid', (int)($moduleId))); |
|
| 246 | $criteria->add(new Criteria('conf_uid', (int)($uid))); |
|
| 247 | $configs = $this->getConfigs($criteria, true); |
|
| 248 | if (is_array($configs)) { |
|
| 249 | foreach (array_keys($configs) as $i) { |
|
| 250 | $ret[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); |
|
| 251 | } |
|
| 252 | } |
|
| 253 | $_cachedConfigs[$moduleId][$uid] = $ret; |
|
| 254 | return $_cachedConfigs[$moduleId][$uid]; |
|
| 255 | } |
|
| 256 | } |
|
| 257 | ||
| 258 | /** |
|
| 259 | * Make a new {@link UserconfigsOption} |
|
| @@ 227-247 (lines=21) @@ | ||
| 224 | * |
|
| 225 | * @deprecated Use getConfigsByModule instead |
|
| 226 | */ |
|
| 227 | public function getConfigsByCat($category, $module = 0) |
|
| 228 | { |
|
| 229 | static $_cachedConfigs; |
|
| 230 | if (!empty($_cachedConfigs[$module][$category])) { |
|
| 231 | return $_cachedConfigs[$module][$category]; |
|
| 232 | } else { |
|
| 233 | $ret = array(); |
|
| 234 | $criteria = new CriteriaCompo(new Criteria('conf_modid', (int)($module))); |
|
| 235 | if (!empty($category)) { |
|
| 236 | $criteria->add(new Criteria('conf_catid', (int)($category))); |
|
| 237 | } |
|
| 238 | $configs = $this->getConfigs($criteria, true); |
|
| 239 | if (is_array($configs)) { |
|
| 240 | foreach (array_keys($configs) as $i) { |
|
| 241 | $ret[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput(); |
|
| 242 | } |
|
| 243 | } |
|
| 244 | $_cachedConfigs[$module][$category] = $ret; |
|
| 245 | return $_cachedConfigs[$module][$category]; |
|
| 246 | } |
|
| 247 | } |
|
| 248 | ||
| 249 | /** |
|
| 250 | * Make a new XoopsConfigOption |
|