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();
            }
        }
    }
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();
            }
        }
    }
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 ( ) ; } } }
Respond to a form view ajax or redirect
@param array $params
@param \Form $form
@param string $redirect
@return \SS_HTTPResponse|null
Respond to a form view ajax or redirect