Example #1
0
 /**
  * Used by the track chair app to allow comments on presentations.
  * Comments are only displayed in the track chair interface.
  **/
 public function addComment($commentBody, $MemberID)
 {
     $comment = new SummitPresentationComment();
     $comment->Body = $commentBody;
     $comment->CommenterID = $MemberID;
     $comment->PresentationID = $this->ID;
     $comment->write();
 }
Example #2
0
 public function handleAcceptCategoryChange(SS_HTTPResponse $r)
 {
     if (!Permission::check('ADMIN')) {
         return $this->httpError(403);
     }
     if (!is_numeric($r->param('ID'))) {
         return $this->httpError(500, "Invalid category change id");
     }
     $request = SummitCategoryChange::get()->byID($r->param('ID'));
     if ($request->exists()) {
         if ($request->Presentation()->isSelectedByAnyone()) {
             return new SS_HTTPResponse("The presentation has already been selected by chairs.", 500);
         }
         if ($request->Presentation()->CategoryID == $request->NewCategoryID) {
             $request->Done = TRUE;
             $request->write();
             return new SS_HTTPResponse("The presentation is already in this category.", 200);
         }
         // Make the category change
         $summit = Summit::get_active();
         $category = $summit->Categories()->filter('ID', $request->NewCategoryID)->first();
         if (!$category->exists()) {
             return $this->httpError(500, "Category not found in current summit");
         }
         $request->OldCategoryID = $request->Presentation()->CategoryID;
         $request->Presentation()->CategoryID = $request->NewCategoryID;
         $request->Presentation()->write();
         $comment = new SummitPresentationComment();
         $comment->Body = 'This presentaiton was moved into the category ' . $category->Title . '.' . ' The chage was approved by ' . Member::currentUser()->FirstName . ' ' . Member::currentUser()->Surname . '.';
         $comment->PresentationID = $request->Presentation()->ID;
         $comment->write();
         $request->AdminApproverID = Member::currentUserID();
         $request->Approved = TRUE;
         $request->Done = TRUE;
         $request->ApprovalDate = SS_Datetime::now();
         $request->write();
         return new SS_HTTPResponse("change request accepted.", 200);
     }
 }
 public function addNotification($text)
 {
     $text = str_replace(['{member}', '{presentation}'], [Member::currentUser()->getName(), $this->owner->Title], $text);
     $comment = SummitPresentationComment::create(['Body' => $text, 'CommenterID' => Member::currentUserID(), 'PresentationID' => $this->owner->ID, 'IsActivity' => true]);
     $comment->write();
 }