Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php |
— | — | @@ -753,12 +753,11 @@ |
754 | 754 | $objectIds = getUniqueIdsInRecordSet($recordSet, array($objectIdAttribute)); |
755 | 755 | |
756 | 756 | if (count($objectIds) > 0) { |
757 | | - for ($i = 0; $i < count($objectIds); $i++) { |
| 757 | + for ($i = 0; $i < count($objectIds); $i++) |
758 | 758 | if (isset($objectIds[$i])) { |
759 | 759 | $record = new ArrayRecord($objectAttributesRecordStructure); |
760 | 760 | $objectAttributesRecords[$objectIds[$i]] = $record; |
761 | 761 | } |
762 | | - } |
763 | 762 | |
764 | 763 | // Text attributes |
765 | 764 | $allTextAttributeValuesRecordSet = getTextAttributesValuesRecordSet($objectIds, $viewInformation); |
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php |
— | — | @@ -508,20 +508,19 @@ |
509 | 509 | return $result; |
510 | 510 | } |
511 | 511 | |
512 | | - public function view(IdStack $idPath, $value) { |
| 512 | + public function viewHeader(IdStack $idPath, array $visibleColumnEditors) { |
513 | 513 | $result = '<table id="'. $idPath->getId() .'" class="wiki-data-table">'; |
514 | | - $structure = $value->getStructure(); |
515 | | - $key = $value->getKey(); |
516 | | - $rowAttributes = $this->getRowAttributesText(); |
517 | | - |
518 | | - if ($this->hideEmptyColumns) |
519 | | - $visibleColumnEditors = $this->getColumnEditorsShowingData($this, $value); |
520 | | - else |
521 | | - $visibleColumnEditors = $this->getAllColumnEditors($this, $value); |
522 | 514 | |
523 | 515 | foreach (getStructureAsTableHeaderRows($this->getTableStructure($this, $visibleColumnEditors), 0, $idPath) as $headerRow) |
524 | 516 | $result .= '<tr>' . $headerRow . '</tr>'.EOL; |
525 | | - |
| 517 | + |
| 518 | + return $result; |
| 519 | + } |
| 520 | + |
| 521 | + public function viewRows(IdStack $idPath, $value, array $visibleColumnEditors) { |
| 522 | + $result = ""; |
| 523 | + $rowAttributes = $this->getRowAttributesText(); |
| 524 | + $key = $value->getKey(); |
526 | 525 | $recordCount = $value->getRecordCount(); |
527 | 526 | |
528 | 527 | for ($i = 0; $i < $recordCount; $i++) { |
— | — | @@ -534,8 +533,28 @@ |
535 | 534 | |
536 | 535 | $idPath->popKey(); |
537 | 536 | } |
| 537 | + |
| 538 | + return $result; |
| 539 | + } |
| 540 | + |
| 541 | + public function viewFooter(IdStack $idPath, array $visibleColumnEditors) { |
| 542 | + return '</table>' . EOL; |
| 543 | + } |
| 544 | + |
| 545 | + public function getVisibleColumnHeadersForView($value) { |
| 546 | + if ($this->hideEmptyColumns) |
| 547 | + return $this->getColumnEditorsShowingData($this, $value); |
| 548 | + else |
| 549 | + return $this->getAllColumnEditors($this, $value); |
| 550 | + } |
538 | 551 | |
539 | | - $result .= '</table>' . EOL; |
| 552 | + public function view(IdStack $idPath, $value) { |
| 553 | + $visibleColumnEditors = $this->getVisibleColumnHeadersForView($value); |
| 554 | + |
| 555 | + $result = |
| 556 | + $this->viewHeader($idPath, $visibleColumnEditors) . |
| 557 | + $this->viewRows($idPath, $value, $visibleColumnEditors) . |
| 558 | + $this->viewFooter($idPath, $visibleColumnEditors); |
540 | 559 | |
541 | 560 | return $result; |
542 | 561 | } |