ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilOrgUnitStaffGUI Class Reference

Class ilOrgUnitStaffGUI. More...

+ Collaboration diagram for ilOrgUnitStaffGUI:

Public Member Functions

 __construct (ilObjOrgUnitGUI $parent_gui)
 executeCommand ()
 showStaff ()
 showOtherRoles ()
 showStaffRec ()
 addStaff ()
 addOtherRoles ()
 getStaffTableHTML ($recursive=false, $table_cmd="showStaff")
 getOtherRolesTableHTML ()
 fromSuperiorToEmployee ()
 fromEmployeeToSuperior ()
 confirmRemoveUser ($cmd)
 removeFromSuperiors ()
 removeFromEmployees ()
 removeFromRole ()
 setTabs ()

Protected Member Functions

 addStaffToolbar ()
 addOtherRolesToolbar ()

Protected Attributes

 $tabs_gui
 $toolbar
 $ctrl
 $tpl
 $parent_gui
 $parent_obj
 $lng
 $ilAccess
 $rbacreview

Detailed Description

Constructor & Destructor Documentation

ilOrgUnitStaffGUI::__construct ( ilObjOrgUnitGUI  $parent_gui)
Parameters
ilObjOrgUnitGUI$parent_gui

Definition at line 60 of file class.ilOrgUnitStaffGUI.php.

References $ilAccess, $ilCtrl, $lng, $parent_gui, $rbacreview, $tpl, and setTabs().

{
global $tpl, $ilCtrl, $ilTabs, $lng, $ilAccess, $ilToolbar, $rbacreview;
$this->tpl = $tpl;
$this->ctrl = $ilCtrl;
$this->parent_gui = $parent_gui;
$this->parent_object = $parent_gui->object;
$this->tabs_gui = $this->parent_gui->tabs_gui;
$this->toolbar = $ilToolbar;
$this->lng = $lng;
$this->ilAccess = $ilAccess;
$this->toolbar = $ilToolbar;
$this->rbacreview = $rbacreview;
$this->tabs_gui->setTabActive("orgu_staff");
$this->setTabs();
}

+ Here is the call graph for this function:

Member Function Documentation

ilOrgUnitStaffGUI::addOtherRoles ( )

Definition at line 234 of file class.ilOrgUnitStaffGUI.php.

References $_POST, $lng, $rbacreview, ilObjUser\_lookupId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

Referenced by executeCommand().

