Index: trunk/core/kernel/utility/event.php =================================================================== diff -u -r958 -r1339 --- trunk/core/kernel/utility/event.php (.../event.php) (revision 958) +++ trunk/core/kernel/utility/event.php (.../event.php) (revision 1339) @@ -1,7 +1,20 @@ Init($prefix,$special); + $this->Name = getArrayValue($params,'name'); + } + } + function setEventParam($name,$value) { $this->specificParams[$name]=$value; } function getEventParam($name) { - return isset($this->specificParams[$name])?$this->specificParams[$name]:false; + return getArrayValue($this->specificParams, $name); } function getPrefixSpecial($from_submit=false) @@ -123,7 +181,7 @@ $this->pseudoClass=$this->Prefix.$appendix; } - function Init($prefix,$special) + function Init($prefix,$special='') { $this->Prefix=$prefix; $this->pseudoClass=$prefix; // default value @@ -135,12 +193,45 @@ * Returns object used in event * * @access public + * @return kDBBase */ - function &createObject() + function &getObject() { - return $this->Application->recallObject($this->Prefix_Special,$this->pseudoClass); + return $this->Application->recallObject($this->Prefix_Special,$this->pseudoClass); } + /** + * Calls passed event by name in current prefix/special environment + * Called event gets this event as MasterEvent, + * but its results (status and redirect* properties are copied back to current event) + * + * @param string $name EventName to call + */ + function CallSubEvent($name) + { + $child_event = new kEvent(); + $child_event->MasterEvent =& $this; + $child_event->Prefix = $this->Prefix; + $child_event->Special = $this->Special; + $child_event->Prefix_Special = $this->Prefix_Special; + $child_event->redirect = $this->redirect; + $child_event->redirect_params = $this->redirect_params; + $child_event->redirect_script = $this->redirect_script; + $child_event->Name = $name; + + $this->Application->HandleEvent( $child_event ); + + $this->status = $child_event->status; + $this->redirect = $child_event->redirect; + $this->redirect_params = $child_event->redirect_params; + $this->redirect_script = $child_event->redirect_script; + } + + function SetRedirectParam($name, $value) + { + $this->redirect_params = array_merge_recursive2( $this->redirect_params, Array($name => $value) ); + } + } ?> \ No newline at end of file