commit
						9e50a0b5d2
					
				@ -0,0 +1,48 @@ | 
				
			||||
<?php | 
				
			||||
/* For licensing terms, see /license.txt */ | 
				
			||||
/** | 
				
			||||
 * This file contains the Hook Event class for Content format of Notifications | 
				
			||||
 * @package chamilo.library.hook | 
				
			||||
 */ | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * Class HookNotificationContent | 
				
			||||
 */ | 
				
			||||
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; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,49 @@ | 
				
			||||
<?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; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,18 @@ | 
				
			||||
<?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 | 
				
			||||
{ | 
				
			||||
    /** | 
				
			||||
     * @param HookNotificationContentEventInterface $hook | 
				
			||||
     * @return array | 
				
			||||
     */ | 
				
			||||
    public function hookNotificationContent(HookNotificationContentEventInterface $hook); | 
				
			||||
} | 
				
			||||
@ -0,0 +1,18 @@ | 
				
			||||
<?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 | 
				
			||||
{ | 
				
			||||
    /** | 
				
			||||
     * @param HookNotificationTitleEventInterface $hook | 
				
			||||
     * @return array | 
				
			||||
     */ | 
				
			||||
    public function hookNotificationTitle(HookNotificationTitleEventInterface $hook); | 
				
			||||
} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue