public function getGraph($entityTypeId, &$visited, &$edges, $firstNode = false) { if ($visited[$entityTypeId]) { return ''; } else { $entityTypeService = $this->_application->retrieveProxy('movio.modules.ontologybuilder.service.EntityTypeService'); $entityProperties = $entityTypeService->getEntityTypeProperties($entityTypeId); $graph = ''; $color = __Config::get('movio.graph.shapeColor'); $entityTypeName = $entityTypeService->getEntityTypeName($entityTypeId); if ($this->getAttribute('generateLinks')) { $entityResolver = org_glizy_objectFactory::createObject('movio.modules.ontologybuilder.EntityResolver'); $ar = $entityResolver->getMenuVisibleEntity($entityTypeId); if ($ar) { $url = 'URL="' . $this->makeUrl($ar->id, $ar->title) . '"'; } } // se è il nodo da cui inizia la ricerca ricorsiva if ($firstNode or empty($url)) { $s = $url ? $url . ', ' : ''; $graph .= '"' . $this->escape($entityTypeName) . '" [' . $s . 'label="<span>' . $this->escape($entityTypeName . ' ' . __Link::makeLinkWithIcon('actionsMVC', 'icon-pencil icon-white', array('action' => 'edit', 'id' => $entityTypeId, 'title' => __T('GLZ_RECORD_EDIT'))) . '<a href="' . __Link::makeURL('actionsMVC', array('action' => 'delete', 'id' => $entityTypeId)) . '" onclick="if (!confirm('' . __T('GLZ_RECORD_MSG_DELETE') . '')){return false}"><i class="icon-remove icon-white"></i></a>') . ' </span>"];' . PHP_EOL; } else { if ($url) { $graph .= '"' . $this->escape($entityTypeName) . '" [' . $url . '];' . PHP_EOL; } } $visited[$entityTypeId] = true; foreach ((array) $entityProperties as $entityProperty) { if ($entityProperty['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $entityProperty['entity_properties_target_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $entityProperty['entity_properties_type']); if (!$edges[$entityTypeName][$toEntityTypeName]) { $edges[$entityTypeName][$toEntityTypeName] = true; $graph .= '"' . $this->escape($entityTypeName) . '" -> "' . $this->escape($toEntityTypeName) . '" [label="' . $this->escape($label) . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $referenceRelations = $entityTypeService->getEntityTypeReferenceRelations($entityTypeId); foreach ((array) $referenceRelations as $referenceRelation) { if ($referenceRelation['entity_properties_target_FK_entity_id']) { $toEntityTypeId = $referenceRelation['entity_properties_FK_entity_id']; $toEntityTypeName = $entityTypeService->getEntityTypeName($toEntityTypeId); $label = __Tp('rel:' . $referenceRelation['entity_properties_type']); if (!$edges[$toEntityTypeName][$entityTypeName]) { $edges[$toEntityTypeName][$entityTypeName] = true; $graph .= '"' . $this->escape($toEntityTypeName) . '" -> "' . $this->escape($entityTypeName) . '" [label="' . $this->escape($label) . '"];' . PHP_EOL; } $graph .= $this->getGraph($toEntityTypeId, $visited, $edges); } } $visited[$entityTypeId] = true; return $graph; } }
function current() { if (!$this->currentAr) { $this->currentAr = $this->iterator->current(); call_user_func(array($this->parent, 'getContent'), array()); // aggiunge proprietà dinamiche if (!count($this->tempCssClass)) { $this->tempCssClass = $this->cssClass; } $this->currentAr->__cssClass__ = count($this->tempCssClass) ? array_shift($this->tempCssClass) : ''; $languageId = $this->parent->_application->getLanguage(); foreach ($this->routeUrl as $k => $v) { if ($k == '__url__' && $this->currentAr->fieldExists('url') && $this->currentAr->url) { $this->currentAr->{$k} = $languageId . '/' . $this->currentAr->url; } else { $this->currentAr->{$k} = __Link::makeURL($v, $this->currentAr->getValuesAsArray()); } } if ($this->processCell) { $ar =& $this->currentAr; call_user_func_array(array($this->processCell, 'renderCell'), array($ar, $this->processCellParams)); } } return $this->currentAr; }