Пример #1
0
<?php

include_once 'includes/globalConfig.php';
Dune::setDatabaseCredentials($twlProjectCredentials);
function isfloat($f)
{
    return $f == (string) (double) $f;
}
print isfloat(false) . '<br>';
print isfloat(true) . '<br>';
print isfloat("") . '<br>';
print isfloat("abc") . '<br>';
print isfloat(2) . '<br>';
print isfloat("2") . '<br>';
print isfloat(2.3) . '<br>';
print isfloat("2.3") . '<br>';
Пример #2
0
 /**
  * Saves the site dunes to the database.
  *
  * @throws InvalidOperationException If the database credentials have not been set.
  */
 public final function saveSiteDunes()
 {
     if (is_null(self::$databaseCredentials)) {
         throw new InvalidOperationException('Database credentials must be set at the class level to allow this action to take place.');
     }
     Dune::setDatabaseCredentials(self::$databaseCredentials);
     foreach ($this->dunes as $dune) {
         $dune->save();
     }
 }
Пример #3
0
 /**
  * @param array $databaseCredentials An array of credentials for access to the twlProject database
  */
 public static final function setDatabaseCredentials(array $databaseCredentials)
 {
     self::$databaseCredentials = $databaseCredentials;
 }
Пример #4
0
<?php

/**
 * Provides functionality to return a dune time series for graphing.
 *
 * Project: twlProject
 * File: loadDune.php
 * Created: 3/6/2016 5:19 PM
 *
 * @author Richard Snell <*****@*****.**>
 */
include_once '../includes/globalConfig.php';
Dune::setDatabaseCredentials($twlProjectCredentials);
GeographicalFeature::setDatabaseCredentials($geonamesCredentials);
TwlTimeSeries::setDatabaseCredentials($twlProjectCredentials);
$DBH = call_user_func_array('DatabaseHelper::getInstance', $twlProjectCredentials);
$timeSeriesId = filter_input(INPUT_GET, 'timeSeriesId', FILTER_VALIDATE_INT);
$fileId = filter_input(INPUT_GET, 'fileId', FILTER_VALIDATE_INT);
$duneId = filter_input(INPUT_GET, 'duneId', FILTER_VALIDATE_INT);
if (empty($timeSeriesId) || empty($fileId) || empty($duneId)) {
    print 'empty';
    exit;
}
$dune = Dune::loadById($duneId);
$location = new GeographicalFeature($dune->getPosition());
$location->reverseGeocode();
$dune->setTimeSeries(TwlTimeSeries::loadTimeSeries($fileId, $timeSeriesId));
$returnData = $dune->exportDune();
$returnData['impEvt'] = $dune->duneImpactingEvents();
$returnData['dune']['location'] = $location->getCity();
print json_encode($returnData);