コード例 #1
0
 /**
  * 
  * @return __FlowExecutor
  */
 public static function &getInstance()
 {
     if (self::$_instance == null) {
         self::$_instance = new __FlowExecutor();
     }
     return self::$_instance;
 }
コード例 #2
0
 protected function _executeControllerAssociatedToState(__FlowState $state, __FlowExecutor &$flow_executor, $flow_execution_key)
 {
     try {
         $action_identity = $state->getActionIdentity();
         $response = __ActionDispatcher::getInstance()->dispatch($action_identity);
         if ($response instanceof __IResponse) {
             $flow_executor->setResponse($response);
             $response->clear();
             //redirect via 303 because of the redirect after submit pattern (alwaysRedirectOnPause)
             $request = __FrontController::getInstance()->getRequest();
             $uri = $request->getUri();
             //add the flow execution key parameter:
             $application_context = __ApplicationContext::getInstance();
             $request_flow_execution_key = $application_context->getPropertyContent('REQUEST_FLOW_EXECUTION_KEY');
             $request_flow_state_id = $application_context->getPropertyContent('REQUEST_FLOW_STATE_ID');
             $uri->addParameter($request_flow_execution_key, $flow_execution_key);
             $uri->addParameter($request_flow_state_id, $state->getId());
             $empty_request = __RequestFactory::getInstance()->createRequest();
             __FrontController::getInstance()->redirect($uri, $empty_request, 303);
         } else {
             if ($response instanceof __FlowEvent) {
                 $fc_response = __FrontController::getInstance()->getResponse();
                 $fc_response->clear();
                 //clear the response content (to avoid decorator lateral issues)
                 $state = $flow_executor->resume($flow_execution_key, $response->getEventName());
                 if ($state != null) {
                     $application_context = __ApplicationContext::getInstance();
                     $action_identity = $state->getActionIdentity();
                     $this->_executeControllerAssociatedToState($state, $flow_executor, $flow_execution_key);
                 }
             }
         }
     } catch (Exception $e) {
         if ($flow_executor->isExceptionHandled($e)) {
             //$state = $flow_executor->handleException($flow_execution_key, $e);
             //if($state != null) {
             //    $this->_executeControllerAssociatedToState($flow_executor, $state);
             //}
         } else {
             throw $e;
         }
     }
     return $response;
 }
コード例 #3
0
 public function startRender(__IComponent &$component)
 {
     $component_id = $component->getId();
     $component_properties = $component->getProperties();
     foreach ($component_properties as $property => $value) {
         $property = strtolower($property);
         if ($property != 'runat') {
             $properties[] = $property . '="' . $value . '"';
         }
     }
     $properties[] = 'id="' . $component_id . '"';
     $properties[] = 'name="' . $component->getName() . '"';
     $properties[] = 'action = "' . __UriContainerWriterHelper::resolveUrl($component) . '"';
     $properties[] = 'method="' . strtoupper($component->getMethod()) . '"';
     if ($component->getVisible() == false) {
         $properties[] = 'style = "display : none;"';
     }
     $url = __FrontController::getInstance()->getRequest()->getUrl();
     $encoded_url = base64_encode(serialize($url));
     $form_code = '<form ' . join(' ', $properties) . ' onSubmit="return (__ClientEventHandler.getInstance()).handleSubmit(this);">' . "\n";
     $request_submit_code = __ContextManager::getInstance()->getApplicationContext()->getPropertyContent('REQUEST_SUBMIT_CODE');
     $form_code .= '<input type="HIDDEN" name="' . $request_submit_code . '" value="' . $component_id . '"></input>' . "\n";
     $form_code .= '<input type="HIDDEN" name="viewCode" value="' . $encoded_url . '"></input>' . "\n";
     $flow_executor = __FlowExecutor::getInstance();
     if ($flow_executor->hasActiveFlowExecution()) {
         $active_flow_execution = $flow_executor->getActiveFlowExecution();
         $request_flow_execution_key = __ApplicationContext::getInstance()->getPropertyContent('REQUEST_FLOW_EXECUTION_KEY');
         $form_code .= '<input type="HIDDEN" name="' . $request_flow_execution_key . '" value="' . $active_flow_execution->getId() . '"></input>' . "\n";
         $current_state = $active_flow_execution->getCurrentState();
         if ($current_state != null) {
             $request_flow_state_id = __ApplicationContext::getInstance()->getPropertyContent('REQUEST_FLOW_STATE_ID');
             $form_code .= '<input type="HIDDEN" name="' . $request_flow_state_id . '" value="' . $current_state->getId() . '"></input>' . "\n";
         }
     }
     $hidden_parameters = $component->getHiddenParameters();
     foreach ($hidden_parameters as $hidden_parameter_name => $hidden_parameter_value) {
         if (strtoupper($hidden_parameter_name) != strtoupper($request_submit_code) && strtoupper($hidden_parameter_name) != 'CLIENTENDPOINTVALUES') {
             $form_code .= '<input type="HIDDEN" name="' . $hidden_parameter_name . '" value="' . htmlentities($hidden_parameter_value) . '"></input>' . "\n";
         }
     }
     return $form_code;
 }
コード例 #4
0
 public function &getFlowScope()
 {
     return __FlowExecutor::getInstance()->getActiveFlowExecution();
 }