Skip to content

Commit

Permalink
Fixed course selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Neumann committed Jul 11, 2023
1 parent d69e085 commit 95f4215
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 0 additions & 2 deletions classes/class.ilVhbShibAuthCourseSelectGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ protected function showCourseSelection()
{
global $DIC;

$ilMainMenu = $DIC['ilMainMenu'];
$ilMainMenu->showLogoOnly(true);
$this->tpl->setOnScreenMessage('info', $this->plugin->txt('course_selection_info'));

$this->initCourseSelectForm();
Expand Down
25 changes: 22 additions & 3 deletions classes/class.ilVhbShibAuthPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ class ilVhbShibAuthPlugin extends ilShibbolethAuthenticationPlugin implements il
*/
protected $matching;

/**
* @var string
*/
protected $redirect_url = null;

/**
* Get the keyword in the meta data of a course for which students should make a join request
* (StudOn specific)
Expand Down Expand Up @@ -119,12 +124,11 @@ protected function prepareRedirection($user)
if (isset($_GET['id'])) {
$DIC->ctrl()->setParameterByClass('ilVhbShibAuthCourseSelectGUI', 'deepLink', $_GET['id']);
}
$target = $DIC->ctrl()->getLinkTargetByClass(['iluipluginroutergui','ilVhbShibAuthCourseSelectGUI'],null,null, true);
$_GET['target'] = $target;
$this->redirect_url = $DIC->ctrl()->getLinkTargetByClass(['iluipluginroutergui','ilVhbShibAuthCourseSelectGUI'],null,null, true);
}
elseif (isset($_GET['id']) && !isset($_GET['target'])) {
if ($ref_id = $this->getMatching()->getTargetCourseRefId($user, $_GET['id'])) {
$_GET['target'] = 'crs_'. $ref_id;
$this->redirect_url = ilLink::_getLink($ref_id, 'crs');
}
}
}
Expand Down Expand Up @@ -241,4 +245,19 @@ public function afterLogout(ilObjUser $user): ilObjUser
{
return $user;
}

/**
* Eventually redirect after a successful login
* @param string $a_component
* @param string $a_event
* @param mixed $a_parameter
*/
public function handleEvent($a_component, $a_event, $a_parameter)
{
global $DIC;
if ($a_event == 'afterLogin' && !empty($this->redirect_url)) {
$DIC->ctrl()->redirectToURL($this->redirect_url);
}
}

}
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$id = "vhbshib";

// code version; must be changed for all code changes
$version = "1.2.1";
$version = "1.2.3";

// ilias min and max version; must always reflect the versions that should
// run with the plugin
Expand Down
6 changes: 6 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version = "1.0" encoding = "UTF-8"?>
<plugin id="vhbshib">
<events>
<event type="listen" id="Services/Authentication" />
</events>
</plugin>

0 comments on commit 95f4215

Please sign in to comment.