Working in the new features.

This commit is contained in:
mdtrooper 2016-02-04 16:59:40 +01:00
parent 2c7f0c423c
commit ca19d447cb
4 changed files with 55 additions and 10 deletions

View File

@ -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 "<script type='text/javascript' src='$js'></script>" . "\n";
}
?>
<div class="map">
<svg width="800" height="800" pointer-events="all" style="border: 2px solid red;">
<g>
<circle id="node_10" class="node" r="5" style="fill: rgb(128, 186, 39);" cx="100" cy="100"/>
</g>
<div id="map" data-id="<?php echo $this->id;?>" >
<svg style="border: 2px solid red;" pointer-events="all" width="800" height="800"><g><circle id="node_10" class="node" cx="100" cy="100" style="fill: rgb(128, 186, 39);" r="5">
</svg>
</div>
<?php
$this->print_js_init();
}
}
?>

View File

@ -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 "<h1>Networkmap</h1>";
?>
<script type="text/javascript">
$(function() {
// map = new js_networkmap();
});
</script>
<?php
}
}
?>

View File

@ -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 {
//TODO VISUAL
$map = new Networkmap($id);
}
}
else {
//~ $map = new Map($id);
}
$map->show();
}
?>

View File

@ -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() {
}