card_game.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Define the CardGame class as an extension of Plugin to
  5. * install/uninstall the plugin.
  6. *
  7. * @author Damien Renou
  8. *
  9. * @package chamilo.plugin.card_game
  10. */
  11. class CardGame extends Plugin
  12. {
  13. /**
  14. * CardGame constructor.
  15. */
  16. protected function __construct()
  17. {
  18. parent::__construct(
  19. '1.1',
  20. 'Damien Renou'
  21. );
  22. }
  23. public static function create()
  24. {
  25. static $result = null;
  26. return $result ? $result : $result = new self();
  27. }
  28. public function install()
  29. {
  30. // 'pan' is the ID of the current background image/panel
  31. $sql = "CREATE TABLE IF NOT EXISTS plugin_card_game(
  32. id INT NOT NULL AUTO_INCREMENT,
  33. user_id INT NOT NULL,
  34. pan int NOT NULL,
  35. access_date DATE NOT NULL,
  36. parts VARCHAR(500) NOT NULL,
  37. PRIMARY KEY (id)
  38. )";
  39. Database::query($sql);
  40. }
  41. public function uninstall()
  42. {
  43. $sql = "DROP TABLE IF EXISTS plugin_card_game";
  44. Database::query($sql);
  45. }
  46. }