ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilForumModeratorsGUI Class Reference

Class ilForumModeratorsGUI. More...

+ Collaboration diagram for ilForumModeratorsGUI:

Public Member Functions

 __construct ()
 executeCommand ()
 addModerator ()
 showModeratorsSearchResult ($users=array())
 searchModerators ()
 searchModeratorsForm ()
 detachModeratorRole ()
 showModerators ()

Private Member Functions

 parseQueryString ($query_string)

Private Attributes

 $ctrl = null
 $tpl = null
 $lng = null
 $oForumModerators = null

Detailed Description

Constructor & Destructor Documentation

ilForumModeratorsGUI::__construct ( )

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

References $_GET, $ilCtrl, $lng, and $tpl.

{
global $ilCtrl, $tpl, $lng, $ilTabs, $ilAccess, $ilias;
$this->ctrl = $ilCtrl;
$this->tpl = $tpl;
$this->lng = $lng;
$ilTabs->setTabActive('frm_moderators');
$this->lng->loadLanguageModule('search');
if(!$ilAccess->checkAccess('edit_permission', '', (int)$_GET['ref_id']))
{
$ilias->raiseError($this->lng->txt('permission_denied'), $ilias->error_obj->MESSAGE);
}
$this->oForumModerators = new ilForumModerators((int)$_GET['ref_id']);
}

Member Function Documentation

ilForumModeratorsGUI::addModerator ( )

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

References $_POST, $_SESSION, ilUtil\sendInfo(), showModerators(), and showModeratorsSearchResult().

{
if(!((int)$_POST['usr_id']))
{
ilUtil::sendInfo($this->lng->txt('frm_moderators_select_one'));
return $this->showModeratorsSearchResult($_SESSION['frm']['moderators']['search_result']);
}
unset($_SESSION['frm']['moderators']['search_result']);
$this->oForumModerators->addModeratorRole((int)$_POST['usr_id']);
ilUtil::sendInfo($this->lng->txt('frm_moderator_role_added_successfully'));
return $this->showModerators();
}

+ Here is the call graph for this function:

ilForumModeratorsGUI::detachModeratorRole ( )

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

References $_POST, $usr_id, ilUtil\sendInfo(), and showModerators().

{
if(!is_array($_POST['usr_id']))
{
ilUtil::sendInfo($this->lng->txt('frm_moderators_select_at_least_one'));
return $this->showModerators();
}
foreach($_POST['usr_id'] as $usr_id)
{
$this->oForumModerators->detachModeratorRole((int)$usr_id);
}
ilUtil::sendInfo($this->lng->txt('frm_moderators_detached_role_successfully'));
return $this->showModerators();
}

+ Here is the call graph for this function:

ilForumModeratorsGUI::executeCommand ( )

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

References $cmd.

{
$cmd = $this->ctrl->getCmd();
switch ($next_class)
{
default:
if(!$cmd)
{
$cmd = 'showModerators';
}
$this->$cmd();
break;
}
return true;
}
ilForumModeratorsGUI::parseQueryString (   $query_string)
private

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

Referenced by searchModerators().

{
$oQueryParser = new ilQueryParser($query_string);
$oQueryParser->setCombination('or');
$oQueryParser->parse();
if(!$oQueryParser->validate())
{
return $oQueryParser->getMessage();
}
return $oQueryParser;
}

+ Here is the caller graph for this function:

ilForumModeratorsGUI::searchModerators ( )

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

References $_POST, $_SESSION, ilObjectSearchFactory\_getUserSearchInstance(), parseQueryString(), searchModeratorsForm(), ilUtil\sendInfo(), showModeratorsSearchResult(), and ilUtil\stripSlashes().

{
if(!is_object($oQueryParser = $this->parseQueryString(ilUtil::stripSlashes($_POST['search_query']))))
{
ilUtil::sendInfo($oQueryParser);
return $this->searchModeratorsForm();
}
$oUserSearchFirstname = ilObjectSearchFactory::_getUserSearchInstance($oQueryParser);
$oUserSearchFirstname->setFields(array('firstname'));
$oSearchResult = $oUserSearchFirstname->performSearch();
$oUserSearchLastname = ilObjectSearchFactory::_getUserSearchInstance($oQueryParser);
$oUserSearchLastname->setFields(array('lastname'));
$oSearchResultLastname = $oUserSearchLastname->performSearch();
$oSearchResult->mergeEntries($oSearchResultLastname);
$oUserSearchLogin = ilObjectSearchFactory::_getUserSearchInstance($oQueryParser);
$oUserSearchLogin->setFields(array('login'));
$oSearchResultLogin = $oUserSearchLogin->performSearch();
$oSearchResult->mergeEntries($oSearchResultLogin);
$oSearchResult->filter(ROOT_FOLDER_ID, $oQueryParser->getCombination() == 'and');
$search_results = $oSearchResult->getUniqueResults();
if(is_array($search_results) && count($search_results))
{
$_SESSION['frm']['moderators']['search_result'] = $search_results;
return $this->showModeratorsSearchResult($search_results);
}
else
{
ilUtil::sendInfo($this->lng->txt('frm_moderators_matches_in_no_results'));
return $this->searchModeratorsForm();
}
}

