Actualización
This commit is contained in:
37
main/inc/lib/hook/CheckLoginCredentialsHook.php
Normal file
37
main/inc/lib/hook/CheckLoginCredentialsHook.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class CheckLoginCredentialsHook.
|
||||
*/
|
||||
class CheckLoginCredentialsHook extends HookEvent implements CheckLoginCredentialsHookEventInterface
|
||||
{
|
||||
/**
|
||||
* CheckLoginCredentialsHook constructor.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('CheckLoginCredentialsHook');
|
||||
}
|
||||
|
||||
/**
|
||||
* Call to all observers.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function notifyLoginCredentials()
|
||||
{
|
||||
/** @var CheckLoginCredentialsHookObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$isChecked = $observer->checkLoginCredentials($this);
|
||||
|
||||
if ($isChecked) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
53
main/inc/lib/hook/HookAdminBlock.php
Normal file
53
main/inc/lib/hook/HookAdminBlock.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* This file contains a Hook Event class for Admin Block.
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class HookAdminBlock
|
||||
* This class is a Hook event implementing Admin Block Event interface.
|
||||
* This class is used to modify admin block by notifying Hook Observer for Admin Block.
|
||||
*/
|
||||
class HookAdminBlock extends HookEvent implements HookAdminBlockEventInterface
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookAdminBlock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify Hook observers for Admin Block event.
|
||||
*
|
||||
* @param int $type Set the type of hook event called.
|
||||
* 0: HOOK_EVENT_TYPE_PRE, 1: HOOK_EVENT_TYPE_POST
|
||||
*
|
||||
* @return array|int
|
||||
*/
|
||||
public function notifyAdminBlock($type)
|
||||
{
|
||||
/** @var \HookAdminBlockObserverInterface $observer */
|
||||
// Save data
|
||||
if (isset($this->eventData['blocks'])) {
|
||||
$this->eventData['type'] = $type;
|
||||
// Call all registered hook observers for admin block
|
||||
foreach ($this->observers as $observer) {
|
||||
$data = $observer->hookAdminBlock($this);
|
||||
if (isset($data['blocks'])) {
|
||||
// Get modified data
|
||||
$this->eventData['blocks'] = $data['blocks'];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->eventData;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
36
main/inc/lib/hook/HookConditionalLogin.php
Normal file
36
main/inc/lib/hook/HookConditionalLogin.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookConditionalLogin.
|
||||
* Hook to implement Conditional Login.
|
||||
*/
|
||||
class HookConditionalLogin extends HookEvent implements HookConditionalLoginEventInterface
|
||||
{
|
||||
/**
|
||||
* HookConditionalLogin constructor.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookConditionalLogin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify to all hook observers.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyConditionalLogin()
|
||||
{
|
||||
$conditions = [];
|
||||
|
||||
/** @var HookConditionalLoginObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$conditions[] = $observer->hookConditionalLogin($this);
|
||||
}
|
||||
|
||||
return $conditions;
|
||||
}
|
||||
}
|
||||
37
main/inc/lib/hook/HookCreateCourse.php
Normal file
37
main/inc/lib/hook/HookCreateCourse.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookCreateCourse.
|
||||
*/
|
||||
class HookCreateCourse extends HookEvent implements HookCreateCourseEventInterface
|
||||
{
|
||||
/**
|
||||
* HookCreateCourse constructor.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookCreateCourse');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyCreateCourse($type)
|
||||
{
|
||||
$this->eventData['type'] = $type;
|
||||
|
||||
/** @var HookCreateCourseObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookCreateCourse($this);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
37
main/inc/lib/hook/HookCreateUser.php
Normal file
37
main/inc/lib/hook/HookCreateUser.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookCreateUser.
|
||||
*
|
||||
* @var \SplObjectStorage
|
||||
*/
|
||||
class HookCreateUser extends HookEvent implements HookCreateUserEventInterface
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookCreateUser');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyCreateUser($type)
|
||||
{
|
||||
$this->eventData['type'] = $type;
|
||||
|
||||
/** @var HookCreateUserObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookCreateUser($this);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
39
main/inc/lib/hook/HookDocumentAction.php
Normal file
39
main/inc/lib/hook/HookDocumentAction.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookDocumentAction.
|
||||
*/
|
||||
class HookDocumentAction extends HookEvent implements HookDocumentActionEventInterface
|
||||
{
|
||||
/**
|
||||
* HookDocumentAction constructor.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookDocumentAction');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyDocumentAction($type)
|
||||
{
|
||||
$this->eventData['type'] = $type;
|
||||
|
||||
/** @var \HookDocumentActionObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$data = $observer->notifyDocumentAction($this);
|
||||
$this->setEventData($data);
|
||||
}
|
||||
|
||||
return $this->eventData;
|
||||
}
|
||||
}
|
||||
39
main/inc/lib/hook/HookDocumentItemAction.php
Normal file
39
main/inc/lib/hook/HookDocumentItemAction.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookDocumentItemAction.
|
||||
*/
|
||||
class HookDocumentItemAction extends HookEvent implements HookDocumentItemActionEventInterface
|
||||
{
|
||||
/**
|
||||
* HookDocumentItemAction constructor.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookDocumentItemAction');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyDocumentItemAction($type)
|
||||
{
|
||||
$this->eventData['type'] = $type;
|
||||
|
||||
/** @var \HookDocumentItemActionObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$data = $observer->notifyDocumentItemAction($this);
|
||||
$this->setEventData($data);
|
||||
}
|
||||
|
||||
return $this->eventData;
|
||||
}
|
||||
}
|
||||
34
main/inc/lib/hook/HookDocumentItemView.php
Normal file
34
main/inc/lib/hook/HookDocumentItemView.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookDocumentItemView.
|
||||
*/
|
||||
class HookDocumentItemView extends HookEvent implements HookDocumentItemViewEventInterface
|
||||
{
|
||||
/**
|
||||
* HookDocumentItemView constructor.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookDocumentItemView');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function notifyDocumentItemView(): array
|
||||
{
|
||||
$tools = [];
|
||||
|
||||
/** @var HookDocumentItemViewObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$tools[] = $observer->notifyDocumentItemView($this);
|
||||
}
|
||||
|
||||
return $tools;
|
||||
}
|
||||
}
|
||||
193
main/inc/lib/hook/HookEvent.php
Normal file
193
main/inc/lib/hook/HookEvent.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* This file contains an abstract Hook event class
|
||||
* Used for Hook Events (e.g Create user, Webservice registration).
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class HookEvent
|
||||
* This abstract class implements Hook Event Interface to build the base
|
||||
* for Hook Events. This class have some public static method,
|
||||
* e.g for create Hook Events.
|
||||
*/
|
||||
abstract class HookEvent implements HookEventInterface
|
||||
{
|
||||
public $observers;
|
||||
public $eventName;
|
||||
public $eventData;
|
||||
public $manager;
|
||||
public static $hook;
|
||||
|
||||
/**
|
||||
* Construct Method.
|
||||
*
|
||||
* @param string $eventName
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function __construct($eventName)
|
||||
{
|
||||
$this->observers = new SplObjectStorage();
|
||||
$this->eventName = $eventName;
|
||||
$this->eventData = [];
|
||||
$this->manager = HookManagement::create();
|
||||
$this->loadAttachments();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the singleton instance of Hook event.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
static $result = null;
|
||||
|
||||
if ($result) {
|
||||
return $result;
|
||||
} else {
|
||||
try {
|
||||
$class = get_called_class();
|
||||
|
||||
return new $class();
|
||||
} catch (Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
$observerClass = get_class($observer);
|
||||
self::$hook[$this->eventName][$observerClass] = [
|
||||
'class_name' => $observerClass,
|
||||
'path' => $observer->getPath(),
|
||||
'plugin_name' => $observer->getPluginName(),
|
||||
];
|
||||
$this->observers->attach($observer);
|
||||
$this->manager->insertHook($this->eventName, $observerClass, HOOK_EVENT_TYPE_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
$observerClass = get_class($observer);
|
||||
unset(self::$hook[$this->eventName][$observerClass]);
|
||||
$this->observers->detach($observer);
|
||||
$this->manager->deleteHook($this->eventName, $observerClass, HOOK_EVENT_TYPE_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify an observer.
|
||||
*
|
||||
* @see http://php.net/manual/en/splsubject.notify.php
|
||||
*/
|
||||
public function notify()
|
||||
{
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->update($this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the event name refer to where hook is used.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEventName()
|
||||
{
|
||||
return $this->eventName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array containing all data needed by the hook observer to update.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getEventData()
|
||||
{
|
||||
return $this->eventData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an array with data needed by hooks.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setEventData(array $data)
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
// Assign value for each array item
|
||||
$this->eventData[$key] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach all hook observers.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function detachAll()
|
||||
{
|
||||
self::$hook[$this->eventName] = null;
|
||||
$this->observers->removeAll($this->observers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all hookObservers without detach them.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function clearAttachments()
|
||||
{
|
||||
$this->observers->removeAll($this->observers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all hook observer already registered from Session or Database.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function loadAttachments()
|
||||
{
|
||||
if (isset(self::$hook[$this->eventName]) && is_array(self::$hook[$this->eventName])) {
|
||||
foreach (self::$hook[$this->eventName] as $hookObserver => $val) {
|
||||
$hookObserverInstance = $hookObserver::create();
|
||||
$this->observers->attach($hookObserverInstance);
|
||||
}
|
||||
} else {
|
||||
// Load from Database and save into global name
|
||||
self::$hook[$this->eventName] = $this->manager->listHookObservers($this->eventName);
|
||||
if (isset(self::$hook[$this->eventName]) && is_array(self::$hook[$this->eventName])) {
|
||||
foreach (self::$hook[$this->eventName] as $hookObserver => $val) {
|
||||
$hookObserverInstance = $hookObserver::create();
|
||||
$this->observers->attach($hookObserverInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
19
main/inc/lib/hook/HookLearningPathCreated.php
Normal file
19
main/inc/lib/hook/HookLearningPathCreated.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookLearningPathCreated extends HookEvent implements HookLearningPathCreatedEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookLearningPathCreated');
|
||||
}
|
||||
|
||||
public function notifyCreated()
|
||||
{
|
||||
/** @var HookLearningPathCreatedObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookCreated($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
main/inc/lib/hook/HookLearningPathEnd.php
Normal file
30
main/inc/lib/hook/HookLearningPathEnd.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookLearningPathEnd.
|
||||
*/
|
||||
class HookLearningPathEnd extends HookEvent implements HookLearningPathEndEventInterface
|
||||
{
|
||||
/**
|
||||
* HookLearningPathEnd constructor.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookLearningPathEndEvent');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hookLearningPathEnd()
|
||||
{
|
||||
/** @var \HookLearningPathEndObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->notifyLearningPathEnd($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
main/inc/lib/hook/HookLearningPathItemViewed.php
Normal file
30
main/inc/lib/hook/HookLearningPathItemViewed.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookLearningPathItemViewed.
|
||||
*/
|
||||
class HookLearningPathItemViewed extends HookEvent implements HookLearningPathItemViewedEventInterface
|
||||
{
|
||||
/**
|
||||
* HookLearningPathItemViewed constructor.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookLearningPathItemViewed');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function notifyLearningPathItemViewed()
|
||||
{
|
||||
/** @var \HookLearningPathItemViewedObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookLearningPathItemViewed($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
371
main/inc/lib/hook/HookManagement.php
Normal file
371
main/inc/lib/hook/HookManagement.php
Normal file
@@ -0,0 +1,371 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* @TODO: Improve description
|
||||
*
|
||||
* @package chamilo.hookmanagement
|
||||
*/
|
||||
class HookManagement implements HookManagementInterface
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
$this->tables[TABLE_HOOK_OBSERVER] = Database::get_main_table(TABLE_HOOK_OBSERVER);
|
||||
$this->tables[TABLE_HOOK_EVENT] = Database::get_main_table(TABLE_HOOK_EVENT);
|
||||
$this->tables[TABLE_HOOK_CALL] = Database::get_main_table(TABLE_HOOK_CALL);
|
||||
|
||||
$this->hookCalls = $this->listAllHookCalls();
|
||||
$this->hookEvents = $this->listAllHookEvents();
|
||||
$this->hookObservers = $this->listAllHookObservers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance the hook manager.
|
||||
*
|
||||
* @staticvar null $result
|
||||
*
|
||||
* @return HookManagement
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
static $result = null;
|
||||
|
||||
return $result ? $result : $result = new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert hook into Database. Return insert id.
|
||||
*
|
||||
* @param string $eventName
|
||||
* @param string $observerClassName
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function insertHook($eventName, $observerClassName, $type)
|
||||
{
|
||||
if ($type === HOOK_EVENT_TYPE_ALL) {
|
||||
$this->insertHook($eventName, $observerClassName, HOOK_EVENT_TYPE_PRE);
|
||||
$this->insertHook($eventName, $observerClassName, HOOK_EVENT_TYPE_POST);
|
||||
} else {
|
||||
$this->insertHookIfNotExist($eventName, $observerClassName);
|
||||
// Check if exists hook call
|
||||
$row = Database::select(
|
||||
'id, enabled',
|
||||
$this->tables[TABLE_HOOK_CALL],
|
||||
[
|
||||
'where' => [
|
||||
'hook_event_id = ? ' => $this->hookEvents[$eventName],
|
||||
'AND hook_observer_id = ? ' => $this->hookObservers[$observerClassName],
|
||||
'AND type = ? ' => $type,
|
||||
],
|
||||
],
|
||||
'ASSOC'
|
||||
);
|
||||
|
||||
if (!empty($row) && is_array($row)) {
|
||||
// Check if is hook call is active
|
||||
if ((int) $row['enabled'] === 0) {
|
||||
Database::update(
|
||||
$this->tables[TABLE_HOOK_CALL],
|
||||
[
|
||||
'enabled' => 1,
|
||||
],
|
||||
[
|
||||
'id = ?' => $row['id'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
if ($type === HOOK_EVENT_TYPE_ALL) {
|
||||
$this->deleteHook($eventName, $observerClassName, HOOK_EVENT_TYPE_PRE);
|
||||
$this->deleteHook($eventName, $observerClassName, HOOK_EVENT_TYPE_POST);
|
||||
} else {
|
||||
$this->insertHookIfNotExist($eventName, $observerClassName);
|
||||
|
||||
Database::update(
|
||||
$this->tables[TABLE_HOOK_CALL],
|
||||
[
|
||||
'enabled' => 0,
|
||||
],
|
||||
[
|
||||
'id = ? ' => $this->hookCalls[$eventName][$observerClassName][$type],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update hook observer order by hook event.
|
||||
*
|
||||
* @param $eventName
|
||||
* @param $type
|
||||
* @param $hookOrders
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function orderHook($eventName, $type, $hookOrders)
|
||||
{
|
||||
foreach ($this->hookCalls[$eventName] as $observerClassName => $types) {
|
||||
foreach ($hookOrders as $oldOrder => $newOrder) {
|
||||
$res = Database::update(
|
||||
$this->tables[TABLE_HOOK_CALL],
|
||||
[
|
||||
'hook_order ' => $newOrder,
|
||||
],
|
||||
[
|
||||
'id = ? ' => $types[$type],
|
||||
'AND hook_order = ? ' => $oldOrder,
|
||||
]
|
||||
);
|
||||
|
||||
if ($res) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list an associative array where keys are the active hook observer class name.
|
||||
*
|
||||
* @param string $eventName
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listHookObservers($eventName)
|
||||
{
|
||||
$array = [];
|
||||
$joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
|
||||
' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
|
||||
' ON hc.hook_event_id = he.id '.
|
||||
' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
|
||||
' ON hc.hook_observer_id = ho.id ';
|
||||
$columns = 'ho.class_name, ho.path, ho.plugin_name, hc.enabled';
|
||||
$where = ['where' => ['he.class_name = ? ' => $eventName, 'AND hc.enabled = ? ' => 1]];
|
||||
$rows = Database::select($columns, $joinTable, $where);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$array[$row['class_name']] = $row;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list an associative array where keys are the active hook observer class name.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listAllHookObservers()
|
||||
{
|
||||
$array = [];
|
||||
$columns = 'id, class_name';
|
||||
$rows = Database::select($columns, $this->tables[TABLE_HOOK_OBSERVER]);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$array[$row['class_name']] = $row['id'];
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list an associative array where keys are the active hook observer class name.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listAllHookEvents()
|
||||
{
|
||||
$array = [];
|
||||
$columns = 'id, class_name';
|
||||
$rows = Database::select($columns, $this->tables[TABLE_HOOK_EVENT]);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$array[$row['class_name']] = $row['id'];
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list an associative array where keys are the active hook observer class name.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listAllHookCalls()
|
||||
{
|
||||
$array = [];
|
||||
$joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
|
||||
' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
|
||||
' ON hc.hook_event_id = he.id '.
|
||||
' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
|
||||
' ON hc.hook_observer_id = ho.id ';
|
||||
$columns = 'he.class_name AS event_class_name, ho.class_name AS observer_class_name, hc.id AS id, hc.type AS type';
|
||||
$rows = Database::select($columns, $joinTable);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$array[$row['event_class_name']][$row['observer_class_name']][$row['type']] = $row['id'];
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// Check if exists hook event
|
||||
if (isset($eventName) && !isset($this->hookEvents[$eventName])) {
|
||||
$attributes = [
|
||||
'class_name' => $eventName,
|
||||
'description' => get_lang('HookDescription'.$eventName),
|
||||
];
|
||||
$id = Database::insert($this->tables[TABLE_HOOK_EVENT], $attributes);
|
||||
$this->hookEvents[$eventName] = $id;
|
||||
}
|
||||
|
||||
// Check if exists hook observer
|
||||
if (isset($observerClassName) &&
|
||||
!isset($this->hookObservers[$observerClassName])
|
||||
) {
|
||||
$object = $observerClassName::create();
|
||||
$attributes = [
|
||||
'class_name' => $observerClassName,
|
||||
'path' => $object->getPath(),
|
||||
'plugin_name' => $object->getPluginName(),
|
||||
];
|
||||
$id = Database::insert($this->tables[TABLE_HOOK_OBSERVER], $attributes);
|
||||
$this->hookObservers[$observerClassName] = $id;
|
||||
}
|
||||
|
||||
if (isset($eventName) &&
|
||||
isset($observerClassName) &&
|
||||
!isset($this->hookCalls[$eventName][$observerClassName])
|
||||
) {
|
||||
// HOOK TYPE PRE
|
||||
|
||||
$row = Database::select(
|
||||
'MAX(hook_order) as hook_order',
|
||||
$this->tables[TABLE_HOOK_CALL],
|
||||
[
|
||||
'where' => [
|
||||
'hook_event_id = ? ' => $this->hookEvents[$eventName],
|
||||
'AND type = ? ' => HOOK_EVENT_TYPE_PRE,
|
||||
],
|
||||
],
|
||||
'ASSOC'
|
||||
);
|
||||
|
||||
// Check if exists hook call
|
||||
$id = Database::insert(
|
||||
$this->tables[TABLE_HOOK_CALL],
|
||||
[
|
||||
'hook_event_id' => $this->hookEvents[$eventName],
|
||||
'hook_observer_id' => $this->hookObservers[$observerClassName],
|
||||
'type' => HOOK_EVENT_TYPE_PRE,
|
||||
'enabled' => 0,
|
||||
'hook_order' => $row['hook_order'] + 1,
|
||||
]
|
||||
);
|
||||
|
||||
$this->hookCalls[$eventName][$observerClassName][HOOK_EVENT_TYPE_PRE] = $id;
|
||||
|
||||
// HOOK TYPE POST
|
||||
$row = Database::select(
|
||||
'MAX(hook_order) as hook_order',
|
||||
$this->tables[TABLE_HOOK_CALL],
|
||||
[
|
||||
'where' => [
|
||||
'hook_event_id = ? ' => $this->hookEvents[$eventName],
|
||||
'AND type = ? ' => HOOK_EVENT_TYPE_POST,
|
||||
],
|
||||
],
|
||||
'ASSOC'
|
||||
);
|
||||
|
||||
// Check if exists hook call
|
||||
$id = Database::insert(
|
||||
$this->tables[TABLE_HOOK_CALL],
|
||||
[
|
||||
'hook_event_id' => $this->hookEvents[$eventName],
|
||||
'hook_observer_id' => $this->hookObservers[$observerClassName],
|
||||
'type' => HOOK_EVENT_TYPE_POST,
|
||||
'enabled' => 0,
|
||||
'hook_order' => $row['hook_order'] + 1,
|
||||
]
|
||||
);
|
||||
|
||||
$this->hookCalls[$eventName][$observerClassName][HOOK_EVENT_TYPE_POST] = $id;
|
||||
} elseif (isset($eventName) && !isset($observerClassName)) {
|
||||
foreach ($this->hookObservers as $observer => $id) {
|
||||
$this->insertHookIfNotExist($eventName, $observer);
|
||||
}
|
||||
} elseif (!isset($eventName) && isset($observerClassName)) {
|
||||
foreach ($this->hookEvents as $event => $id) {
|
||||
$this->insertHookIfNotExist($event, $observerClassName);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
$eventName = Database::escape_string($eventName);
|
||||
$observerClassName($observerClassName);
|
||||
$type = Database::escape_string($type);
|
||||
$joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
|
||||
' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
|
||||
' ON hc.hook_event_id = he.id '.
|
||||
' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
|
||||
' ON hc.hook_observer_id = ho.id ';
|
||||
$row = Database::select(
|
||||
'id',
|
||||
$joinTable,
|
||||
[
|
||||
'where' => [
|
||||
'he.class_name = ? ' => $eventName,
|
||||
'AND ho.class_name = ? ' => $observerClassName,
|
||||
'AND hc.type = ? ' => $type,
|
||||
],
|
||||
],
|
||||
'ASSOC'
|
||||
);
|
||||
|
||||
return $row['id'];
|
||||
}
|
||||
}
|
||||
54
main/inc/lib/hook/HookMyStudentsLpTracking.php
Normal file
54
main/inc/lib/hook/HookMyStudentsLpTracking.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookMyStudentsLpTracking.
|
||||
*/
|
||||
class HookMyStudentsLpTracking extends HookEvent implements HookMyStudentsLpTrackingEventInterface
|
||||
{
|
||||
/**
|
||||
* HookMyStudentsLpTracking constructor.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookMyStudentsLpTracking');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function notifyTrackingHeader()
|
||||
{
|
||||
$results = [];
|
||||
|
||||
/** @var HookMyStudentsLpTrackingObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$results[] = $observer->trackingHeader($this);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $lpId
|
||||
* @param int $studentId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyTrackingContent($lpId, $studentId)
|
||||
{
|
||||
$this->eventData['lp_id'] = $lpId;
|
||||
$this->eventData['student_id'] = $studentId;
|
||||
|
||||
$results = [];
|
||||
|
||||
/** @var HookMyStudentsLpTrackingObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$results[] = $observer->trackingContent($this);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
54
main/inc/lib/hook/HookMyStudentsQuizTracking.php
Normal file
54
main/inc/lib/hook/HookMyStudentsQuizTracking.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookMyStudentsQuizTracking.
|
||||
*/
|
||||
class HookMyStudentsQuizTracking extends HookEvent implements HookMyStudentsQuizTrackingEventInterface
|
||||
{
|
||||
/**
|
||||
* HookMyStudentsQuizTracking constructor.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookMyStudentsQuizTracking');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function notifyTrackingHeader()
|
||||
{
|
||||
$results = [];
|
||||
|
||||
/** @var HookMyStudentsQuizTrackingObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$results[] = $observer->trackingHeader($this);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $quizId
|
||||
* @param int $studentId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyTrackingContent($quizId, $studentId)
|
||||
{
|
||||
$this->eventData['quiz_id'] = $quizId;
|
||||
$this->eventData['student_id'] = $studentId;
|
||||
|
||||
$results = [];
|
||||
|
||||
/** @var HookMyStudentsQuizTrackingObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$results[] = $observer->trackingContent($this);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
47
main/inc/lib/hook/HookNotificationContent.php
Normal file
47
main/inc/lib/hook/HookNotificationContent.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookNotificationContent
|
||||
* Hook Event class for Content format of Notifications.
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
class HookNotificationContent extends HookEvent implements HookNotificationContentEventInterface
|
||||
{
|
||||
/**
|
||||
* Construct.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookNotificationContent');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $type
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function notifyNotificationContent($type)
|
||||
{
|
||||
/** @var \HookNotificationContentObserverInterface $observer */
|
||||
// Check if exists data content
|
||||
if (isset($this->eventData['content'])) {
|
||||
// Save data type
|
||||
$this->eventData['type'] = $type;
|
||||
// Check for hook all registered observers
|
||||
foreach ($this->observers as $observer) {
|
||||
$data = $observer->hookNotificationContent($this);
|
||||
// Check if isset content
|
||||
if (isset($data['content'])) {
|
||||
// Set data from hook observer data
|
||||
$this->setEventData($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->eventData;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
50
main/inc/lib/hook/HookNotificationTitle.php
Normal file
50
main/inc/lib/hook/HookNotificationTitle.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* This file contains the Hook Event class for Title of Notifications.
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class HookNotificationTitle.
|
||||
*/
|
||||
class HookNotificationTitle extends HookEvent implements HookNotificationTitleEventInterface
|
||||
{
|
||||
/**
|
||||
* Construct.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookNotificationTitle');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $type
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function notifyNotificationTitle($type)
|
||||
{
|
||||
/** @var \HookNotificationTitleObserverInterface $observer */
|
||||
// Check if exists data title
|
||||
if (isset($this->eventData['title'])) {
|
||||
// Save data type
|
||||
$this->eventData['type'] = $type;
|
||||
// Check for hook all registered observers
|
||||
foreach ($this->observers as $observer) {
|
||||
// Get data from hook observer
|
||||
$data = $observer->hookNotificationTitle($this);
|
||||
// Check if isset data title
|
||||
if (isset($data['title'])) {
|
||||
// Set data from hook observer data
|
||||
$this->setEventData($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->eventData;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
78
main/inc/lib/hook/HookObserver.php
Normal file
78
main/inc/lib/hook/HookObserver.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* This file contains an abstract Hook observer class
|
||||
* Used for Hook Observers in plugins, called when a hook event happens
|
||||
* (e.g Create user, Webservice registration).
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class HookObserver
|
||||
* This abstract class implements Hook Observer Interface to build the base
|
||||
* for Hook Observer. This class have some public static method,
|
||||
* e.g for create Hook Observers.
|
||||
*/
|
||||
abstract class HookObserver implements HookObserverInterface
|
||||
{
|
||||
public $path;
|
||||
public $pluginName;
|
||||
|
||||
/**
|
||||
* Construct method
|
||||
* Save the path of Hook Observer class implementation and
|
||||
* the plugin name where this class is included.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $pluginName
|
||||
*/
|
||||
protected function __construct($path, $pluginName)
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->pluginName = $pluginName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the singleton instance of Hook observer.
|
||||
* If Hook Management plugin is not enabled, will return NULL.
|
||||
*
|
||||
* @return HookObserver
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
static $result = null;
|
||||
|
||||
if ($result) {
|
||||
return $result;
|
||||
} else {
|
||||
try {
|
||||
$class = get_called_class();
|
||||
|
||||
return new $class();
|
||||
} catch (Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the path from the class, needed to store location or autoload later.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin name where is the Hook Observer.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPluginName()
|
||||
{
|
||||
return $this->pluginName;
|
||||
}
|
||||
}
|
||||
19
main/inc/lib/hook/HookPortfolioCommentEdited.php
Normal file
19
main/inc/lib/hook/HookPortfolioCommentEdited.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioCommentEdited extends HookEvent implements HookPortfolioCommentEditedEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioCommentEdited');
|
||||
}
|
||||
|
||||
public function notifyCommentEdited()
|
||||
{
|
||||
/** @var HookPortfolioCommentEditedObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookCommentEdited($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
main/inc/lib/hook/HookPortfolioCommentScored.php
Normal file
19
main/inc/lib/hook/HookPortfolioCommentScored.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioCommentScored extends HookEvent implements HookPortfolioCommentScoredEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioCommentScored');
|
||||
}
|
||||
|
||||
public function notifyCommentScored()
|
||||
{
|
||||
/** @var HookPortfolioCommentScoredObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookCommentScored($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
main/inc/lib/hook/HookPortfolioDownloaded.php
Normal file
19
main/inc/lib/hook/HookPortfolioDownloaded.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioDownloaded extends HookEvent implements HookPortfolioDownloadedEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioDownloaded');
|
||||
}
|
||||
|
||||
public function notifyPortfolioDownloaded(): void
|
||||
{
|
||||
/** @var HookPortfolioDownloadedObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookPortfolioDownloaded($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
main/inc/lib/hook/HookPortfolioItemAdded.php
Normal file
30
main/inc/lib/hook/HookPortfolioItemAdded.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookPortfolioItemAdded.
|
||||
*/
|
||||
class HookPortfolioItemAdded extends HookEvent implements HookPortfolioItemAddedEventInterface
|
||||
{
|
||||
/**
|
||||
* HookPortfolioItemAdded constructor.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioItemAdded');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function notifyItemAdded()
|
||||
{
|
||||
/** @var \HookPortfolioItemAddedObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookItemAdded($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
27
main/inc/lib/hook/HookPortfolioItemCommented.php
Normal file
27
main/inc/lib/hook/HookPortfolioItemCommented.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioItemCommented extends HookEvent implements HookPortfolioItemCommentedEventInterface
|
||||
{
|
||||
/**
|
||||
* HookPortfolioItemCommented constructor.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioItemCommented');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function notifyItemCommented()
|
||||
{
|
||||
/** @var \HookPortfolioItemCommentedObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookItemCommented($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
main/inc/lib/hook/HookPortfolioItemDeleted.php
Normal file
19
main/inc/lib/hook/HookPortfolioItemDeleted.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioItemDeleted extends HookEvent implements HookPortfolioItemDeletedEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioItemDeleted');
|
||||
}
|
||||
|
||||
public function notifyItemDeleted()
|
||||
{
|
||||
/** @var HookPortfolioItemDeletedHookObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookItemDeleted($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
main/inc/lib/hook/HookPortfolioItemEdited.php
Normal file
19
main/inc/lib/hook/HookPortfolioItemEdited.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioItemEdited extends HookEvent implements HookPortfolioItemEditedEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioItemEdited');
|
||||
}
|
||||
|
||||
public function notifyItemEdited()
|
||||
{
|
||||
/** @var HookPortfolioItemEditedObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookItemEdited($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
main/inc/lib/hook/HookPortfolioItemHighlighted.php
Normal file
19
main/inc/lib/hook/HookPortfolioItemHighlighted.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioItemHighlighted extends HookEvent implements HookPortfolioItemHighlightedEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioItemHighlighted');
|
||||
}
|
||||
|
||||
public function notifyItemHighlighted()
|
||||
{
|
||||
/** @var HookPortfolioItemHighlightedObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookItemHighlighted($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
main/inc/lib/hook/HookPortfolioItemScored.php
Normal file
19
main/inc/lib/hook/HookPortfolioItemScored.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioItemScored extends HookEvent implements HookPortfolioItemScoredEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioItemScored');
|
||||
}
|
||||
|
||||
public function notifyItemScored(): void
|
||||
{
|
||||
/** @var HookPortfolioItemScoredObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookItemScored($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
main/inc/lib/hook/HookPortfolioItemViewed.php
Normal file
19
main/inc/lib/hook/HookPortfolioItemViewed.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioItemViewed extends HookEvent implements HookPortfolioItemViewedEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioItemViewed');
|
||||
}
|
||||
|
||||
public function notifyItemViewed(): void
|
||||
{
|
||||
/** @var HookPortfolioItemViewedObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookItemViewed($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
main/inc/lib/hook/HookPortfolioItemVisibility.php
Normal file
22
main/inc/lib/hook/HookPortfolioItemVisibility.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
class HookPortfolioItemVisibility extends HookEvent implements HookPortfolioItemVisibilityEventInterface
|
||||
{
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookPortfolioItemVisibility');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function notifyItemVisibility()
|
||||
{
|
||||
/** @var HookPortfolioItemVisibilityObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookItemVisibility($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
29
main/inc/lib/hook/HookQuizEnd.php
Normal file
29
main/inc/lib/hook/HookQuizEnd.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookQuizEnd.
|
||||
*/
|
||||
class HookQuizEnd extends HookEvent implements HookQuizEndEventInterface
|
||||
{
|
||||
/**
|
||||
* HookQuizEnd constructor.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookQuizEnd');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function notifyQuizEnd()
|
||||
{
|
||||
/** @var HookQuizEndObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookQuizEnd($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
main/inc/lib/hook/HookQuizQuestionAnswered.php
Normal file
30
main/inc/lib/hook/HookQuizQuestionAnswered.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookQuizQuestionAnswered.
|
||||
*/
|
||||
class HookQuizQuestionAnswered extends HookEvent implements HookQuizQuestionAnsweredEventInterface
|
||||
{
|
||||
/**
|
||||
* HookQuizQuestionAnswered constructor.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookQuestionAnswered');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function notifyQuizQuestionAnswered()
|
||||
{
|
||||
/** @var \HookQuizQuestionAnsweredObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookQuizQuestionAnswered($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
main/inc/lib/hook/HookResubscribe.php
Normal file
36
main/inc/lib/hook/HookResubscribe.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookResubscribe.
|
||||
*
|
||||
* @var \SplObjectStorage
|
||||
*/
|
||||
class HookResubscribe extends HookEvent implements HookResubscribeEventInterface
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookResubscribe');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyResubscribe($type)
|
||||
{
|
||||
/** @var \HookResubscribeObserverInterface $observer */
|
||||
$this->eventData['type'] = $type;
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookResubscribe($this);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
36
main/inc/lib/hook/HookSkype.php
Normal file
36
main/inc/lib/hook/HookSkype.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookEventSkype.
|
||||
*
|
||||
* @var \SplObjectStorage
|
||||
*/
|
||||
class HookEventSkype extends HookEvent implements HookSkypeEventInterface
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookEventSkype');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifySkype($type)
|
||||
{
|
||||
/** @var \HookSkypeObserverInterface $observer */
|
||||
$this->eventData['type'] = $type;
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookEventSkype($this);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
37
main/inc/lib/hook/HookUpdateUser.php
Normal file
37
main/inc/lib/hook/HookUpdateUser.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Class HookUpdateUser.
|
||||
*
|
||||
* @var \SplObjectStorage
|
||||
*/
|
||||
class HookUpdateUser extends HookEvent implements HookUpdateUserEventInterface
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('HookUpdateUser');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyUpdateUser($type)
|
||||
{
|
||||
$this->eventData['type'] = $type;
|
||||
|
||||
/** @var HookUpdateUserObserverInterface $observer */
|
||||
foreach ($this->observers as $observer) {
|
||||
$observer->hookUpdateUser($this);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
58
main/inc/lib/hook/HookWSRegistration.php
Normal file
58
main/inc/lib/hook/HookWSRegistration.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* This file contains a Hook Event class for Admin Block.
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class HookWSRegistration
|
||||
* This class is a Hook event implementing Webservice Registration Event interface.
|
||||
* This class is used to modify ws for registration by notifying Hook Observer
|
||||
* for Webservice registration.
|
||||
*/
|
||||
class HookWSRegistration extends HookEvent implements HookWSRegistrationEventInterface
|
||||
{
|
||||
/**
|
||||
* Construct.
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
parent::__construct('HookWSRegistration');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify all Hook observer for WS Registration.
|
||||
* This save "server" (soap server) and send to Hook observer to be modified
|
||||
* (e.g. add more registration webservice).
|
||||
*
|
||||
* @param int $type Set the type of hook event called.
|
||||
* 0: HOOK_EVENT_TYPE_PRE, 1: HOOK_EVENT_TYPE_POST
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyWSRegistration($type)
|
||||
{
|
||||
/** @var \HookWSRegistrationObserverInterface $observer */
|
||||
// check if already have server data
|
||||
if (isset($this->eventData['server'])) {
|
||||
// Save Hook event type data
|
||||
$this->eventData['type'] = $type;
|
||||
foreach ($this->observers as $observer) {
|
||||
// Notify all registered observers
|
||||
$data = $observer->hookWSRegistration($this);
|
||||
// check if server is not null
|
||||
if (isset($data['server'])) {
|
||||
// Get modified server
|
||||
$this->eventData['server'] = $data['server'];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->eventData;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
65
main/inc/lib/hook/README.md
Normal file
65
main/inc/lib/hook/README.md
Normal file
@@ -0,0 +1,65 @@
|
||||
Hook Management plugin for Chamilo LMS
|
||||
=======================================
|
||||
Enable hooks in Chamilo to allow plugins and core to extend current features and
|
||||
watch for certain events.
|
||||
|
||||
The Hooks structure is based on the Observer pattern
|
||||
|
||||
The base structure is composed of 3 Interfaces
|
||||
* HookEvent: will call the hook methods in Chamilo code
|
||||
* HookObserver: will be executed when a Hook event is called
|
||||
* HookManagement: manages hooks, creation, instantiation, persistence and
|
||||
connection to the database
|
||||
|
||||
|
||||
|
||||
From version 1.10.x, the following Hooks (or more) exist:
|
||||
|
||||
|
||||
|Number| Directory | EventClass | ObserverInterface | Reference |
|
||||
|------|-----------------------------------|----------------|---------------------------------|---------------------------|
|
||||
| 1| /main/inc/lib/usermanager.lib.php | HookCreateUser | HookCreateUserObserverInterface | UserManager::createUser() |
|
||||
| 2| /main/inc/lib/usermanager.lib.php | HookUpdateUser | HookUpdateUserObserverInterface | UserManager::updateUser() |
|
||||
| 3| /main/admin/index.php | HookAdminBlock | HookAdminBlockObserverInterface | ADMIN BLOCK |
|
||||
|
||||
# What do I need to use Hooks?
|
||||
|
||||
You need to create a class extending the `HookObserver` class and implement any
|
||||
(or many) Hook Observer Interfaces, e.g. `HookCreateUserObserverInterface`.
|
||||
An observer can implement many Hook Observer Interfaces.
|
||||
This was developed to allow plugins to have a unique Hook Observer class.
|
||||
Don't forget to add your Hook Observer class to the autoload file (vendor/composer/autoload_classmap.php).
|
||||
|
||||
# How to add MyHookObserver to my plugin?
|
||||
|
||||
When installing your plugin (or other functions) you should call the attach
|
||||
method from a specific Hook Observer class, e.g. `HookCreateUser` class
|
||||
```
|
||||
$myHookObserver = MyHookObserver::create();
|
||||
HookCreateUser::create()->attach($myHookObserver);
|
||||
```
|
||||
|
||||
# How to detach MyHookObserver from inside my plugin?
|
||||
|
||||
To detach the HookObserver, it should be detached from a specific Hook Event class
|
||||
```
|
||||
$myHookObserver = MyHookObserver::create();
|
||||
HookCreateUser::create()->detach($myHookObserver);
|
||||
```
|
||||
|
||||
# How to add HookEvents to the Chamilo code (add the possibility to be hooked)?
|
||||
|
||||
To expand Hooks in Chamilo you should:
|
||||
1. Identify an event that could be customized through a plugin
|
||||
2. Create an interface for the Hook Event and the Hook Observer.
|
||||
The names should be like the Hooks interfaces already created,
|
||||
with The Pattern: HookXyzEventInterface and HookXyzObserverInterface.
|
||||
e.g. Hook event: `HookUpdateUserEventInterface`, Hook observer: `HookUpdateUserObserverInterface`
|
||||
3. Add at least one notify method to Hook Event Interface and update method to
|
||||
Hook Observer Interface
|
||||
4. Create a class extending the `HookEvent` class and implementing your Hook
|
||||
Event Interface
|
||||
5. Complete the notify method calling the Hook Observer update
|
||||
6. Add your Interfaces and Class to the autoload file (vendor/composer/autoload_classmap.php)
|
||||
7. Test your hook. If your Observer requires data, you can use the data property
|
||||
from Hook Event
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface CheckLoginCredentialsHookEventInterface.
|
||||
*/
|
||||
interface CheckLoginCredentialsHookEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* Call to all observers.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function notifyLoginCredentials();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface CheckLoginCredentialsHookObserverInterface.
|
||||
*/
|
||||
interface CheckLoginCredentialsHookObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function checkLoginCredentials(CheckLoginCredentialsHookEventInterface $event);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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 HookAdminBlockEventInterface.
|
||||
*/
|
||||
interface HookAdminBlockEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyAdminBlock($type);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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 HookAdminBlockObserverInterface.
|
||||
*/
|
||||
interface HookAdminBlockObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function hookAdminBlock(HookAdminBlockEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookConditionalLoginEventInterface.
|
||||
*/
|
||||
interface HookConditionalLoginEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* Call Conditional Login hooks.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyConditionalLogin();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookConditionalLoginObserverInterface.
|
||||
*/
|
||||
interface HookConditionalLoginObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* Return an associative array (callable, url) needed for Conditional Login.
|
||||
* <code>
|
||||
* [
|
||||
* 'conditional_function' => function (array $userInfo) {},
|
||||
* 'url' => '',
|
||||
* ]
|
||||
* </code>
|
||||
* conditional_function returns false to redirect to the url and returns true to continue with the classical login.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function hookConditionalLogin(HookConditionalLoginEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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 HookCreateUserEventInterface.
|
||||
*/
|
||||
interface HookCreateCourseEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyCreateCourse($type);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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 CreateUserHookInterface.
|
||||
*/
|
||||
interface HookCreateCourseObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function hookCreateCourse(HookCreateCourseEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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 HookCreateUserEventInterface.
|
||||
*/
|
||||
interface HookCreateUserEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyCreateUser($type);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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 CreateUserHookInterface.
|
||||
*/
|
||||
interface HookCreateUserObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function hookCreateUser(HookCreateUserEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookDocumentActionEventInterface.
|
||||
*/
|
||||
interface HookDocumentActionEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @param $type
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function notifyDocumentAction($type);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookDocumentActionObserverInterface.
|
||||
*/
|
||||
interface HookDocumentActionObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @param \HookDocumentActionEventInterface $hookvent
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function notifyDocumentAction(HookDocumentActionEventInterface $hookvent);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookDocumentItemActionEventInterface.
|
||||
*/
|
||||
interface HookDocumentItemActionEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @param $type
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function notifyDocumentItemAction($type);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookDocumentItemActionObserverInterface.
|
||||
*/
|
||||
interface HookDocumentItemActionObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @param \HookDocumentItemActionEventInterface $hookvent
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function notifyDocumentItemAction(HookDocumentItemActionEventInterface $hookvent);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookDocumentItemViewEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyDocumentItemView(): array;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookDocumentItemViewObserverInterface.
|
||||
*/
|
||||
interface HookDocumentItemViewObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function notifyDocumentItemView(HookDocumentItemViewEventInterface $hookvent): string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookLearningPathCreatedEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyCreated();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookLearningPathCreatedObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function hookCreated(HookLearningPathCreatedEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookLearningPathEndEventInterface.
|
||||
*/
|
||||
interface HookLearningPathEndEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function hookLearningPathEnd();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookLearningPathEndObserverInterface.
|
||||
*/
|
||||
interface HookLearningPathEndObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function notifyLearningPathEnd(HookLearningPathEndEventInterface $event);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookLearningPathItemViewedEventInterface.
|
||||
*/
|
||||
interface HookLearningPathItemViewedEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function notifyLearningPathItemViewed();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookLearningPathItemViewedObserverInterface.
|
||||
*/
|
||||
interface HookLearningPathItemViewedObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @param \HookLearningPathItemViewedEventInterface $event
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function hookLearningPathItemViewed(HookLearningPathItemViewedEventInterface $event);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookMyStudentsLpTrackingEventInterface.
|
||||
*/
|
||||
interface HookMyStudentsLpTrackingEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function notifyTrackingHeader();
|
||||
|
||||
/**
|
||||
* @param int $lpId
|
||||
* @param int $studentId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyTrackingContent($lpId, $studentId);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookMyStudentsLpTrackingObserverInterface.
|
||||
*/
|
||||
interface HookMyStudentsLpTrackingObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* Return an associative array this value and attributes.
|
||||
* <code>
|
||||
* [
|
||||
* 'value' => 'Users online',
|
||||
* 'attrs' => ['class' => 'text-center'],
|
||||
* ]
|
||||
* </code>.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function trackingHeader(HookMyStudentsLpTrackingEventInterface $hook);
|
||||
|
||||
/**
|
||||
* Return an associative array this value and attributes.
|
||||
* <code>
|
||||
* [
|
||||
* 'value' => '5 connected users ',
|
||||
* 'attrs' => ['class' => 'text-center text-success'],
|
||||
* ]
|
||||
* </code>.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function trackingContent(HookMyStudentsLpTrackingEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookMyStudentsQuizTrackingEventInterface.
|
||||
*/
|
||||
interface HookMyStudentsQuizTrackingEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function notifyTrackingHeader();
|
||||
|
||||
/**
|
||||
* @param int $quizId
|
||||
* @param int $studentId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyTrackingContent($quizId, $studentId);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookMyStudentsQuizTrackingObserverInterface.
|
||||
*/
|
||||
interface HookMyStudentsQuizTrackingObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* Return an associative array this value and attributes.
|
||||
* <code>
|
||||
* [
|
||||
* 'value' => 'Users online',
|
||||
* 'attrs' => ['class' => 'text-center'],
|
||||
* ]
|
||||
* </code>.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function trackingHeader(HookMyStudentsQuizTrackingEventInterface $hook);
|
||||
|
||||
/**
|
||||
* Return an associative array this value and attributes.
|
||||
* <code>
|
||||
* [
|
||||
* 'value' => '5 connected users ',
|
||||
* 'attrs' => ['class' => 'text-center text-success'],
|
||||
* ]
|
||||
* </code>.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function trackingContent(HookMyStudentsQuizTrackingEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* This file contains Hook event interface for notification content.
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface HookNotificationContentEventInterface.
|
||||
*/
|
||||
interface HookNotificationContentEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @param int $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyNotificationContent($type);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* This file contains Hook observer interface for notification content.
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface HookNotificationContentObserverInterface.
|
||||
*/
|
||||
interface HookNotificationContentObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function hookNotificationContent(HookNotificationContentEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* This file contains Hook event interface for notification title.
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface HookNotificationTitleEventInterface.
|
||||
*/
|
||||
interface HookNotificationTitleEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @param int $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function notifyNotificationTitle($type);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* This file contains Hook observer interface for notification title.
|
||||
*
|
||||
* @package chamilo.library.hook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface HookNotificationTitleObserverInterface.
|
||||
*/
|
||||
interface HookNotificationTitleObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function hookNotificationTitle(HookNotificationTitleEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioCommentEditedEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyCommentEdited();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioCommentEditedObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function hookCommentEdited(HookPortfolioCommentEditedEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioCommentScoredEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyCommentScored();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioCommentScoredObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function hookCommentScored(HookPortfolioCommentScoredEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioDownloadedEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyPortfolioDownloaded();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioDownloadedObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function hookPortfolioDownloaded(HookPortfolioDownloadedEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookPortfolioItemAddedEventInterface.
|
||||
*/
|
||||
interface HookPortfolioItemAddedEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function notifyItemAdded();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookPortfolioItemAddedObserverInterface.
|
||||
*/
|
||||
interface HookPortfolioItemAddedObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @param \HookPortfolioItemAddedEventInterface $hookEvent
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function hookItemAdded(HookPortfolioItemAddedEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookPortfolioItemCommentedEventInterface.
|
||||
*/
|
||||
interface HookPortfolioItemCommentedEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function notifyItemCommented();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookPortfolioItemCommentedObserverInterface.
|
||||
*/
|
||||
interface HookPortfolioItemCommentedObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @param \HookPortfolioItemCommentedEventInterface $hookEvent
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function hookItemCommented(HookPortfolioItemCommentedEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemDeletedEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyItemDeleted();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemDeletedHookObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function hookItemDeleted(HookPortfolioItemDeletedEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemEditedEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyItemEdited();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemEditedObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function hookItemEdited(HookPortfolioItemEditedEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemHighlightedEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyItemHighlighted();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemHighlightedObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function hookItemHighlighted(HookPortfolioItemHighlightedEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemScoredEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyItemScored();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemScoredObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function hookItemScored(HookPortfolioItemScoredEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemViewedEventInterface extends HookEventInterface
|
||||
{
|
||||
public function notifyItemViewed(): void;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemViewedObserverInterface extends HookObserverInterface
|
||||
{
|
||||
public function hookItemViewed(HookPortfolioItemViewedEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemVisibilityEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function notifyItemVisibility();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
interface HookPortfolioItemVisibilityObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function hookItemVisibility(HookPortfolioItemVisibilityEventInterface $event);
|
||||
}
|
||||
13
main/inc/lib/hook/interfaces/HookQuizEndEventInterface.php
Normal file
13
main/inc/lib/hook/interfaces/HookQuizEndEventInterface.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookQuizEndEventInterface.
|
||||
*/
|
||||
interface HookQuizEndEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function notifyQuizEnd();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookQuizEndObserverInterface.
|
||||
*/
|
||||
interface HookQuizEndObserverInterface
|
||||
{
|
||||
/**
|
||||
* @param \HookQuizEndEventInterface $hookEvent
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function hookQuizEnd(HookQuizEndEventInterface $hookEvent);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookQuizQuestionAnsweredEventInterface.
|
||||
*/
|
||||
interface HookQuizQuestionAnsweredEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function notifyQuizQuestionAnswered();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Interface HookQuizQuestionAnsweredObserverInterface.
|
||||
*/
|
||||
interface HookQuizQuestionAnsweredObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @param \HookQuizQuestionAnsweredEventInterface $event
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function hookQuizQuestionAnswered(HookQuizQuestionAnsweredEventInterface $event);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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 HookResubscribeEventInterface.
|
||||
*/
|
||||
interface HookResubscribeEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyResubscribe($type);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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 ResubscribeHookInterface.
|
||||
*/
|
||||
interface HookResubscribeObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function hookResubscribe(HookResubscribeEventInterface $hook);
|
||||
}
|
||||
23
main/inc/lib/hook/interfaces/HookSkypeEventInterface.php
Normal file
23
main/inc/lib/hook/interfaces/HookSkypeEventInterface.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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 HookSkypeEventInterface.
|
||||
*/
|
||||
interface HookSkypeEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifySkype($type);
|
||||
}
|
||||
21
main/inc/lib/hook/interfaces/HookSkypeObserverInterface.php
Normal file
21
main/inc/lib/hook/interfaces/HookSkypeObserverInterface.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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 SkypeHookInterface.
|
||||
*/
|
||||
interface HookSkypeObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @param HookSkypeObserverInterface $hook
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function hookEventSkype(HookSkypeEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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 HookUpdateUserEventInterface.
|
||||
*/
|
||||
interface HookUpdateUserEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* Update all the observers.
|
||||
*
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyUpdateUser($type);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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 UpdateUserHookInterface.
|
||||
*/
|
||||
interface HookUpdateUserObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function hookUpdateUser(HookUpdateUserEventInterface $hook);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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 HookWSRegistrationEventInterface.
|
||||
*/
|
||||
interface HookWSRegistrationEventInterface extends HookEventInterface
|
||||
{
|
||||
/**
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function notifyWSRegistration($type);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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 HookWSRegistrationObserverInterface.
|
||||
*/
|
||||
interface HookWSRegistrationObserverInterface extends HookObserverInterface
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function hookWSRegistration(HookWSRegistrationEventInterface $hook);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user