Location: PHPKode > scripts > SigSlots > sigslots/MyEventTest.php
<?php
	require_once("sigslots.php");
	
	class Button extends SigSlots
	{
		private $m_Id = null;
		
		public function __construct($Id)
		{
			$this->m_Id = $Id;
			$this->_Initialize();
		}
		
		public function __destruct() { }
		
		private function _Initialize()
		{
			$this->RegisterSignal("ButtonPress");
		}
		
		public function Press()
		{
			$this->EmitSignal("ButtonPress",array($this->m_Id,"Call Ted!"));
		}
	}
	
	class Light extends SigSlots 
	{
		public function __construct()
		{
			$this->_Initialize();
		}
		
		public function __destruct() { }
		
		private function _Initialize()
		{
			$this->RegisterSlot("ButtonPress","ButtonPressLight");
		}
		
		public function ButtonPressLight($Id)
		{
			echo "Light Activated by button: " . $Id .  "\n";
		}
	}
	
	class Alarm extends SigSlots 
	{
		public function __construct()
		{
			$this->_Initialize();
		}
		
		public function __destruct() { }
		
		private function _Initialize()
		{
			$this->RegisterSlot("ButtonPress","ButtonPressAlarm");
		}
		
		public function ButtonPressAlarm($Id,$Message)
		{
			echo "Alarm Activated by button: " . $Id . " Message: " . $Message . "\n";
		}		
	}
	
	$Button = new Button(9782);
	
	$Light = new Light();
	$Alarm = new Alarm();
	
	$Button->Press();
	

?>
Return current item: SigSlots