ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilForumModeratorsGUI Class Reference

Class ilForumModeratorsGUI. More...

+ Collaboration diagram for ilForumModeratorsGUI:

Public Member Functions

 executeCommand ()
 
 addModerator ($users=array())
 
 detachModeratorRole ()
 

Private Attributes

 $ctrl
 
 $tpl
 
 $lng
 
 $oForumModerators
 
 $ref_id = 0
 

Detailed Description

Member Function Documentation

◆ addModerator()

ilForumModeratorsGUI::addModerator (   $users = array())

Definition at line 99 of file class.ilForumModeratorsGUI.php.

References $ilUser, ilForumNotification\_isParentNodeGrpCrs(), ilObject\_lookupObjId(), ilForumProperties\getInstance(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

100  {
101  global $ilUser;
102 
103  if(!$users)
104  {
105  ilUtil::sendFailure($this->lng->txt('frm_moderators_select_one'));
106  return;
107  }
108 
109  include_once "Modules/Forum/classes/class.ilForumNotification.php";
110  $isCrsGrp = ilForumNotification::_isParentNodeGrpCrs($this->ref_id);
111  include_once "Modules/Forum/classes/class.ilForumProperties.php";
112  $objFrmProps = ilForumProperties::getInstance(ilObject::_lookupObjId($this->ref_id));
113  $frm_noti_type = $objFrmProps->getNotificationType();
114 
115  foreach($users as $user_id)
116  {
117  $this->oForumModerators->addModeratorRole((int)$user_id);
118  if($isCrsGrp && $frm_noti_type != 'default')
119  {
120  $tmp_frm_noti = new ilForumNotification($this->ref_id);
121  $tmp_frm_noti->setUserId((int)$user_id);
122  $tmp_frm_noti->setUserIdNoti($ilUser->getId());
123  $tmp_frm_noti->setUserToggle((int)$objFrmProps->getUserToggleNoti());
124  $tmp_frm_noti->setAdminForce((int)$objFrmProps->getAdminForceNoti());
125 
126  $tmp_frm_noti->insertAdminForce();
127  }
128  }
129 
130  ilUtil::sendSuccess($this->lng->txt('frm_moderator_role_added_successfully'), true);
131  $this->ctrl->redirect($this, 'showModerators');
132  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _isParentNodeGrpCrs($a_ref_id)
Class ilForumNotification.
static getInstance($a_obj_id=0)
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ detachModeratorRole()

ilForumModeratorsGUI::detachModeratorRole ( )

Definition at line 137 of file class.ilForumModeratorsGUI.php.

References $_GET, $_POST, $lng, $result, $tbl, ilForumNotification\_isParentNodeGrpCrs(), ilParticipants\_isParticipant(), ilObject\_lookupObjId(), array, ilRepositorySearchGUI\fillAutoCompleteToolbar(), ilUtil\formCheckbox(), ilForumProperties\getInstance(), ilObjectFactory\getInstanceByObjId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

138  {
139  if(!isset($_POST['usr_id']) || !is_array($_POST['usr_id']))
140  {
141  ilUtil::sendFailure($this->lng->txt('frm_moderators_select_at_least_one'));
142  return $this->showModerators();
143  }
144 
145  $entries = $this->oForumModerators->getCurrentModerators();
146  if(count($_POST['usr_id']) == count($entries))
147  {
148  ilUtil::sendFailure($this->lng->txt('frm_at_least_one_moderator'));
149  return $this->showModerators();
150  }
151 
152  include_once "Modules/Forum/classes/class.ilForumNotification.php";
153  $isCrsGrp = ilForumNotification::_isParentNodeGrpCrs($this->ref_id);
154 
155  if($isCrsGrp)
156  {
157  global $tree;
158  $parent_ref_id = $tree->getParentId($this->ref_id);
159 
160  include_once "Services/Membership/classes/class.ilParticipants.php";
161  }
162 
163  include_once "Modules/Forum/classes/class.ilForumProperties.php";
164  $objFrmProps = ilForumProperties::getInstance(ilObject::_lookupObjId($this->ref_id));
165  $frm_noti_type = $objFrmProps->getNotificationType();
166 
167  foreach($_POST['usr_id'] as $usr_id)
168  {
169  $this->oForumModerators->detachModeratorRole((int)$usr_id);
170 
171  if($isCrsGrp && $frm_noti_type != 'default')
172  {
173  if(!ilParticipants::_isParticipant($this->ref_id, $usr_id))
174  {
175  $tmp_frm_noti = new ilForumNotification($this->ref_id);
176  $tmp_frm_noti->setUserId((int)$usr_id);
177  $tmp_frm_noti->setForumId(ilObject::_lookupObjId($this->ref_id));
178 
179  $tmp_frm_noti->deleteAdminForce();
180  }
181  }
182  }
183 
184  ilUtil::sendSuccess($this->lng->txt('frm_moderators_detached_role_successfully'),true);
185  $this->ctrl->redirect($this, 'showModerators');
186  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _isParentNodeGrpCrs($a_ref_id)
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
Class ilForumNotification.
static getInstance($a_obj_id=0)
static _lookupObjId($a_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ executeCommand()

ilForumModeratorsGUI::executeCommand ( )

Definition at line 71 of file class.ilForumModeratorsGUI.php.

References $cmd.

72  {
73  $next_class = $this->ctrl->getNextClass($this);
74  $cmd = $this->ctrl->getCmd();
75 
76  switch($next_class)
77  {
78  case 'ilrepositorysearchgui':
79  include_once 'Services/Search/classes/class.ilRepositorySearchGUI.php';
80  $rep_search = new ilRepositorySearchGUI();
81  $rep_search->setCallback($this, 'addModerator');
82  $this->ctrl->setReturn($this, 'showModerators');
83  $this->ctrl->forwardCommand($rep_search);
84  break;
85 
86  default:
87  if(!$cmd)
88  {
89  $cmd = 'showModerators';
90  }
91  $this->$cmd();
92  break;
93  }
94  }
$cmd
Definition: sahs_server.php:35

Field Documentation

◆ $ctrl

ilForumModeratorsGUI::$ctrl
private

Definition at line 21 of file class.ilForumModeratorsGUI.php.

◆ $lng

ilForumModeratorsGUI::$lng
private

Definition at line 31 of file class.ilForumModeratorsGUI.php.

Referenced by detachModeratorRole().

◆ $oForumModerators

ilForumModeratorsGUI::$oForumModerators
private

Definition at line 36 of file class.ilForumModeratorsGUI.php.

◆ $ref_id

ilForumModeratorsGUI::$ref_id = 0
private

Definition at line 38 of file class.ilForumModeratorsGUI.php.

◆ $tpl

ilForumModeratorsGUI::$tpl
private

Definition at line 26 of file class.ilForumModeratorsGUI.php.


The documentation for this class was generated from the following file: