示例#1
0
 /**
  * Add header action menu
  * 
  * @param string $a_sub_type
  * @param int $a_sub_id
  * @return ilObjectListGUI
  */
 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
 {
     global $ilAccess;
     if ($this->id_type == self::WORKSPACE_NODE_ID) {
         if (!$this->creation_mode && $this->object_id) {
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_WORKSPACE, $this->getAccessHandler(), $this->getType(), $this->node_id, $this->object_id);
             $dispatcher->setSubObject($a_sub_type, $a_sub_id);
             include_once "Services/Object/classes/class.ilObjectListGUI.php";
             ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
             $lg = $dispatcher->initHeaderAction();
             if (is_object($lg)) {
                 // to enable add to desktop / remove from desktop
                 if ($this instanceof ilDesktopItemHandling) {
                     $lg->setContainerObject($this);
                 }
                 // for activation checks see ilObjectGUI
                 // $lg->enableComments(true);
                 $lg->enableNotes(true);
                 // $lg->enableTags(true);
             }
             return $lg;
         }
     } else {
         return parent::initHeaderAction();
     }
 }
示例#2
0
 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) {
         if ($ilUser->getId() != ANONYMOUS_USER_ID && $this->ilias->getSetting('forum_notification') != 0) {
             $is_user_allowed_to_deactivate_notification = $this->isUserAllowedToDeactivateNotification();
             $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()));
             $frm_notificiation_enabled = $frm->isForumNotificationEnabled($ilUser->getId());
             if ($this->objCurrentTopic->getId()) {
                 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
             }
             if ($this->isParentObjectCrsOrGrp()) {
                 // special behaviour for CRS/GRP-Forum notification!!
                 if ($frm_notificiation_enabled && $is_user_allowed_to_deactivate_notification) {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'disableForumNotification'), "forums_disable_forum_notification");
                 } else {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'enableForumNotification'), "forums_enable_forum_notification");
                 }
             } else {
                 if ($frm_notificiation_enabled) {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'disableForumNotification'), "forums_disable_forum_notification");
                 } else {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'enableForumNotification'), "forums_enable_forum_notification");
                 }
             }
             $topic_notification_enabled = false;
             if ($this->objCurrentTopic->getId()) {
                 $topic_notification_enabled = $this->objCurrentTopic->isNotificationEnabled($ilUser->getId());
                 if ($topic_notification_enabled) {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'toggleThreadNotification'), "forums_disable_notification");
                 } else {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'toggleThreadNotification'), "forums_enable_notification");
                 }
             }
             $this->ctrl->setParameter($this, 'thr_pk', '');
             if ($frm_notificiation_enabled || $topic_notification_enabled) {
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.svg"), $this->lng->txt("frm_notification_activated"));
             } else {
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.svg"), $this->lng->txt("frm_notification_deactivated"));
             }
         }
     }
     return $lg;
 }
示例#3
0
 /**
  * Add file manager link
  * @param <type> $a_sub_type
  * @param <type> $a_sub_id
  *
  */
 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
 {
     $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
     // begin-patch fm
     include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
     if (ilFMSettings::getInstance()->isEnabled()) {
         if ($lg instanceof ilObjectListGUI) {
             $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'fileManagerLaunch'), 'fm_start', '_blank');
         }
     }
     // end-patch fm
     return $lg;
 }
 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;
 }