Skip to content

Commit

Permalink
starting architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
grillol committed Jul 12, 2019
0 parents commit 5482e29
Show file tree
Hide file tree
Showing 30 changed files with 1,126 additions and 0 deletions.
Empty file added README.md
Empty file.
63 changes: 63 additions & 0 deletions css/sidebar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 999999999999;
top: 30px;
right: 0;
background-color: #FFFFFF;
overflow-x: hidden;
transition: 0.5s;
padding-top: 80px;
}

#header {
font-size: 15px;
right: 0px;
padding: 10px;
height: 30px;
float: right;
}

#footer {
height: 30px;
}

.sidenav a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 15px;
color: #818181;
display: block;
transition: 0.3s;
}

.sidenav a:hover {
color: #f1f1f1;
}


#openbtn{
font-size: 15px;
right: 5px;
top: 5px;
height: 29px;
cursor:pointer;
float: right;
display: block;
}

#closebtn {
font-size: 15px;
right: 5px;
top: 5px;
height: 29px;
cursor:pointer;
float: right;
display: none;
}

@media screen and (max-height: 450px) {
.sidenav {padding-top: 15px;}
.sidenav a {font-size: 18px;}
}
34 changes: 34 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
body {
padding: 0;
margin: 0;
}

html, body, #mapid {
height: 96%;
width: 100vw;
}

.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}

.active, .accordion:hover {
background-color: #ccc;
}

.panel {
padding: 0 18px;
display: none;
background-color: white;
overflow: hidden;
}

12 changes: 12 additions & 0 deletions database/add.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
require_once("dbcontroller.php");
$db_handle = new DBController();

if(!empty($_POST["lng"])) {

$sql = "INSERT INTO poi (lat,lng,description) VALUES ('" .$_POST["lat"] . "','" . $_POST["lng"] ."','" . $_POST["description"] . "')";
$poi = $db_handle->executeInsert($sql);

echo $poi;

}
58 changes: 58 additions & 0 deletions database/dbcontroller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
class DBController {
private $conn = "";
private $host = "89.46.111.49";
private $user = "Sql1127014";
private $password = "827r224040";
private $database = "Sql1127014_5";

function __construct() {
$conn = $this->connectDB();
if(!empty($conn)) {
$this->conn = $conn;
}
}

function connectDB() {
$conn = mysqli_connect($this->host,$this->user,$this->password,$this->database);
return $conn;
}

function runSelectQuery($query) {
$result = mysqli_query($this->conn,$query);
while($row=mysqli_fetch_assoc($result)) {
$resultset[] = $row;
}
if(!empty($resultset))
return $resultset;
}

function executeInsert($query) {
$result = mysqli_query($this->conn,$query);
$insert_id = mysqli_insert_id($this->conn);
return $insert_id;

}
function executeUpdate($query) {
$result = mysqli_query($this->conn,$query);
return $result;

}

function executeQuery($sql) {
$result = mysqli_query($this->conn,$sql);
return $result;

}

function numRows($query) {
$result = mysqli_query($this->conn,$query);
$rowcount = mysqli_num_rows($result);
return $rowcount;
}

function stringEscape($s) {
return mysqli_real_escape_string($this->conn,$s);
}
}
?>
26 changes: 26 additions & 0 deletions database/load.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/*
* Author:
* File:
* Last update:
* Todo:
*
*
*/

require_once("dbcontroller.php");
$db_handle = new DBController();


$sql = "SELECT * from poi";
$poi = $db_handle->runSelectQuery($sql);

$fd = fopen("log.txt","w");
fwrite($fd,json_encode($poi));
fclose($fd);

echo json_encode($poi);

// TODO Check for error


1 change: 1 addition & 0 deletions database/log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
Binary file added icons/baseball-marker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/leaf-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/iocumap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/loaderIcon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 93 additions & 0 deletions img.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!DOCTYPE html>
<html>
<head>

<title>static map example - luigigrillo.com </title>

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />

<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" crossorigin=""></script>


<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 98%;
width: 100vw;
}
</style>


</head>
<body>

<div id='map'></div>

<script>

var map = L.map('map', {
crs: L.CRS.Simple,
minZoom: -7
});

var yx = L.latLng;

var xy = function(x, y) {
if (L.Util.isArray(x)) { // When doing xy([x, y]);
return yx(x[1], x[0]);
}
return yx(y, x); // When doing xy(x, y);
};

var bounds = [xy(-25, -26.5), xy(1023, 1021.5)];
var image = L.imageOverlay('maps/Cartina-della-Sicilia-1024x792.jpg', bounds).addTo(map);

var ct = xy(875.007315, 468.999245 );
var me = xy(973.007975, 793.000643);
var pa = xy(384.004008, 766.000527);
var sr = xy(916.007591, 285.998455);

L.marker(ct).addTo(map).bindPopup('Catania');
L.marker(me).addTo(map).bindPopup('Messina');
L.marker(pa).addTo(map).bindPopup('Palermo');
L.marker(sr).addTo(map).bindPopup('Siracusa');

var travel = L.polyline([ct, me]).addTo(map);

var popup = L.popup();


function onMapClick(e) {
var html = "<form action=index.php method=GET> \
<table> \
<tr><td>Title </td><td><input type=textarea name=title> </td></tr> \
<tr><td>Author </td><td><input type=textarea name=author></td></tr> \
<tr><td><input type=submit></td><td></td></tr> \
</table> \
</form>";

popup
.setLatLng(e.latlng)
.setContent("I can look for books concerning this location: " + e.latlng.toString() + "<br> Great! Isn't it??" + html)
.openOn(map);
}

map.on('click', onMapClick);

map.setView(xy(542.832833, 570.360558), 0);



</script>



</body>
</html>
Loading

0 comments on commit 5482e29

Please sign in to comment.