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); } }
/** * @param SS_HTTPResponse $r * @throws SS_HTTPResponse_Exception */ public function handleSelect(SS_HTTPResponse $r) { if (!Member::currentUser()) { return $this->httpError(403); } try { $maybe = SummitSelectedPresentation::COLLECTION_MAYBE; $pass = SummitSelectedPresentation::COLLECTION_PASS; $selected = SummitSelectedPresentation::COLLECTION_SELECTED; switch ($r->getVar('type')) { case $maybe: $this->presentation->assignToIndividualList($maybe); break; case $pass: $this->presentation->assignToIndividualList($pass); break; default: $this->presentation->assignToIndividualList($selected); break; } return new SS_HTTPResponse('OK'); } catch (EntityValidationException $ex1) { SS_Log::log($ex1->getMessage(), SS_Log::WARN); return $this->validationError($ex1->getMessages()); } catch (Exception $ex) { SS_Log::log($ex->getMessage(), SS_Log::ERR); return $this->serverError(); } }