Beispiel #1
0
 public function performDeleteThreadsObject()
 {
     /**
      * @var $lng ilLanguage
      */
     global $lng;
     if (!$this->is_moderator) {
         $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
         return $this->showThreadsObject();
     }
     if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids'])) {
         ilUtil::sendInfo($this->lng->txt('select_at_least_one_thread'));
         return $this->showThreadsObject();
     }
     require_once 'Modules/Forum/classes/class.ilForum.php';
     require_once 'Modules/Forum/classes/class.ilObjForum.php';
     $forumObj = new ilObjForum($_GET['ref_id']);
     $this->objProperties->setObjId($forumObj->getId());
     $frm = new ilForum();
     foreach ($_POST['thread_ids'] as $topic_id) {
         $frm->setForumId($forumObj->getId());
         $frm->setForumRefId($forumObj->getRefId());
         $first_node = $frm->getFirstPostNode($topic_id);
         if ((int) $first_node['pos_pk']) {
             $frm->deletePost($first_node['pos_pk']);
             ilUtil::sendInfo($lng->txt('forums_post_deleted'), true);
         }
     }
     $this->ctrl->redirect($this, 'showThreads');
 }