*/ // IF no error was found, save the data if (!isset($php_errormsg)) { if ($weatherCount > 0) { $WeatherID = $Weather->SaveWeatherData(); $Plant->setPlantWeather($WeatherID); } else { $Plant->setPlantWeather(null); } if ($LocationCount > 0) { $LocationID = $Location->SaveLocation(); $Plant->setPlantLocation($LocationID); } else { $Plant->setPlantLocation(null); } $PlantManager = new PlantManager(); $PlantID = $PlantManager->savePlant($Plant); } // Reset the values that should not be re-used if another plant is entered by the user. // URW I am leaving the rest of the data, for convinience to allow the user to entered multiple plants // which were likely observed at the same time in the same place. $Plant->setPlantName(""); $Plant->getPlantID(""); $Plant->getPlantNote(""); $_SESSION['current_plant'] = $Plant; $_SESSION['current_location'] = $Location; $_SESSION['current_soil'] = $Soil; $_SESSION['current_weather'] = $Weather; $_SESSION['current_user'] = $user; include_once "views/flower_add.php";
<?php /** * Created by PhpStorm. * User: Ute * Date: 11/28/2015 * Time: 8:37 PM */ require_once "models/plant.class.php"; require_once "models/plant_manager.class.php"; $PlantManager = new PlantManager(); $Plants = $PlantManager->getAllPLants(); include_once 'include/Header.php'; ?> <h1> All Plants</h1> <form name="Report" action="ExportData.php" method="get"> <button type="submit" name="Export" class="btn btn-default">Export</button> <button type="submit" name="Exit" class="btn btn-default">Exit</button> </form> <div id="table"></div> <?php echo '<script type="text/javascript"> var plants = ' . $Plants . '; </script>'; $scripts = ['jquery.jsontotable.min.js', 'reportTable.js']; include_once 'views/footer.php';
<?php /** * Created by PhpStorm. * User: Ute * Date: 11/28/2015 * Time: 8:37 PM */ require_once "models/plant.class.php"; require_once "models/plant_manager.class.php"; require_once "classes/db.interface.php"; require_once "classes/db.class.php"; require_once "models/exportResultsToCSV.php"; if (isset($_GET['Export'])) { $PlantManager = new PlantManager(); $plants = $PlantManager->getAllPlantsAsMSQLiObjects(); $exporter = new DataExport(); $exporter->toCSV($plants); } else { if (isset($_GET['Exit'])) { session_destroy(); print "<script type='text/javascript'>window.close();</script>"; } }