Beispiel #1
0
 /**
  * 
  */
 public function mergeThreadsObject()
 {
     if (!$this->is_moderator) {
         $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
     }
     $selected_thread_id = 0;
     if (isset($_GET['merge_thread_id']) && (int) $_GET['merge_thread_id']) {
         $selected_thread_id = (int) $_GET['merge_thread_id'];
     } else {
         if (isset($_POST['thread_ids']) && count((array) $_POST['thread_ids']) == 1) {
             $selected_thread_id = (int) current($_POST['thread_ids']);
         } else {
             ilUtil::sendInfo($this->lng->txt('select_one'));
             $this->showThreadsObject();
             return;
         }
     }
     if ($selected_thread_id) {
         $frm = $this->object->Forum;
         $frm->setForumId($this->object->getId());
         $frm->setForumRefId($this->object->getRefId());
         $selected_thread_obj = new ilForumTopic($selected_thread_id);
         if (ilForum::_lookupObjIdForForumId($selected_thread_obj->getForumId()) != $frm->getForumId()) {
             ilUtil::sendFailure($this->lng->txt('not_allowed_to_merge_into_another_forum'));
             $this->showThreadsObject();
             return;
         }
         $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
         $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_liste.html', 'Modules/Forum');
         $topicData = $frm->getOneTopic();
         if ($topicData) {
             include_once 'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
             $this->ctrl->setParameter($this, 'merge_thread_id', $selected_thread_id);
             $tbl = new ilForumTopicTableGUI($this, 'mergeThreads', '', (int) $_GET['ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
             $tbl->setSelectedThread($selected_thread_obj);
             $tbl->setMapper($frm)->fetchData();
             $tbl->populate();
             $this->tpl->setVariable('THREADS_TABLE', $tbl->getHTML());
         } else {
             ilUtil::sendFailure($this->lng->txt('select_one'));
             $this->showThreadsObject();
             return;
         }
     }
 }
 public function getContent()
 {
     /**
      * @var $ilUser ilObjUser
      * @var $ilAccess ilAccessHandler
      * @var $lng ilLanguage
      * @var $ilToolbar ilToolbarGUI
      */
     global $ilUser, $ilAccess, $lng, $ilToolbar;
     if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
         $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
     }
     $frm = $this->object->Forum;
     $frm->setForumId($this->object->getId());
     $frm->setForumRefId($this->object->getRefId());
     $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_liste.html', 'Modules/Forum');
     if ((int) strlen($this->confirmation_gui_html)) {
         $this->tpl->setVariable('CONFIRMATION_GUI', $this->confirmation_gui_html);
     }
     // Create topic button
     if ($ilAccess->checkAccess('add_thread', '', $this->object->getRefId()) && !$this->hideToolbar()) {
         $ilToolbar->addButton($this->lng->txt('forums_new_thread'), $this->ctrl->getLinkTarget($this, 'createThread'));
     }
     // Mark all topics as read button
     include_once 'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
     if ($ilUser->getId() != ANONYMOUS_USER_ID && !(int) strlen($this->confirmation_gui_html)) {
         $ilToolbar->addButton($this->lng->txt('forums_mark_read'), $this->ctrl->getLinkTarget($this, 'markAllRead'), '', ilAccessKey::MARK_ALL_READ);
         $this->ctrl->clearParameters($this);
     }
     // Import information: Topic (variable $topicData) means frm object, not thread
     $topicData = $frm->getOneTopic();
     if ($topicData) {
         // Visit-Counter
         $frm->setDbTable('frm_data');
         $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk']));
         $frm->updateVisits($topicData['top_pk']);
         include_once 'Modules/Forum/classes/class.ilForumTopicTableGUI.php';
         $tbl = new ilForumTopicTableGUI($this, 'showThreads', '', (int) $_GET['ref_id'], $topicData, $this->is_moderator, $this->forum_overview_setting);
         $tbl->setMapper($frm)->fetchData();
         $this->tpl->setVariable('THREADS_TABLE', $tbl->getHTML());
     }
     // Permanent link
     include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
     $permalink = new ilPermanentLinkGUI('frm', $this->object->getRefId());
     $this->tpl->setVariable('PRMLINK', $permalink->getHTML());
 }