Actualización

This commit is contained in:
Xes
2025-04-10 12:49:05 +02:00
parent 4aff98e77b
commit 1cdd00920f
9151 changed files with 1800913 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes.
*
* Interface HookEventInterface.
*/
interface HookEventInterface
{
/**
* Attach an HookObserver.
*
* @see http://php.net/manual/en/splsubject.attach.php
*
* @param \HookObserverInterface| $observer <p>
* The <b>HookObserver</b> to attach.
* </p>
*/
public function attach(HookObserverInterface $observer);
/**
* Detach an HookObserver.
*
* @see http://php.net/manual/en/splsubject.detach.php
*
* @param \HookObserverInterface| $observer <p>
* The <b>HookObserver</b> to detach.
* </p>
*/
public function detach(HookObserverInterface $observer);
/**
* Return the singleton instance of Hook event.
*
* @return static
*/
public static function create();
/**
* Return an array containing all data needed by the hook observer to update.
*
* @return array
*/
public function getEventData();
/**
* Set an array with data needed by hooks.
*
* @return $this
*/
public function setEventData(array $data);
/**
* Return the event name refer to where hook is used.
*
* @return string
*/
public function getEventName();
/**
* Clear all hookObservers without detach them.
*
* @return mixed
*/
public function clearAttachments();
/**
* Detach all hook observers.
*
* @return $this
*/
public function detachAll();
}

View File

@@ -0,0 +1,74 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes.
*
* @package chamilo.library.hook
*/
interface HookManagementInterface
{
/**
* Insert hook into Database. Return insert id.
*
* @param string $eventName
* @param string $observerClassName
* @param int $type
*
* @return int
*/
public function insertHook($eventName, $observerClassName, $type);
/**
* Delete hook from Database. Return deleted rows number.
*
* @param string $eventName
* @param string $observerClassName
* @param int $type
*
* @return int
*/
public function deleteHook($eventName, $observerClassName, $type);
/**
* Update hook observer order by hook event.
*
* @param $eventName
* @param $type
* @param $newOrder
*
* @return int
*/
public function orderHook($eventName, $type, $newOrder);
/**
* Return a list an associative array where keys are the hook observer class name.
*
* @param $eventName
*
* @return array
*/
public function listHookObservers($eventName);
/**
* Check if hooks (event, observer, call) exist in Database, if not,
* Will insert them into their respective table.
*
* @param string $eventName
* @param string $observerClassName
*
* @return int
*/
public function insertHookIfNotExist($eventName = null, $observerClassName = null);
/**
* Return the hook call id identified by hook event, hook observer and type.
*
* @param string $eventName
* @param string $observerClassName
* @param int $type
*
* @return mixed
*/
public function getHookCallId($eventName, $observerClassName, $type);
}

View File

@@ -0,0 +1,31 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes.
*
* @package chamilo.library.hook
*/
interface HookObserverInterface
{
/**
* Return the singleton instance of Hook observer.
*
* @return static
*/
public static function create();
/**
* Return the path from the class, needed to store location or autoload later.
*
* @return string
*/
public function getPath();
/**
* Return the plugin name where is the Hook Observer.
*
* @return string
*/
public function getPluginName();
}

View File

@@ -0,0 +1,29 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes.
*
* @package chamilo.library.hook
*/
/**
* Interface HookPluginInterface
* This interface should be implemented by plugins to implements Hook Observer.
*/
interface HookPluginInterface
{
/**
* This method will call the Hook management insertHook to add Hook observer from this plugin.
*
* @return int
*/
public function installHook();
/**
* This method will call the Hook management deleteHook to disable Hook observer from this plugin.
*
* @return int
*/
public function uninstallHook();
}