public function __construct( Attribute $attribute, $propertyCaption, $valueCaption, ViewInformation $viewInformation, $levelName, AttributeIDFilter $attributeIDFilter ) { parent::__construct( new RecordUnorderedListEditor( $attribute, 5 ) ); $this->levelName = $levelName; $this->attributeIDFilter = $attributeIDFilter; $this->showPropertyColumn = !$attributeIDFilter->leavesOnlyOneOption(); $this->recordSetTableEditor = new RecordSetTableEditor( $attribute, new SimplePermissionController( false ), new ShowEditFieldChecker( true ), new AllowAddController( false ), false, false, null ); $this->propertyAttribute = new Attribute( "property", $propertyCaption, "short-text" ); $this->valueAttribute = new Attribute( "value", $valueCaption, "short-text" ); foreach ( $viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter ) $this->recordSetTableEditor->addEditor( new DummyViewer( $propertyToColumnFilter->getAttribute() ) ); $o = OmegaWikiAttributes::getInstance(); $this->recordSetTableEditor->addEditor( new DummyViewer( $o->objectAttributes ) ); addTableMetadataEditors( $this->recordSetTableEditor, $viewInformation ); }
function expandObjectAttributesAttribute( RecordSet $recordSet, Attribute $attributeToExpand, Attribute $objectIdAttribute, ViewInformation $viewInformation ) { $o = OmegaWikiAttributes::getInstance(); $recordSetStructure = $recordSet->getStructure(); $recordSetStructure->addAttribute( $attributeToExpand ); foreach ( $viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter ) $recordSetStructure->addAttribute( $propertyToColumnFilter->getAttribute() ); $objectAttributesRecordStructure = $attributeToExpand->type; $objectIds = getUniqueIdsInRecordSet( $recordSet, array( $objectIdAttribute ) ); if ( count( $objectIds ) > 0 ) { for ( $i = 0; $i < count( $objectIds ); $i++ ) if ( isset( $objectIds[$i] ) ) { $record = new ArrayRecord( $objectAttributesRecordStructure ); $objectAttributesRecords[$objectIds[$i]] = $record; } // Defined meaning attributes $allDefinedMeaningAttributeValuesRecordSet = getDefinedMeaningAttributeValuesRecordSet( $objectIds, $viewInformation ); $definedMeaningAttributeValuesRecordSets = splitRecordSet( $allDefinedMeaningAttributeValuesRecordSet, $o->relationType ); $emptyDefinedMeaningAttributesRecordSet = new ArrayRecordSet( $allDefinedMeaningAttributeValuesRecordSet->getStructure(), $allDefinedMeaningAttributeValuesRecordSet->getKey() ); // Text attributes $allTextAttributeValuesRecordSet = getTextAttributesValuesRecordSet( $objectIds, $viewInformation ); $textAttributeValuesRecordSets = splitRecordSet( $allTextAttributeValuesRecordSet, $o->textAttributeObject ); $emptyTextAttributesRecordSet = new ArrayRecordSet( $allTextAttributeValuesRecordSet->getStructure(), $allTextAttributeValuesRecordSet->getKey() ); // Translated text attributes $allTranslatedTextAttributeValuesRecordSet = getTranslatedTextAttributeValuesRecordSet( $objectIds, $viewInformation ); $translatedTextAttributeValuesRecordSets = splitRecordSet( $allTranslatedTextAttributeValuesRecordSet, $o->attributeObject ); $emptyTranslatedTextAttributesRecordSet = new ArrayRecordSet( $allTranslatedTextAttributeValuesRecordSet->getStructure(), $allTranslatedTextAttributeValuesRecordSet->getKey() ); // Link attributes $allLinkAttributeValuesRecordSet = getLinkAttributeValuesRecordSet( $objectIds, $viewInformation ); $linkAttributeValuesRecordSets = splitRecordSet( $allLinkAttributeValuesRecordSet, $o->linkAttributeObject ); $emptyLinkAttributesRecordSet = new ArrayRecordSet( $allLinkAttributeValuesRecordSet->getStructure(), $allLinkAttributeValuesRecordSet->getKey() ); // Option attributes $allOptionAttributeValuesRecordSet = getOptionAttributeValuesRecordSet( $objectIds, $viewInformation ); $optionAttributeValuesRecordSets = splitRecordSet( $allOptionAttributeValuesRecordSet, $o->optionAttributeObject ); $emptyOptionAttributesRecordSet = new ArrayRecordSet( $allOptionAttributeValuesRecordSet->getStructure(), $allOptionAttributeValuesRecordSet->getKey() ); for ( $i = 0; $i < $recordSet->getRecordCount(); $i++ ) { $record = $recordSet->getRecord( $i ); $objectId = $record->getAttributeValue( $objectIdAttribute ); // Defined meaning attributes if ( isset( $definedMeaningAttributeValuesRecordSets[$objectId] ) ) $definedMeaningAttributeValuesRecordSet = $definedMeaningAttributeValuesRecordSets[$objectId]; else $definedMeaningAttributeValuesRecordSet = $emptyDefinedMeaningAttributesRecordSet; // Text attributes if ( isset( $textAttributeValuesRecordSets[$objectId] ) ) $textAttributeValuesRecordSet = $textAttributeValuesRecordSets[$objectId]; else $textAttributeValuesRecordSet = $emptyTextAttributesRecordSet; // Translated text attributes if ( isset( $translatedTextAttributeValuesRecordSets[$objectId] ) ) $translatedTextAttributeValuesRecordSet = $translatedTextAttributeValuesRecordSets[$objectId]; else $translatedTextAttributeValuesRecordSet = $emptyTranslatedTextAttributesRecordSet; // Link attributes if ( isset( $linkAttributeValuesRecordSets[$objectId] ) ) $linkAttributeValuesRecordSet = $linkAttributeValuesRecordSets[$objectId]; else $linkAttributeValuesRecordSet = $emptyLinkAttributesRecordSet; // Option attributes if ( isset( $optionAttributeValuesRecordSets[$objectId] ) ) $optionAttributeValuesRecordSet = $optionAttributeValuesRecordSets[$objectId]; else $optionAttributeValuesRecordSet = $emptyOptionAttributesRecordSet; $objectAttributesRecord = new ArrayRecord( $objectAttributesRecordStructure ); $objectAttributesRecord->objectId = $objectId; $objectAttributesRecord->relations = $definedMeaningAttributeValuesRecordSet; $objectAttributesRecord->textAttributeValues = $textAttributeValuesRecordSet; $objectAttributesRecord->translatedTextAttributeValues = $translatedTextAttributeValuesRecordSet; $objectAttributesRecord->linkAttributeValues = $linkAttributeValuesRecordSet; $objectAttributesRecord->optionAttributeValues = $optionAttributeValuesRecordSet; $record->setAttributeValue( $attributeToExpand, $objectAttributesRecord ); applyPropertyToColumnFiltersToRecord( $record, $objectAttributesRecord, $viewInformation ); } } }
public function history() { global $wgOut, $wgTitle, $wgRequest; $wgOut->enableClientCache( false ); $title = $wgTitle->getPrefixedText(); if ( !$this->showClassicPageTitles ) $title = $this->getTitle(); $wgOut->setPageTitle( wfMsgSc( "history", $title ) ); # Plain filter for the lifespan info about each record if ( isset( $_GET['show'] ) ) { $this->showRecordLifeSpan = isset( $_GET["show-record-life-span"] ); $this->transaction = (int) $_GET["transaction"]; } else { $this->showRecordLifeSpan = true; $this->transaction = 0; } # Up to which transaction to view the data if ( $this->transaction == 0 ) $this->queryTransactionInformation = new QueryHistoryTransactionInformation(); else $this->queryTransactionInformation = new QueryAtTransactionInformation( $this->transaction, $this->showRecordLifeSpan ); $transactionId = $wgRequest->getInt( 'transaction' ); $wgOut->addHTML( getOptionPanel( array( wfMsg( 'ow_history_transaction' ) => getSuggest( 'transaction', 'transaction', array(), $transactionId, getTransactionLabel( $transactionId ), array( 0, 2, 3 ) ), wfMsg( 'ow_history_show_life_span' ) => getCheckBox( 'show-record-life-span', $this->showRecordLifeSpan ) ), 'history' ) ); $viewInformation = new ViewInformation(); $viewInformation->filterLanguageId = $this->filterLanguageId; $viewInformation->showRecordLifeSpan = $this->showRecordLifeSpan; $viewInformation->queryTransactionInformation = $this->queryTransactionInformation; $viewInformation->setPropertyToColumnFilters( $this->propertyToColumnFilters ); $this->viewInformation = $viewInformation; initializeOmegaWikiAttributes( $this->viewInformation ); initializeObjectAttributeEditors( $viewInformation ); }