';
}
foreach ($columnList as $column => $rows) {
$leftColumn = $defaultSpace.'px';
if ($column == 1) {
$leftColumn = 0;
}
if (count($columnList) == 1) {
$leftColumn = 0;
}
$widthColumn = 85 / count($columnList);
$graphHtml .= '
';
$maxRow = 0;
foreach ($rows as $row => $vertex) {
if ($row > $maxRow) {
$maxRow = $row;
}
}
$newRowList = [];
$defaultSubGroup = -1;
$subGroupCountList = [];
for ($i = 0; $i < $maxRow; $i++) {
/** @var Vertex $vertex */
$vertex = isset($rows[$i + 1]) ? $rows[$i + 1] : null;
if (!is_null($vertex)) {
$subGroup = $vertex->getAttribute('SubGroup');
if ($subGroup == '' || empty($subGroup)) {
$defaultSubGroup = 0;
} else {
$defaultSubGroup = (int)$subGroup;
}
}
$newRowList[$i + 1][$defaultSubGroup][] = $vertex;
if (!isset($subGroupCountList[$defaultSubGroup])) {
$subGroupCountList[$defaultSubGroup] = 1;
} else {
$subGroupCountList[$defaultSubGroup]++;
}
}
$subGroup = null;
$subGroupAdded = [];
/** @var Vertex $vertex */
foreach ($newRowList as $row => $subGroupList) {
foreach ($subGroupList as $subGroup => $vertexList) {
if (!empty($subGroup) && $subGroup != -1) {
if (!isset($subGroupAdded[$subGroup])) {
$subGroupAdded[$subGroup] = 1;
} else {
$subGroupAdded[$subGroup]++;
}
}
foreach ($vertexList as $vertex) {
if (is_null($vertex)) {
$graphHtml .= '
';
$graphHtml .= '
';
continue;
}
$id = $vertex->getId();
$rowId = "row_$row";
$graphHtml .= '
';
$color = '';
if (!empty($vertex->getAttribute('DefinedColor'))) {
$color = $vertex->getAttribute('DefinedColor');
}
$content = $vertex->getAttribute('Notes');
$content .= '
['.$id.']
';
$graphHtml .= Display::panel(
$content,
$vertex->getAttribute('graphviz.label'),
null,
null,
null,
null,
$color
);
$graphHtml .= '
';
$arrow = $vertex->getAttribute('DrawArrowFrom');
$found = false;
if (!empty($arrow)) {
$pos = strpos($arrow, 'SG');
if ($pos === false) {
$pos = strpos($arrow, 'G');
if (is_numeric($pos)) {
$parts = explode('G', $arrow);
if (empty($parts[0]) && count($parts) == 2) {
$groupArrow = $parts[1];
$graphHtml .= self::createConnection(
"group_$groupArrow",
"row_$id",
['Left', 'Right']
);
$found = true;
}
}
} else {
$parts = explode('SG', $arrow);
if (empty($parts[0]) && count($parts) == 2) {
$subGroupArrow = $parts[1];
/*var_dump($subGroupArrow);
var_dump(array_keys($subGroupList));*/
$graphHtml .= self::createConnection(
"subgroup_$subGroupArrow",
"row_$id",
['Left', 'Right']
);
$found = true;
}
}
}
if ($found == false) {
$defaultArrow = ['Left', 'Right'];
if (isset($groupCourseList[$group]) &&
in_array($arrow, $groupCourseList[$group])
) {
$defaultArrow = ['Top', 'Bottom'];
}
$graphHtml .= self::createConnection(
"row_$arrow",
"row_$id",
$defaultArrow
);
}
}
}
}
$graphHtml .= '