+ Here is the call graph for this function:

ilForumModeratorsGUI::searchModeratorsForm ( )

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

References $_POST, ilUtil\prepareFormOutput(), and ilTextInputGUI\setValue().

Referenced by searchModerators().

{
$oForm = new ilPropertyFormGUI();
$oForm->setFormAction($this->ctrl->getFormAction($this, 'searchModerators'));
$oForm->setTitle($this->lng->txt('frm_moderators_search'));
$oForm->setTitleIcon('');
$oTextField = new ilTextInputGUI($this->lng->txt('frm_moderators_search_query'), 'search_query');
$oTextField->setValue(ilUtil::prepareFormOutput($_POST['search_query'], true));
$oForm->addItem($oTextField);
$oForm->addCommandButton('searchModerators', $this->lng->txt('frm_moderators_do_search'));
$oForm->addCommandButton('showModerators', $this->lng->txt('cancel'));
$this->tpl->setVariable('ADM_CONTENT', $oForm->getHTML());
return $this->tpl->show();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilForumModeratorsGUI::showModerators ( )

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

References $_GET, $result, $usr_id, ilUtil\formCheckbox(), and ilObjectFactory\getInstanceByObjId().

Referenced by addModerator(), and detachModeratorRole().

{
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forum_moderators.html', 'Modules/Forum');
$tbl = new ilTable2GUI($this);
$tbl->setId('frm_show_mods_tbl_'.$_GET['ref_id']);
$tbl->setFormAction($this->ctrl->getFormAction($this, 'detachModeratorRole'));
$tbl->setTitle($this->lng->txt('frm_moderators'));
$tbl->setRowTemplate('tpl.forum_moderators_table_row.html', 'Modules/Forum');
$tbl->addColumn('', 'check', '1%');
$tbl->addColumn($this->lng->txt('fullname'), 'fullname', '99%');
$tbl->setDefaultOrderField('fullname');
$entries = $this->oForumModerators->getCurrentModerators();
$result = array();
if(count($entries))
{
$tbl->enable('select_all');
$tbl->setSelectAllCheckbox('usr_id');
$counter = 0;
foreach($entries as $usr_id)
{
$oUser = ilObjectFactory::getInstanceByObjId($usr_id, false);
if(is_object($oUser))
{
$result[$counter]['check'] = ilUtil::formCheckbox(0, 'usr_id[]', $oUser->getId());
$result[$counter]['fullname'] = $oUser->getFullname();
++$counter;
}
}
$tbl->addMultiCommand('detachModeratorRole', $this->lng->txt('frm_detach_moderator_role'));
}
else
{
$tbl->disable('header');
$tbl->disable('footer');
$tbl->setNoEntriesText($this->lng->txt('frm_moderators_not_exist_yet'));
}
$tbl->setData($result);
$tbl->addCommandButton('searchModeratorsForm', $this->lng->txt('add'));
$this->tpl->setVariable('TXT_FORUM_MODERATORS', $tbl->getHTML());
return $this->tpl->show();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References $_GET, $result, ilUtil\formRadioButton(), and ilObjectFactory\getInstanceByObjId().

Referenced by addModerator(), and searchModerators().

{
$tbl = new ilTable2GUI($this);
$tbl->setId('frm_show_mods_search_tbl_'.$_GET['ref_id']);
$tbl->setTitle($this->lng->txt('users'));
$tbl->setRowTemplate('tpl.forum_moderators_table_row.html', 'Modules/Forum');
$tbl->addColumn('','check','1%');
$tbl->addColumn($this->lng->txt('fullname'), 'fullname', '99%');
$tbl->setDefaultOrderField('fullname');
$result = array();
$counter = 0;
foreach($users as $usr)
{
$oUser = ilObjectFactory::getInstanceByObjId($usr['obj_id'], false);
if(is_object($oUser))
{
$result[$counter]['check'] = ilUtil::formRadioButton(0, 'usr_id', $oUser->getId());
$result[$counter]['fullname'] = $oUser->getFullname();
++$counter;
}
}
$tbl->setData($result);
$tbl->addCommandButton('addModerator', $this->lng->txt('add'));
$tbl->setFormAction($this->ctrl->getFormAction($this, 'addModeratorRole'));
$this->tpl->setVariable('ADM_CONTENT', $tbl->getHTML());
return $this->tpl->show();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilForumModeratorsGUI::$ctrl = null
private

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

ilForumModeratorsGUI::$lng = null
private

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

Referenced by __construct().

ilForumModeratorsGUI::$oForumModerators = null
private

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

ilForumModeratorsGUI::$tpl = null
private

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

Referenced by __construct().


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