buildEvents[$pseudo_class]=$build_event_name; } /** * Returns build event by pseudo class * name if any defined in config * * @param string $pseudo_class * @return kEvent * @access public */ function &getBuildEvent($pseudo_class) { if( !isset($this->buildEvents[$pseudo_class]) ) return false; $event = new kEvent(); $event->Name=$this->buildEvents[$pseudo_class]; $event->MasterEvent=null; return $event; } /** * Allows to process any type of event * * @param kEvent $event * @access public */ function HandleEvent(&$event) { $event_handler =& $this->Application->recallObject($event->Prefix.'_EventHandler'); $event_handler->processEvent(&$event); } function getTemplateName($querystring_template) { $t_from_post=$this->Application->GetVar('t'); $t=$t_from_post?$t_from_post:$querystring_template; return $t; } function ProcessRequest() { // env=SID:TEMPLATE:m-1-1-1-1:l0-0-0:n-0-0-0:bb-0-0-1-1-1-0 // 1. process QueryString $env_var =& $this->Application->GetVar(ENV_VAR_NAME); $query_maps=Array(); if($env_var) { $parts=explode(':',$env_var); // Save Session ID $sid=array_shift($parts); if($sid) $this->Application->SetVar('sid',$sid); // Save Template Name $t=$this->getTemplateName( array_shift($parts) ); if(!$t) $t='index'; $this->Application->SetVar('t',$t); if($parts) { foreach($parts as $mixed_part) { $mixed_part=explode('-',$mixed_part); $prefix_special=array_shift($mixed_part); // l.pick, l list($prefix)=explode('.',$prefix_special); $query_maps[$prefix_special]=$this->Application->getUnitOption($prefix,'QueryString'); foreach($query_maps[$prefix_special] as $index => $var_name) { // l_id, l_page, l_bla-bla-bla $this->Application->SetVar($prefix_special.'_'.$var_name,$mixed_part[$index-1]); } } } } else { $t=$this->getTemplateName('index'); $this->Application->SetVar('t',$t); } // 1. get events from $_POST $events=$this->Application->GetVar('events'); if($events===false) $events=Array(); // 2. if nothing there, then try to find them in $_GET if($query_maps && !$events) { // if we got $_GET type submit (links, not javascript) foreach($query_maps as $prefix_special => $query_map) { $query_map=array_flip($query_map); if(isset($query_map['event'])) { $events[$prefix_special]=$this->Application->GetVar($prefix_special.'_event'); } } } //print_pre($events); $t=$this->Application->GetVar('t'); foreach($events as $prefix_special => $event_name) { if(!$event_name) continue; $event = new kEvent(); $event->Name=$event_name; $event->Prefix_Special=$prefix_special; $prefix_special=explode('.',$prefix_special); $event->Prefix=$prefix_special[0]; $event->Special=isset($prefix_special[1])?$prefix_special[1]:''; $event->redirect=$this->Application->RecallVar('redirect_to'); $this->HandleEvent(&$event); } } function registerHook($hookto_unit, $hookto_event_name, $mode, $do_unit, $do_event_name) { } function processHooks(&$event, $mode) { } /** * Set's new event for $prefix_special * passed * * @param string $prefix_special * @param string $event_name * @access public */ function setEvent($prefix_special,$event_name) { $actions =& $this->Application->recallObject('kActions'); $actions->Set('events['.$prefix_special.']',$event_name); } } ?>