ILIAS  Release_4_1_x_branch Revision 61804
 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 ()
 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 46 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 98 of file class.ilForumModeratorsGUI.php.

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

{
if(!$_POST['user'])
{
ilUtil::sendInfo($this->lng->txt('frm_moderators_select_one'));
return $this->showModeratorsSearchResult($_SESSION['frm']['moderators']['search_result']);
}
unset($_SESSION['frm']['moderators']['search_result']);
foreach($_POST['user'] as $user_id)
{
$this->oForumModerators->addModeratorRole((int)$user_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 203 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 65 of file class.ilForumModeratorsGUI.php.

References $cmd, and $ret.

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
#vd($next_class);
# vd($cmd);
switch ($next_class)
{
case 'ilrepositorysearchgui':
include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
$rep_search = new ilRepositorySearchGUI();
$rep_search->setCallback($this,
'addModerator');
// Set tabs
$this->ctrl->setReturn($this,'showModerators');
$ret = $this->ctrl->forwardCommand($rep_search);
break;
default:
if(!$cmd)
{
$cmd = 'showModerators';
}
$this->$cmd();
break;
}
return true;
}
ilForumModeratorsGUI::parseQueryString (   $query_string)
private

Definition at line 190 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 152 of file class.ilForumModeratorsGUI.php.

References $_POST, $_SESSION, ilObjectSearchFactory\_getUserSearchInstance(), parseQueryString(), 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::showModerators ( )

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

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

Referenced by addModerator(), and detachModeratorRole().

{
global $ilToolbar;
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forum_moderators.html', 'Modules/Forum');
// search button
$ilToolbar->addButton($this->lng->txt("search_users"),
$this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI','start'));
$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('login'),'login', '30%');
$tbl->addColumn($this->lng->txt('firstname'),'firstname', '30%');
$tbl->addColumn($this->lng->txt('lastname'),'lastname', '30%');
$tbl->setDefaultOrderField('login');
$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]['login'] = $oUser->getLogin();
$result[$counter]['firstname'] = $oUser->getFirstname();
$result[$counter]['lastname'] = $oUser->getLastname();
++$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);
$this->tpl->setVariable('TXT_FORUM_MODERATORS', $tbl->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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->setContent($tbl->getHTML());*/
}

+ Here is the caller graph for this function:

Field Documentation

ilForumModeratorsGUI::$ctrl = null
private

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

ilForumModeratorsGUI::$lng = null
private

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

Referenced by __construct().

ilForumModeratorsGUI::$oForumModerators = null
private

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

ilForumModeratorsGUI::$tpl = null
private

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

Referenced by __construct().


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