Exemplo n.º 1
0
function getRecordAsEditTableCells( 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 );
				
			if ( $childEditor instanceof RecordTableCellEditor ) {
				$result .= getRecordAsEditTableCells( $idPath, $childEditor, $visibleAttribute->type, $value, $startColumn );
			} else {
				if ( $childEditor->showEditField( $idPath ) ) {
					$displayValue = $childEditor->edit( $idPath, $value );
				} else {
					$displayValue = "";
				}
				$result .= '<td class="' . getHTMLClassForType( $type, $attribute ) . ' column-' . parityClass( $startColumn ) . '">' . $displayValue . '</td>';
					
				$startColumn++;
			}
			
			$idPath->popAttribute();
		}
		else {
			$result .= "<td/>";
		}
	}
	return $result;
}
Exemplo n.º 2
0
	function getStructureAsAddCells( IdStack $idPath, Editor $editor, &$startColumn = 0 ) {
		$result = '';
		
		foreach ( $editor->getEditors() as $childEditor ) {
			$attribute = $childEditor->getAttribute();
			$type = $attribute->type;
			$idPath->pushAttribute( $attribute );
			
			if ( $childEditor instanceof RecordTableCellEditor )
				$result .= $this->getStructureAsAddCells( $idPath, $childEditor, $startColumn );
			else {
				if ( $childEditor->showEditField( $idPath ) )
					$result .= '<td class="' . getHTMLClassForType( $type, $attribute ) . ' column-' . parityClass( $startColumn ) . '">' . $childEditor->add( $idPath ) . '</td>';
					
				$startColumn++;
			}
			
			$idPath->popAttribute();
		}
		
		return $result;
	}