promo.php 538B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. require_once(dirname(__DIR__)."/models/promo.class.php");
  3. function promo()
  4. {
  5. set("title", "Titre");
  6. set("data", Promo::getAll());
  7. return html("list.html.php", "layout.html.php");
  8. }
  9. function add_promo()
  10. {
  11. Promo::addPromo([
  12. "id" => $_POST["id"],
  13. "libelle" => $_POST["libelle"]
  14. ]);
  15. }
  16. function alter_promo()
  17. {
  18. $promo = new Promo($_POST["id"]);
  19. $promo->setLibelle($_POST["libelle"]);
  20. $promo->write();
  21. }
  22. function delete_promo()
  23. {
  24. (new Promo($_POST["promo"]))->erase();
  25. }