public function saveTemporaryPref(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            $this->app->abort(400);
        }

        $prop = $request->request->get('prop');
        $value = $request->request->get('value');
        $success = false;
        $msg = $this->app->trans('Error while saving preference');

        if (!is_null($prop) && !is_null($value)) {
            $this->getSession()->set('phraseanet.' . $prop, $value);
            $success = true;
            $msg = $this->app->trans('Preference saved !');
        }

        return new JsonResponse(['success' => $success, 'message' => $msg]);
    }
public function saveTemporaryPref(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            $this->app->abort(400);
        }

        $prop = $request->request->get('prop');
        $value = $request->request->get('value');
        $success = false;
        $msg = $this->app->trans('Error while saving preference');

        if (!is_null($prop) && !is_null($value)) {
            $this->getSession()->set('phraseanet.' . $prop, $value);
            $success = true;
            $msg = $this->app->trans('Preference saved !');
        }

        return new JsonResponse(['success' => $success, 'message' => $msg]);
    }
public function saveTemporaryPref ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { $ this -> app -> abort ( 400 ) ; } $ prop = $ request -> request -> get ( 'prop' ) ; $ value = $ request -> request -> get ( 'value' ) ; $ success = false ; $ msg = $ this -> app -> trans ( 'Error while saving preference' ) ; if ( ! is_null ( $ prop ) && ! is_null ( $ value ) ) { $ this -> getSession ( ) -> set ( 'phraseanet.' . $ prop , $ value ) ; $ success = true ; $ msg = $ this -> app -> trans ( 'Preference saved !' ) ; } return new JsonResponse ( [ 'success' => $ success , 'message' => $ msg ] ) ; }
Save temporary user preferences

@param  Request $request
@return JsonResponse
Save temporary user preferences