public function changeViewName(Request $request, $databox_id)
    {
        if (null === $viewName = $request->request->get('viewname')) {
            $this->app->abort(400, $this->app->trans('Missing view name parameter'));
        }

        $success = false;

        try {
            $this->findDataboxById($databox_id)->set_viewname($viewName);
            $success = true;
        } catch (\Exception $e) {

        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $success ? $this->app->trans('Successful update') : $this->app->trans('An error occured'),
                'sbas_id' => $databox_id,
            ]);
        }

        // TODO: Check whether html call is still valid
        return $this->app->redirectPath('admin_database', [
            'databox_id' => $databox_id,
            'error'      => 'file-too-big',
        ]);
    }
public function changeViewName(Request $request, $databox_id)
    {
        if (null === $viewName = $request->request->get('viewname')) {
            $this->app->abort(400, $this->app->trans('Missing view name parameter'));
        }

        $success = false;

        try {
            $this->findDataboxById($databox_id)->set_viewname($viewName);
            $success = true;
        } catch (\Exception $e) {

        }

        if ('json' === $request->getRequestFormat()) {
            return $this->app->json([
                'success' => $success,
                'msg'     => $success ? $this->app->trans('Successful update') : $this->app->trans('An error occured'),
                'sbas_id' => $databox_id,
            ]);
        }

        // TODO: Check whether html call is still valid
        return $this->app->redirectPath('admin_database', [
            'databox_id' => $databox_id,
            'error'      => 'file-too-big',
        ]);
    }
public function changeViewName ( Request $ request , $ databox_id ) { if ( null === $ viewName = $ request -> request -> get ( 'viewname' ) ) { $ this -> app -> abort ( 400 , $ this -> app -> trans ( 'Missing view name parameter' ) ) ; } $ success = false ; try { $ this -> findDataboxById ( $ databox_id ) -> set_viewname ( $ viewName ) ; $ success = true ; } catch ( \ Exception $ e ) { } if ( 'json' === $ request -> getRequestFormat ( ) ) { return $ this -> app -> json ( [ 'success' => $ success , 'msg' => $ success ? $ this -> app -> trans ( 'Successful update' ) : $ this -> app -> trans ( 'An error occured' ) , 'sbas_id' => $ databox_id , ] ) ; } // TODO: Check whether html call is still valid return $ this -> app -> redirectPath ( 'admin_database' , [ 'databox_id' => $ databox_id , 'error' => 'file-too-big' , ] ) ; }
Change the name of a databox

@param  Request $request    The current HTTP request
@param  integer $databox_id The requested databox
@return JsonResponse|RedirectResponse
Change the name of a databox