public function respondToFormAppropriately($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 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();
         }
     }
 }
예제 #2
0
 public static function require_google_platform_script()
 {
     singleton('require')->defer(Director::protocol() . 'apis.google.com/js/platform.js', true);
 }