original_string: public function respondToFormAppropriately(array $params, $form = null, $redirect = '')
      {
          if ($redirect && !isset($params['redirect'])) {
              $params['redirect'] = $redirect;
          }
  
          if ($this->owner->Request->isAjax()) {
              if (!isset($params['code'])) {
                  $params['code'] = 200;
              }
              if (!isset($params['code'])) {
                  $params['status'] = 'success';
              }
  
              return singleton('director')->ajax_response($params, $params['code'], $params['status']);
          } else {
              if (isset($params['redirect'])) {
                  $this->owner->redirect($params['redirect']);
              }
  
              if ($form && isset($params['message'])) {
                  $form->sessionMessage($params['message'], 'good');
              }
  
              if (!$this->owner->redirectedTo()) {
                  $this->owner->redirectBack();
              }
          }
      }
code: public function respondToFormAppropriately(array $params, $form = null, $redirect = '')
      {
          if ($redirect && !isset($params['redirect'])) {
              $params['redirect'] = $redirect;
          }
  
          if ($this->owner->Request->isAjax()) {
              if (!isset($params['code'])) {
                  $params['code'] = 200;
              }
              if (!isset($params['code'])) {
                  $params['status'] = 'success';
              }
  
              return singleton('director')->ajax_response($params, $params['code'], $params['status']);
          } else {
              if (isset($params['redirect'])) {
                  $this->owner->redirect($params['redirect']);
              }
  
              if ($form && isset($params['message'])) {
                  $form->sessionMessage($params['message'], 'good');
              }
  
              if (!$this->owner->redirectedTo()) {
                  $this->owner->redirectBack();
              }
          }
      }
code_tokens: public function respondToFormAppropriately ( array $ params , $ form = null , $ redirect = '' ) { if ( $ redirect && ! isset ( $ params [ 'redirect' ] ) ) { $ params [ 'redirect' ] = $ redirect ; } if ( $ this -> owner -> Request -> isAjax ( ) ) { if ( ! isset ( $ params [ 'code' ] ) ) { $ params [ 'code' ] = 200 ; } if ( ! isset ( $ params [ 'code' ] ) ) { $ params [ 'status' ] = 'success' ; } return singleton ( 'director' ) -> ajax_response ( $ params , $ params [ 'code' ] , $ params [ 'status' ] ) ; } else { if ( isset ( $ params [ 'redirect' ] ) ) { $ this -> owner -> redirect ( $ params [ 'redirect' ] ) ; } if ( $ form && isset ( $ params [ 'message' ] ) ) { $ form -> sessionMessage ( $ params [ 'message' ] , 'good' ) ; } if ( ! $ this -> owner -> redirectedTo ( ) ) { $ this -> owner -> redirectBack ( ) ; } } }
docstring: Respond to a form view ajax or redirect
  @param array $params
  @param \Form $form
  @param string $redirect
  @return \SS_HTTPResponse|null
docstring_tokens: Respond to a form view ajax or redirect