Пример #1
0
 /**
  * 
  */
 public function __construct()
 {
     global $lng, $ilCtrl, $ilAccess;
     $forum = new ilObjForum((int) $_GET['ref_id']);
     $this->frm = $forum->Forum;
     $this->frm->setForumId($forum->getId());
     $this->frm->setForumRefId($forum->getRefId());
     $this->ctrl = $ilCtrl;
     $lng->loadLanguageModule('forum');
     $this->is_moderator = $ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id']);
 }
 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
 {
     /**
      * @var $ilUser ilObjUser
      */
     global $ilUser;
     $lg = parent::initHeaderAction();
     // Workaround: Do not show "desktop actions" in thread view
     if ($this->objCurrentTopic->getId()) {
         $container_obj = null;
         $lg->setContainerObject($container_obj);
     }
     if ($lg instanceof ilObjForumListGUI) {
         include_once 'Modules/Forum/classes/class.ilForumNotification.php';
         $frm_noti = new ilForumNotification((int) $_GET['ref_id']);
         $frm_noti->setUserId($ilUser->getId());
         $user_toggle = $frm_noti->isUserToggleNotification();
         // Notification button
         $notificiation_enabled = false;
         if ($ilUser->getId() != ANONYMOUS_USER_ID && $this->ilias->getSetting('forum_notification') != 0 && $user_toggle != 1) {
             $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()));
             if ($this->objCurrentTopic->getId()) {
                 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
             }
             if ($frm->isForumNotificationEnabled($ilUser->getId())) {
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'disableForumNotification'), "forums_disable_forum_notification");
                 $notificiation_enabled = true;
             } else {
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'enableForumNotification'), "forums_enable_forum_notification");
             }
             if ($this->objCurrentTopic->getId()) {
                 if ($this->objCurrentTopic->isNotificationEnabled($ilUser->getId())) {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'toggleThreadNotification'), "forums_disable_notification");
                     $notificiation_enabled = true;
                 } else {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'toggleThreadNotification'), "forums_enable_notification");
                 }
             }
             $this->ctrl->setParameter($this, 'thr_pk', '');
             if ($notificiation_enabled) {
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("frm_notification_activated"));
             } else {
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $this->lng->txt("frm_notification_deactivated"));
             }
         }
     }
     return $lg;
 }
Пример #3
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;
         }
     }
 }