Skip to content

Commit

Permalink
New Release with support for ILIAS 5
Browse files Browse the repository at this point in the history
  • Loading branch information
chfsx committed Mar 18, 2015
1 parent d7f013a commit e8c0c67
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 116 deletions.
2 changes: 1 addition & 1 deletion classes/class.ilUserTakeOverPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ilUserTakeOverPlugin extends ilUserInterfaceHookPlugin {
* @return ilUserTakeOverPlugin
*/
public static function getInstance() {
if (!isset(self::$instance)) {
if (! isset(self::$instance)) {
self::$instance = new self();
}

Expand Down
25 changes: 16 additions & 9 deletions classes/class.ilUserTakeOverUIHookGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
require_once('./Services/UIComponent/classes/class.ilUIHookPluginGUI.php');
require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/UserTakeOver/classes/class.usrtoGUI.php';
require_once('./Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/UserTakeOver/classes/class.usrtoHelper.php');

/**
* Class ilUserTakeOverUIHookGUI
Expand Down Expand Up @@ -58,17 +59,14 @@ public function getHTML($a_comp, $a_part, $a_par = array()) {
* @var $rbacreview ilRbacReview
* @var $ilUser ilObjUser
*/
global $ilCtrl;

if ($a_comp == 'Services/MainMenu') {
if ($_SESSION['usrtoOriginalAccountId']) {
$ilToolbar = new ilToolbarGUI();
if (!self::isLoaded('user_take_back')) {
if (! self::isLoaded('user_take_back')) {
if ($ilToolbar instanceof ilToolbarGUI) {
$ilUserTakeOverPlugin = ilUserTakeOverPlugin::getInstance();
$ilCtrl->setParameterByClass('usrtoGUI', 'cmd', usrtoGUI::CMD_PERFORM_USER_TAKE_BACK);
$link = $ilCtrl->getLinkTargetByClass(array( 'ilAdministrationGUI', 'ilRouterGUI', 'usrtoGUI' ));

$link = 'goto.php?target=usr_takeback';
$html = '<a class="MMInactive" id="leave_user_view" href="' . $link . '">' . $ilUserTakeOverPlugin->txt("leave_user_view")
. '</a>';
self::setLoaded('user_take_back');
Expand All @@ -79,11 +77,11 @@ public function getHTML($a_comp, $a_part, $a_par = array()) {
}
}

if (!self::isLoaded('user_take_over')) {
if (! self::isLoaded('user_take_over')) {
if ($_GET['cmdClass'] == 'ilobjusergui' AND ($_GET['cmd'] == 'view' OR $_GET['cmd'] == 'edit')) {
global $rbacreview, $ilUser;
// Only Administrators
if (!in_array(2, $rbacreview->assignedGlobalRoles($ilUser->getId()))) {
if (! in_array(2, $rbacreview->assignedGlobalRoles($ilUser->getId()))) {
self::setLoaded('user_take_over');

return false;
Expand All @@ -92,15 +90,24 @@ public function getHTML($a_comp, $a_part, $a_par = array()) {
global $ilToolbar;
if ($ilToolbar instanceof ilToolbarGUI) {
$ilUserTakeOverPlugin = ilUserTakeOverPlugin::getInstance();
$ilCtrl->setParameterByClass('usrtoGUI', usrtoGUI::USR_ID, $_GET['obj_id']);
$link = $ilCtrl->getLinkTargetByClass(array( 'ilAdministrationGUI', 'ilRouterGUI', 'usrtoGUI' ));
$link = 'goto.php?target=usr_takeover_' . $_GET['obj_id'];
// TODO: Refactor in ILIAS 5.0: ilLinkButton::getInstance(); and $ilToolbar->addButtonInstance();
$ilToolbar->addButton($ilUserTakeOverPlugin->txt('take_over_user_view'), $link, '', '', 'take_over_user_view');
self::setLoaded('user_take_over');
}
}
}
}


public function gotoHook() {
if (preg_match("/usr_takeover_(.*)/uim", $_GET['target'], $matches)) {
usrtoHelper::getInstance()->takeOver($matches[1]);
}
if (preg_match("/usr_takeback/uim", $_GET['target'], $matches)) {
usrtoHelper::getInstance()->switchBack();
}
}
}

?>
102 changes: 0 additions & 102 deletions classes/class.usrtoGUI.php

This file was deleted.

8 changes: 4 additions & 4 deletions plugin.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
$id = 'usrto';
$version = '1.0.0';
$version = '1.1.0';
$ilias_min_version = '4.3.0';
$ilias_max_version = '4.4.999';
$responsible = 'Martin Studer';
$responsible_mail = 'ms@studer-raimann.ch';
$ilias_max_version = '5.0.999';
$responsible = 'Martin Studer, Fabian Schmid';
$responsible_mail = 'info@studer-raimann.ch';
?>

0 comments on commit e8c0c67

Please sign in to comment.