$item = new PlantObservation(); $item->hydrate($arr); $ObservationMgr->save($item); $msg = $arr["PlantName"] . ' record added'; header("Location: adminController.php?msg={$msg}"); break; case 'manage_users': header("Location: adminController.php?msg=User management isn't yet implemented"); break; case 'shapefile_export': header("Location: adminController.php?msg=Shapefile export isn't yet implemented"); break; case 'csv_export': $export = new DataExport(); $rows = $ObservationMgr->getAllObservationsAsMSQLiObjects(); $export->toCSV($rows); header("Location: adminController.php"); break; default: //include('../views/FOFAEntry.view.php'); $items = $ObservationMgr->getAllObservationRecords(); include '../views/list.view.php'; break; } ?> </body> </html>
<?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>"; } }