/**
  * Register a new consumer for a class of events
  * @param mixed $class_name the name of the class to be associated to this consumer
  *						if this parameter is an array the consumer will be
  *						related to all event class identified by the array items
  * @param string $consumer_class the PHP class of the consumer
  * @param string $consumer_file the PHP file to be included before the $consumer_class
  * 					instantiation
  * @return boolean TRUE on success, FALSE otherwise
  * @static
  * @access public
  * @internal if you pass an int $class_id or an array of int in the first parameter
  *				you can relate the consumer to these class ids.
  **/
 function registerEventConsumer($class_name, $consumer_class, $consumer_file)
 {
     $idConsumer = DoceboEventManager::_registerConsumer($consumer_class, $consumer_file);
     if ($idConsumer === FALSE) {
         return FALSE;
     }
     if (is_array($class_name)) {
         foreach ($class_name as $cn) {
             $class_id = DoceboEventClass::getClassId($cn);
             if ($class_id !== FALSE) {
                 DoceboEventManager::_makeConsumerClassRelation($idConsumer, $class_id);
             } else {
                 return FALSE;
             }
         }
     } else {
         $class_id = DoceboEventClass::getClassId($class_name);
         if ($class_id !== FALSE) {
             DoceboEventManager::_makeConsumerClassRelation($idConsumer, $class_id);
         } else {
             return FALSE;
         }
     }
     return TRUE;
 }
Beispiel #2
0
 /**
  * Return the class of the event
  * @return string The class of the event
  * @access public
  **/
 function getClassName()
 {
     return DoceboEventClass::getClassName($this->class_id);
 }