Index: trunk/extensions/Wikidata/OmegaWiki/Wikidata.php |
— | — | @@ -9,7 +9,6 @@ |
10 | 10 | protected $showRecordLifeSpan; |
11 | 11 | protected $transaction; |
12 | 12 | protected $queryTransactionInformation; |
13 | | - protected $viewQueryTransactionInformation; |
14 | 13 | protected $shouldShowAuthorities; |
15 | 14 | protected $showCommunityContribution; |
16 | 15 | protected $authoritiesToShow; |
— | — | @@ -17,16 +16,16 @@ |
18 | 17 | // The following member variables control some application specific preferences |
19 | 18 | protected $availableAuthorities = array(); // A map containing (userId => displayName) combination for authoritative contribution view |
20 | 19 | protected $filterLanguageId = 0; // Filter pages on this languageId, set to 0 to show all languages |
| 20 | + protected $possiblySynonymousRelationTypeId = 0; // Put this relation type in a special section "Possibly synonymous" |
21 | 21 | protected $showLanguageSelector = true; // Show language selector at the top of each wiki data page |
22 | 22 | protected $showClassicPageTitles = true; // Show classic page titles instead of prettier page titles |
23 | | - protected $possiblySynonymousRelationTypeId = 0; // Put this relation type in a special section "Possibly synonymous" |
24 | 23 | |
| 24 | + protected $viewInformation; |
| 25 | + |
25 | 26 | // Show a panel to select expressions from available data-sets |
26 | 27 | protected $showDataSetPanel=true; |
27 | 28 | |
28 | | - |
29 | 29 | public function __construct() { |
30 | | - |
31 | 30 | global |
32 | 31 | $wgAvailableAuthorities, $wgFilterLanguageId, $wgShowLanguageSelector, |
33 | 32 | $wgShowClassicPageTitles, $wgPossiblySynonymousRelationTypeId; |
— | — | @@ -45,7 +44,6 @@ |
46 | 45 | |
47 | 46 | if (isset($wgPossiblySynonymousRelationTypeId)) |
48 | 47 | $this->possiblySynonymousRelationTypeId = $wgPossiblySynonymousRelationTypeId; |
49 | | - |
50 | 48 | } |
51 | 49 | |
52 | 50 | function getLanguageSelector() { |
— | — | @@ -58,7 +56,6 @@ |
59 | 57 | return wfMsg('ow_uilang',"<b>$userlang</b>"). " — " . $skin->makeLink("Special:Preferences", wfMsg('ow_uilang_set')); |
60 | 58 | } |
61 | 59 | |
62 | | - |
63 | 60 | protected function outputViewHeader() { |
64 | 61 | global |
65 | 62 | $wgOut; |
— | — | @@ -66,9 +63,8 @@ |
67 | 64 | if ($this->showLanguageSelector) |
68 | 65 | $wgOut->addHTML($this->getLanguageSelector()); |
69 | 66 | |
70 | | - if($this->showDataSetPanel) { |
| 67 | + if($this->showDataSetPanel) |
71 | 68 | $wgOut->addHTML($this->getDataSetPanel()); |
72 | | - } |
73 | 69 | } |
74 | 70 | |
75 | 71 | protected function outputViewFooter() { |
— | — | @@ -94,7 +90,16 @@ |
95 | 91 | |
96 | 92 | initializeOmegaWikiAttributes($this->filterLanguageId != 0); |
97 | 93 | initializeObjectAttributeEditors($this->filterLanguageId, false); |
98 | | - $this->viewQueryTransactionInformation = new QueryLatestTransactionInformation(); |
| 94 | + $this->queryTransactionInformation = new QueryLatestTransactionInformation(); |
| 95 | + |
| 96 | + $viewInformation = new ViewInformation(); |
| 97 | + $viewInformation->filterLanguageId = $this->filterLanguageId; |
| 98 | + $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId; |
| 99 | + $viewInformation->showRecordLifeSpan = false; |
| 100 | + $viewInformation->showAuthority = $this->shouldShowAuthorities; |
| 101 | + $viewInformation->queryTransactionInformation = $this->queryTransactionInformation; |
| 102 | + |
| 103 | + $this->viewInformation = $viewInformation; |
99 | 104 | } |
100 | 105 | |
101 | 106 | protected function getDataSetPanel() { |
— | — | @@ -119,9 +124,16 @@ |
120 | 125 | return $html; |
121 | 126 | } |
122 | 127 | |
123 | | - protected function save($referenceTransaction) { |
| 128 | + protected function save($referenceQueryTransactionInformation) { |
124 | 129 | initializeOmegaWikiAttributes($this->filterLanguageId != 0, false); |
125 | 130 | initializeObjectAttributeEditors($this->filterLanguageId, false); |
| 131 | + |
| 132 | + $viewInformation = new ViewInformation(); |
| 133 | + $viewInformation->filterLanguageId = $this->filterLanguageId; |
| 134 | + $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId; |
| 135 | + $viewInformation->queryTransactionInformation = $referenceQueryTransactionInformation; |
| 136 | + |
| 137 | + $this->viewInformation = $viewInformation; |
126 | 138 | } |
127 | 139 | |
128 | 140 | public function saveWithinTransaction() { |
— | — | @@ -168,6 +180,16 @@ |
169 | 181 | |
170 | 182 | initializeOmegaWikiAttributes($this->filterLanguageId != 0, false); |
171 | 183 | initializeObjectAttributeEditors($this->filterLanguageId, false, false); |
| 184 | + |
| 185 | + $viewInformation = new ViewInformation(); |
| 186 | + $viewInformation->filterLanguageId = $this->filterLanguageId; |
| 187 | + $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId; |
| 188 | + $viewInformation->showRecordLifeSpan = false; |
| 189 | + $viewInformation->showAuthority = false; |
| 190 | + $viewInformation->queryTransactionInformation = new QueryLatestTransactionInformation(); |
| 191 | + |
| 192 | + $this->viewInformation = $viewInformation; |
| 193 | + |
172 | 194 | return true; |
173 | 195 | } |
174 | 196 | |
— | — | @@ -215,6 +237,15 @@ |
216 | 238 | |
217 | 239 | initializeOmegaWikiAttributes($this->filterLanguageId != 0, true); |
218 | 240 | initializeObjectAttributeEditors($this->filterLanguageId, $this->showRecordLifeSpan, false); |
| 241 | + |
| 242 | + $viewInformation = new ViewInformation(); |
| 243 | + $viewInformation->filterLanguageId = $this->filterLanguageId; |
| 244 | + $viewInformation->possiblySynonymousRelationTypeId = $this->possiblySynonymousRelationTypeId; |
| 245 | + $viewInformation->showRecordLifeSpan = $this->showRecordLifeSpan; |
| 246 | + $viewInformation->showAuthority = $this->shouldShowAuthorities; |
| 247 | + $viewInformation->queryTransactionInformation = $this->queryTransactionInformation; |
| 248 | + |
| 249 | + $this->viewInformation = $viewInformation; |
219 | 250 | } |
220 | 251 | |
221 | 252 | protected function outputEditHeader() { |
Index: trunk/extensions/Wikidata/OmegaWiki/GetDM.php |
— | — | @@ -21,11 +21,11 @@ |
22 | 22 | |
23 | 23 | /* insert code here */ |
24 | 24 | $definedMeaningId=663665; # UnitTest |
25 | | -$filterLanguageId=0; # ??? What does this do ??? |
26 | | -$possiblySynonymousRelationTypeId=0; # ??? What does this do ??? |
27 | | -$queryTransactionInformation= new QueryLatestTransactionInformation(); |
28 | 25 | |
29 | | -$model=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation); |
| 26 | +$viewInformation = new ViewInformation(); |
| 27 | +$viewInformation->queryTransactionInformation = new QueryLatestTransactionInformation(); |
| 28 | + |
| 29 | +$model=new DefinedMeaningModel($definedMeaningId, $viewInformation); |
30 | 30 | $record=$model->getRecord(); |
31 | 31 | $record->finish("DefinedMeaning"); |
32 | 32 | echo $record; |
Index: trunk/extensions/Wikidata/OmegaWiki/Test.skeleton.php |
— | — | @@ -43,11 +43,10 @@ |
44 | 44 | $wgCommandLineMode = true; |
45 | 45 | $dc = "uw"; |
46 | 46 | $definedMeaningId=663665; # education |
47 | | - $filterLanguageId=0; # ??? What does this do ??? |
48 | | - $possiblySynonymousRelationTypeId=0; # ??? What does this do ??? |
49 | | - $queryTransactionInformation= new QueryLatestTransactionInformation(); |
| 47 | + $viewInformation = new ViewInformation(); |
| 48 | + $viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation(); |
50 | 49 | |
51 | | - $model=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation); |
| 50 | + $model=new DefinedMeaningModel($definedMeaningId, $viewInformation); |
52 | 51 | $testRecord=$model->getRecord(); |
53 | 52 | } |
54 | 53 | |
Index: trunk/extensions/Wikidata/OmegaWiki/RecordHelperTest.php |
— | — | @@ -41,11 +41,10 @@ |
42 | 42 | $wgCommandLineMode = true; |
43 | 43 | $dc = "uw"; |
44 | 44 | $definedMeaningId=663665; # education |
45 | | - $filterLanguageId=0; # ??? What does this do ??? |
46 | | - $possiblySynonymousRelationTypeId=0; # ??? What does this do ??? |
47 | | - $queryTransactionInformation= new QueryLatestTransactionInformation(); |
| 45 | + $viewInformation = new ViewInformation(); |
| 46 | + $viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation(); |
48 | 47 | |
49 | | - $model=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation); |
| 48 | + $model=new DefinedMeaningModel($definedMeaningId, $viewInformation); |
50 | 49 | $testRecord=$model->getRecord(); |
51 | 50 | } |
52 | 51 | |
Index: trunk/extensions/Wikidata/OmegaWiki/RecordHelper.php |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | } |
78 | 78 | |
79 | 79 | public function getRecord() { |
80 | | - return $record; |
| 80 | + return $this->record; |
81 | 81 | } |
82 | 82 | |
83 | 83 | # should probably be abstract. Making non-abstract |
Index: trunk/extensions/Wikidata/OmegaWiki/SaveDM.php |
— | — | @@ -18,10 +18,9 @@ |
19 | 19 | global |
20 | 20 | $wdCurrentContext; |
21 | 21 | $wdCurrentContext=$dc; |
22 | | - $filterLanguageId=0; # ??? What does this do ??? |
23 | | - $possiblySynonymousRelationTypeId=0; # ??? What does this do ??? |
24 | | - $queryTransactionInformation= new QueryLatestTransactionInformation(); |
25 | | - $model=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation); |
| 22 | + $viewInformation = new ViewInformation(); |
| 23 | + $viewInformation->queryTransactionInformation= new QueryLatestTransactionInformation(); |
| 24 | + $model=new DefinedMeaningModel($definedMeaningId, $viewInformation); |
26 | 25 | $record=$model->getRecord(); |
27 | 26 | $record->finish("DefinedMeaning"); |
28 | 27 | return $model; |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php |
— | — | @@ -273,7 +273,7 @@ |
274 | 274 | } |
275 | 275 | |
276 | 276 | function removeRelation($definedMeaning1Id, $relationTypeId, $definedMeaning2Id) { |
277 | | - $dc=$wdGetDataSetContext(); |
| 277 | + $dc=wdGetDataSetContext(); |
278 | 278 | $dbr =& wfGetDB(DB_MASTER); |
279 | 279 | $dbr->query("UPDATE {$dc}_meaning_relations SET remove_transaction_id=" . getUpdateTransactionId() . |
280 | 280 | " WHERE meaning1_mid=$definedMeaning1Id AND meaning2_mid=$definedMeaning2Id AND relationtype_mid=$relationTypeId " . |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaning.php |
— | — | @@ -27,11 +27,7 @@ |
28 | 28 | |
29 | 29 | $wgOut->addHTML($this->getConceptPanel()); |
30 | 30 | |
31 | | - $dmModel=new DefinedMeaningModel( |
32 | | - $definedMeaningId, |
33 | | - $this->filterLanguageId, |
34 | | - $this->possiblySynonymousRelationTypeId, |
35 | | - $this->viewQueryTransactionInformation); |
| 31 | + $dmModel=new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
36 | 32 | |
37 | 33 | $wgOut->addHTML( |
38 | 34 | getDefinedMeaningEditor( |
— | — | @@ -52,12 +48,8 @@ |
53 | 49 | $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
54 | 50 | |
55 | 51 | $this->outputEditHeader(); |
56 | | - $dmModel=new DefinedMeaningModel( |
57 | | - $definedMeaningId, |
58 | | - $this->filterLanguageId, |
59 | | - $this->possiblySynonymousRelationTypeId, |
60 | | - new QueryLatestTransactionInformation() |
61 | | - ); |
| 52 | + $dmModel = new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
| 53 | + |
62 | 54 | $wgOut->addHTML( |
63 | 55 | getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->edit( |
64 | 56 | $this->getIdStack($definedMeaningId), |
— | — | @@ -74,12 +66,7 @@ |
75 | 67 | parent::history(); |
76 | 68 | |
77 | 69 | $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
78 | | - $dmModel=new DefinedMeaningModel( |
79 | | - $definedMeaningId, |
80 | | - $this->filterLanguageId, |
81 | | - $this->possiblySynonymousRelationTypeId, |
82 | | - $this->queryTransactionInformation |
83 | | - ); |
| 70 | + $dmModel=new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
84 | 71 | $wgOut->addHTML( |
85 | 72 | getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, $this->showRecordLifeSpan, false)->view( |
86 | 73 | new IdStack("defined-meaning"), |
— | — | @@ -99,31 +86,21 @@ |
100 | 87 | $wgTitle; |
101 | 88 | |
102 | 89 | $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
103 | | - $dmModel=new DefinedMeaningModel( |
104 | | - $definedMeaningId, |
105 | | - $this->filterLanguageId, |
106 | | - $this->possiblySynonymousRelationTypeId, |
107 | | - $this->viewQueryTransactionInformation |
108 | | - ); |
| 90 | + $dmModel = new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
109 | 91 | $record=$dmModel->getRecord(); |
110 | 92 | return $record; |
111 | 93 | } |
112 | 94 | |
113 | | - protected function save($referenceTransaction) { |
| 95 | + protected function save($referenceQueryTransactionInformation) { |
114 | 96 | global |
115 | 97 | $wgTitle; |
116 | 98 | |
117 | | - parent::save($referenceTransaction); |
| 99 | + parent::save($referenceQueryTransactionInformation); |
118 | 100 | $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
119 | 101 | |
120 | | - $dmModel=new DefinedMeaningModel( |
121 | | - $definedMeaningId, |
122 | | - $this->filterLanguageId, |
123 | | - $this->possiblySynonymousRelationTypeId, |
124 | | - $referenceTransaction |
125 | | - ); |
126 | | - |
| 102 | + $dmModel =new DefinedMeaningModel($definedMeaningId, $this->viewInformation); |
127 | 103 | $definedMeaningId = $this->getDefinedMeaningIdFromTitle($wgTitle->getText()); |
| 104 | + |
128 | 105 | getDefinedMeaningEditor($this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->save( |
129 | 106 | $this->getIdStack($definedMeaningId), |
130 | 107 | $dmModel->getRecord() |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php |
— | — | @@ -8,6 +8,7 @@ |
9 | 9 | require_once('WikiDataTables.php'); |
10 | 10 | require_once('RecordSetQueries.php'); |
11 | 11 | require_once('DefinedMeaningModel.php'); |
| 12 | +require_once('ViewInformation.php'); |
12 | 13 | |
13 | 14 | function getSynonymSQLForLanguage($languageId, &$definedMeaningIds) { |
14 | 15 | |
— | — | @@ -219,16 +220,16 @@ |
220 | 221 | } |
221 | 222 | } |
222 | 223 | |
223 | | -function expandTranslatedContentInRecord($record, $idAttribute, $translatedContentAttribute, $filterLanguageId, $queryTransactionInformation) { |
| 224 | +function expandTranslatedContentInRecord($record, $idAttribute, $translatedContentAttribute, ViewInformation $viewInformation) { |
224 | 225 | $record->setAttributeValue( |
225 | 226 | $translatedContentAttribute, |
226 | | - getTranslatedContentValue($record->getAttributeValue($idAttribute), $filterLanguageId, $queryTransactionInformation) |
| 227 | + getTranslatedContentValue($record->getAttributeValue($idAttribute), $viewInformation) |
227 | 228 | ); |
228 | 229 | } |
229 | 230 | |
230 | | -function expandTranslatedContentsInRecordSet($recordSet, $idAttribute, $translatedContentAttribute, $filterLanguageId, $queryTransactionInformation) { |
| 231 | +function expandTranslatedContentsInRecordSet($recordSet, $idAttribute, $translatedContentAttribute, ViewInformation $viewInformation) { |
231 | 232 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) |
232 | | - expandTranslatedContentInRecord($recordSet->getRecord($i), $idAttribute, $translatedContentAttribute, $filterLanguageId, $queryTransactionInformation); |
| 233 | + expandTranslatedContentInRecord($recordSet->getRecord($i), $idAttribute, $translatedContentAttribute, $viewInformation); |
233 | 234 | } |
234 | 235 | |
235 | 236 | function getExpressionReferenceRecords($expressionIds) { |
— | — | @@ -352,7 +353,7 @@ |
353 | 354 | } |
354 | 355 | } |
355 | 356 | |
356 | | -function getExpressionMeaningsRecordSet($expressionId, $exactMeaning, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) { |
| 357 | +function getExpressionMeaningsRecordSet($expressionId, $exactMeaning, ViewInformation $viewInformation) { |
357 | 358 | global |
358 | 359 | $expressionMeaningStructure, $definedMeaningIdAttribute; |
359 | 360 | |
— | — | @@ -370,7 +371,7 @@ |
371 | 372 | |
372 | 373 | while($definedMeaning = $dbr->fetchObject($queryResult)) { |
373 | 374 | $definedMeaningId = $definedMeaning->defined_meaning_id; |
374 | | - $dmModel=new DefinedMeaningModel($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation); |
| 375 | + $dmModel=new DefinedMeaningModel($definedMeaningId, $viewInformation); |
375 | 376 | $recordSet->addRecord( |
376 | 377 | array( |
377 | 378 | $definedMeaningId, |
— | — | @@ -383,27 +384,24 @@ |
384 | 385 | return $recordSet; |
385 | 386 | } |
386 | 387 | |
387 | | -function getExpressionMeaningsRecord($expressionId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) { |
| 388 | +function getExpressionMeaningsRecord($expressionId, ViewInformation $viewInformation) { |
388 | 389 | global |
389 | 390 | $expressionMeaningsStructure, $expressionExactMeaningsAttribute, $expressionApproximateMeaningsAttribute; |
390 | 391 | |
391 | 392 | $record = new ArrayRecord($expressionMeaningsStructure); |
392 | | - $record->setAttributeValue($expressionExactMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, true, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation)); |
393 | | - $record->setAttributeValue($expressionApproximateMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, false, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation)); |
| 393 | + $record->setAttributeValue($expressionExactMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, true, $viewInformation)); |
| 394 | + $record->setAttributeValue($expressionApproximateMeaningsAttribute, getExpressionMeaningsRecordSet($expressionId, false, $viewInformation)); |
394 | 395 | |
395 | 396 | return $record; |
396 | 397 | } |
397 | 398 | |
398 | | -function getExpressionsRecordSet($spelling, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) { |
| 399 | +function getExpressionsRecordSet($spelling, ViewInformation $viewInformation) { |
399 | 400 | global |
400 | 401 | $expressionIdAttribute, $expressionAttribute, $languageAttribute, $expressionMeaningsAttribute, $expressionsStructure; |
401 | 402 | |
402 | 403 | $dc=wdGetDataSetContext(); |
403 | 404 | |
404 | | - if ($filterLanguageId != 0) |
405 | | - $languageRestriction = " AND language_id=$filterLanguageId"; |
406 | | - else |
407 | | - $languageRestriction = ""; |
| 405 | + $languageRestriction = $viewInformation->filterLanguageId != 0 ? " AND language_id=". $viewInformation->filterLanguageId : ""; |
408 | 406 | |
409 | 407 | $dbr =& wfGetDB(DB_SLAVE); |
410 | 408 | $queryResult = $dbr->query( |
— | — | @@ -430,7 +428,7 @@ |
431 | 429 | $result->addRecord(array( |
432 | 430 | $expression->expression_id, |
433 | 431 | $expressionRecord, |
434 | | - getExpressionMeaningsRecord($expression->expression_id, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) |
| 432 | + getExpressionMeaningsRecord($expression->expression_id, $viewInformation) |
435 | 433 | )); |
436 | 434 | } |
437 | 435 | |
— | — | @@ -462,14 +460,14 @@ |
463 | 461 | } |
464 | 462 | |
465 | 463 | |
466 | | -function getClassAttributesRecordSet($definedMeaningId, $queryTransactionInformation) { |
| 464 | +function getClassAttributesRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
467 | 465 | global |
468 | 466 | $classAttributesTable, $classAttributeIdAttribute, $classAttributeLevelAttribute, $classAttributeAttributeAttribute, $classAttributeTypeAttribute, $optionAttributeOptionsAttribute, |
469 | 467 | $classAttributesStructure; |
470 | 468 | |
471 | 469 | $recordSet = queryRecordSet( |
472 | 470 | $classAttributesStructure->getStructureType(), |
473 | | - $queryTransactionInformation, |
| 471 | + $viewInformation->queryTransactionInformation, |
474 | 472 | $classAttributeIdAttribute, |
475 | 473 | array( |
476 | 474 | 'object_id' => $classAttributeIdAttribute, |
— | — | @@ -482,30 +480,30 @@ |
483 | 481 | ); |
484 | 482 | |
485 | 483 | expandDefinedMeaningReferencesInRecordSet($recordSet, array($classAttributeLevelAttribute ,$classAttributeAttributeAttribute)); |
486 | | - expandOptionAttributeOptionsInRecordSet($recordSet, $classAttributeIdAttribute, $queryTransactionInformation); |
| 484 | + expandOptionAttributeOptionsInRecordSet($recordSet, $classAttributeIdAttribute, $viewInformation); |
487 | 485 | |
488 | 486 | return $recordSet; |
489 | 487 | } |
490 | 488 | |
491 | | -function expandOptionAttributeOptionsInRecordSet($recordSet, $attributeIdAttribute, $queryTransactionInformation) { |
| 489 | +function expandOptionAttributeOptionsInRecordSet($recordSet, $attributeIdAttribute, ViewInformation $viewInformation) { |
492 | 490 | global |
493 | 491 | $definedMeaningIdAttribute, $optionAttributeOptionsAttribute; |
494 | 492 | |
495 | 493 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
496 | 494 | $record = $recordSet->getRecord($i); |
497 | 495 | |
498 | | - $record->setAttributeValue($optionAttributeOptionsAttribute, getOptionAttributeOptionsRecordSet($record->getAttributeValue($attributeIdAttribute), $queryTransactionInformation)); |
| 496 | + $record->setAttributeValue($optionAttributeOptionsAttribute, getOptionAttributeOptionsRecordSet($record->getAttributeValue($attributeIdAttribute), $viewInformation)); |
499 | 497 | } |
500 | 498 | } |
501 | 499 | |
502 | | -function getAlternativeDefinitionsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation) { |
| 500 | +function getAlternativeDefinitionsRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
503 | 501 | global |
504 | 502 | $alternativeDefinitionsTable, $definitionIdAttribute, $alternativeDefinitionAttribute, $sourceAttribute, |
505 | 503 | $alternativeDefinitionsStructure; |
506 | 504 | |
507 | 505 | $recordSet = queryRecordSet( |
508 | 506 | $alternativeDefinitionsStructure->getStructureType(), |
509 | | - $queryTransactionInformation, |
| 507 | + $viewInformation->queryTransactionInformation, |
510 | 508 | $definitionIdAttribute, |
511 | 509 | array( |
512 | 510 | 'meaning_text_tcid' => $definitionIdAttribute, |
— | — | @@ -517,56 +515,55 @@ |
518 | 516 | |
519 | 517 | $recordSet->getStructure()->addAttribute($alternativeDefinitionAttribute); |
520 | 518 | |
521 | | - expandTranslatedContentsInRecordSet($recordSet, $definitionIdAttribute, $alternativeDefinitionAttribute, $filterLanguageId, $queryTransactionInformation); |
| 519 | + expandTranslatedContentsInRecordSet($recordSet, $definitionIdAttribute, $alternativeDefinitionAttribute, $viewInformation); |
522 | 520 | expandDefinedMeaningReferencesInRecordSet($recordSet, array($sourceAttribute)); |
523 | 521 | |
524 | 522 | return $recordSet; |
525 | 523 | } |
526 | 524 | |
527 | | -function getDefinedMeaningDefinitionRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation) { |
| 525 | +function getDefinedMeaningDefinitionRecord($definedMeaningId, ViewInformation $viewInformation) { |
528 | 526 | global |
529 | 527 | $definitionAttribute, $translatedTextAttribute, $objectAttributesAttribute; |
530 | 528 | |
531 | 529 | $definitionId = getDefinedMeaningDefinitionId($definedMeaningId); |
532 | 530 | $record = new ArrayRecord(new Structure($definitionAttribute)); |
533 | | - $record->setAttributeValue($translatedTextAttribute, getTranslatedContentValue($definitionId, $filterLanguageId, $queryTransactionInformation)); |
534 | | - $record->setAttributeValue($objectAttributesAttribute, getObjectAttributesRecord($definitionId, $filterLanguageId, $queryTransactionInformation,$objectAttributesAttribute->id)); |
| 531 | + $record->setAttributeValue($translatedTextAttribute, getTranslatedContentValue($definitionId, $viewInformation)); |
| 532 | + $record->setAttributeValue($objectAttributesAttribute, getObjectAttributesRecord($definitionId, $viewInformation, $objectAttributesAttribute->id)); |
535 | 533 | |
536 | 534 | return $record; |
537 | 535 | } |
538 | 536 | |
539 | | -function getObjectAttributesRecord($objectId, $filterLanguageId, $queryTransactionInformation, $structuralOverride=null) { |
| 537 | +function getObjectAttributesRecord($objectId, ViewInformation $viewInformation, $structuralOverride = null) { |
540 | 538 | global |
541 | 539 | $objectAttributesAttribute, $objectIdAttribute, |
542 | 540 | $urlAttributeValuesAttribute, $textAttributeValuesAttribute, |
543 | 541 | $translatedTextAttributeValuesAttribute, $optionAttributeValuesAttribute, |
544 | 542 | $definedMeaningAttributesAttribute; |
545 | 543 | |
546 | | - if($structuralOverride) { |
| 544 | + if ($structuralOverride) |
547 | 545 | $record = new ArrayRecord(new Structure($structuralOverride,$definedMeaningAttributesAttribute)); |
548 | | - } else { |
| 546 | + else |
549 | 547 | $record = new ArrayRecord(new Structure($definedMeaningAttributesAttribute)); |
550 | | - } |
551 | 548 | |
552 | 549 | $record->setAttributeValue($objectIdAttribute, $objectId); |
553 | | - $record->setAttributeValue($textAttributeValuesAttribute, getTextAttributesValuesRecordSet(array($objectId), $filterLanguageId, $queryTransactionInformation)); |
554 | | - $record->setAttributeValue($translatedTextAttributeValuesAttribute, getTranslatedTextAttributeValuesRecordSet(array($objectId), $filterLanguageId, $queryTransactionInformation)); |
555 | | - $record->setAttributeValue($urlAttributeValuesAttribute, getURLAttributeValuesRecordSet(array($objectId), $filterLanguageId, $queryTransactionInformation)); |
556 | | - $record->setAttributeValue($optionAttributeValuesAttribute, getOptionAttributeValuesRecordSet(array($objectId), $filterLanguageId, $queryTransactionInformation)); |
| 550 | + $record->setAttributeValue($textAttributeValuesAttribute, getTextAttributesValuesRecordSet(array($objectId), $viewInformation)); |
| 551 | + $record->setAttributeValue($translatedTextAttributeValuesAttribute, getTranslatedTextAttributeValuesRecordSet(array($objectId), $viewInformation)); |
| 552 | + $record->setAttributeValue($urlAttributeValuesAttribute, getURLAttributeValuesRecordSet(array($objectId), $viewInformation)); |
| 553 | + $record->setAttributeValue($optionAttributeValuesAttribute, getOptionAttributeValuesRecordSet(array($objectId), $viewInformation)); |
557 | 554 | |
558 | 555 | return $record; |
559 | 556 | } |
560 | 557 | |
561 | | -function getTranslatedContentValue($translatedContentId, $filterLanguageId, $queryTransactionInformation) { |
| 558 | +function getTranslatedContentValue($translatedContentId, ViewInformation $viewInformation) { |
562 | 559 | global |
563 | 560 | $textAttribute; |
564 | 561 | |
565 | | - if ($filterLanguageId == 0) |
566 | | - return getTranslatedContentRecordSet($translatedContentId, $queryTransactionInformation); |
| 562 | + if ($viewInformation->filterLanguageId == 0) |
| 563 | + return getTranslatedContentRecordSet($translatedContentId, $viewInformation); |
567 | 564 | else { |
568 | | - $recordSet = getFilteredTranslatedContentRecordSet($translatedContentId, $filterLanguageId, $queryTransactionInformation); |
| 565 | + $recordSet = getFilteredTranslatedContentRecordSet($translatedContentId, $viewInformation); |
569 | 566 | |
570 | | - if (count($queryTransactionInformation->versioningAttributes()) > 0) |
| 567 | + if (count($viewInformation->queryTransactionInformation->versioningAttributes()) > 0) |
571 | 568 | return $recordSet; |
572 | 569 | else { |
573 | 570 | if ($recordSet->getRecordCount() > 0) |
— | — | @@ -577,14 +574,14 @@ |
578 | 575 | } |
579 | 576 | } |
580 | 577 | |
581 | | -function getTranslatedContentRecordSet($translatedContentId, $queryTransactionInformation) { |
| 578 | +function getTranslatedContentRecordSet($translatedContentId, ViewInformation $viewInformation) { |
582 | 579 | global |
583 | 580 | $translatedContentTable, $languageAttribute, $textAttribute, |
584 | 581 | $translatedTextStructure; |
585 | 582 | |
586 | 583 | $recordSet = queryRecordSet( |
587 | 584 | $translatedTextStructure->getStructureType(), |
588 | | - $queryTransactionInformation, |
| 585 | + $viewInformation->queryTransactionInformation, |
589 | 586 | $languageAttribute, |
590 | 587 | array( |
591 | 588 | 'language_id' => $languageAttribute, |
— | — | @@ -599,13 +596,13 @@ |
600 | 597 | return $recordSet; |
601 | 598 | } |
602 | 599 | |
603 | | -function getFilteredTranslatedContentRecordSet($translatedContentId, $filterLanguageId, $queryTransactionInformation) { |
| 600 | +function getFilteredTranslatedContentRecordSet($translatedContentId, ViewInformation $viewInformation) { |
604 | 601 | global |
605 | 602 | $translatedContentTable, $languageAttribute, $textAttribute; |
606 | 603 | |
607 | 604 | $recordSet = queryRecordSet( |
608 | 605 | null, |
609 | | - $queryTransactionInformation, |
| 606 | + $viewInformation->queryTransactionInformation, |
610 | 607 | $languageAttribute, |
611 | 608 | array( |
612 | 609 | 'language_id' => $languageAttribute, |
— | — | @@ -614,7 +611,7 @@ |
615 | 612 | $translatedContentTable, |
616 | 613 | array( |
617 | 614 | "translated_content_id=$translatedContentId", |
618 | | - "language_id=$filterLanguageId" |
| 615 | + "language_id=" . $viewInformation->filterLanguageId |
619 | 616 | ) |
620 | 617 | ); |
621 | 618 | |
— | — | @@ -623,7 +620,7 @@ |
624 | 621 | return $recordSet; |
625 | 622 | } |
626 | 623 | |
627 | | -function getSynonymAndTranslationRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation) { |
| 624 | +function getSynonymAndTranslationRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
628 | 625 | global |
629 | 626 | $syntransTable, $syntransIdAttribute, $expressionAttribute, $identicalMeaningAttribute, $objectAttributesAttribute, |
630 | 627 | $synonymsTranslationsStructure; |
— | — | @@ -631,19 +628,19 @@ |
632 | 629 | $dc=wdGetDataSetContext(); |
633 | 630 | $restrictions = array("defined_meaning_id=$definedMeaningId"); |
634 | 631 | |
635 | | - if ($filterLanguageId != 0) |
| 632 | + if ($viewInformation->filterLanguageId != 0) |
636 | 633 | $restrictions[] = |
637 | 634 | "expression_id IN (" . |
638 | 635 | "SELECT expressions.expression_id" . |
639 | 636 | " FROM {$dc}_expression_ns AS expressions" . |
640 | 637 | " WHERE expressions.expression_id=expression_id" . |
641 | | - " AND language_id=$filterLanguageId" . |
| 638 | + " AND language_id=" . $viewInformation->filterLanguageId . |
642 | 639 | " AND " . getLatestTransactionRestriction('expressions') . |
643 | 640 | ")"; |
644 | 641 | |
645 | 642 | $recordSet = queryRecordSet( |
646 | 643 | $synonymsTranslationsStructure->getStructureType(), |
647 | | - $queryTransactionInformation, |
| 644 | + $viewInformation->queryTransactionInformation, |
648 | 645 | $syntransIdAttribute, |
649 | 646 | array( |
650 | 647 | 'syntrans_sid' => $syntransIdAttribute, |
— | — | @@ -654,7 +651,7 @@ |
655 | 652 | $restrictions |
656 | 653 | ); |
657 | 654 | |
658 | | - if ($filterLanguageId == 0) |
| 655 | + if ($viewInformation->filterLanguageId == 0) |
659 | 656 | expandExpressionReferencesInRecordSet($recordSet, array($expressionAttribute)); |
660 | 657 | else |
661 | 658 | expandExpressionSpellingsInRecordSet($recordSet, array($expressionAttribute)); |
— | — | @@ -662,11 +659,11 @@ |
663 | 660 | //add object attributes attribute to the generated structure |
664 | 661 | //and expand the records |
665 | 662 | $recordSet->getStructure()->addAttribute($objectAttributesAttribute); |
666 | | - expandObjectAttributesAttribute($recordSet, $syntransIdAttribute, $filterLanguageId, $queryTransactionInformation); |
| 663 | + expandObjectAttributesAttribute($recordSet, $syntransIdAttribute, $viewInformation); |
667 | 664 | return $recordSet; |
668 | 665 | } |
669 | 666 | |
670 | | -function expandObjectAttributesAttribute($recordSet, $objectIdAttribute, $filterLanguageId, $queryTransactionInformation) { |
| 667 | +function expandObjectAttributesAttribute($recordSet, $objectIdAttribute, ViewInformation $viewInformation) { |
671 | 668 | global |
672 | 669 | $objectAttributesAttribute, |
673 | 670 | $textAttributeObjectAttribute, $textAttributeValuesAttribute, |
— | — | @@ -685,7 +682,7 @@ |
686 | 683 | } |
687 | 684 | |
688 | 685 | // Text attributes |
689 | | - $allTextAttributeValuesRecordSet = getTextAttributesValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation); |
| 686 | + $allTextAttributeValuesRecordSet = getTextAttributesValuesRecordSet($objectIds, $viewInformation); |
690 | 687 | $textAttributeValuesRecordSets = |
691 | 688 | splitRecordSet( |
692 | 689 | $allTextAttributeValuesRecordSet, |
— | — | @@ -695,7 +692,7 @@ |
696 | 693 | $emptyTextAttributesRecordSet = new ArrayRecordSet($allTextAttributeValuesRecordSet->getStructure(), $allTextAttributeValuesRecordSet->getKey()); |
697 | 694 | |
698 | 695 | // Translated text attributes |
699 | | - $allTranslatedTextAttributeValuesRecordSet = getTranslatedTextAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation); |
| 696 | + $allTranslatedTextAttributeValuesRecordSet = getTranslatedTextAttributeValuesRecordSet($objectIds, $viewInformation); |
700 | 697 | $translatedTextAttributeValuesRecordSets = |
701 | 698 | splitRecordSet( |
702 | 699 | $allTranslatedTextAttributeValuesRecordSet, |
— | — | @@ -705,7 +702,7 @@ |
706 | 703 | $emptyTranslatedTextAttributesRecordSet = new ArrayRecordSet($allTranslatedTextAttributeValuesRecordSet->getStructure(), $allTranslatedTextAttributeValuesRecordSet->getKey()); |
707 | 704 | |
708 | 705 | // URL attributes |
709 | | - $allURLAttributeValuesRecordSet = getURLAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation); |
| 706 | + $allURLAttributeValuesRecordSet = getURLAttributeValuesRecordSet($objectIds, $viewInformation); |
710 | 707 | $urlAttributeValuesRecordSets = |
711 | 708 | splitRecordSet( |
712 | 709 | $allURLAttributeValuesRecordSet, |
— | — | @@ -715,7 +712,7 @@ |
716 | 713 | $emptyURLAttributesRecordSet = new ArrayRecordSet($allURLAttributeValuesRecordSet->getStructure(), $allURLAttributeValuesRecordSet->getKey()); |
717 | 714 | |
718 | 715 | // Option attributes |
719 | | - $allOptionAttributeValuesRecordSet = getOptionAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation); |
| 716 | + $allOptionAttributeValuesRecordSet = getOptionAttributeValuesRecordSet($objectIds, $viewInformation); |
720 | 717 | $optionAttributeValuesRecordSets = |
721 | 718 | splitRecordSet( |
722 | 719 | $allOptionAttributeValuesRecordSet, |
— | — | @@ -779,7 +776,7 @@ |
780 | 777 | return $record; |
781 | 778 | } |
782 | 779 | |
783 | | -function getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterLanguageId, $filterRelationTypes, $queryTransactionInformation) { |
| 780 | +function getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterRelationTypes, ViewInformation $viewInformation) { |
784 | 781 | global |
785 | 782 | $meaningRelationsTable, $relationIdAttribute, $relationTypeAttribute, |
786 | 783 | $objectAttributesAttribute, $otherDefinedMeaningAttribute, |
— | — | @@ -792,7 +789,7 @@ |
793 | 790 | |
794 | 791 | $recordSet = queryRecordSet( |
795 | 792 | $relationStructure->getStructureType(), |
796 | | - $queryTransactionInformation, |
| 793 | + $viewInformation->queryTransactionInformation, |
797 | 794 | $relationIdAttribute, |
798 | 795 | array( |
799 | 796 | 'relation_id' => $relationIdAttribute, |
— | — | @@ -810,12 +807,12 @@ |
811 | 808 | //and expand the records |
812 | 809 | $struct=$recordSet->getStructure(); |
813 | 810 | $struct->addAttribute($objectAttributesAttribute); |
814 | | - expandObjectAttributesAttribute($recordSet, $relationIdAttribute, $filterLanguageId, $queryTransactionInformation); |
| 811 | + expandObjectAttributesAttribute($recordSet, $relationIdAttribute, $viewInformation); |
815 | 812 | |
816 | 813 | return $recordSet; |
817 | 814 | } |
818 | 815 | |
819 | | -function getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation) { |
| 816 | +function getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
820 | 817 | global |
821 | 818 | $meaningRelationsTable, $relationIdAttribute, $relationTypeAttribute, |
822 | 819 | $otherDefinedMeaningAttribute, $objectAttributesAttribute, |
— | — | @@ -823,7 +820,7 @@ |
824 | 821 | |
825 | 822 | $recordSet = queryRecordSet( |
826 | 823 | $reciprocalRelationsAttribute->id, |
827 | | - $queryTransactionInformation, |
| 824 | + $viewInformation->queryTransactionInformation, |
828 | 825 | $relationIdAttribute, |
829 | 826 | array( |
830 | 827 | 'relation_id' => $relationIdAttribute, |
— | — | @@ -841,19 +838,19 @@ |
842 | 839 | //and expand the records |
843 | 840 | $struct=$recordSet->getStructure(); |
844 | 841 | $struct->addAttribute($objectAttributesAttribute); |
845 | | - expandObjectAttributesAttribute($recordSet, $relationIdAttribute, $filterLanguageId, $queryTransactionInformation); |
| 842 | + expandObjectAttributesAttribute($recordSet, $relationIdAttribute, $viewInformation); |
846 | 843 | |
847 | 844 | return $recordSet; |
848 | 845 | } |
849 | 846 | |
850 | | -function getPossiblySynonymousRecordSet($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) { |
| 847 | +function getPossiblySynonymousRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
851 | 848 | global |
852 | 849 | $meaningRelationsTable, $possiblySynonymousIdAttribute, $possibleSynonymAttribute, |
853 | 850 | $objectAttributesAttribute, $otherDefinedMeaningAttribute; |
854 | 851 | |
855 | 852 | $recordSet = queryRecordSet( |
856 | 853 | null, |
857 | | - $queryTransactionInformation, |
| 854 | + $viewInformation->queryTransactionInformation, |
858 | 855 | $possiblySynonymousIdAttribute, |
859 | 856 | array( |
860 | 857 | 'relation_id' => $possiblySynonymousIdAttribute, |
— | — | @@ -862,7 +859,7 @@ |
863 | 860 | $meaningRelationsTable, |
864 | 861 | array( |
865 | 862 | "meaning1_mid=$definedMeaningId", |
866 | | - "relationtype_mid=" . $possiblySynonymousRelationTypeId |
| 863 | + "relationtype_mid=" . $viewInformation->possiblySynonymousRelationTypeId |
867 | 864 | ), |
868 | 865 | array('add_transaction_id') |
869 | 866 | ); |
— | — | @@ -873,7 +870,7 @@ |
874 | 871 | //and expand the records |
875 | 872 | $struct=$recordSet->getStructure(); |
876 | 873 | $struct->addAttribute($objectAttributesAttribute); |
877 | | - expandObjectAttributesAttribute($recordSet, $possiblySynonymousIdAttribute, $filterLanguageId, $queryTransactionInformation); |
| 874 | + expandObjectAttributesAttribute($recordSet, $possiblySynonymousIdAttribute, $viewInformation); |
878 | 875 | |
879 | 876 | return $recordSet; |
880 | 877 | } |
— | — | @@ -889,14 +886,14 @@ |
890 | 887 | return $result; |
891 | 888 | } |
892 | 889 | |
893 | | -function getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, $queryTransactionInformation) { |
| 890 | +function getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
894 | 891 | global |
895 | 892 | $collectionMembershipsTable, $collectionIdAttribute, $collectionMeaningAttribute, $sourceIdentifierAttribute, |
896 | 893 | $gotoSourceAttribute, $collectionMembershipStructure; |
897 | 894 | |
898 | 895 | $recordSet = queryRecordSet( |
899 | 896 | $collectionMembershipStructure->getStructureType(), |
900 | | - $queryTransactionInformation, |
| 897 | + $viewInformation->queryTransactionInformation, |
901 | 898 | $collectionIdAttribute, |
902 | 899 | array( |
903 | 900 | 'collection_id' => $collectionIdAttribute, |
— | — | @@ -919,7 +916,7 @@ |
920 | 917 | return $recordSet; |
921 | 918 | } |
922 | 919 | |
923 | | -function getTextAttributesValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation) { |
| 920 | +function getTextAttributesValuesRecordSet($objectIds, ViewInformation $viewInformation) { |
924 | 921 | global |
925 | 922 | $textAttributeValuesTable, $textAttributeIdAttribute, $textAttributeObjectAttribute, |
926 | 923 | $textAttributeAttribute, $textAttribute, $objectAttributesAttribute, |
— | — | @@ -927,7 +924,7 @@ |
928 | 925 | |
929 | 926 | $recordSet = queryRecordSet( |
930 | 927 | $textAttributeValuesStructure->getStructureType(), |
931 | | - $queryTransactionInformation, |
| 928 | + $viewInformation->queryTransactionInformation, |
932 | 929 | $textAttributeIdAttribute, |
933 | 930 | array( |
934 | 931 | 'value_id' => $textAttributeIdAttribute, |
— | — | @@ -944,12 +941,12 @@ |
945 | 942 | //add object attributes attribute to the generated structure |
946 | 943 | //and expand the records |
947 | 944 | $recordSet->getStructure()->addAttribute($objectAttributesAttribute); |
948 | | - expandObjectAttributesAttribute($recordSet, $textAttributeIdAttribute, $filterLanguageId, $queryTransactionInformation); |
| 945 | + expandObjectAttributesAttribute($recordSet, $textAttributeIdAttribute, $viewInformation); |
949 | 946 | |
950 | 947 | return $recordSet; |
951 | 948 | } |
952 | 949 | |
953 | | -function getURLAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation) { |
| 950 | +function getURLAttributeValuesRecordSet($objectIds, ViewInformation $viewInformation) { |
954 | 951 | global |
955 | 952 | $urlAttributeValuesTable, $urlAttributeIdAttribute, $urlAttributeObjectAttribute, |
956 | 953 | $urlAttributeAttribute, $urlAttribute, $objectAttributesAttribute, |
— | — | @@ -957,7 +954,7 @@ |
958 | 955 | |
959 | 956 | $recordSet = queryRecordSet( |
960 | 957 | $urlAttributeValuesStructure->getStructureType(), |
961 | | - $queryTransactionInformation, |
| 958 | + $viewInformation->queryTransactionInformation, |
962 | 959 | $urlAttributeIdAttribute, |
963 | 960 | array( |
964 | 961 | 'value_id' => $urlAttributeIdAttribute, |
— | — | @@ -974,12 +971,12 @@ |
975 | 972 | //add object attributes attribute to the generated structure |
976 | 973 | //and expand the records |
977 | 974 | $recordSet->getStructure()->addAttribute($objectAttributesAttribute); |
978 | | - expandObjectAttributesAttribute($recordSet, $urlAttributeIdAttribute, $filterLanguageId, $queryTransactionInformation); |
| 975 | + expandObjectAttributesAttribute($recordSet, $urlAttributeIdAttribute, $viewInformation); |
979 | 976 | |
980 | 977 | return $recordSet; |
981 | 978 | } |
982 | 979 | |
983 | | -function getTranslatedTextAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation) { |
| 980 | +function getTranslatedTextAttributeValuesRecordSet($objectIds, ViewInformation $viewInformation) { |
984 | 981 | global |
985 | 982 | $translatedTextAttributeIdAttribute, $translatedContentAttributeValuesTable, $translatedTextAttributeAttribute, |
986 | 983 | $objectAttributesAttribute, $translatedTextAttributeObjectAttribute, $translatedTextValueAttribute, $translatedTextValueIdAttribute, |
— | — | @@ -987,7 +984,7 @@ |
988 | 985 | |
989 | 986 | $recordSet = queryRecordSet( |
990 | 987 | $translatedTextAttributeValuesStructure->getStructureType(), |
991 | | - $queryTransactionInformation, |
| 988 | + $viewInformation->queryTransactionInformation, |
992 | 989 | $translatedTextAttributeIdAttribute, |
993 | 990 | array( |
994 | 991 | 'value_id' => $translatedTextAttributeIdAttribute, |
— | — | @@ -1001,23 +998,23 @@ |
1002 | 999 | |
1003 | 1000 | $recordSet->getStructure()->addAttribute($translatedTextValueAttribute); |
1004 | 1001 | |
1005 | | - expandTranslatedContentsInRecordSet($recordSet, $translatedTextValueIdAttribute, $translatedTextValueAttribute, $filterLanguageId, $queryTransactionInformation); |
| 1002 | + expandTranslatedContentsInRecordSet($recordSet, $translatedTextValueIdAttribute, $translatedTextValueAttribute, $viewInformation); |
1006 | 1003 | expandDefinedMeaningReferencesInRecordSet($recordSet, array($translatedTextAttributeAttribute)); |
1007 | 1004 | |
1008 | 1005 | //add object attributes attribute to the generated structure |
1009 | 1006 | //and expand the records |
1010 | 1007 | $recordSet->getStructure()->addAttribute($objectAttributesAttribute); |
1011 | | - expandObjectAttributesAttribute($recordSet, $translatedTextAttributeIdAttribute, $filterLanguageId, $queryTransactionInformation); |
| 1008 | + expandObjectAttributesAttribute($recordSet, $translatedTextAttributeIdAttribute, $viewInformation); |
1012 | 1009 | return $recordSet; |
1013 | 1010 | } |
1014 | 1011 | |
1015 | | -function getOptionAttributeOptionsRecordSet($attributeId, $queryTransactionInformation) { |
| 1012 | +function getOptionAttributeOptionsRecordSet($attributeId, ViewInformation $viewInformation) { |
1016 | 1013 | global |
1017 | 1014 | $optionAttributeOptionIdAttribute, $optionAttributeAttribute, $optionAttributeOptionAttribute, $languageAttribute, $optionAttributeOptionsTable; |
1018 | 1015 | |
1019 | 1016 | $recordSet = queryRecordSet( |
1020 | 1017 | null, |
1021 | | - $queryTransactionInformation, |
| 1018 | + $viewInformation->queryTransactionInformation, |
1022 | 1019 | $optionAttributeOptionIdAttribute, |
1023 | 1020 | array( |
1024 | 1021 | 'option_id' => $optionAttributeOptionIdAttribute, |
— | — | @@ -1034,14 +1031,14 @@ |
1035 | 1032 | return $recordSet; |
1036 | 1033 | } |
1037 | 1034 | |
1038 | | -function getOptionAttributeValuesRecordSet($objectIds, $filterLanguageId, $queryTransactionInformation) { |
| 1035 | +function getOptionAttributeValuesRecordSet($objectIds, ViewInformation $viewInformation) { |
1039 | 1036 | global |
1040 | 1037 | $optionAttributeIdAttribute, $optionAttributeObjectAttribute, $optionAttributeOptionIdAttribute, $optionAttributeAttribute,$optionAttributeOptionAttribute, $optionAttributeValuesTable, $objectAttributesAttribute, |
1041 | 1038 | $optionAttributeValuesStructure; |
1042 | 1039 | |
1043 | 1040 | $recordSet = queryRecordSet( |
1044 | 1041 | $optionAttributeValuesStructure->getStructureType(), |
1045 | | - $queryTransactionInformation, |
| 1042 | + $viewInformation->queryTransactionInformation, |
1046 | 1043 | $optionAttributeIdAttribute, |
1047 | 1044 | array( |
1048 | 1045 | 'value_id' => $optionAttributeIdAttribute, |
— | — | @@ -1052,19 +1049,19 @@ |
1053 | 1050 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1054 | 1051 | ); |
1055 | 1052 | |
1056 | | - expandOptionsInRecordSet($recordSet, $queryTransactionInformation); |
| 1053 | + expandOptionsInRecordSet($recordSet, $viewInformation); |
1057 | 1054 | expandDefinedMeaningReferencesInRecordSet($recordSet, array($optionAttributeAttribute, $optionAttributeOptionAttribute)); |
1058 | 1055 | |
1059 | 1056 | /* Add object attributes attribute to the generated structure |
1060 | 1057 | and expand the records. */ |
1061 | 1058 | $recordSet->getStructure()->addAttribute($objectAttributesAttribute); |
1062 | | - expandObjectAttributesAttribute($recordSet, $optionAttributeIdAttribute, $filterLanguageId, $queryTransactionInformation); |
| 1059 | + expandObjectAttributesAttribute($recordSet, $optionAttributeIdAttribute, $viewInformation); |
1063 | 1060 | |
1064 | 1061 | return $recordSet; |
1065 | 1062 | } |
1066 | 1063 | |
1067 | 1064 | /* XXX: This can probably be combined with other functions. In fact, it probably should be. Do it. */ |
1068 | | -function expandOptionsInRecordSet($recordSet, $queryTransactionInformation) { |
| 1065 | +function expandOptionsInRecordSet($recordSet, ViewInformation $viewInformation) { |
1069 | 1066 | global |
1070 | 1067 | $optionAttributeOptionIdAttribute, $optionAttributeIdAttribute, $optionAttributeAttribute, $optionAttributeOptionAttribute, $optionAttributeOptionsTable, $classAttributesTable; |
1071 | 1068 | |
— | — | @@ -1073,7 +1070,7 @@ |
1074 | 1071 | |
1075 | 1072 | $optionRecordSet = queryRecordSet( |
1076 | 1073 | null, |
1077 | | - $queryTransactionInformation, |
| 1074 | + $viewInformation->queryTransactionInformation, |
1078 | 1075 | $optionAttributeOptionIdAttribute, |
1079 | 1076 | array( |
1080 | 1077 | 'attribute_id' => $optionAttributeIdAttribute, |
— | — | @@ -1091,7 +1088,7 @@ |
1092 | 1089 | |
1093 | 1090 | $optionRecordSet = queryRecordSet( |
1094 | 1091 | null, |
1095 | | - $queryTransactionInformation, |
| 1092 | + $viewInformation->queryTransactionInformation, |
1096 | 1093 | $optionAttributeIdAttribute, |
1097 | 1094 | array('attribute_mid' => $optionAttributeAttribute), |
1098 | 1095 | $classAttributesTable, |
— | — | @@ -1106,14 +1103,14 @@ |
1107 | 1104 | } |
1108 | 1105 | } |
1109 | 1106 | |
1110 | | -function getDefinedMeaningClassMembershipRecordSet($definedMeaningId, $queryTransactionInformation) { |
| 1107 | +function getDefinedMeaningClassMembershipRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
1111 | 1108 | global |
1112 | 1109 | $classMembershipsTable, $classMembershipIdAttribute, $classAttribute, |
1113 | 1110 | $classMembershipStructure; |
1114 | 1111 | |
1115 | 1112 | $recordSet = queryRecordSet( |
1116 | 1113 | $classMembershipStructure->getStructureType(), |
1117 | | - $queryTransactionInformation, |
| 1114 | + $viewInformation->queryTransactionInformation, |
1118 | 1115 | $classMembershipIdAttribute, |
1119 | 1116 | array( |
1120 | 1117 | 'class_membership_id' => $classMembershipIdAttribute, |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWiki.php |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | require_once('HTMLtable.php'); |
12 | 12 | require_once('OmegaWikiRecordSets.php'); |
13 | 13 | require_once('OmegaWikiEditors.php'); |
| 14 | +require_once('ViewInformation.php'); |
14 | 15 | require_once('WikiDataGlobals.php'); |
15 | 16 | |
16 | 17 | /** |
— | — | @@ -30,12 +31,7 @@ |
31 | 32 | $wgOut->addHTML( |
32 | 33 | getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, $this->shouldShowAuthorities)->view( |
33 | 34 | $this->getIdStack(), |
34 | | - getExpressionsRecordSet( |
35 | | - $spelling, |
36 | | - $this->filterLanguageId, |
37 | | - $this->possiblySynonymousRelationTypeId, |
38 | | - $this->viewQueryTransactionInformation |
39 | | - ) |
| 35 | + getExpressionsRecordSet($spelling, $this->viewInformation) |
40 | 36 | ) |
41 | 37 | ); |
42 | 38 | |
— | — | @@ -49,16 +45,11 @@ |
50 | 46 | parent::history(); |
51 | 47 | |
52 | 48 | $spelling = $wgTitle->getText(); |
53 | | - |
| 49 | + |
54 | 50 | $wgOut->addHTML( |
55 | 51 | getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, $this->showRecordLifeSpan, false)->view( |
56 | 52 | $this->getIdStack(), |
57 | | - getExpressionsRecordSet( |
58 | | - $spelling, |
59 | | - $this->filterLanguageId, |
60 | | - $this->possiblySynonymousRelationTypeId, |
61 | | - $this->queryTransactionInformation |
62 | | - ) |
| 53 | + getExpressionsRecordSet($spelling, $this->viewInformation) |
63 | 54 | ) |
64 | 55 | ); |
65 | 56 | |
— | — | @@ -66,22 +57,17 @@ |
67 | 58 | $wgOut->addHTML("<script language='javascript'><!--\nexpandEditors();\n--></script>"); |
68 | 59 | } |
69 | 60 | |
70 | | - protected function save($referenceTransaction) { |
| 61 | + protected function save($referenceQueryTransactionInformation) { |
71 | 62 | global |
72 | 63 | $wgTitle; |
73 | 64 | |
74 | | - parent::save($referenceTransaction); |
| 65 | + parent::save($referenceQueryTransactionInformation); |
75 | 66 | |
76 | 67 | $spelling = $wgTitle->getText(); |
77 | 68 | |
78 | 69 | getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->save( |
79 | 70 | $this->getIdStack(), |
80 | | - getExpressionsRecordSet( |
81 | | - $spelling, |
82 | | - $this->filterLanguageId, |
83 | | - $this->possiblySynonymousRelationTypeId, |
84 | | - $referenceTransaction |
85 | | - ) |
| 71 | + getExpressionsRecordSet($spelling, $this->viewInformation) |
86 | 72 | ); |
87 | 73 | } |
88 | 74 | |
— | — | @@ -97,12 +83,7 @@ |
98 | 84 | $wgOut->addHTML( |
99 | 85 | getExpressionsEditor($spelling, $this->filterLanguageId, $this->possiblySynonymousRelationTypeId, false, false)->edit( |
100 | 86 | $this->getIdStack(), |
101 | | - getExpressionsRecordSet( |
102 | | - $spelling, |
103 | | - $this->filterLanguageId, |
104 | | - $this->possiblySynonymousRelationTypeId, |
105 | | - new QueryLatestTransactionInformation() |
106 | | - ) |
| 87 | + getExpressionsRecordSet($spelling, $this->viewInformation) |
107 | 88 | ) |
108 | 89 | ); |
109 | 90 | |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php |
— | — | @@ -12,9 +12,9 @@ |
13 | 13 | protected $record=null; |
14 | 14 | protected $definedMeaningID=null; |
15 | 15 | |
16 | | - public function __construct($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation) { |
| 16 | + public function __construct($definedMeaningId, $viewInformation) { |
17 | 17 | |
18 | | - wfDebug("definedMeaningId:$definedMeaningId, filterLanguageId:$filterLanguageId, possiblySynonymousRelationTypeId:$possiblySynonymousRelationTypeId, queryTransactionInformation:$queryTransactionInformation\n"); |
| 18 | + wfDebug("definedMeaningId:$definedMeaningId, filterLanguageId:$viewInformation->filterLanguageId, possiblySynonymousRelationTypeId:$viewInformation->possiblySynonymousRelationTypeId, queryTransactionInformation:$viewInformation->queryTransactionInformation\n"); |
19 | 19 | global |
20 | 20 | $definedMeaningAttribute, $definitionAttribute, $classAttributesAttribute, |
21 | 21 | $alternativeDefinitionsAttribute, $synonymsAndTranslationsAttribute, |
— | — | @@ -24,23 +24,23 @@ |
25 | 25 | |
26 | 26 | $this->setDefinedMeaningID($definedMeaningId); |
27 | 27 | $record = new ArrayRecord($definedMeaningAttribute->type); |
28 | | - $record->setAttributeValue($definitionAttribute, getDefinedMeaningDefinitionRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation)); |
29 | | - $record->setAttributeValue($classAttributesAttribute, getClassAttributesRecordSet($definedMeaningId, $queryTransactionInformation)); |
30 | | - $record->setAttributeValue($alternativeDefinitionsAttribute, getAlternativeDefinitionsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation)); |
31 | | - $record->setAttributeValue($synonymsAndTranslationsAttribute, getSynonymAndTranslationRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation)); |
| 28 | + $record->setAttributeValue($definitionAttribute, getDefinedMeaningDefinitionRecord($definedMeaningId, $viewInformation)); |
| 29 | + $record->setAttributeValue($classAttributesAttribute, getClassAttributesRecordSet($definedMeaningId, $viewInformation)); |
| 30 | + $record->setAttributeValue($alternativeDefinitionsAttribute, getAlternativeDefinitionsRecordSet($definedMeaningId, $viewInformation)); |
| 31 | + $record->setAttributeValue($synonymsAndTranslationsAttribute, getSynonymAndTranslationRecordSet($definedMeaningId, $viewInformation)); |
32 | 32 | |
33 | 33 | $filterRelationTypes = array(); |
34 | 34 | |
35 | | - if ($possiblySynonymousRelationTypeId != 0) { |
36 | | - $record->setAttributeValue($possiblySynonymousAttribute, getPossiblySynonymousRecordSet($definedMeaningId, $filterLanguageId, $possiblySynonymousRelationTypeId, $queryTransactionInformation)); |
37 | | - $filterRelationTypes[] = $possiblySynonymousRelationTypeId; |
| 35 | + if ($viewInformation->possiblySynonymousRelationTypeId != 0) { |
| 36 | + $record->setAttributeValue($possiblySynonymousAttribute, getPossiblySynonymousRecordSet($definedMeaningId, $viewInformation)); |
| 37 | + $filterRelationTypes[] = $viewInformation->possiblySynonymousRelationTypeId; |
38 | 38 | } |
39 | 39 | |
40 | | - $record->setAttributeValue($relationsAttribute, getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterLanguageId, $filterRelationTypes, $queryTransactionInformation)); |
41 | | - $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, $filterLanguageId, $queryTransactionInformation)); |
42 | | - $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($definedMeaningId, $queryTransactionInformation)); |
43 | | - $record->setAttributeValue($collectionMembershipAttribute, getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, $queryTransactionInformation)); |
44 | | - $record->setAttributeValue($definedMeaningAttributesAttribute, getObjectAttributesRecord($definedMeaningId, $filterLanguageId, $queryTransactionInformation)); |
| 40 | + $record->setAttributeValue($relationsAttribute, getDefinedMeaningRelationsRecordSet($definedMeaningId, $filterRelationTypes, $viewInformation)); |
| 41 | + $record->setAttributeValue($reciprocalRelationsAttribute, getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, $viewInformation)); |
| 42 | + $record->setAttributeValue($classMembershipAttribute, getDefinedMeaningClassMembershipRecordSet($definedMeaningId, $viewInformation)); |
| 43 | + $record->setAttributeValue($collectionMembershipAttribute, getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, $viewInformation)); |
| 44 | + $record->setAttributeValue($definedMeaningAttributesAttribute, getObjectAttributesRecord($definedMeaningId, $viewInformation)); |
45 | 45 | $this->record=$record; |
46 | 46 | |
47 | 47 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class ViewInformation { |
| 5 | + public $filterLanguageId; |
| 6 | + public $possiblySynonymousRelationTypeId; |
| 7 | + public $queryTransactionInformation; |
| 8 | + public $showRecordLifeSpan; |
| 9 | + public $showAuthority; |
| 10 | + |
| 11 | + public function __construct() { |
| 12 | + $this->filterLanguageId = 0; |
| 13 | + $this->possiblySynonymousRelationTypeId = 0; |
| 14 | + $this->queryTransactionInformation; |
| 15 | + $this->showRecordLifeSpan = false; |
| 16 | + $this->showAuthority = false; |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +?> |
Property changes on: trunk/extensions/Wikidata/OmegaWiki/ViewInformation.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 21 | + native |
Index: trunk/extensions/Wikidata/OmegaWiki/RecordSetQueries.php |
— | — | @@ -13,8 +13,9 @@ |
14 | 14 | else |
15 | 15 | $groupBy = array(); |
16 | 16 | |
17 | | - $query = "SELECT ". implode(", ", $selectFields) . |
18 | | - " FROM ". implode(", ", $tableNames); |
| 17 | + $query = |
| 18 | + "SELECT ". implode(", ", $selectFields) . |
| 19 | + " FROM ". implode(", ", $tableNames); |
19 | 20 | |
20 | 21 | if (count($restrictions) > 0) |
21 | 22 | $query .= " WHERE ". implode(' AND ', $restrictions); |
— | — | @@ -44,11 +45,12 @@ |
45 | 46 | |
46 | 47 | $query = getTransactedSQL($transactionInformation, $selectFields, $table, $restrictions, $orderBy, $count, $offset); |
47 | 48 | $queryResult = $dbr->query($query); |
48 | | - if(!is_null($recordSetStructureId)) { |
| 49 | + |
| 50 | + if (!is_null($recordSetStructureId)) |
49 | 51 | $structure = new Structure($recordSetStructureId, $allAttributes); |
50 | | - } else { |
| 52 | + else |
51 | 53 | $structure = new Structure($allAttributes); |
52 | | - } |
| 54 | + |
53 | 55 | $recordSet = new ArrayRecordSet($structure, new Structure($keyAttribute)); |
54 | 56 | |
55 | 57 | while ($row = $dbr->fetchRow($queryResult)) { |