document.php 733B

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