Exemple #1
0
 /**
  * Delete comment
  *
  * @return	   void, redirect
  */
 protected function _deleteComment()
 {
     // Check permission
     if (!$this->model->access('content')) {
         throw new Exception(Lang::txt('ALERTNOTAUTH'), 403);
         return;
     }
     // Incoming
     $cid = Request::getInt('cid', 0);
     $todoid = $this->_todoid;
     // Instantiate comment
     $objC = new \Components\Projects\Tables\Comment($this->_database);
     if ($objC->load($cid)) {
         $activityid = $objC->activityid;
         // delete comment
         if ($objC->deleteComment()) {
             $this->_msg = Lang::txt('PLG_PROJECTS_TODO_COMMENT_DELETED');
         }
         // delete associated activity
         $objAA = new \Components\Projects\Tables\Activity($this->_database);
         if ($activityid && $objAA->load($activityid)) {
             $objAA->deleteActivity();
         }
     }
     // Pass error or success message
     if ($this->getError()) {
         \Notify::message($this->getError(), 'error', 'projects');
     } elseif (!empty($this->_msg)) {
         \Notify::message($this->_msg, 'success', 'projects');
     }
     // Redirect
     App::redirect(Route::url($this->model->link('todo') . '&action=view&todoid=' . $todoid));
     return;
 }