public static function expandirarriba($id, $itemtype, $pivot, $oldpivot = 0) { $cadenaarriba = ""; $a = PluginRelationRelation::getParentsItem($itemtype, $id); $resulup = PluginRelationRelation::checkArrayExpande($_SESSION['glpi_expandearriba'], $id, $itemtype); if ($resulup == true) { $registroup = array('source' => $pivot, 'target' => $oldpivot, 'id' => $id, 'itemtype' => $itemtype); array_push($_SESSION['glpi_expandearriba'], $registroup); } $npivot = 0; $i = 1; /* sólo para efectos ilustrativos */ $struct = ""; $direction = ""; $ramas = ""; foreach ($a as $v) { //echo $v["id"]."/".$v["name"]."/".$v["name_relation"]."/".$v["itemtype"]; $rst = PluginRelationRelation::checkArrayExpande($_SESSION['glpi_expandearriba'], $v['id'], $v['itemtype']); if ($rst == true) { $struct .= "struct" . $pivot . $i . " [margin=0 shape=ellipse, style=filled, fillcolor=white, color=blue, label=<<TABLE border=\"0\" cellborder=\"0\">\n\t\t\t\t\t\t\t\t\t\t<TR><TD width=\"35\" height=\"25\" fixedsize=\"true\"><IMG SRC='" . PluginRelationRelation::getIconItem($v["itemtype"], $v["id"]) . "' scale=\"true\"/></TD><td><font face=\"Arial\" point-size=\"7\">" . $v["name"] . "</font></td></TR>\n\t\t\t\t\t\t\t\t\t\t<TR><TD colspan=\"2\" fixedsize=\"true\"><font face=\"Arial\" point-size=\"7\">" . PluginRelationRelation::getViewNameClass($v["itemtype"]) . "</font></TD></TR>\n\t\t\t\t\t\t\t </TABLE>>];\n\t\t\t\t\t\t\t\t"; $direction .= "struct" . $pivot . $i . " -> struct" . $pivot . " [ label = \"" . $v["name_relation"] . "\" penwidth = 1 fontname=Arial fontsize = 7 fontcolor = \"black\"];\n\t\t\t\t\t\t\t\t"; } else { $existe = PluginRelationRelation::checkUpExists($pivot); if ($existe == 1) { $recurpivot = PluginRelationRelation::getTargetStructUp($_SESSION['glpi_expandearriba'], $v['id'], $v['itemtype']); $direction .= "struct" . $recurpivot . " -> struct" . $pivot . " [ label = \"" . $v["name_relation"] . "\" penwidth = 1 fontname=Arial fontsize = 7 fontcolor = \"black\"];\n\t\t\t\t\t\t"; } } $npivot = $pivot . $i; $ramas .= PluginRelationRelation::expandirarriba($v["id"], $v["itemtype"], $npivot, $pivot); $i++; } $cadenaarriba = $struct . $direction . $ramas; return $cadenaarriba; }