promo.php 548B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. require_once(dirname(__DIR__)."/models/promo.class.php");
  3. function promo()
  4. {
  5. set("title", "Promotions");
  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($promoid)
  17. {
  18. $promo = new Promo($promoid);
  19. $promo->setLibelle($_POST["libelle"]);
  20. $promo->write();
  21. }
  22. function delete_promo($promoid)
  23. {
  24. (new Promo($promoid))->erase();
  25. }