document.php 825B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. require_once(dirname(__DIR__) . "/models/document.class.php");
  3. require_once(dirname(__DIR__) . "/models/promo.class.php");
  4. function document()
  5. {
  6. set("title", "Titre");
  7. set("data", Document::getAll());
  8. return html("list.html.php", "layout.html.php");
  9. }
  10. function add_document()
  11. {
  12. File::addDocument($_FILES["document"], [
  13. "rang" => $_POST["rang"],
  14. "promo" => $_POST["promo"],
  15. "libelle" => $_POST["libelle"]
  16. ]);
  17. }
  18. function alter_document()
  19. {
  20. $document = new Document($_POST["id"]);
  21. $document->setRang($_POST["rang"]);
  22. $document->setPromo($_POST["promo"]);
  23. $document->setLibelle($_POST["libelle"]);
  24. $document->setFichier($_POST["fichier"]);
  25. }
  26. function delete_document()
  27. {
  28. (new File($_POST["id"]))->erase();
  29. }