facility-data.php 526 B

123456789101112131415161718192021222324
  1. <?php
  2. require_once('classes/Facilities.php');
  3. $id = (int)$_REQUEST['id'];
  4. if (empty($id)) {
  5. throw new Exception('No ID supplied');
  6. }
  7. $filedir = sprintf("facilities/%d", $id);
  8. $facilities = new Facilities("$filedir/facility.tsv");
  9. foreach($facilities->get_all() as $facility) {
  10. if (isset($_FILES['picture'])) {
  11. $facility->add_uploaded_picture($_FILES['picture']);
  12. header(sprintf('Location: ./?id=%d', $facility->ID));
  13. die;
  14. }
  15. echo isset($_REQUEST['popup']) ? $facility->popup_html() : $facility->full_html();
  16. }