Example #1
0
 /**
  * @method POST
  */
 function get()
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $pageTypeId = -1;
         parse_str($this->request->data, $request);
         // parse request
         $pageId = $request['pageId'];
         $list = Category::GetCategoriesForPage($pageId);
         // return a json response
         $response = new Tonic\Response(Tonic\Response::OK);
         $response->contentType = 'application/json';
         $response->body = json_encode($list);
         return $response;
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }