Ejemplo n.º 1
0
function getRecordAsTableCells( IdStack $idPath, Editor $editor, Structure $visibleStructure, Record $record, &$startColumn = 0 ) {
	$result = '';
	$childEditorMap = $editor->getAttributeEditorMap();
	
	foreach ( $visibleStructure->getAttributes() as $visibleAttribute ) {
		$childEditor = $childEditorMap->getEditorForAttribute( $visibleAttribute );
		
		if ( $childEditor != null ) {
			$attribute = $childEditor->getAttribute();
			$type = $attribute->type;
			$value = $record->getAttributeValue( $attribute );
			$idPath->pushAttribute( $attribute );
			$attributeId = $idPath->getId();
			
			if ( $childEditor instanceof RecordTableCellEditor ) {
				$result .= getRecordAsTableCells( $idPath, $childEditor, $visibleAttribute->type, $value, $startColumn );
			} else {
				$displayValue = $childEditor->showsData( $value ) ? $childEditor->view( $idPath, $value ) : "";
				$result .= '<td class="' . getHTMLClassForType( $type, $attribute ) . ' column-' . parityClass( $startColumn ) . '">' . $displayValue . '</td>';
				$startColumn++;
			}
			
			$idPath->popAttribute();
		}
		else {
			$result .= '<td/>';
		}
	}
	return $result;
}
Ejemplo n.º 2
0
	public function view( IdStack $idPath, $value ) {
		return getStaticSuggest(
			$idPath->getId(),
			$this->wrappedEditor->view( $idPath, $value ),
			count( $value->getKey()->getAttributes() )
		);
	}