Beispiel #1
0
 public function disableHideUserToggleNotiObject()
 {
     /**
      * @var $ilAccess ilAccessHandler
      * @var $ilErr		ilErr
      */
     global $ilAccess, $ilErr;
     if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
         $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
     }
     if (!isset($_POST['user_id']) || !is_array($_POST['user_id'])) {
         ilUtil::sendInfo($this->lng->txt('time_limit_no_users_selected'));
     } else {
         include_once 'Modules/Forum/classes/class.ilForumNotification.php';
         $frm_noti = new ilForumNotification($this->object->getRefId());
         foreach ($_POST['user_id'] as $user_id) {
             $frm_noti->setUserId((int) $user_id);
             $is_enabled = $frm_noti->isAdminForceNotification();
             $frm_noti->setUserToggle(0);
             if ($is_enabled) {
                 $frm_noti->updateUserToggle();
             } else {
                 $frm_noti->setAdminForce(1);
                 $frm_noti->insertAdminForce();
             }
         }
         ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
     }
     $this->showMembersObject();
 }
 public static function checkForumsExistsInsert($ref_id, $user_id = 0)
 {
     global $ilUser;
     include_once 'Modules/Forum/classes/class.ilForumProperties.php';
     $node_data = self::getCachedNodeData($ref_id);
     foreach ($node_data as $data) {
         //check frm_properties if frm_noti is enabled
         $frm_noti = new ilForumNotification($data['ref_id']);
         if ($user_id != 0) {
             $frm_noti->setUserId($user_id);
         } else {
             $frm_noti->setUserId($ilUser->getId());
         }
         $admin_force = ilForumProperties::_isAdminForceNoti($data['obj_id']);
         $frm_noti->setAdminForce($admin_force);
         $user_toggle = ilForumProperties::_isUserToggleNoti($data['obj_id']);
         if ($user_toggle) {
             $frm_noti->setAdminForce(1);
         }
         if ($admin_force == 1 || $user_toggle == 1) {
             $frm_noti->setUserToggle($user_toggle);
             $frm_noti->setForumId($data['obj_id']);
             if ($frm_noti->existsNotification() == false) {
                 $frm_noti->insertAdminForce();
             }
         }
     }
 }
 /**
  *
  */
 public function addModerator($users = array())
 {
     global $ilUser;
     if (!$users) {
         ilUtil::sendFailure($this->lng->txt('frm_moderators_select_one'));
         return;
     }
     include_once "Modules/Forum/classes/class.ilForumNotification.php";
     $isCrsGrp = ilForumNotification::_isParentNodeGrpCrs($this->ref_id);
     include_once "Modules/Forum/classes/class.ilForumProperties.php";
     $objFrmProps = ilForumProperties::getInstance(ilObject::_lookupObjId($this->ref_id));
     $frm_noti_type = $objFrmProps->getNotificationType();
     foreach ($users as $user_id) {
         $this->oForumModerators->addModeratorRole((int) $user_id);
         if ($isCrsGrp && $frm_noti_type != 'default') {
             $tmp_frm_noti = new ilForumNotification($this->ref_id);
             $tmp_frm_noti->setUserId((int) $user_id);
             $tmp_frm_noti->setUserIdNoti($ilUser->getId());
             $tmp_frm_noti->setUserToggle((int) $objFrmProps->getUserToggleNoti());
             $tmp_frm_noti->setAdminForce((int) $objFrmProps->getAdminForceNoti());
             $tmp_frm_noti->insertAdminForce();
         }
     }
     ilUtil::sendSuccess($this->lng->txt('frm_moderator_role_added_successfully'), true);
     $this->ctrl->redirect($this, 'showModerators');
 }