$oRelGraph = MetaModel::GetRelatedObjectsUp($sRelation, $aSourceObjects, $iMaxRecursionDepth, true, $aContexts); } else { $oRelGraph = MetaModel::GetRelatedObjectsDown($sRelation, $aSourceObjects, $iMaxRecursionDepth, true, $aExcludedObjects, $aContexts); } // Remove excluded classes from the graph if (count($aExcludedClasses) > 0) { $oIterator = new RelationTypeIterator($oRelGraph, 'Node'); foreach ($oIterator as $oNode) { $oObj = $oNode->GetProperty('object'); if ($oObj && in_array(get_class($oObj), $aExcludedClasses)) { $oRelGraph->FilterNode($oNode); } } } $oPage = new PDFPage($sTitle, $sPageFormat, $sPageOrientation); $oPage->SetContentDisposition('attachment', $sTitle . '.pdf'); $oGraph = DisplayableGraph::FromRelationGraph($oRelGraph, $iGroupingThreshold, $sDirection == 'down'); $oGraph->InitFromGraphviz(); if ($aPositions != null) { $oGraph->UpdatePositions($aPositions); } $aGroups = array(); $oIterator = new RelationTypeIterator($oGraph, 'Node'); foreach ($oIterator as $oNode) { if ($oNode instanceof DisplayableGroupNode) { $aGroups[$oNode->GetProperty('group_index')] = $oNode->GetObjects(); } } // First page is the graph $oGraph->RenderAsPDF($oPage, $sComments, $sContextKey); if ($bIncludeList) {