cookie720 wrote:Can someone please post their full function which displays related records in a tables' details tab?
I have tried some bits and pieces from the previous posts, and I am getting some results, but they are not exactly what I want.
I simply need to list basically the last related record from each related table, in my tables details view, in the same format.
I thought it would be nice and simple but I just cant seem to get anything to work. Xataface is a very diverse program and the learning curve is hard for me because I am a beginner in both PHP + MySQL too
Here is a function that builds a related section for a details view. I call this function from appropriate section_xxx() methods of the delegate class.
- Code: Select all
function buildRelatedSection(Dataface_Record $record, $relationship){
import('Dataface/RelatedList.php');
$relatedList = new Dataface_RelatedList($record, $relationship);
$relatedList->noLinks = true;
$relatedList->hideActions = true;
$content = $relatedList->toHtml();
$rel = $record->table()->getRelationship($relationship);
return array(
'class'=>'main',
'content'=>$content,
'label'=>$rel->getLabel(),
'order'=>10
);
}
Creating a section for the "ingredients" relationship:
- Code: Select all
function section__ingredients($record){
return $this->buildRelatedSection($record, 'Ingredientes');
}
-Steve