4 include_once
'Modules/Forum/classes/class.ilForumModerators.php';
5 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
6 include_once
'Services/Table/classes/class.ilTable2GUI.php';
7 include_once
'Services/Search/classes/class.ilQueryParser.php';
8 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
27 public function __construct()
43 $ilTabs->setTabActive(
'frm_moderators');
44 $this->lng->loadLanguageModule(
'search');
46 if(!$ilAccess->checkAccess(
'write',
'', (
int)
$_GET[
'ref_id']))
48 $ilias->raiseError($this->lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
52 $this->ref_id = (int)$_GET[
'ref_id'];
57 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
63 case 'ilrepositorysearchgui':
65 include_once(
'./Services/Search/classes/class.ilRepositorySearchGUI.php');
67 $rep_search->setCallback($this,
70 $this->ctrl->setReturn($this,
'showModerators');
71 $this->ctrl->forwardCommand($rep_search);
78 $cmd =
'showModerators';
96 include_once
"Modules/Forum/classes/class.ilForumNotification.php";
98 include_once
"Modules/Forum/classes/class.ilForumProperties.php";
100 $frm_noti_type = $objFrmProps->getNotificationType();
102 unset(
$_SESSION[
'frm'][
'moderators'][
'search_result']);
103 foreach(
$_POST[
'user'] as $user_id)
105 $this->oForumModerators->addModeratorRole((
int)$user_id);
107 if($isCrsGrp && $frm_noti_type !=
'default')
110 $tmp_frm_noti->setUserId((
int)$user_id);
111 $tmp_frm_noti->setUserIdNoti($ilUser->getId());
112 $tmp_frm_noti->setUserToggle((
int)$objFrmProps->getUserToggleNoti());
113 $tmp_frm_noti->setAdminForce((
int)$objFrmProps->getAdminForceNoti());
115 $tmp_frm_noti->insertAdminForce();
120 return $this->showModerators();
127 public function searchModerators()
132 return $this->searchModeratorsForm();
136 $oUserSearchFirstname->setFields(array(
'firstname'));
138 $oSearchResult = $oUserSearchFirstname->performSearch();
141 $oUserSearchLastname->setFields(array(
'lastname'));
142 $oSearchResultLastname = $oUserSearchLastname->performSearch();
143 $oSearchResult->mergeEntries($oSearchResultLastname);
147 $oUserSearchLogin->setFields(array(
'login'));
148 $oSearchResultLogin = $oUserSearchLogin->performSearch();
149 $oSearchResult->mergeEntries($oSearchResultLogin);
151 $oSearchResult->filter(ROOT_FOLDER_ID, $oQueryParser->getCombination() ==
'and');
152 $search_results = $oSearchResult->getUniqueResults();
154 if(is_array($search_results) && count($search_results))
156 $_SESSION[
'frm'][
'moderators'][
'search_result'] = $search_results;
162 return $this->searchModeratorsForm();
169 $oQueryParser->setCombination(
'or');
170 $oQueryParser->parse();
172 if(!$oQueryParser->validate())
174 return $oQueryParser->getMessage();
176 return $oQueryParser;
182 $entries = $this->oForumModerators->getCurrentModerators();
184 if(count(
$_POST[
'usr_id']) == count($entries))
187 return $this->showModerators();
189 if(!is_array(
$_POST[
'usr_id']))
192 return $this->showModerators();
194 include_once
"Modules/Forum/classes/class.ilForumNotification.php";
200 $parent_ref_id = $tree->getParentId($this->ref_id);
202 include_once
"Services/Membership/classes/class.ilParticipants.php";
205 include_once
"Modules/Forum/classes/class.ilForumProperties.php";
207 $frm_noti_type = $objFrmProps->getNotificationType();
211 $this->oForumModerators->detachModeratorRole((
int)$usr_id);
213 if($isCrsGrp && $frm_noti_type !=
'default')
219 $tmp_frm_noti->setUserId((
int)$usr_id);
222 $tmp_frm_noti->deleteAdminForce();
227 ilUtil::sendInfo($this->lng->txt(
'frm_moderators_detached_role_successfully'));
228 return $this->showModerators();
231 public function showModerators()
237 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.forum_moderators.html',
'Modules/Forum');
239 $ilToolbar->addButton($this->lng->txt(
"search_users"),
240 $this->ctrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
'start'));
243 $tbl->setId(
'frm_show_mods_tbl_'.
$_GET[
'ref_id']);
244 $tbl->setFormAction($this->ctrl->getFormAction($this,
'detachModeratorRole'));
245 $tbl->setTitle($this->lng->txt(
'frm_moderators'));
246 $tbl->setRowTemplate(
'tpl.forum_moderators_table_row.html',
'Modules/Forum');
248 $tbl->addColumn(
'',
'check',
'1%');
249 $tbl->addColumn($this->lng->txt(
'login'),
'login',
'30%');
250 $tbl->addColumn($this->lng->txt(
'firstname'),
'firstname',
'30%');
251 $tbl->addColumn($this->lng->txt(
'lastname'),
'lastname',
'30%');
253 $tbl->setDefaultOrderField(
'login');
255 $entries = $this->oForumModerators->getCurrentModerators();
263 if(is_object($oUser))
265 if(count($entries) > 1)
269 $result[$counter][
'login'] = $oUser->getLogin();
270 $result[$counter][
'firstname'] = $oUser->getFirstname();
271 $result[$counter][
'lastname'] = $oUser->getLastname();
277 if(count($entries) > 1)
279 $tbl->enable(
'select_all');
280 $tbl->setSelectAllCheckbox(
'usr_id');
281 $tbl->addMultiCommand(
'detachModeratorRole', $this->lng->txt(
'frm_detach_moderator_role'));
286 $tbl->disable(
'header');
287 $tbl->disable(
'footer');
289 $tbl->setNoEntriesText($this->lng->txt(
'frm_moderators_not_exist_yet'));
293 $this->tpl->setVariable(
'TXT_FORUM_MODERATORS', $tbl->getHTML());