コード例 #1
0
ファイル: getcrags.php プロジェクト: pekka-m/ClimbingWeb
<?php

// this ajax file will get all the crags from the database that are inside the viewport
// of the current google maps view
// the given parameters are the bounds where to find
// all the crags in that area
// maybe work in done, comment this section later 15.5.2015
// at least need  to make function later to check if the old and new list of crags contains same things in
// order to delete the ones that aren't visible anymore and load new ones
// without loading every point again
// saves processing power I think.
spl_autoload_register(function ($class) {
    include '../classes/' . $class . '.class.php';
});
$crag = new Crag();
$latupperbound = $_GET['latupperbound'];
$latlowerbound = $_GET['latlowerbound'];
$longupperbound = $_GET['longupperbound'];
$longlowerbound = $_GET['longlowerbound'];
echo $crag->getCragsViewportJson($latupperbound, $latlowerbound, $longupperbound, $longlowerbound);
コード例 #2
0
ファイル: addcragtodb.php プロジェクト: pekka-m/ClimbingWeb
<?php

session_start();
include 'initclasses.php';
if (isset($_POST['cragupload'])) {
    $name = $_POST['cragname'];
    $lat = $_POST['lat'];
    $long = $_POST['long'];
    $crag = new Crag();
    $cragid = $crag->addCragToDB($name, $lat, $long);
    $datapath = $_POST['datadir'] . $cragid . "/";
    $image = new ImageUpload('crag', $cragid);
    $uploadfile = $datapath . $_FILES['filetti']['name'];
    $temp = explode(".", $_FILES["filetti"]["name"]);
    $newfilename = md5(time());
    $newfilenameext = $newfilename . '.' . end($temp);
    move_uploaded_file($_FILES["filetti"]["tmp_name"], $datapath . $newfilenameext);
    $images = new Image($datapath . $newfilenameext);
    $images->resize(175, 150, 'crop');
    $images->save($newfilename, $datapath);
    $image->addImageToSQL($newfilenameext);
    $image->linkImage('crag', $cragid, $newfilenameext);
}
header('Location: markroute.php');
コード例 #3
0
ファイル: cragdata_ajax.php プロジェクト: pekka-m/ClimbingWeb
<?php

session_start();
spl_autoload_register(function ($class) {
    include '../classes/' . $class . '.class.php';
});
// tehdään uusi Crag luokan ilmentymä
$crag = new Crag();
$cragid = $_GET['crag'];
if (!$cragid) {
    return false;
}
// haetaa cragin tiedot antammalla haettavan cragin id, tulostuu jsonina
echo $crag->getCragJson($cragid);
?>

コード例 #4
0
ファイル: markroute.php プロジェクト: pekka-m/ClimbingWeb
       
        <title>add route</title>
    </head>
    <body>
        <div id="map-canvas"></div>
        <div id="container">
<?php 
include "navbar.php";
?>
            <div id="content">
                <p>Select crag where you want to add route</p>
                <form id="image_upload_form" enctype="multipart/form-data" action="addroutetodb.php" method="post">
                    <select name="crag"  id="crags">
                        <option value="">Crags</option>
<?php 
$crag = new Crag();
$crag->getCragsFromDB();
$crag->printCragList();
?>
                    </select>
                    <div id="kortti">
                    </div>
                </form>
                <p> or add crag to your current location</p>
                <div id='cragikortti'>
                    <button id='nappula' name='buton' value='getlocation'>get location</button>
                    <form method="post" enctype="multipart/form-data" action="addcragtodb.php">
                <input type='text' name='cragname' placeholder='crag name'>
                    <div class='clear'></div>
                        <div class='upload'><input id='image_upload' name='filetti' type='file'><input type='hidden' name='datadir' value='/var/www/html/images/crag/'></div>
                    <input type='submit' name='cragupload' value='add crag'>
コード例 #5
0
ファイル: routecoord.php プロジェクト: pekka-m/ClimbingWeb
<?php

session_start();
spl_autoload_register(function ($class) {
    include '../classes/' . $class . '.class.php';
});
$crag = new Crag();
$cragid = $_GET['crag'];
if (!$cragid) {
    return false;
}
// haetaan cragin koordinaatit
$crag->getCragcoordJson($cragid);