function getSearchResultAsRecordSet( $queryResult ) { $o = OmegaWikiAttributes::getInstance(); global $definedMeaningReferenceType, $wgDefinedMeaning; $dbr = wfGetDB( DB_SLAVE ); $spellingAttribute = new Attribute( "found-word", "Found word", "short-text" ); $languageAttribute = new Attribute( "language", "Language", "language" ); $expressionStructure = new Structure( $spellingAttribute, $languageAttribute ); $expressionAttribute = new Attribute( "expression", "Expression", $expressionStructure ); $definedMeaningAttribute = new Attribute( $wgDefinedMeaning, "Defined meaning", $definedMeaningReferenceType ); $definitionAttribute = new Attribute( "definition", "Definition", "definition" ); $meaningStructure = new Structure( $definedMeaningAttribute, $definitionAttribute ); $meaningAttribute = new Attribute( "meaning", "Meaning", $meaningStructure ); $recordSet = new ArrayRecordSet( new Structure( $o->definedMeaningId, $expressionAttribute, $meaningAttribute ), new Structure( $o->definedMeaningId ) ); while ( $row = $dbr->fetchObject( $queryResult ) ) { $expressionRecord = new ArrayRecord( $expressionStructure ); $expressionRecord->setAttributeValue( $spellingAttribute, $row->spelling ); $expressionRecord->setAttributeValue( $languageAttribute, $row->language_id ); $meaningRecord = new ArrayRecord( $meaningStructure ); $meaningRecord->setAttributeValue( $definedMeaningAttribute, getDefinedMeaningReferenceRecord( $row->defined_meaning_id ) ); $meaningRecord->setAttributeValue( $definitionAttribute, getDefinedMeaningDefinition( $row->defined_meaning_id ) ); $recordSet->addRecord( array( $row->defined_meaning_id, $expressionRecord, $meaningRecord ) ); } $expressionEditor = new RecordTableCellEditor( $expressionAttribute ); $expressionEditor->addEditor( new SpellingEditor( $spellingAttribute, new SimplePermissionController( false ), false ) ); $expressionEditor->addEditor( new LanguageEditor( $languageAttribute, new SimplePermissionController( false ), false ) ); $meaningEditor = new RecordTableCellEditor( $meaningAttribute ); $meaningEditor->addEditor( new DefinedMeaningReferenceEditor( $definedMeaningAttribute, new SimplePermissionController( false ), false ) ); $meaningEditor->addEditor( new TextEditor( $definitionAttribute, new SimplePermissionController( false ), false, true, 75 ) ); $editor = createTableViewer( null ); $editor->addEditor( $expressionEditor ); $editor->addEditor( $meaningEditor ); return array( $recordSet, $editor ); }
function getWordsSearchResultAsRecordSet($queryResult) { $o = OmegaWikiAttributes::getInstance(); $dbr = wfGetDB(DB_SLAVE); $recordSet = new ArrayRecordSet(new Structure($o->definedMeaningId, $this->expressionAttribute, $this->meaningAttribute), new Structure($o->definedMeaningId)); while ($row = $dbr->fetchObject($queryResult)) { $expressionRecord = new ArrayRecord($this->expressionStructure); $expressionRecord->setAttributeValue($this->spellingAttribute, $row->spelling); $expressionRecord->setAttributeValue($this->languageAttribute, $row->language_id); $meaningRecord = new ArrayRecord($this->meaningStructure); $meaningRecord->setAttributeValue($this->definedMeaningAttribute, getDefinedMeaningReferenceRecord($row->defined_meaning_id)); $meaningRecord->setAttributeValue($this->definitionAttribute, getDefinedMeaningDefinition($row->defined_meaning_id)); $recordSet->addRecord(array($row->defined_meaning_id, $expressionRecord, $meaningRecord)); } return $recordSet; }
function getUpdatedTranslatedTextRecordSet( $transactionId ) { $o = OmegaWikiAttributes::getInstance(); $dc = wdGetDataSetContext(); $dbr = wfGetDB( DB_SLAVE ); $queryResult = $dbr->query( "SELECT value_id, object_id, attribute_mid, translated_content_id, language_id, text_text, " . getOperationSelectColumn( "{$dc}_translated_content", $transactionId ) . ', ' . getIsLatestSelectColumn( "{$dc}_translated_content", array( 'translated_content_id', 'language_id' ), $transactionId ) . " FROM {$dc}_translated_content_attribute_values, {$dc}_translated_content, {$dc}_text " . " WHERE {$dc}_translated_content_attribute_values.value_tcid={$dc}_translated_content.translated_content_id " . " AND {$dc}_translated_content.text_id={$dc}_text.text_id " . " AND " . getInTransactionRestriction( "{$dc}_translated_content", $transactionId ) . " AND " . getAtTransactionRestriction( "{$dc}_translated_content_attribute_values", $transactionId ) ); $recordSet = new ArrayRecordSet( $o->updatedTranslatedTextStructure, new Structure( $o->valueId, $o->language ) ); while ( $row = $dbr->fetchObject( $queryResult ) ) { $record = new ArrayRecord( $o->updatedTranslatedTextStructure ); $record->valueId = $row->value_id; $record->objectId = $row->object_id; $record->attribute = getDefinedMeaningReferenceRecord( $row->attribute_mid ); $record->translatedContentId = $row->translated_content_id; $record->language = $row->language_id; $record->text = $row->text_text; $record->operation = $row->operation; $record->isLatest = $row->is_latest; $record->rollBackTranslatedContent = simpleRecord( $o->rollBackTranslatedContentStructure, array( $row->is_latest, $row->operation, getTranslatedContentHistory( $row->translated_content_id, $row->language_id, $row->is_latest ) ) ); $recordSet->add( $record ); } return $recordSet; }