aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2025-06-19 07:24:04 +0200
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2025-06-25 14:44:26 +0200
commit2d544c49f2cb3e192ab091c47c4c3bf50d8a1272 (patch)
tree1590c76817cdf532ae7c3cd2ecfcc33e92d6c795 /lib
parente5cacda63edc816b1116c2c5bf72f65a97fac037 (diff)
fix multipersonsearch regarding removed and selected users and prevent warnings, fixes #5629
Closes #5629 Merge request studip/studip!4246
Diffstat (limited to 'lib')
-rw-r--r--lib/classes/MultiPersonSearch.class.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/classes/MultiPersonSearch.class.php b/lib/classes/MultiPersonSearch.class.php
index 137c249..61a88b0 100644
--- a/lib/classes/MultiPersonSearch.class.php
+++ b/lib/classes/MultiPersonSearch.class.php
@@ -35,6 +35,7 @@ class MultiPersonSearch {
private $navigationItem = "";
private $dataDialogStatus = false;
private $verified = null;
+ private bool $allowRemoval = false;
/**
* restores a MultiPersonSearch object.
@@ -103,6 +104,17 @@ class MultiPersonSearch {
}
/**
+ * Defines whether the removal of pre-selected users should be allowed or
+ * not
+ */
+ public function allowRemovalOfDefaultSeselectedUsers(bool $allowRemoval): self
+ {
+ $this->allowRemoval = $allowRemoval;
+
+ return $this;
+ }
+
+ /**
* returns the removed persons. The array will contain all
* persons which were selected by default (on the right side of the
* dialog) and then removed by the user.
@@ -110,7 +122,7 @@ class MultiPersonSearch {
* @return array containing all removed persons
*/
public function getRemovedUsers() {
- return $_SESSION['multipersonsearch'][$this->name]['removed'];
+ return $_SESSION['multipersonsearch'][$this->name]['removed'] ?? [];
}
/**
@@ -141,6 +153,7 @@ class MultiPersonSearch {
$template->set_attribute('description', $this->description);
$template->set_attribute('executeURL', $this->executeURL);
$template->set_attribute('jsFunction', $this->jsFunction);
+ $template->set_attribute('allowRemoval', $this->allowRemoval);
$this->storeToSession();
return $template->render();
}