HookManagementInterface.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. * @package chamilo.library.hook
  7. */
  8. interface HookManagementInterface
  9. {
  10. /**
  11. * Insert hook into Database. Return insert id
  12. * @param string $eventName
  13. * @param string $observerClassName
  14. * @param int $type
  15. *
  16. * @return int
  17. */
  18. public function insertHook($eventName, $observerClassName, $type);
  19. /**
  20. * Delete hook from Database. Return deleted rows number
  21. * @param string $eventName
  22. * @param string $observerClassName
  23. * @param int $type
  24. *
  25. * @return int
  26. */
  27. public function deleteHook($eventName, $observerClassName, $type);
  28. /**
  29. * Update hook observer order by hook event
  30. * @param $eventName
  31. * @param $type
  32. * @param $newOrder
  33. *
  34. * @return int
  35. */
  36. public function orderHook($eventName, $type, $newOrder);
  37. /**
  38. * Return a list an associative array where keys are the hook observer class name
  39. * @param $eventName
  40. *
  41. * @return array
  42. */
  43. public function listHookObservers($eventName);
  44. /**
  45. * Check if hooks (event, observer, call) exist in Database, if not,
  46. * Will insert them into their respective table
  47. * @param string $eventName
  48. * @param string $observerClassName
  49. *
  50. * @return int
  51. */
  52. public function insertHookIfNotExist($eventName = null, $observerClassName = null);
  53. /**
  54. * Return the hook call id identified by hook event, hook observer and type
  55. * @param string $eventName
  56. * @param string $observerClassName
  57. * @param int $type
  58. *
  59. * @return mixed
  60. */
  61. public function getHookCallId($eventName, $observerClassName, $type);
  62. }