id = $id; $this->requires_js = array(); $this->requires_js[] = "include/javascript/d3.3.5.14.js"; $this->requires_js[] = "include/javascript/map/MapController.js"; $this->requires_js[] = "include/javascript/jquery.tooltipster.js"; $this->requires_js[] = "include/javascript/jquery.svg.js"; $this->requires_js[] = "include/javascript/jquery.svgdom.js"; if (!$this->loadDB()) { $this->status = STATUS_ERROR; } } protected function processDBValues($dbValues) { $this->type = (int)$dbValues['type']; $this->subtype = (int)$dbValues['subtype']; $this->id_group = (int)$dbValues['id_group']; $this->generation_method = (int)$dbValues['generation_method']; $this->width = (int)$dbValues['width']; $this->height = (int)$dbValues['height']; } private function loadDB() { $row = db_get_row_filter('tmap', array('id' => $this->id)); if (empty($row)) return false; switch (get_class($this)) { case 'Networkmap': Networkmap::processDBValues($row); break; case 'NetworkmapEnterprise': NetworkmapEnterprise::processDBValues($row); break; default: $this->processDBValues($row); break; } } abstract function printJSInit(); public function writeJSGraph() { $this->nodes = json_decode('[ { "graph_id": "165", "id": "17", "type": 0, "x": 1033.4, "y": 806.38 }, { "graph_id": "166", "id": "198", "type": 1, "x": 1119.5, "y": 847.85 }, { "graph_id": 208, "type": 2 }, { "graph_id": "169", "id": "207", "type": 1, "x": 947.33, "y": 764.91 }, { "graph_id": 209, "type": 2 }, { "graph_id": "179", "id": "27", "type": 0, "x": 159.23, "y": 1005.9 }, { "graph_id": "180", "id": "223", "type": 1, "x": 218.82, "y": 931.19 }, { "graph_id": "183", "id": "89", "type": 0, "x": 516.77, "y": 557.57 }, { "graph_id": "184", "id": "418", "type": 1, "x": 430.66, "y": 599.03 }, { "graph_id": "196", "id": "412", "type": 1, "x": 602.88, "y": 516.1 }, { "graph_id": 212, "type": 2 }, { "graph_id": 213, "type": 2 }, { "graph_id": 214, "id": 666, "type": 0, "x": 300, "y": 300 }, { "graph_id": 215, "id": 999, "type": 0, "x": 300, "y": 100 }, { "graph_id": 216, "id": 999, "type": 0, "x": 300, "y": 500 }, { "graph_id": 217, "id": 666, "type": 0, "x": 100, "y": 300 }, { "graph_id": 218, "id": 666, "type": 0, "x": 500, "y": 300 }, { "graph_id": 219, "id": 666, "type": 0, "x": 500, "y": 100 }, { "graph_id": 220, "id": 666, "type": 0, "x": 500, "y": 500 }, { "graph_id": 221, "id": 666, "type": 0, "x": 100, "y": 100 }, { "graph_id": 222, "id": 666, "type": 0, "x": 100, "y": 500 }, { "graph_id": 400, "type": 2 }, { "graph_id": 401, "type": 2 }, { "graph_id": 402, "type": 2 }, { "graph_id": 403, "type": 2 }, { "graph_id": 404, "type": 2 }, { "graph_id": 405, "type": 2 }, { "graph_id": 406, "type": 2 }, { "graph_id": 407, "type": 2 } ]', true); $this->edges = json_decode( '[ {"to":"215","from":"214","graph_id":400}, {"to":"216","from":"214","graph_id":401}, {"to":"217","from":"214","graph_id":402}, {"to":"218","from":"214","graph_id":403} ]', true); $this->edges = json_decode( '[ {"to":"219","from":"214","graph_id":404}, {"to":"220","from":"214","graph_id":405}, {"to":"221","from":"214","graph_id":406}, {"to":"222","from":"214","graph_id":407} ]', true); //~ $this->edges = json_decode( //~ '[ //~ {"to":"215","from":"214","graph_id":400} //~ ]', true); $this->edges = json_decode( '[ {"to":"215","from":"214","graph_id":400}, {"to":"216","from":"214","graph_id":401}, {"to":"217","from":"214","graph_id":402}, {"to":"218","from":"214","graph_id":403}, {"to":"219","from":"214","graph_id":404}, {"to":"220","from":"214","graph_id":405}, {"to":"221","from":"214","graph_id":406}, {"to":"222","from":"214","graph_id":407} ]', true); //~ $this->edges = json_decode('[{"to":"165","from":"166","graph_id":208}]', true); ?> is_buggy_firefox = true; break; case 'Microsoft': // Do install a GNU/Linux. break; default: // The world is a wonderful place. break; } } public function show() { // Tooltip css echo "" . "\n"; echo "" . "\n"; echo "" . "\n"; echo "" . "\n"; echo "" . "\n"; //Tooltips spinner echo ""; foreach ($this->requires_js as $js) { echo "" . "\n"; } $this->check_browser(); $this->writeJSConstants(); $this->writeJSGraph(); ?>
+
-
H
width == 0) { $width = "100%"; } else { $width = $this->width . "px"; } if ($this->height == 0) { $height = "500px"; } else { $height = $this->height . "px"; } ?> embedded_symbols_for_firefox(); ?>
printJSInit(); } private function embedded_symbols_for_firefox() { global $config; if ($this->is_buggy_firefox) { echo ""; // Firefox BUG // https://bugzilla.mozilla.org/show_bug.cgi?id=1254159 $this->is_buggy_firefox = true; $dir_string = $config['homedir'] . '/images/maps/'; if ($dir = opendir($dir_string)) { while (false !== ($file = readdir($dir))) { if (is_file($dir_string . $file)) { $xml = simplexml_load_file($dir_string . $file); $xml->registerXPathNamespace("x", "http://www.w3.org/2000/svg"); $symbols = $xml->xpath("//x:symbol"); //~ $symbols = $symbols->xpath("//symbol"); echo $symbols[0]->asXML(); } } closedir($dir); } echo ""; } } public function writeJSConstants() { $contants = array(); $contants["ITEM_TYPE_AGENT_NETWORKMAP"] = ITEM_TYPE_AGENT_NETWORKMAP; $contants["ITEM_TYPE_MODULE_NETWORKMAP"] = ITEM_TYPE_MODULE_NETWORKMAP; $contants["ITEM_TYPE_EDGE_NETWORKMAP"] = ITEM_TYPE_EDGE_NETWORKMAP; ?> type; } } ?>