function getUniqueIdsInRecordSet( RecordSet $recordSet, array $idAttributes ) {
	$ids = array();
	
	for ( $i = 0; $i < $recordSet->getRecordCount(); $i++ ) {
		$record = $recordSet->getRecord( $i );
		
		foreach ( $idAttributes as $idAttribute ) {
			$ids[] = $record->getAttributeValue( $idAttribute );
		}
	}
	
	return array_unique( $ids );
}
function expandOptionsInRecordSet( RecordSet $recordSet, ViewInformation $viewInformation ) {
	global
		$dataSet;

	$o = OmegaWikiAttributes::getInstance();

	$recordSet->getStructure()->addAttribute( $o->optionAttributeOption );
	$recordSet->getStructure()->addAttribute( $o->optionAttribute );

	for ( $i = 0; $i < $recordSet->getRecordCount(); $i++ ) {
		$record = $recordSet->getRecord( $i );

		$optionRecordSet = queryRecordSet(
			null,
			$viewInformation->queryTransactionInformation,
			$o->optionAttributeOptionId,
			new TableColumnsToAttributesMapping(
				new TableColumnsToAttribute( array( 'attribute_id' ), $o->optionAttributeId ),
				new TableColumnsToAttribute( array( 'option_mid' ), $o->optionAttributeOption )
			),
			$dataSet->optionAttributeOptions,
			array( 'option_id = ' . $record->optionAttributeOptionId )
		);

		$optionRecord = $optionRecordSet->getRecord( 0 );
		$record->optionAttributeOption = $optionRecord->optionAttributeOption;

		$optionRecordSet = queryRecordSet(
			null,
			$viewInformation->queryTransactionInformation,
			$o->optionAttributeId,
			new TableColumnsToAttributesMapping( new TableColumnsToAttribute( array( 'attribute_mid' ), $o->optionAttribute ) ),
			$dataSet->classAttributes,
			array( 'object_id = ' . $optionRecord->optionAttributeId )
		);
	
		$optionRecord = $optionRecordSet->getRecord( 0 );
		$record->optionAttribute = $optionRecord->optionAttribute;
	}
}
Exemplo n.º 3
0
function expandTransactionIdsInRecordSet( RecordSet $recordSet ) {
	for ( $i = 0; $i < $recordSet->getRecordCount(); $i++ ) {
		$record = $recordSet->getRecord( $i );
		$record->transaction = getTransactionRecord( $record->transactionId );
	}
}
Exemplo n.º 4
0
	public function viewRows( IdStack $idPath, RecordSet $value, Structure $visibleStructure ) {
		$result = "";
		$rowAttributes = $this->getRowAttributesText();
		$key = $value->getKey();
		$recordCount = $value->getRecordCount();

		for ( $i = 0; $i < $recordCount; $i++ ) {
			$record = $value->getRecord( $i );
			$idPath->pushKey( project( $record, $key ) );
			$result .=
				'<tr id="' . $idPath->getId() . '" ' .  $rowAttributes . '>' .
					getRecordAsTableCells( $idPath, $this, $visibleStructure, $record ) .
				'</tr>' . EOL;
				
			$idPath->popKey();
		}
		
		return $result;
	}