HookManagementInterface.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This file contains all Hook interfaces and their relation.
  5. * They are used for Hook classes.
  6. *
  7. * @package chamilo.library.hook
  8. */
  9. interface HookManagementInterface
  10. {
  11. /**
  12. * Insert hook into Database. Return insert id.
  13. *
  14. * @param string $eventName
  15. * @param string $observerClassName
  16. * @param int $type
  17. *
  18. * @return int
  19. */
  20. public function insertHook($eventName, $observerClassName, $type);
  21. /**
  22. * Delete hook from Database. Return deleted rows number.
  23. *
  24. * @param string $eventName
  25. * @param string $observerClassName
  26. * @param int $type
  27. *
  28. * @return int
  29. */
  30. public function deleteHook($eventName, $observerClassName, $type);
  31. /**
  32. * Update hook observer order by hook event.
  33. *
  34. * @param $eventName
  35. * @param $type
  36. * @param $newOrder
  37. *
  38. * @return int
  39. */
  40. public function orderHook($eventName, $type, $newOrder);
  41. /**
  42. * Return a list an associative array where keys are the hook observer class name.
  43. *
  44. * @param $eventName
  45. *
  46. * @return array
  47. */
  48. public function listHookObservers($eventName);
  49. /**
  50. * Check if hooks (event, observer, call) exist in Database, if not,
  51. * Will insert them into their respective table.
  52. *
  53. * @param string $eventName
  54. * @param string $observerClassName
  55. *
  56. * @return int
  57. */
  58. public function insertHookIfNotExist($eventName = null, $observerClassName = null);
  59. /**
  60. * Return the hook call id identified by hook event, hook observer and type.
  61. *
  62. * @param string $eventName
  63. * @param string $observerClassName
  64. * @param int $type
  65. *
  66. * @return mixed
  67. */
  68. public function getHookCallId($eventName, $observerClassName, $type);
  69. }