Ejemplo 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;
}
function expandTranslatedContentInRecord( Record $record, Attribute $idAttribute, Attribute $translatedContentAttribute, ViewInformation $viewInformation ) {
	$record->setAttributeValue(
		$translatedContentAttribute,
		getTranslatedContentValue( $record->getAttributeValue( $idAttribute ), $viewInformation )
	);
}
Ejemplo n.º 3
0
	public function setSubRecord( Record $record ) {
		foreach ( $record->getStructure()->getAttributes() as $attribute )
			$this->values[$attribute->id] = $record->getAttributeValue( $attribute );
	}
Ejemplo n.º 4
0
	protected function saveRecord( IdStack $idPath, Record $record ) {
		foreach ( $this->getEditors() as $editor ) {
			$attribute = $editor->getAttribute();
			$value = $record->getAttributeValue( $attribute );
			$idPath->pushAttribute( $attribute );
			$editor->save( $idPath, $value );
			$idPath->popAttribute();
		}
	}