document.php 862B

12345678910111213141516171819202122232425262728293031323334353637
  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. set("promos", Promo::getAll());
  9. return html("list.html.php", "layout.html.php");
  10. }
  11. function add_document()
  12. {
  13. File::addDocument($_FILES["document"], [
  14. "rang" => $_POST["rang"],
  15. "promo" => $_POST["promo"],
  16. "libelle" => $_POST["libelle"]
  17. ]);
  18. }
  19. function alter_document()
  20. {
  21. $document = new Document($_POST["id"]);
  22. $document->setRang($_POST["rang"]);
  23. $document->setPromo($_POST["promo"]);
  24. $document->setLibelle($_POST["libelle"]);
  25. $document->setFichier($_POST["fichier"]);
  26. }
  27. function delete_document()
  28. {
  29. (new File($_POST["id"]))->erase();
  30. }