diff --git a/Westdc/EventModel/AbstractEventManager.php b/Westdc/EventModel/AbstractEventManager.php new file mode 100644 index 0000000..74357e5 --- /dev/null +++ b/Westdc/EventModel/AbstractEventManager.php @@ -0,0 +1,35 @@ +setIdentifiers(array( + __CLASS__, + get_called_class(), + )); + $this->events = $events; + + return $this; + } + + public function getEventManager () { + if (NULL === $this->events) { + $this->setEventManager(new EventManager()); + } + + return $this->events; + } + +} \ No newline at end of file diff --git a/Westdc/EventModel/HandleFactory.php b/Westdc/EventModel/HandleFactory.php new file mode 100644 index 0000000..00185b2 --- /dev/null +++ b/Westdc/EventModel/HandleFactory.php @@ -0,0 +1,21 @@ +handle = $handle; + unset($handle); + } + + public function attach(EventManagerInterface $events) + { + $this->listeners[] = $events->attach('submit.checkParam', array($this->handle, 'checkParam'), 100); + $this->listeners[] = $events->attach('submit.processData', array($this->handle, 'processData'), 100); + $this->listeners[] = $events->attach('submit.recordPosted', array($this->handle, 'recordPosted'), 100); + $this->listeners[] = $events->attach('submit.recordChanged', array($this->handle, 'recordChanged'), 100); + } + + public function detach(EventManagerInterface $events) + { + foreach ($this->listeners as $index => $listener) { + if ($events->detach($listener)) { + unset($this->listeners[$index]); + } + } + } + +} \ No newline at end of file diff --git a/Westdc/Service/AbstractServiceManager.php b/Westdc/Service/AbstractServiceManager.php new file mode 100644 index 0000000..7ac6d1f --- /dev/null +++ b/Westdc/Service/AbstractServiceManager.php @@ -0,0 +1,21 @@ +getServiceManager(); + } + +} \ No newline at end of file diff --git a/Westdc/Service/ServiceManager.php b/Westdc/Service/ServiceManager.php new file mode 100644 index 0000000..1906b1a --- /dev/null +++ b/Westdc/Service/ServiceManager.php @@ -0,0 +1,41 @@ +serviceManager = new Zend_ServiceManager(); + $this->serviceManager->addAbstractFactory(new ServiceFactory); + } + + public function addKey($key,$value = "") + { + if(!empty($value)) + $this->serviceManager->$key($value); + else + $this->serviceManager->$key(); + } + + public function setServiceManager(Zend_ServiceManager $service) + { + $this->serviceManager = $service; + } + + public function getServiceManager() + { + return $this->serviceManager; + } + +} \ No newline at end of file