18 import(
'classes.codelist.CodelistItem');
26 parent::__construct();
35 if ($locale ==
null) {
41 if ($cache ===
null) {
43 $cache = $cacheManager->getFileCache(
44 $this->
getName() .
'_codelistItems', $locale,
45 array($this,
'_cacheMiss')
47 $cacheTime = $cache->getCacheTime();
48 if ($cacheTime !==
null && $cacheTime < filemtime($this->
getFilename($locale))) {
64 if ($allCodelistItems ===
null) {
67 $locale = $cache->cacheId;
68 if ($locale ==
null) {
72 $notes[] = array(
'debug.notes.codelistItemListLoad', array(
'filename' => $filename));
77 $data = $xmlDao->parseStruct($filename, array($nodeName));
80 if (isset($data[$nodeName])) {
81 foreach ($data[$nodeName] as $codelistData) {
82 $allCodelistItems[$codelistData[
'attributes'][
'code']] = array(
83 $codelistData[
'attributes'][
'text'],
87 if (is_array($allCodelistItems)) {
88 asort($allCodelistItems);
90 $cache->setEntireCache($allCodelistItems);
100 return $this->
getName() .
'Cache';
135 return $this->
_fromRow($code, $cache->get($code));
146 foreach ($cache->getContents() as $code => $entry) {
147 $returner[] = $this->
_fromRow($code, $entry);
160 $cacheContents = $cache->getContents();
161 if (is_array($cacheContents)) {
162 foreach ($cache->getContents() as $code => $entry) {
163 $returner[] = $entry[0];
177 $codelistItem->setCode($code);
178 $codelistItem->setText($entry[0]);
180 HookRegistry::call(
'CodelistItemDAO::_fromRow', array(&$codelistItem, &$code, &$entry));
182 return $codelistItem;