From ca19d447cbd8e97d40a0a7b680a5e1fb00ce0d37 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 4 Feb 2016 16:59:40 +0100 Subject: [PATCH] Working in the new features. --- pandora_console/include/class/Map.class.php | 37 ++++++++++++++++--- .../include/class/Networkmap.class.php | 13 +++++++ pandora_console/include/functions_maps.php | 13 +++++-- .../include/javascript/map/MapController.js | 2 +- 4 files changed, 55 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/class/Map.class.php b/pandora_console/include/class/Map.class.php index 0bd585f8c3..c53b69b171 100644 --- a/pandora_console/include/class/Map.class.php +++ b/pandora_console/include/class/Map.class.php @@ -21,23 +21,48 @@ * @subpackage Maps */ -class Map { +abstract class Map { protected $id = null; + protected $type = null; + protected $subtype = null; + + protected $requires_js = null; + public function __construct($id) { $this->id = $id; + + $this->loadDB(); + + $this->requires_js = array(); + $this->requires_js[] = "include/javascript/d3.3.5.14.js"; + //~ $this->requires_js[] = "include/javascript/map/MapController.js"; } + private function loadDB() { + $row = db_get_row_filter('tmap', array('id' => $this->id)); + + $this->type = $row['type']; + $this->subtype = $row['subtype']; + } + + abstract function print_js_init(); + public function show() { + + foreach ($this->requires_js as $js) { + echo "" . "\n"; + } + ?> -
- - - - + +
+
+ print_js_init(); } } ?> diff --git a/pandora_console/include/class/Networkmap.class.php b/pandora_console/include/class/Networkmap.class.php index e560ba9318..208f46db30 100644 --- a/pandora_console/include/class/Networkmap.class.php +++ b/pandora_console/include/class/Networkmap.class.php @@ -24,10 +24,23 @@ class Networkmap extends Map { public function __construct($id) { parent::__construct($id); + + //~ $this->requires_js[] = "include/javascript/map/NetworkMapController.js"; } public function show() { parent::show(); } + + public function print_js_init() { + echo "

Networkmap

"; + ?> + + \ No newline at end of file diff --git a/pandora_console/include/functions_maps.php b/pandora_console/include/functions_maps.php index 246770aa3f..4f911fb8c2 100644 --- a/pandora_console/include/functions_maps.php +++ b/pandora_console/include/functions_maps.php @@ -162,12 +162,19 @@ function maps_show($id) { if (maps_is_networkmap($id)) { require_once("include/class/Networkmap.class.php"); + enterprise_include_once("include/class/NetworkmapEnterprise.class.php"); - $map = new Networkmap($id); - $map->show(); + if (enterprise_installed()) { + $map = new NetworkmapEnterprise($id); + } + else { + $map = new Networkmap($id); + } } else { - //TODO VISUAL + //~ $map = new Map($id); } + + $map->show(); } ?> diff --git a/pandora_console/include/javascript/map/MapController.js b/pandora_console/include/javascript/map/MapController.js index b7e7d5e3e8..4eaa320653 100644 --- a/pandora_console/include/javascript/map/MapController.js +++ b/pandora_console/include/javascript/map/MapController.js @@ -12,6 +12,6 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -var MapController { +var MapController = function() { }