{
global $rbacreview, $lng, $rbacadmin;
if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
$users = explode(',', $_POST['user_login']);
$user_ids = array();
foreach ($users as $user) {
$user_id = ilObjUser::_lookupId($user);
if ($user_id) {
$user_ids[] = $user_id;
}
}
$user_type = isset($_POST['user_type']) ? $_POST['user_type'] : 0;
$arrLocalRoles = $rbacreview->getLocalRoles($this->parent_object->getRefId());
if (in_array($user_type, $arrLocalRoles)) {
foreach ($user_ids as $user_id) {
$rbacadmin->assignUser($user_type, $user_id);
}
} else {
ilUtil::sendFailure($lng->txt("no_permission"));
}
ilUtil::sendSuccess($this->lng->txt("users_successfuly_added"), true);
$this->ctrl->redirect($this,"showOtherRoles");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::addOtherRolesToolbar ( )
protected

Definition at line 183 of file class.ilOrgUnitStaffGUI.php.

References ilRepositorySearchGUI\fillAutoCompleteToolbar().

Referenced by showOtherRoles().

{
$arrLocalRoles = $this->rbacreview->getLocalRoles($this->parent_object->getRefId());
$types = array();
foreach ($arrLocalRoles as $role_id) {
$ilObjRole = new ilObjRole($role_id);
if (! preg_match("/il_orgu_/", $ilObjRole->getUntranslatedTitle())) {
$types[$role_id] = $ilObjRole->getPresentationTitle();
}
}
$this->ctrl->setParameterByClass('ilRepositorySearchGUI', 'addusertype', 'other');
ilRepositorySearchGUI::fillAutoCompleteToolbar($this, $this->toolbar, array(
'auto_complete_name' => $this->lng->txt('user'),
'user_type' => $types,
'submit_name' => $this->lng->txt('add')
));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::addStaff ( )

Definition at line 201 of file class.ilOrgUnitStaffGUI.php.

References $_POST, ilObjUser\_lookupId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

Referenced by executeCommand().

{
if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
$users = explode(',', $_POST['user_login']);
$user_ids = array();
foreach ($users as $user) {
$user_id = ilObjUser::_lookupId($user);
if ($user_id) {
$user_ids[] = $user_id;
}
}
if(!count($user_ids)) {
ilUtil::sendFailure($this->lng->txt("user_not_found"), true);
$this->ctrl->redirect($this,"showStaff");
}
$user_type = isset($_POST['user_type']) ? $_POST['user_type'] : 0;
if ($user_type == "employee") {
$this->parent_object->assignUsersToEmployeeRole($user_ids);
} elseif ($user_type == "superior") {
$this->parent_object->assignUsersToSuperiorRole($user_ids);
} else {
throw new Exception("The post request didn't specify wether the user_ids should be assigned to the employee or the superior role.");
}
ilUtil::sendSuccess($this->lng->txt("users_successfuly_added"), true);
$this->ctrl->redirect($this,"showStaff");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::addStaffToolbar ( )
protected

Definition at line 169 of file class.ilOrgUnitStaffGUI.php.

References ilRepositorySearchGUI\fillAutoCompleteToolbar().

Referenced by showStaff().

{
$types = array(
"employee" => $this->lng->txt("employee"),
"superior" => $this->lng->txt("superior")
);
$this->ctrl->setParameterByClass('ilRepositorySearchGUI', 'addusertype', 'staff');
ilRepositorySearchGUI::fillAutoCompleteToolbar($this, $this->toolbar, array(
'auto_complete_name' => $this->lng->txt('user'),
'user_type' => $types,
'submit_name' => $this->lng->txt('add')
));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::confirmRemoveUser (   $cmd)

Definition at line 324 of file class.ilOrgUnitStaffGUI.php.

References $_GET, $cmd, ilObjUser\_lookupName(), ilUtil\getImagePath(), and ilUtil\sendFailure().

Referenced by executeCommand().

{
if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
switch ($cmd) {
case "confirmRemoveFromRole":
$this->tabs_gui->activateSubTab("show_other_roles");
$nextcmd = "removeFromRole";
$paramname = "obj_id-role_id";
$param = $_GET["obj_id"] . '-' . $_GET["role_id"];
break;
case "confirmRemoveFromSuperiors":
$this->tabs_gui->activateSubTab("show_staff");
$nextcmd = "removeFromSuperiors";
$paramname = "obj_id";
$param = $_GET["obj_id"];
break;
case "confirmRemoveFromEmployees":
$this->tabs_gui->activateSubTab("show_staff");
$nextcmd = "removeFromEmployees";
$paramname = "obj_id";
$param = $_GET["obj_id"];
break;
}
include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
$confirm = new ilConfirmationGUI();
$confirm->setFormAction($this->ctrl->getFormAction($this, $nextcmd));
$confirm->setHeaderText($this->lng->txt('orgu_staff_deassign'));
$confirm->setConfirm($this->lng->txt('confirm'), $nextcmd);
$confirm->setCancel($this->lng->txt('cancel'), 'showStaff');
$arrUser = ilObjUser::_lookupName($_GET["obj_id"]);
$confirm->addItem($paramname, $param,
$arrUser['lastname'] . ', ' . $arrUser['firstname'] . ' [' . $arrUser['login']
. ']', ilUtil::getImagePath('icon_usr.png'));
$this->tpl->setContent($confirm->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::executeCommand ( )
Returns
bool

Definition at line 81 of file class.ilOrgUnitStaffGUI.php.

References $_GET, $cmd, addOtherRoles(), addStaff(), confirmRemoveUser(), showOtherRoles(), showStaff(), and showStaffRec().

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
switch ($next_class) {
case 'ilrepositorysearchgui':
switch ($cmd) {
case 'addUserFromAutoComplete':
if ($_GET['addusertype'] == "staff") {
$this->addStaff();
} elseif ($_GET['addusertype'] == "other") {
$this->addOtherRoles();
}
break;
default:
$repo = new ilRepositorySearchGUI();
$this->ctrl->forwardCommand($repo);
break;
}
break;
default:
switch ($cmd) {
case 'showStaff':
$this->tabs_gui->activateSubTab("show_staff");
$this->showStaff();
break;
case 'showOtherRoles':
$this->tabs_gui->activateSubTab("show_other_roles");
$this->showOtherRoles();
break;
case 'showStaffRec':
$this->tabs_gui->activateSubTab("show_staff_rec");
$this->showStaffRec();
break;
case 'confirmRemoveFromRole':
case 'confirmRemoveFromEmployees':
case 'confirmRemoveFromSuperiors':
break;
default:
$this->$cmd();
break;
}
break;
}
return true;
}

+ Here is the call graph for this function:

ilOrgUnitStaffGUI::fromEmployeeToSuperior ( )

Definition at line 313 of file class.ilOrgUnitStaffGUI.php.

References $_GET, ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
$this->parent_object->deassignUserFromEmployeeRole($_GET["obj_id"]);
$this->parent_object->assignUsersToSuperiorRole(array( $_GET["obj_id"] ));
ilUtil::sendSuccess($this->lng->txt("user_changed_successful"), true);
$this->ctrl->redirect($this, "showStaff");
}

+ Here is the call graph for this function:

ilOrgUnitStaffGUI::fromSuperiorToEmployee ( )

Definition at line 301 of file class.ilOrgUnitStaffGUI.php.

References $_GET, ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
$this->parent_object->deassignUserFromSuperiorRole($_GET["obj_id"]);
$this->parent_object->assignUsersToEmployeeRole(array( $_GET["obj_id"] ));
ilUtil::sendSuccess($this->lng->txt("user_changed_successful"), true);
$this->ctrl->redirect($this, "showStaff");
}

+ Here is the call graph for this function:

ilOrgUnitStaffGUI::getOtherRolesTableHTML ( )

Definition at line 282 of file class.ilOrgUnitStaffGUI.php.

References $lng, and $rbacreview.

Referenced by showOtherRoles().

{
global $lng, $rbacreview;
$arrLocalRoles = $rbacreview->getLocalRoles($this->parent_object->getRefId());
$html = "";
foreach ($arrLocalRoles as $role_id) {
$ilObjRole = new ilObjRole($role_id);
if (! preg_match("/il_orgu_/", $ilObjRole->getUntranslatedTitle())) {
$other_roles_table = new ilOrgUnitOtherRolesTableGUI($this, 'other_role_' . $role_id, $role_id);
$other_roles_table->readData();
$html .= $other_roles_table->getHTML() . "<br/>";
}
}
if (! $html) {
$html = $lng->txt("no_roles");
}
return $html;
}

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::getStaffTableHTML (   $recursive = false,
  $table_cmd = "showStaff" 
)
Parameters
bool$recursive
string$table_cmd
Returns
string the tables html.

Definition at line 269 of file class.ilOrgUnitStaffGUI.php.

References $lng, and $rbacreview.

Referenced by showStaff(), and showStaffRec().

{
global $lng, $rbacreview;
$superior_table = new ilOrgUnitStaffTableGUI($this, $table_cmd, "superior", $recursive);
$superior_table->parseData();
$superior_table->setTitle($lng->txt("il_orgu_superior"));
$employee_table = new ilOrgUnitStaffTableGUI($this, $table_cmd, "employee", $recursive);
$employee_table->parseData();
$employee_table->setTitle($lng->txt("il_orgu_employee"));
return $superior_table->getHTML() . $employee_table->getHTML();
}

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::removeFromEmployees ( )

Definition at line 373 of file class.ilOrgUnitStaffGUI.php.

References $_POST, ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
$this->parent_object->deassignUserFromEmployeeRole($_POST["obj_id"]);
ilUtil::sendSuccess($this->lng->txt("deassign_user_successful"), true);
$this->ctrl->redirect($this, "showStaff");
}

+ Here is the call graph for this function:

ilOrgUnitStaffGUI::removeFromRole ( )

Definition at line 384 of file class.ilOrgUnitStaffGUI.php.

References $_POST, ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
global $rbacadmin;
$arrObjIdRolId = explode("-", $_POST["obj_id-role_id"]);
$rbacadmin->deassignUser($arrObjIdRolId[1], $arrObjIdRolId[0]);
ilUtil::sendSuccess($this->lng->txt("deassign_user_successful"), true);
$this->ctrl->redirect($this, "showOtherRoles");
}

+ Here is the call graph for this function:

ilOrgUnitStaffGUI::removeFromSuperiors ( )

Definition at line 362 of file class.ilOrgUnitStaffGUI.php.

References $_POST, ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
$this->parent_object->deassignUserFromSuperiorRole($_POST["obj_id"]);
ilUtil::sendSuccess($this->lng->txt("deassign_user_successful"), true);
$this->ctrl->redirect($this, "showStaff");
}

