예제 #1
0
 public function handleCategoryChangeRequest(SS_HTTPResponse $r)
 {
     if (!Member::currentUser()) {
         return $this->httpError(403);
     }
     if (!is_numeric($r->getVar('new_cat'))) {
         return $this->httpError(500, "Invalid category id");
     }
     $c = PresentationCategory::get()->byID((int) $r->getVar('new_cat'));
     if ($c) {
         $request = new SummitCategoryChange();
         $request->PresentationID = $this->presentation->ID;
         $request->NewCategoryID = $r->getVar('new_cat');
         $request->ReqesterID = Member::currentUserID();
         $request->write();
         $m = Member::currentUser();
         $comment = $m->FirstName . ' ' . $m->Surname . ' suggested that this presentation be moved to the category ' . $c->Title . '.';
         $this->presentation->addComment($comment, Member::currentUserID());
         return new SS_HTTPResponse("change request made.", 200);
     }
 }
예제 #2
0
 /**
  * @param SS_HTTPResponse $r
  * @return SS_HTTPResponse|void
  * @throws SS_HTTPResponse_Exception
  * @throws ValidationException
  * @throws null
  */
 public function handleCategoryChangeRequest(SS_HTTPResponse $r)
 {
     if (!Member::currentUser()) {
         return $this->httpError(403);
     }
     $newCat = $r->postVar('new_cat');
     if (!is_numeric($newCat)) {
         return $this->httpError(500, "Invalid category id");
     }
     $c = PresentationCategory::get()->byID($newCat);
     if ($c) {
         $request = SummitCategoryChange::create();
         $request->PresentationID = $this->presentation->ID;
         $request->NewCategoryID = $newCat;
         $request->ReqesterID = Member::currentUserID();
         $request->write();
         $this->presentation->addNotification('
         	{member} submitted a request to change the category from ' . $request->Presentation()->Category()->Title . ' to ' . $c->Title);
         return new SS_HTTPResponse("change request made.", 200);
     }
 }