public static function checkForumsExistsDelete($ref_id, $user_id = 0) { global $ilUser; $node_data = self::getCachedNodeData($ref_id); include_once 'Modules/Forum/classes/class.ilForumModerators.php'; foreach ($node_data as $data) { //check frm_properties if frm_noti is enabled $frm_noti = new ilForumNotification($data['ref_id']); $objFrmMods = new ilForumModerators($data['ref_id']); $moderator_ids = $objFrmMods->getCurrentModerators(); if ($user_id != 0) { $frm_noti->setUserId($user_id); } else { $frm_noti->setUserId($ilUser->getId()); } $frm_noti->setForumId($data['obj_id']); if (!in_array($frm_noti->getUserId(), $moderator_ids)) { $frm_noti->deleteAdminForce(); } } }
public static function checkForumsExistsDelete($ref_id, $user_id = 0) { global $tree, $ilUser; $node_data = $tree->getChildsByType($ref_id, 'frm'); 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()); } $frm_noti->setForumId($data['obj_id']); $frm_noti->deleteAdminForce(); } }
public function disableAdminForceNotiObject() { /** * @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(); if ($is_enabled) { $frm_noti->deleteAdminForce(); } } ilUtil::sendSuccess($this->lng->txt('saved_successfully')); } $this->showMembersObject(); }
/** * */ public function detachModeratorRole() { if (!isset($_POST['usr_id']) || !is_array($_POST['usr_id'])) { ilUtil::sendFailure($this->lng->txt('frm_moderators_select_at_least_one')); return $this->showModerators(); } $entries = $this->oForumModerators->getCurrentModerators(); if (count($_POST['usr_id']) == count($entries)) { ilUtil::sendFailure($this->lng->txt('frm_at_least_one_moderator')); return $this->showModerators(); } include_once "Modules/Forum/classes/class.ilForumNotification.php"; $isCrsGrp = ilForumNotification::_isParentNodeGrpCrs($this->ref_id); if ($isCrsGrp) { global $tree; $parent_ref_id = $tree->getParentId($this->ref_id); include_once "Services/Membership/classes/class.ilParticipants.php"; } include_once "Modules/Forum/classes/class.ilForumProperties.php"; $objFrmProps = ilForumProperties::getInstance(ilObject::_lookupObjId($this->ref_id)); $frm_noti_type = $objFrmProps->getNotificationType(); foreach ($_POST['usr_id'] as $usr_id) { $this->oForumModerators->detachModeratorRole((int) $usr_id); if ($isCrsGrp && $frm_noti_type != 'default') { if (!ilParticipants::_isParticipant($this->ref_id, $usr_id)) { $tmp_frm_noti = new ilForumNotification($this->ref_id); $tmp_frm_noti->setUserId((int) $usr_id); $tmp_frm_noti->setForumId(ilObject::_lookupObjId($this->ref_id)); $tmp_frm_noti->deleteAdminForce(); } } } ilUtil::sendSuccess($this->lng->txt('frm_moderators_detached_role_successfully'), true); $this->ctrl->redirect($this, 'showModerators'); }