/** * @param NodeInfo $node * @return string */ protected function renderNode(NodeInfo $node) { if ($node->visible()) { $rect = $node->rectangle(); $content = $this->contentHtml($node->content()); return "<div style='left:{$rect->left}px;top:{$rect->top}px;width:{$rect->width}px;height:{$rect->height}px;background-color:{$node->background()}'>{$content}</div>"; } else { return ""; } }
public function makeGraph($type, $interval, $width, $height) { $nodeid = $this->nodeinfo->getNodeId(); $hostname = $this->nodeinfo->getHostname(); $nodeHeaderText = $hostname . " - " . $nodeid; if ($this->checkReDrawGraph($this->getFileName($type, $interval, $width, $height))) { switch ($type) { case "clients": $this->createGraphClients($interval, "Clients Online - " . $nodeHeaderText, $width, $height); break; case "traffic": $this->createGraphTraffic($interval, "Traffic Bytes - " . $nodeHeaderText, $width, $height); break; case "trafficPackages": $this->createGraphTrafficPackages($interval, "Traffic Packages - " . $nodeHeaderText, $width, $height); break; case "memoryUsage": $this->createGraphMemory($interval, "Memory Usage - " . $nodeHeaderText, $width, $height); break; case "rootfsUsage": $this->createGraphRootFs($interval, "RootFS Usage - " . $nodeHeaderText, $width, $height); break; case "loadavg": $this->createGraphLoadAvg($interval, "Load Average - " . $nodeHeaderText, $width, $height); break; } } }
/** * @param NodeInfo $info * @return array */ protected function mapNode(NodeInfo $info) { if ($info->visible()) { $content = $info->content()->content(); foreach ($content as $id => $line) { $content[$id][1] += $info->rectangle()->left; $content[$id][2] += $info->rectangle()->top; } return [$info->rectangle()->left, $info->rectangle()->top, $info->rectangle()->width, $info->rectangle()->height, $info->background(), $content, $info->level(), $info->isLeaf(), $info->isRoot()]; } else { return false; } }