/** * @method POST */ function updateOrder() { // get an authuser $token = Utilities::ValidateJWTToken(apache_request_headers()); // check if token is not null if ($token != NULL) { parse_str($this->request->data, $request); // parse request $json = $request['priorities']; $arr = json_decode($json, true); // update the order of the menu item foreach ($arr as $key => $value) { MenuItem::EditPriority($key, $value); } // return a json response $response = new Tonic\Response(Tonic\Response::OK); return $response; } else { // unauthorized access return new Tonic\Response(Tonic\Response::UNAUTHORIZED); } }
/** * @method POST */ function updateOrder() { // get an authuser $authUser = new AuthUser(); if (isset($authUser->UserUniqId)) { // check if authorized parse_str($this->request->data, $request); // parse request $json = $request['json']; $arr = json_decode($json, true); // update the order of the menu item foreach ($arr as $key => $value) { MenuItem::EditPriority($key, $value); } // return a json response $response = new Tonic\Response(Tonic\Response::OK); return $response; } else { // unauthorized access return new Tonic\Response(Tonic\Response::UNAUTHORIZED); } }