Пример #1
0
 /**
  * Delete the submitted entry.
  * 
  * @param string $topic_id the entry to delete
  */
 function delete_entry_action($topic_id)
 {
     // get the page of the posting to be able to jump there again
     $page = ForumEntry::getPostingPage($topic_id);
     URLHelper::addLinkParam('page', $page);
     if (ForumPerm::hasEditPerms($topic_id) || ForumPerm::check('remove_entry', $this->getId(), $topic_id)) {
         $path = ForumEntry::getPathToPosting($topic_id);
         $topic = array_pop($path);
         $parent = array_pop($path);
         if ($topic_id != $this->getId()) {
             // only delete directly if passed by ajax, otherwise ask for confirmation
             if (Request::isXhr() || Request::get('approve_delete')) {
                 ForumEntry::delete($topic_id);
                 $this->flash['messages'] = array('success' => sprintf(_('Der Eintrag %s wurde gelöscht!'), $topic['name']));
             } else {
                 $this->flash['messages'] = array('info_html' => sprintf(_('Sind sie sicher dass Sie den Eintrag %s löschen möchten?'), $topic['name']) . '<br>' . \Studip\LinkButton::createAccept(_('Ja'), PluginEngine::getUrl('coreforum/index/delete_entry/' . $topic_id . '?approve_delete=1')) . \Studip\LinkButton::createCancel(_('Nein'), PluginEngine::getUrl('coreforum/index/index/' . ForumEntry::getParentTopicId($topic_id) . '/' . $page)));
             }
         } else {
             $this->flash['messages'] = array('success' => _('Sie können nicht die gesamte Veranstaltung löschen!'));
         }
     }
     if (Request::isXhr()) {
         $this->render_template('messages');
         $this->flash['messages'] = null;
     } else {
         $this->redirect(PluginEngine::getLink('coreforum/index/index/' . $parent['id'] . '/' . $page));
     }
 }
Пример #2
0
 /**
  * Delete an entry
  *
  * @delete /forum_entry/:entry_id
  */
 public function deleteForumEntry($entry_id)
 {
     $entry = $this->findEntry($entry_id);
     $cid = $parent['course_id'];
     if (!\ForumPerm::hasEditPerms($entry_id) || !\ForumPerm::has('remove_entry', $cid)) {
         $this->error(401);
     }
     \ForumEntry::delete($entry_id);
     $this->status(204);
 }
Пример #3
0
 function deleteContents($seminar_id)
 {
     $this->setupAutoload();
     return ForumEntry::delete($seminar_id);
 }