Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_List.php |
— | — | @@ -18,7 +18,6 @@ |
19 | 19 | |
20 | 20 | /// cache for datavalues of types belonging to this object |
21 | 21 | private $m_typevalues = NULL; |
22 | | - |
23 | 22 | /// Should this DV operate on query syntax (special mode for parsing queries in a compatible fashion) |
24 | 23 | private $m_querysyntax = false; |
25 | 24 | /// Array of comparators as might be found in query strings (based on inputs like >, <, etc.) |
— | — | @@ -131,7 +130,11 @@ |
132 | 131 | $this->m_typevalues = NULL; |
133 | 132 | } |
134 | 133 | |
135 | | - ///@todo Update (implementation below still from SMWNAryValue) |
| 134 | + /** |
| 135 | + * @todo Since containers are always exported in a similar fashion, it |
| 136 | + * would be preferrable to have their export controlled where it happens, |
| 137 | + * and minimize the below special code. |
| 138 | + */ |
136 | 139 | public function getExportData() { |
137 | 140 | if (!$this->isValid()) return NULL; |
138 | 141 | |
— | — | @@ -139,7 +142,7 @@ |
140 | 143 | $ed = new SMWExpData(SMWExporter::getSpecialElement('swivt','Container')); |
141 | 144 | $result->addPropertyObjectValue(SMWExporter::getSpecialElement('rdf','type'), $ed); |
142 | 145 | $count = 0; |
143 | | - foreach ($this->m_values as $value) { |
| 146 | + foreach ($this->getDVs() as $value) { |
144 | 147 | $count++; |
145 | 148 | if ( ($value === NULL) || (!$value->isValid()) ) { |
146 | 149 | continue; |
— | — | @@ -238,5 +241,23 @@ |
239 | 242 | return $this->m_typevalues; |
240 | 243 | } |
241 | 244 | |
| 245 | + /** |
| 246 | + * If valid and in querymode, build a suitable SMWValueList description from the |
| 247 | + * given input or return NULL if no such description was given. This requires the |
| 248 | + * input to be given to setUserValue(). Otherwise bad things will happen. |
| 249 | + */ |
| 250 | + public function getValueList() { |
| 251 | + $vl = new SMWValueList(); |
| 252 | + if (!$this->isValid() || !$this->m_querysyntax) { |
| 253 | + return NULL; |
| 254 | + } |
| 255 | + for ($i=0; $i < $this->m_count; $i++) { |
| 256 | + if ($this->m_values[$i] !== NULL) { |
| 257 | + $vl->setDescription($i,new SMWValueDescription($this->m_values[$i], $this->m_comparators[$i])); |
| 258 | + } |
| 259 | + } |
| 260 | + return $vl; |
| 261 | + } |
| 262 | + |
242 | 263 | } |
243 | 264 | |