Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php |
— | — | @@ -128,6 +128,36 @@ |
129 | 129 | |
130 | 130 | return $prefix . definedMeaningExpression($this->getDefinedMeaningIdFromTitle($wgTitle->getText())); |
131 | 131 | } |
| 132 | + |
| 133 | + public function getDefinedMeaningId() { |
| 134 | + return $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
| 135 | + } |
| 136 | + /** cut and paste getDataSetPanel with mods for Collection instead |
| 137 | + * Potential refactor candidate! |
| 138 | + */ |
| 139 | + protected function getConceptPanel() { |
| 140 | + global $wgTitle, $wgUser; |
| 141 | + $dm=$this->getDefinedMeaningId(); |
| 142 | + $dc=wdGetDataSetContext(); |
| 143 | + $ow_datasets="Concept Panel"; |
| 144 | + |
| 145 | + $html="<div class=\"dataset-panel\">";; |
| 146 | + $html.="<table border=\"0\"><tr><th class=\"dataset-panel-heading\">$ow_datasets</th></tr>"; |
| 147 | + $dataSets=getDataSetsAssociatedByConcept($dm,$dc); |
| 148 | + $sk=$wgUser->getSkin(); |
| 149 | + foreach ($dataSets as $dataset) { |
| 150 | + $active=($dataset->getPrefix()==$dc->getPrefix()); |
| 151 | + $name=$dataset->fetchName(); |
| 152 | + $prefix=$dataset->getPrefix(); |
| 153 | + |
| 154 | + $class= $active ? 'dataset-panel-active' : 'dataset-panel-inactive'; |
| 155 | + $slot = $active ? "$name" : $sk->makeLinkObj($wgTitle,$name,"dataset=$prefix"); |
| 156 | + $html.="<tr><td class=\"$class\">$slot</td></tr>"; |
| 157 | + } |
| 158 | + $html.="</table>"; |
| 159 | + $html.="</div>"; |
| 160 | + return $html; |
| 161 | + } |
132 | 162 | } |
133 | 163 | |
134 | 164 | ?> |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php |
— | — | @@ -1185,4 +1185,16 @@ |
1186 | 1186 | return readConceptMapping($concept_id); |
1187 | 1187 | } |
1188 | 1188 | |
| 1189 | +function &getDataSetsAssociatedByConcept($dm, $dc) { |
| 1190 | + $map=getAssociatedByConcept($dm, $dc); |
| 1191 | + $Sets=wdGetDataSets() |
| 1192 | + $newSets=array(); |
| 1193 | + foreach ($map as $map_dc => $map_dm) { |
| 1194 | + $dataset=$Sets[$map_dc]; |
| 1195 | + $dataset->setDefinedMeaningId($map_dm); |
| 1196 | + $newSets[$map_dc]=$dataset |
| 1197 | + } |
| 1198 | + return $newSets; |
| 1199 | +} |
| 1200 | + |
1189 | 1201 | ?> |