document.php 519B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. require_once(dirname(__DIR__) . "/models/document.class.php");
  3. function files()
  4. {
  5. set("title", "Titre");
  6. set("data", File::getAll());
  7. return html("list.html.php", "layout.html.php");
  8. }
  9. function add_file()
  10. {
  11. $options = [];
  12. foreach(["rang", "promo", "libelle"] as $field)
  13. $options[$field] = $_POST[$field];
  14. File::addDocument($_FILES["document"], $options);
  15. }
  16. function alter_file()
  17. {
  18. // TODO
  19. }
  20. function delete_file()
  21. {
  22. (new File($_POST["id"]))->erase();
  23. }