PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Michal Szpakowski   Event   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example usage
Class: Event
Register handlers and trigger event actions
Author: By
Last change: Removed iEventCreatedEvent interface implementation, actually it was done this way for availability to listen to the first event - EventCreated.
Date: 17 years ago
Size: 736 bytes
 

Contents

Class file image Download
<?php

include_once('ACE_Exception.php');
include_once(
'Event.php');
include_once(
'EventCaller.php');
include_once(
'EventInfo.php');
include_once(
'EventWrapper.php');

interface
iBodyLoadEvent
{
    public function
onBodyLoadCall($dataset);
    public function
onBodyLoadDestroy();
}

class
eventlistener implements iBodyLoadEvent
{
    public function
onBodyLoadCall($ds)
    {
        echo
'BodyLoad Event Called<br>';
    }

    public function
onBodyLoadDestroy()
    {
        echo
'Event BodyLoad Destroyed<br>';
    }
}

$event = new EventWrapper('BodyLoad');
       
$event ->addListener(new eventlistener())
                ->
addListener(new eventlistener())
                ->
addListener(new eventlistener());

echo
'And now, the call:';
$event->call();

?>