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 ) ); }
public function setSubRecord( Record $record ) { foreach ( $record->getStructure()->getAttributes() as $attribute ) $this->values[$attribute->id] = $record->getAttributeValue( $attribute ); }
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(); } }