+ Here is the call graph for this function:

ilOrgUnitStaffGUI::setTabs ( )

Definition at line 397 of file class.ilOrgUnitStaffGUI.php.

Referenced by __construct().

{
$this->tabs_gui->addSubTab("show_staff", sprintf($this->lng->txt("local_staff"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this, "showStaff"));
if ($this->ilAccess->checkAccess("view_learning_progress_rec", "", $this->parent_object->getRefId())) {
$this->tabs_gui->addSubTab("show_staff_rec", sprintf($this->lng->txt("rec_staff"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this, "showStaffRec"));
}
if ($this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
$this->tabs_gui->addSubTab("show_other_roles", sprintf($this->lng->txt("local_other_roles"), $this->parent_object->getTitle()), $this->ctrl->getLinkTarget($this, "showOtherRoles"));
}
}

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::showOtherRoles ( )

Definition at line 146 of file class.ilOrgUnitStaffGUI.php.

References addOtherRolesToolbar(), getOtherRolesTableHTML(), and ilUtil\sendFailure().

Referenced by executeCommand().

{
if (!$this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
if ($this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
}
$this->tpl->setContent($this->getOtherRolesTableHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::showStaff ( )

Definition at line 132 of file class.ilOrgUnitStaffGUI.php.

References ilObjOrgUnitAccess\_checkAccessStaff(), addStaffToolbar(), getStaffTableHTML(), and ilUtil\sendFailure().

Referenced by executeCommand().

{
if(!ilObjOrgUnitAccess::_checkAccessStaff($this->parent_object->getRefId()))
{
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
if ($this->ilAccess->checkAccess("write", "", $this->parent_object->getRefId())) {
$this->addStaffToolbar();
}
$this->ctrl->setParameter($this, "recursive", false);
$this->tpl->setContent($this->getStaffTableHTML(false, "showStaff"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilOrgUnitStaffGUI::showStaffRec ( )

Definition at line 158 of file class.ilOrgUnitStaffGUI.php.

References ilObjOrgUnitAccess\_checkAccessStaffRec(), getStaffTableHTML(), and ilUtil\sendFailure().

Referenced by executeCommand().

{
if(!ilObjOrgUnitAccess::_checkAccessStaffRec($this->parent_object->getRefId()))
{
ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
$this->ctrl->redirect($this->parent_gui, "");
}
$this->ctrl->setParameter($this, "recursive", true);
$this->tpl->setContent($this->getStaffTableHTML(true, "showStaffRec"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilOrgUnitStaffGUI::$ctrl
protected

Definition at line 29 of file class.ilOrgUnitStaffGUI.php.

ilOrgUnitStaffGUI::$ilAccess
protected

Definition at line 49 of file class.ilOrgUnitStaffGUI.php.

Referenced by __construct().

ilOrgUnitStaffGUI::$lng
protected
ilOrgUnitStaffGUI::$parent_gui
protected

Definition at line 37 of file class.ilOrgUnitStaffGUI.php.

Referenced by __construct().

ilOrgUnitStaffGUI::$parent_obj
protected

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

ilOrgUnitStaffGUI::$rbacreview
protected
ilOrgUnitStaffGUI::$tabs_gui
protected

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

ilOrgUnitStaffGUI::$toolbar
protected

Definition at line 25 of file class.ilOrgUnitStaffGUI.php.

ilOrgUnitStaffGUI::$tpl
protected

Definition at line 33 of file class.ilOrgUnitStaffGUI.php.

Referenced by __construct().


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