00001 <?php
00002
00029 abstract class TKComponent extends SObject {
00032 private $id;
00035 private $html = false;
00038 private $parent = null;
00039
00042 private $directEvents = array();
00045 private $indirectEvents = array();
00048 private $eventExtra = array();
00051 private $hasActions = false;
00052
00055 private $properties = array();
00058 private $propTypes = array();
00061 private $propListeners = array();
00062
00065 private $theme = null;
00068 private $themeClass = 'default';
00069
00072 private $bTranslateFields = true;
00073
00074 private $translatedClass = array();
00075 private $translatedStyle = array();
00076 private $translatedActions = '';
00077 private $translatedId = '';
00078
00080 const PROP_NUMERIC = 1;
00082 const PROP_STRING = 2;
00084 const PROP_OBJECT = 3;
00086 const PROP_BOOLEAN = 4;
00088 const PROP_ARRAY = 5;
00090 const PROP_CLASS = 6;
00092 const PROP_STYLE = 7;
00093
00096 const EVENT_DIRECT = 1;
00099 const EVENT_INDIRECT = 2;
00100
00103 private static $NULL_VALUE = null;
00104
00112 public function __construct() {
00113
00114 $this->id = 'id' . Toolkit::getNextId();
00115
00116
00117 $this->addProperty('class', self::PROP_CLASS);
00118 $this->addProperty('style', self::PROP_STYLE);
00119 $this->addProperty('alt', self::PROP_STRING);
00120
00121
00122 $this->directEvents = array(
00123 'onload' => array(),
00124 'onclick' => array(),
00125 'ondblclick' => array(),
00126 'onmousedown' => array(),
00127 'onmousemove' => array(),
00128 'onmouseout' => array(),
00129 'onmouseover' => array(),
00130 'onmouseup' => array(),
00131 'onkeydown' => array(),
00132 'onkeyup' => array(),
00133 'onkeypress' => array()
00134 );
00135
00136 $this->eventExtra = array(
00137 'onload' => array(),
00138 'onclick' => array(),
00139 'ondblclick' => array(),
00140 'onmousedown' => array(),
00141 'onmousemove' => array(),
00142 'onmouseout' => array(),
00143 'onmouseover' => array(),
00144 'onmouseup' => array(),
00145 'onkeydown' => array(),
00146 'onkeyup' => array(),
00147 'onkeypress' => array()
00148 );
00149
00150
00151 $this->theme = Toolkit::getDefaultTheme();
00152
00153
00154 Toolkit::addObject($this, $this->id);
00155 }
00156
00157
00158
00159
00160
00180 public function &__get($fldName) {
00181 if($fldName == 'html') {
00182 $html = $this->render();
00183 return $html;
00184 }
00185
00186
00187
00188
00189
00190
00191
00192 return $this->get($fldName);
00193 }
00194
00216 public function __set($fldName, $value) {
00217 if($this->eventExists($fldName))
00218 return $this->setAction($fldName, $value);
00219 else
00220 return $this->set($fldName, $value);
00221 }
00222
00233 public function __isset($fldName) {
00234 if($this->eventExists($fldName))
00235 return true;
00236 else
00237 return $this->isset($fldName);
00238 }
00239
00248 public function __toString() {
00249 return 'Component [id: ' . $this->getId() . ', type: '
00250 . get_class($this) . ']';
00251 }
00252
00266 public function __call($name, $args) {
00267 if(substr($name, 0, 3) == 'set') {
00268 $op = 'set';
00269 $name = substr($name, 3);
00270 }
00271 else if(substr($name, 0, 3) == 'get') {
00272 $op = 'get';
00273 $name = substr($name, 3);
00274 }
00275 else if(substr($name, 0, 6) == 'append') {
00276 $op = 'append';
00277 $name = substr($name, 6);
00278 }
00279 else if(substr($name, 0, 6) == 'exists') {
00280 $op = 'exists';
00281 $name = substr($name, 6);
00282 }
00283 else {
00284 $this->setError("Invalid dynamic function '$name'");
00285 return false;
00286 }
00287
00288 $name = preg_replace('/([A-Z])([a-z]*)/e', "'_'.strtolower('$1').'$2'",
00289 $name);
00290 $name = ltrim($name, '_');
00291
00292 $args = array_merge(array($name), $args);
00293
00294 return call_user_func_array(array($this, $op), $args);
00295 }
00296
00297
00298 public function setStyle($style) {
00299 if(is_array($style))
00300 $this->properties['style'] = $style;
00301 else
00302 $this->properties['style'] = array($style);
00303 return $this;
00304 }
00305
00306
00307 public function setClass($class) {
00308 if(is_array($class))
00309 $this->properties['class'] = $class;
00310 else
00311 $this->properties['class'] = array($class);
00312 return $this;
00313 }
00314
00323 public function __clone() {
00324
00325
00326 foreach($this->properties as $key => $value) {
00327 if($this->propTypes[$key] == self::PROP_OBJECT)
00328 $this->properties[$key] = clone $this->properties[$key];
00329 }
00330 foreach($this->events as $k => $v) {
00331 $this->events[$k] = clone $this->events[$k];
00332 }
00333 $this->parent = null;
00334 $this->onClone();
00335 }
00336
00346 public function &get($fldName) {
00347 if(isset($this->properties[$fldName]))
00348 return $this->properties[$fldName];
00349 $this->setError("No such property '$fldName'");
00350 return self::$NULL_VALUE;
00351 }
00352
00373 public function set($fldName, $value) {
00374
00375 if(Toolkit::$ENABLE_PROP_EXIST_CHECKING && !isset($this->properties[$fldName])) {
00376 $this->setError("No such property '$fldName'");
00377 return $this;
00378 }
00379
00380
00381 if(!Toolkit::$ENABLE_PROP_TYPE_CHECKING) {
00382 if(!isset($this->propListeners[$fldName])) {
00383 if($this->propTypes[$fldName] >= self::PROP_ARRAY && $this->propTypes[$fldName] <= self::PROP_STYLE
00384 && !is_array($value))
00385 {
00386 $this->properties[$fldName] = array($value);
00387 }
00388 else
00389 $this->properties[$fldName] = $value;
00390 }
00391 else {
00392 list($yes, $value) = $this->onPropChange($fldName, $value);
00393 if($yes) {
00394 if($this->propTypes[$fldName] >= self::PROP_ARRAY && $this->propTypes[$fldName] <= self::PROP_STYLE
00395 && !is_array($value))
00396 {
00397 $this->properties[$fldName] = array($value);
00398 }
00399 else
00400 $this->properties[$fldName] = $value;
00401 }
00402 }
00403 return $this;
00404 }
00405 switch($this->propTypes[$fldName]) {
00406 case self::PROP_NUMERIC:
00407 if(!ctype_digit((string) $value)) {
00408 $this->setError("Property '$fldName' requires a numeric "
00409 . 'value');
00410 return $this;
00411 }
00412 break;
00413 case self::PROP_STRING:
00414 if($value != '' && !is_string($value) && !ctype_digit((string) $value)) {
00415 $this->setError("Property '$fldName' requires a string "
00416 . 'value');
00417 return $this;
00418 }
00419 break;
00420 case self::PROP_CLASS:
00421 case self::PROP_STYLE:
00422 case self::PROP_ARRAY:
00423 if(!is_array($value)) {
00424 if(!isset($this->propListeners[$fldName]))
00425 $this->properties[$fldName] = array($value);
00426 else {
00427 list($yes, $val) = $this->onPropChange($fldName, $value);
00428 if($yes)
00429 $this->properties[$fldName] = array($val);
00430 }
00431 return $this;
00432 }
00433 break;
00434 case self::PROP_OBJECT:
00435 if(!is_object($value)) {
00436 $this->setError("Property '$fldName' requires an object");
00437 return $this;
00438 }
00439 break;
00440 case self::PROP_BOOLEAN:
00441 if(!is_bool($value)) {
00442 $this->setError("Property '$fldName' requires a boolean "
00443 . 'value');
00444 return $this;
00445 }
00446 break;
00447 }
00448
00449 if(!isset($this->propListeners[$fldName])) {
00450 if($value == '' && $this->propTypes[$fldName] == self::PROP_STRING)
00451 $value = '';
00452 $this->properties[$fldName] = $value;
00453 }
00454 else {
00455 if($value == '' && $this->propTypes[$fldName] == self::PROP_STRING)
00456 $value = '';
00457 list($yes, $val) = $this->onPropChange($fldName, $value);
00458 if($yes)
00459 $this->properties[$fldName] = $val;
00460 }
00461 return $this;
00462 }
00463
00473 public function setMany($fields) {
00474 foreach($fields as $name => $value) {
00475 if(!$this->set($name, $value))
00476 return $this;
00477 }
00478 return $this;
00479 }
00480
00501 public function append($fldName, $value, $pre = false) {
00502 if(Toolkit::$ENABLE_PROP_EXIST_CHECKING && !isset($this->properties[$fldName])) {
00503 $this->setError("No such property '$fldName'");
00504 return $this;
00505 }
00506
00507 switch($this->propTypes[$fldName]) {
00508 case self::PROP_NUMERIC:
00509 $this->setError('Cannot append numeric values');
00510 break;
00511 case self::PROP_STRING:
00512 if(!is_string($value) && !ctype_digit((string) $value))
00513 $this->setError("Property '$fldName' requires a string "
00514 . 'value');
00515 else if($pre == true)
00516 $newValue = $value . $this->properties[$fldName];
00517 else
00518 $newValue .= $value;
00519 break;
00520 case self::PROP_CLASS:
00521 case self::PROP_STYLE:
00522 case self::PROP_ARRAY:
00523 if(is_array($value)) {
00524 if($pre == true)
00525 $newValue = array_merge($value, $this->properties[$fldName]);
00526 else
00527 $newValue = array_merge($this->properties[$fldName], $value);
00528 }
00529 else {
00530 if($pre == true)
00531 $newValue = array_merge(array($value), $this->properties[$fldName]);
00532 else
00533 $newValue = array_merge($this->properties[$fldName], array($value));
00534 }
00535 break;
00536 case self::PROP_OBJECT:
00537 $this->setError('Cannot append objects');
00538 break;
00539 case self::PROP_BOOLEAN:
00540 $this->setError('Cannot append booleans');
00541 break;
00542 }
00543 if(!isset($this->propListeners[$fldName]))
00544 $this->properties[$fldName] = $newValue;
00545 else {
00546 list($yes, $val) = $this->onPropChange($fldName, $newValue);
00547 if($yes)
00548 $this->properties[$fldName] = $val;
00549 }
00550 return $this;
00551 }
00552
00562 public function appendMany($fields) {
00563 foreach($this->fields as $name => $value)
00564 if(!$this->append($name, $value))
00565 break;
00566 return $this;
00567 }
00568
00575 public function exists($fld) {
00576 return isset($this->properties[$fld]);
00577 }
00578
00584 public function getProperties($values = false) {
00585 if($values)
00586 return array_merge($this->properties);
00587 else
00588 return array_keys($this->properties);
00589 }
00590
00591
00600 public function setTheme($theme) {
00601 $this->theme = $theme;
00602 }
00603
00609 public function getTheme() {
00610 return $this->theme;
00611 }
00612
00622 public function setThemeClass($class) {
00623 $this->themeClass = $class;
00624 }
00625
00631 public function getThemeClass() {
00632 return $this->themeClass;
00633 }
00634
00652 public function setAction($eventName, $action) {
00653 if(!$this->eventExists($eventName)) {
00654 $this->setError("No such event '$eventName'");
00655 return false;
00656 }
00657 if(is_string($action)) {
00658 $action = new TKCustomAction('', $action);
00659 }
00660 else if(is_array($action)) {
00661 $action = new TKCustomAction($action[0], $action[1]);
00662 }
00663 else if(!($action instanceof TKAction)) {
00664 $this->setError('Action must be subclass of TKAction');
00665 return false;
00666 }
00667 $this->hasActions = true;
00668 if(isset($this->directEvents[$eventName]))
00669 array_push($this->directEvents[$eventName], $action);
00670 else
00671 array_push($this->indirectEvents[$eventName], $action);
00672 return true;
00673 }
00674
00681 public function eventExists($eventName) {
00682 return isset($this->directEvents[$eventName]) || isset($this->indirectEvents[$eventName]);
00683 }
00684
00693 public function render() {
00694 if($this->html === false) {
00695 if($this->theme != null)
00696 $this->theme->initComponent($this);
00697 if($this->bTranslateFields) {
00698 list($class, $style, $events, $id) = $this->translateFields();
00699 $this->html = $this->renderComponent($class, $style, $events, $id);
00700 }
00701 else {
00702 $this->renderComponent(null, null, null, null);
00703 }
00704 }
00705 return $this->html;
00706 }
00707
00713 public function getId() {
00714 return $this->id;
00715 }
00716
00728 public function setId($id) {
00729 if($id == $this->id)
00730 return $this;
00731 Toolkit::setObjectId($this, $id);
00732 $this->id = $id;
00733 if($this->parent !== null)
00734 $this->parent->updateIds();
00735 return $this;
00736 }
00737
00738
00739
00740
00741
00765 protected abstract function renderComponent($class, $style, $events, $id);
00766
00776 protected function onClone() {
00777
00778 }
00779
00780 public static function createFromXML($attrs, $data, $childNodes) {
00781 self::setError('Cannot create a TKComponent from XML!');
00782 return null;
00783 }
00784
00785
00786
00787
00788
00796 protected function addExtraJS($slot, $js) {
00797 Toolkit::globalAddExtraJS($slot, $js);
00798 }
00799
00807 protected function addExtraCSS($slot, $css) {
00808 Toolkit::globalAddExtraCSS($slot, $css);
00809 }
00810
00823 protected static function convertStdAttributes($obj, $attrs) {
00824 if(isset($attrs['id'])) {
00825 $obj->setId($attrs['id']);
00826 unset($attrs['id']);
00827 }
00828 if(isset($attrs['theme'])) {
00829 $theme = $attrs['theme'];
00830 if(class_exists($theme)) {
00831 $t = new $theme();
00832 $obj->setTheme($t);
00833 }
00834 }
00835 if(isset($attrs['theme_class'])) {
00836 $obj->setThemeClass($attrs['theme_class']);
00837 }
00838 foreach($attrs as $a => $v) {
00839 if($obj->exists($a)) {
00840 if(substr($a, -5) == 'class') {
00841 $cl = explode(' ', $v);
00842 $obj->set($a, $cl);
00843 }
00844 else if(substr($a, -5) == 'style') {
00845 $cl = explode(';', $v);
00846 $stl = array();
00847 foreach($cl as $s) {
00848 $tmp = explode(':', $s);
00849 $stl[$tmp[0]] = $tmp[1];
00850 }
00851 $obj->set($a, $stl);
00852 }
00853 else {
00854 $obj->set($a, $v);
00855 }
00856 }
00857 }
00858 }
00859
00870 protected static function convertStdEvents($obj, $node) {
00871 foreach($node['children'] as $evt) {
00872 if($evt['tag'] != 'event')
00873 continue;
00874 $attrs = $evt['attrs'];
00875 $type = (string)$attrs['type'];
00876 $actionName = (string)$attrs['action'];
00877 $action = call_user_func(array($actionName, 'createFromXML'), $evt['attrs'], $evt['children']);
00878 if($action !== null)
00879 $obj->setAction($type, $action);
00880 }
00881 }
00882
00893 protected static function convertChild($child) {
00894 $classname = $child['tag'];
00895 $value = $child['value'];
00896 $attribs = $child['attrs'];
00897 $nobj = call_user_func(array($classname, 'createFromXML'), $attribs, $value, $child);
00898 return $nobj;
00899 }
00900
00913 protected function enableTranslateFields($bEnable) {
00914 $this->bTranslateFields = $bEnable;
00915 }
00916
00931 protected function addProperty($propName, $type) {
00932 if(Toolkit::$ENABLE_PROP_EXIST_CHECKING && isset($this->propTypes[$propName])) {
00933 $this->setDebug('WARNING: Redefinition of existing property '
00934 . "'$propName'");
00935 return false;
00936 }
00937 switch($type) {
00938 case self::PROP_NUMERIC:
00939 $this->properties[$propName] = (int)0;
00940 break;
00941 case self::PROP_STRING:
00942 $this->properties[$propName] = (string)'';
00943 break;
00944 case self::PROP_CLASS:
00945 case self::PROP_STYLE:
00946 case self::PROP_ARRAY:
00947 $this->properties[$propName] = array();
00948 break;
00949 case self::PROP_OBJECT:
00950 $this->properties[$propName] = (object)'';
00951 break;
00952 case self::PROP_BOOLEAN:
00953 $this->properties[$propName] = (boolean)false;
00954 break;
00955 default:
00956 $this->setDebug("ERROR: Invalid property type: $type");
00957 return false;
00958 }
00959 $this->propTypes[$propName] = $type;
00960 return true;
00961 }
00962
00975 protected function removeProperty($propName) {
00976 if(!isset($this->propTypes[$propName])) {
00977 $this->setDebug("WARNING: No such property '$propName'");
00978 return false;
00979 }
00980 unset($this->propTypes[$propName]);
00981 unset($this->properties[$propName]);
00982 return true;
00983 }
00984
00999 protected function setPropChangeListener($prop, $fn) {
01000 if(isset($this->propListeners[$prop])) {
01001 $this->setWarning("Property change listener already registered for property '$prop'");
01002 return false;
01003 }
01004
01005 $oldListener = isset($this->propListeners[$prop]) ? $this->propListeners[$prop] : null;
01006 $this->propListeners[$prop] = $fn;
01007 return $oldListener;
01008 }
01009
01021 protected function removePropChangeListener($prop) {
01022 if(!isset($this->propListeners[$prop])) {
01023 $this->setWarning("No such property '$prop'");
01024 return false;
01025 }
01026 unset($this->propListeners[$prop]);
01027 return true;
01028 }
01029
01046 protected function addEvent($eventName, $eventType = self::EVENT_DIRECT,
01047 $eventExtra = array())
01048 {
01049 if($eventType == self::EVENT_DIRECT) {
01050 if(isset($this->directEvents[$eventName])) {
01051 $this->setDebug("WARNING: Event '$eventName' already exists");
01052 return false;
01053 }
01054 $this->directEvents[$eventName] = array();
01055 }
01056 else if($eventType == self::EVENT_INDIRECT) {
01057 if(isset($this->indirectEvents[$eventName])) {
01058 $this->setDebug("WARNING: Event '$eventName' already exists");
01059 return false;
01060 }
01061 $this->indirectEvents[$eventName] = array();
01062 }
01063 else {
01064 $this->setDebug("ERROR: Invalid event type $eventType");
01065 return false;
01066 }
01067
01068
01069 $this->eventExtra[$eventName] = $eventExtra;
01070 return true;
01071 }
01072
01084 protected function removeEvent($eventName) {
01085 if(isset($this->directEvents[$eventName])) {
01086 unset($this->directEvents[$eventName]);
01087 }
01088 else if(isset($this->indirectEvents[$eventName])) {
01089 unset($this->indirectEvents[$eventName]);
01090 }
01091 else {
01092 $this->setDebug("WARNING: No such event '$eventName'");
01093 return false;
01094 }
01095 unset($this->eventExtra[$eventName]);
01096 return true;
01097 }
01098
01108 protected function getAllEventJS() {
01109 if($this->hasActions == false)
01110 return '';
01111 $collect = '';
01112 foreach($this->indirectEvents as $evt => $dummy) {
01113 $collect .= $this->getIndirectEventJS($evt);
01114 }
01115 foreach($this->directEvents as $evt => $dummy) {
01116 $collect .= $this->getDirectEventJS($evt);
01117 }
01118 return $collect;
01119 }
01120
01135 protected function translateClass($name, $extra = array()) {
01136 $propName = $name === 0 ? 'class' : $name . '_class';
01137 return Toolkit::classToString(array_merge($this->properties[$propName], $extra));
01138 }
01139
01156 protected function translateStyle($name, $extra = array()) {
01157 $propName = $name === 0 ? 'style' : $name . '_style';
01158 return Toolkit::styleToString(array_merge($this->properties[$propName], $extra));
01159 }
01160
01174 protected function mergeClasses($names, $extra = array()) {
01175 $classes = array();
01176 foreach($names as $name)
01177 $classes[] = $this->properties[$name == 0 ? 'class' : $name . '_class'];
01178 foreach($extra as $e)
01179 $classes[] = $e;
01180 return Toolkit::classToString($classes);
01181 }
01182
01198 protected function mergeStyles($names, $extra = array()) {
01199 $styles = array();
01200 foreach($names as $name)
01201 $styles = array_merge($styles, $this->properties[$name == 0 ? 'style' : $name . '_style']);
01202 foreach($extra as $a => $v)
01203 $styles[$a] = $v;
01204 return Toolkit::styleToString($styles);
01205 }
01206
01240 protected function translateFields($extraClasses = array(), $extraStyles = array()) {
01241 $class = array();
01242 $style = array();
01243 foreach($this->properties as $name => $prop) {
01244 if($name == 'class') {
01245 if(isset($extraClasses[0]))
01246 $class[0] = ' class="' . $extraClasses[0] . ' ' . implode(' ', $prot) . '"';
01247 else
01248 $class[0] = (count($prop) > 0 ? ' class="'. implode(' ', $prop) . '"' : '');
01249 }
01250 else if($this->propTypes[$name] == self::PROP_CLASS) {
01251 if(isset($extraClasses[$name]))
01252 $class[substr($name, 0, -6)] = ' class="' . $extraClasses[$name] . ' ' . implode(' ', $prop) . '"';
01253 else
01254 $class[substr($name, 0, -6)] = (count($prop) > 0 ? ' class="' . implode(' ', $prop) . '"' : '');
01255 }
01256 else if($name == 'style') {
01257 if(count($prop) > 0 || isset($extraStyles[0])) {
01258 $collect = ' style="';
01259 foreach($prop as $attr => $value)
01260 $collect .= "$attr:$value;";
01261 if(isset($extraStyles[0]))
01262 foreach($extraStyles[0] as $attr => $value)
01263 $collect .= "$attr:$value;";
01264 $collect .= '"';
01265 }
01266 else
01267 $collect = '';
01268 $style[0] = $collect;
01269
01270 }
01271 else if($this->propTypes[$name] == self::PROP_STYLE) {
01272 if(count($prop) > 0 || isset($extraStyles[$name])) {
01273 $collect = ' style="';
01274 foreach($prop as $attr => $value)
01275 $collect .= "$attr:$value;";
01276 if(isset($extraStyles[$name]))
01277 foreach($extraStyles[$name] as $attr => $value)
01278 $collect .= "$attr:$value;";
01279 $collect .= '"';
01280 }
01281 else
01282 $collect = '';
01283 $style[substr($name, 0, -6)] = $collect;
01284 }
01285 }
01286
01287 $this->translatedClass = $class;
01288 $this->translatedStyle = $style;
01289 $this->translatedActions = $this->hasActions ? $this->getAllEventJS() : '';
01290 $this->translatedId = " id=\"$this->id\"";
01291 return array($class, $style, $this->translatedActions, $this->translatedId);
01292 }
01293
01294 public function getTranslatedClass($className) {
01295 return isset($this->translatedClass[$className]) ? $this->translatedClass[$className] : '';
01296 }
01297
01298 public function getTranslatedStyle($styleName) {
01299 return isset($this->translatedSyyle[$styleName]) ? $this->translatedStyle[$styleName] : '';
01300 }
01301
01302 public function getTranslatedActions() {
01303 return $this->translatedActions;
01304 }
01305
01306 public function getTranslatedId() {
01307 return $this->translatedId;
01308 }
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321 protected function setParent($parent) {
01322 if(!($parent instanceof TKComponent)) {
01323 $this->setDebug('ERROR: Parent must be a TKComponent');
01324 return false;
01325 }
01326 $this->parent = $parent;
01327 return true;
01328 }
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340 private function onPropChange($prop, $newValue) {
01341 if(isset($this->propListeners[$prop])) {
01342 $fn = $this->propListeners[$prop];
01343 return call_user_func($fn, $prop, $newValue);
01344 }
01345 else
01346 return array(true, $newValue);
01347 }
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358 protected function getDirectEventJS($event) {
01359 if(count($this->directEvents[$event]) > 0) {
01360 $collect = " $event=\"";
01361 foreach($this->directEvents[$event] as $i => $action) {
01362 $collect .= $action->getInvocation() . ';';
01363 }
01364 $collect .= '"';
01365
01366 return $collect;
01367 }
01368 else
01369 return '';
01370 }
01371
01372
01373
01374
01375
01376
01377
01378 protected function getIndirectEventJS($event) {
01379 $extraInfo = $this->eventExtra[$event];
01380 if(count($this->indirectEvents[$event]) > 0) {
01381 $accum = array();
01382 foreach($this->indirectEvents[$event] as $i => $action) {
01383 $accum[] = $action->getInvocation() . ';';
01384 }
01385 if(isset($extraInfo['emitTo'])) {
01386 Toolkit::$INDIRECT[$extraInfo['emitTo']->getId()][$event] = $accum;
01387 }
01388 else {
01389 Toolkit::$INDIRECT[$this->getId()][$event] = $accum;
01390 }
01391 }
01392 return '';
01393 }
01394 }
01395
01396 ?>