diff --git a/README.md b/README.md new file mode 100755 index 0000000..9ef20df --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Italian petrol pumps comparator + + +This web app allows you to list in a map and sort all fuel suppliers who are in a particular area, also it provides the current prices on every suppliers. + +We have engineered this solution in a Hackathon that was sponsored by *Facile.it*, an Italian price comparator. This submission **won the competition**. + +## Use +Use the http://fuel.reyboz.it online mirror. It has data updated on a daily basis. + +## More about +Heroes and original technologies in the [/about.php](http://fuel.reyboz.it/about.php) page of the online mirror. + +## Hacking +Clone the source code using Bazaar: + + bzr clone lp:it-fuel-stations-comparator + +## Installation +This project is built over the [Boz-PHP - Another PHP framework](https://github.com/valerio-bozzolan/boz-php-another-php-framework). Install it in your `/usr/share`: + + bzr branch lp:boz-php-another-php-framework /usr/share/boz-php-another-php-framework + +After that you only have to rename and fill the `load-sample.php` to `load.php` and import in MySQL/MariaDB the `database-schema.sql` from the `installation` folder. + +## Import data from MISE +Please download data from the Italian [Ministero dello Sviluppo Economico](http://www.sviluppoeconomico.gov.it/index.php/it/open-data/elenco-dataset/2032336-carburanti-prezzi-praticati-e-anagrafica-degli-impianti): + * http://www.sviluppoeconomico.gov.it/images/exportCSV/prezzo_alle_8.csv + * http://www.sviluppoeconomico.gov.it/images/exportCSV/anagrafica_impianti_attivi.csv + +They are released under the terms of the Italian [Open Data License v2.0](http://www.dati.gov.it/iodl/2.0/). + +The `cli/import.php` can import them into your DB: + + php ./cli/import.php anagrafica_impianti_attivi.csv prezzo_alle_8.csv + +## Pull requests +Push in Launchpad: + +https://code.launchpad.net/it-fuel-stations-comparator + +## License +This is a **Free** as in **Freedom** project. It comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under the terms of the **GNU Affero General Public License v3+**. diff --git a/about.php b/about.php index e6b02d7..c538414 100755 --- a/about.php +++ b/about.php @@ -1,218 +1,235 @@ . + */ require 'load.php'; get_header('about'); ?>
| Apache | ||
| Boz PHP - Another PHP Framework | ||
| Debian GNU/Linux | ||
| jQuery + jQuery UI | ||
| Leaflet | ||
| Materialize | ||
| Material Design Icons | ||
| MySQL | Relational database management system | |
| Open Data MISE | ||
| OpenStreetMap | ||
| OpenClipArt | ||
| PHP | ||
| Reveal.JS |
| " + litres + " L | "; } else { txt += "" + litres + " L | "; } - txt += "per il " + json[i].prezzi[j].descCarburante + " | "; + txt += "per il " + json[i].prices[j].fuel_name + " | "; txt += ""; - if(json[i].prezzi[j].isSelf === "1") { + if(json[i].prices[j].price_self) { txt += "(self)"; } else { txt += ""; } txt += " | "; txt += ""; } txt += "
+ " + L10N.actionFavorites + ""; txt += "segnala errore
"; - var m = L.marker([json[i].latitudine, json[i].longitudine], { + var m = L.marker([json[i].station_lat, json[i].station_lon], { bounceOnAdd: true, bounceOnAddOptions: {duration: 500, height: 100}, bounceOnAddCallback: function() {} - }).bindPopup(txt).addTo(map).options.idImpianto = json[i].idImpianto; + }) + .bindPopup(txt) + .addTo(map) + .options; + + m.station_ID = json[i].station_ID; } postCallback && postCallback(bounds, json); }); } function suggest_nominatim_addresses(query) { $.ajax({ url: "https://nominatim.openstreetmap.org/search", jsonp: "nominatimJsonp", dataType: "jsonp", data: { q: query, format: "json", json_callback: "nominatimJsonp" } }); } function nominatimJsonp(json) { var $searchResults = $("#modal-search-addr-results"); var $list = $searchResults.find("ol").empty(); if(json.length > 0) { for(i=0; igetValue( - "SELECT COUNT(*) as count FROM station", + $db->getValue( + "SELECT COUNT(*) as count FROM {$db->getTable('station')}", 'count' ), HTML::property('class', 'station-counter') ) - ) ?> -
+ ) ?>