| @@ 115-137 (lines=23) @@ | ||
| 112 | * |
|
| 113 | * @return false|array the requested objects or FALSE if they don't exists in the registry |
|
| 114 | */ |
|
| 115 | public function getObjects($itemname, $modulename) |
|
| 116 | { |
|
| 117 | if (!$modulename) { |
|
| 118 | global $xoopsModule; |
|
| 119 | if (!is_object($xoopsModule)) { |
|
| 120 | return false; |
|
| 121 | } else { |
|
| 122 | $modulename = $xoopsModule->dirname(); |
|
| 123 | } |
|
| 124 | } |
|
| 125 | if (isset($this->_registryArray['objects'][$modulename][$itemname])) { |
|
| 126 | return $this->_registryArray['objects'][$modulename][$itemname]; |
|
| 127 | } else { |
|
| 128 | // if they were not in registry, let's fetch them and add them to the reigistry |
|
| 129 | $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
| 130 | if (method_exists($moduleHandler, 'getObjects')) { |
|
| 131 | $objects = $moduleHandler->getObjects(); |
|
| 132 | } |
|
| 133 | $this->_registryArray['objects'][$modulename][$itemname] = $objects; |
|
| 134 | ||
| 135 | return $objects; |
|
| 136 | } |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Fetching objects from the registry, as a list: objectid => identifier |
|
| @@ 147-169 (lines=23) @@ | ||
| 144 | * |
|
| 145 | * @return false|array the requested objects or FALSE if they don't exists in the registry |
|
| 146 | */ |
|
| 147 | public function getList($itemname, $modulename) |
|
| 148 | { |
|
| 149 | if (!$modulename) { |
|
| 150 | global $xoopsModule; |
|
| 151 | if (!is_object($xoopsModule)) { |
|
| 152 | return false; |
|
| 153 | } else { |
|
| 154 | $modulename = $xoopsModule->dirname(); |
|
| 155 | } |
|
| 156 | } |
|
| 157 | if (isset($this->_registryArray['list'][$modulename][$itemname])) { |
|
| 158 | return $this->_registryArray['list'][$modulename][$itemname]; |
|
| 159 | } else { |
|
| 160 | // if they were not in registry, let's fetch them and add them to the reigistry |
|
| 161 | $moduleHandler = xoops_getModuleHandler($itemname, $modulename); |
|
| 162 | if (method_exists($moduleHandler, 'getList')) { |
|
| 163 | $objects = $moduleHandler->getList(); |
|
| 164 | } |
|
| 165 | $this->_registryArray['list'][$modulename][$itemname] = $objects; |
|
| 166 | ||
| 167 | return $objects; |
|
| 168 | } |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * Retreive a single object |
|