private function getTransactionAsRecordSet( $queryResult ) { $o = OmegaWikiAttributes::getInstance(); $dbr = wfGetDB( DB_SLAVE ); $userAttribute = new Attribute( "user", wfMsg( 'ow_User' ), "short-text" ); $timestampAttribute = new Attribute( "timestamp", wfMsg( 'ow_Time' ), "timestamp" ); $summaryAttribute = new Attribute( "summary", wfMsg( 'ow_transaction_summary' ), "short-text" ); $recordSet = new ArrayRecordSet( new Structure( $o->id, $userAttribute, $timestampAttribute, $summaryAttribute ), new Structure( $o->id ) ); while ( $row = $dbr->fetchObject( $queryResult ) ) $recordSet->addRecord( array( $row->transaction_id, getUserLabel( $row->user_id, $row->user_ip ), $row->time, $row->comment ) ); $editor = createSuggestionsTableViewer( null ); $editor->addEditor( createShortTextViewer( $timestampAttribute ) ); $editor->addEditor( createShortTextViewer( $o->id ) ); $editor->addEditor( createShortTextViewer( $userAttribute ) ); $editor->addEditor( createShortTextViewer( $summaryAttribute ) ); return array( $recordSet, $editor ); }
function getTransactionRecord( $transactionId ) { $o = OmegaWikiAttributes::getInstance(); $dc = wdGetDataSetContext(); $result = new ArrayRecord( $o->transactionStructure ); $result->transactionId = $transactionId; if ( $transactionId > 0 ) { $dbr = wfGetDB( DB_SLAVE ); $queryResult = $dbr->query( "SELECT user_id, user_ip, timestamp, comment FROM {$dc}_transactions WHERE transaction_id=$transactionId" ); if ( $transaction = $dbr->fetchObject( $queryResult ) ) { $result->user = getUserLabel( $transaction->user_id, $transaction->user_ip ); if ( $result->user == null ) $result->user = "******" . $transaction->user_id . " not found" ; $result->timestamp = $transaction->timestamp; $result->summary = $transaction->comment; } } else { if ( $transactionId != null ) $result->user = "******"; else $result->user = ""; $result->timestamp = ""; $result->summary = ""; } return $result; }